[q-lang-users] Just starting with Q
Brought to you by:
agraef
From: Burton S. <kr...@gm...> - 2006-08-21 07:56:13
|
Hi Everyone, I just started working with Q and I seem to be running in a newbie problem that I can't seem to get around. My first little function I am trying to write would be a copy of the Unix 'cat' utility, which I thought would be rather simple. I found the example for 'fcopy' in the manual and made a file 'cat' (the Q source file) containing the following code: public cat F; cat F = () if feof F; = writes (freads F) || cat F otherwise; And then in the interpreter i do the following: [.q/] run cat [.q/cat] def F = fopen "cat" "r" [.q/cat] cat F cat <<File>> [.q/cat] cat::cat F cat <<File>> [.q/cat] whos cat cat function symbol defined in /home/kruhft/.q/cat cat X1 As you can see, there seems to be some sort of problem but I can't seem to figure it out (hence my asking here ;-). I tried playing around with the interpreter and file handles and noticed that <<File>> seems to be returned on errors during file operations, but I don't understand how that's happening on a freshly opened file. Any help or suggestions for this newbie problem? TIA -- burton samograd kr...@gm... kruhft.boldlygoingnowhere.org www.myspace.com/kruhft |