On Sun, Aug 06, 2023 at 11:33:32AM +0100, Jason Vas Dias wrote: > Yes, but please mention something about '(script ...) in the > main 'ref' "Invocation" Section. It took me a long time to find!
Can you first explain what you are trying to achieve? 'script' in the hashbang line makes no sense to me, because it is the *essence* of hashbang that the whole file gets scripted. Moreover, if there is no (bye) at the end, the script will be loaded TWICE! You wrote: #!/usr/bin/pil -script (car (nth (argv) 1)) (nth (argv) 2) (let (ars (car (rest))) (prinl (car (nth (file) 2)) " ARGS: " (sym ars)) ) (bye) First of all: PLEASE, PLEASE stop publishing code that violates the rules! How often do I have to say that??? Newcomers of PicoLisp will take those bad habits too! At least 'ars' should be 'Ars'. Then, (car (rest))) could be just (next) here. And - again - (car (nth (file) 2)) is unlispy. Use (cadr (file)). BUT: Why do you go through all that trouble? This does the same: #!/usr/bin/pil (prinl (cadr (file)) " ARGS: " (sym (argv))) (bye) Note that 'sym' is bad here. Does a lot of unnecessay conversions. Better is: #!/usr/bin/pil (prin (cadr (file)) " ARGS: ") (println (argv)) (bye) So why do we need 'script'? The example with 'load' #!/usr/bin/pil -load "@lib/http.l" "@lib/xhtml.l" is useful because it has dual use. You can execute it as ./myscript.l and "@lib/http.l" get loaded, or you can (load "myscript.l") in a program where thes files *are* already loaded. Then the hashbang is a comment and the files are not loaded again. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe