Re: Newbie-level problem
Hi Jon, Yes, using #!/usr/bin/picolisp instead of #!/usr/bin/pil worked fine in OSX. In my case at the moment, however, this #!/usr/bin/picolisp /usr/lib/picolisp/lib/misc.l seemed to be better than .../lib.l, since the only lib function I needed was 'stamp'. Oh, I see. However, I would strongly recommend to load lib.l first, as it the base of most other functionality. The core interpreter can be considered as the combination of the 'picolisp' binary and lib.l, and many things will break if it is missing. Library functions should be loaded after that. E.g #!/usr/bin/picolisp /usr/lib/picolisp/lib.l (load @lib/misc.l) for a minimal setup, or #!/usr/bin/picolisp /usr/lib/picolisp/lib.l (load @ext.l) to get the same setup as 'pil'. For scripts with a GUI, I do #!/usr/bin/picolisp /usr/lib/picolisp/lib.l (load @ext.l @lib/http.l @lib/xhtml.l @lib/form.l) and so on. In this way, you can make sure to load only what is needed, and get the fastest startup time. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Newbie-level problem
Hi Jon, The script was executable (-rwxr-xr-x@), but for some reason I had to replace #!/usr/bin/pil with this direct variant: #!/Volumes/P3/picoLisp/bin/picolisp Strange, since there was no problem launcing PicoLips with /usr/bin/pil on the command line. Is there really a 'pil' script in /usr/bin/pil? BTW, I'm not really sure, but as far as I know traditionally Unix allows only _binary_ executables in the #! notation. Because of that, I always write #!/usr/bin/picolisp /usr/lib/picolisp/lib.l as 'picolisp' is a true binary (not a script). In Linux it doesn't seem to matter, but I don't know how the situation is for Mac OSX. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Newbie-level problem
Hi Alex, Hi Jon, The script was executable (-rwxr-xr-x@), but for some reason I had to replace #!/usr/bin/pil with this direct variant: #!/Volumes/P3/picoLisp/bin/picolisp Strange, since there was no problem launcing PicoLips with /usr/bin/pil on the command line. Is there really a 'pil' script in /usr/bin/pil? BTW, I'm not really sure, but as far as I know traditionally Unix allows only _binary_ executables in the #! notation. Because of that, I always write #!/usr/bin/picolisp /usr/lib/picolisp/lib.l as 'picolisp' is a true binary (not a script). In Linux it doesn't seem to matter, but I don't know how the situation is for Mac OSX. ?? Alex Yes, using #!/usr/bin/picolisp instead of #!/usr/bin/pil worked fine in OSX. In my case at the moment, however, this #!/usr/bin/picolisp /usr/lib/picolisp/lib/misc.l seemed to be better than .../lib.l, since the only lib function I needed was 'stamp'. Thanks for teaching me all this! /Jon -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Newbie-level problem
Hi Alex, The script was executable (-rwxr-xr-x@), but for some reason I had to replace #!/usr/bin/pil with this direct variant: #!/Volumes/P3/picoLisp/bin/picolisp Strange, since there was no problem launcing PicoLips with /usr/bin/pil on the command line. /Jon Hi Jon, I'll look into that #! thing another day. I don't think I've used it much, if at all, with PicoLisp. One thing which should not be forgotten is to set the script executable with 'chmod +x'. Have a nice weekend! You, and everybody else, too! ?? Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Newbie-level problem
Hi, I'm struggling with a rather elementary syntax error. I'm trying to translate into PicoLisp the equivalence of this bash script: while read LINE do echo Hello $LINE! done ... or this Ruby script: STDOUT.sync = true while 1 line = STDIN.readline.strip puts Hello #{line}! end ... but when I try to run this PicoLisp (greeter.l) code ... (while T (let L (line) (prinl Hello (pack (trim L) !) ) ) ) ... I get this: /greeter.l: line 6: syntax error near unexpected token `(' /greeter.l: line 6: `(let L (line)' What can it be that's the problem here? /Jon -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Newbie-level problem
Hi Jon, (while T (let L (line) (prinl Hello (pack (trim L) !) ) ) ) I haven't tried this specifically now, but I see two problems: 1. The loop (while T ... will never terminate. I would use (until (eof) ... 2. The PicoLisp always interprets the current input channel. This is, while a file is being 'load'ed, this very same file. So if you intend to read from standard input (what I assume here), you need an explicit (in NIL (until (eof) ... /greeter.l: line 6: syntax error near unexpected token `(' /greeter.l: line 6: `(let L (line)' This, however, seems another problem. Obviously Bash tries to execute this script. Something must have been wrong with the #! notation, so that it was not recognized. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Newbie-level problem
Hi Alex, Thanks! On 13-12-13 16:08 , Alexander Burger wrote: Hi Jon, (while T (let L (line) (prinl Hello (pack (trim L) !) ) ) ) I haven't tried this specifically now, but I see two problems: 1. The loop (while T ... will never terminate. I would use (until (eof) ... 2. The PicoLisp always interprets the current input channel. This is, while a file is being 'load'ed, this very same file. So if you intend to read from standard input (what I assume here), you need an explicit (in NIL (until (eof) ... Yes, doing pil greeter.l + now works, with this in my greeter.l file: (in NIL (until (eof) (let L (pack (trim (line))) (prinl Hello L !) ) ) ) /greeter.l: line 6: syntax error near unexpected token `(' /greeter.l: line 6: `(let L (line)' This, however, seems another problem. Obviously Bash tries to execute this script. Something must have been wrong with the #! notation, so that it was not recognized. ♪♫ Alex I'll look into that #! thing another day. I don't think I've used it much, if at all, with PicoLisp. Have a nice weekend! /Jon -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe