Re: [q-lang-users] Just starting with Q
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2006-08-22 11:23:19
|
Burton Samograd wrote: > I'm on Gentoo Linux, but I think I found the problem (which is my > fault, I would guess, but might be interesting for you to know about). > I was playing around running q with the --no-prelude option just to > cut down on the defined symbol space. It turns out the code works > fine without the option, but fails with it (no prelude loaded). Well, with --no-prelude clib::fgets is not defined, so the modified program (with fgets instead of freads) won't work anymore; it will (correctly) loop forever, because fgets F is just a normal form and hence nothing ever gets read. The following program, which doesn't depend on clib or anything else in the standard library works fine with --no-prelude, though: cat F = () if feof F; = writes (freads F) || writes "\n" || cat F otherwise; Your code (without the writes "\n") runs fine with --no-prelude, too, but of course the newlines are missing. Could you please check whether the above program works ok for you when run with --no-prelude? I.e., the output should be something like: $ q --no-prelude cat.q ==> def F = fopen "cat.q" "r"; cat F cat F = () if feof F; = writes (freads F) || writes "\n" || cat F otherwise; () > This could be interesting to you since the code I wrote doesn' > actually use any of the prelude functions; maybe there's a bit of code > in the prelude loading code that sets something up in the interpreter > that is causing this problem. There shouldn't be. The above program should work fine without the prelude. If it doesn't then there's a bug lurking somewhere, which needs to be fixed. I'd be surprised if this was so, because these basic examples have been checked on many systems many times. But, C being what it is, you can never be sure. ;-) Cheers, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |