Re: load recursively

2010-09-08 Thread Alexander Burger
Hi Jon,

 In the docs on the 'load' function I read that, When any is T, all
 remaining command line arguments are loaded recursively. Can somebody
 explain what this recursive loading is?

There is nothing special about the word recursive here. It could as
well say When any is T, all remaining command line arguments are
loaded, or .. are loaded in turn.

Do you think this is misleading? What would be a better way to describe
it?

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe


Re: load recursively

2010-09-08 Thread Jon Kleiser
Hi Alex,

 Hi Jon,

 In the docs on the 'load' function I read that, When any is T, all
 remaining command line arguments are loaded recursively. Can somebody
 explain what this recursive loading is?

 There is nothing special about the word recursive here. It could as
 well say When any is T, all remaining command line arguments are
 loaded, or .. are loaded in turn.

 Do you think this is misleading? What would be a better way to describe
 it?

 Cheers,
 - Alex

I still don't get the difference this T makes. If I want to load two files
with one 'load' call, when should I include the T?

/Jon

-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe


Re: load recursively

2010-09-08 Thread Alexander Burger
Hi Jon,

 I still don't get the difference this T makes. If I want to load two files
 with one 'load' call, when should I include the T?

To load two files, you can simply write (load file1 file2).

The T is there to get access to the remaining command line arguments.
This is typically needed in executable scripts.

For example, let's take the script

   #!/usr/bin/picolisp /usr/lib/picolisp/lib.l
   (load @lib/misc.l)
   (doSomething)
   (bye)

This script completely ignores any possible command line arguments.

So you could 'load' the arguments, e.g.

   #!/usr/bin/picolisp /usr/lib/picolisp/lib.l
   (load @lib/misc.l)
   (initSomething)
   (load T)  # Load the remaining args
   (doSomething)
   (bye)


For example, the build script for the 64-bit version uses this (see
src64/mkAsm). It first loads @lib/misc.l, then extracts some further
command line arguments with 'opt', then 'load's some library files and
in the last line defs.l , sys/xxx.defs.l, and finally the actual
source files using 'T'.


(load T) is similar to (apply load (argv)), with the difference that it
will eat the arguments, while 'argv' leaves them in place. For
example, the following script (let's call it a)

   #!/usr/bin/picolisp /usr/lib/picolisp/lib.l
   (apply load (argv))
   (load T)
   (bye)

demonstrates this:

   $ ./a -println 123
   123
   123

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe


Re: load recursively

2010-09-08 Thread Jon Kleiser
Hi Alex,

Thanks for the extensive explanation! I'll work a bit on this later to
make sure I understand every part of it. ;-)

/Jon

 Hi Jon,

 I still don't get the difference this T makes. If I want to load two
 files
 with one 'load' call, when should I include the T?

 To load two files, you can simply write (load file1 file2).

 The T is there to get access to the remaining command line arguments.
 This is typically needed in executable scripts.

 For example, let's take the script

#!/usr/bin/picolisp /usr/lib/picolisp/lib.l
(load @lib/misc.l)
(doSomething)
(bye)

 This script completely ignores any possible command line arguments.

 So you could 'load' the arguments, e.g.

#!/usr/bin/picolisp /usr/lib/picolisp/lib.l
(load @lib/misc.l)
(initSomething)
(load T)  # Load the remaining args
(doSomething)
(bye)


 For example, the build script for the 64-bit version uses this (see
 src64/mkAsm). It first loads @lib/misc.l, then extracts some further
 command line arguments with 'opt', then 'load's some library files and
 in the last line defs.l , sys/xxx.defs.l, and finally the actual
 source files using 'T'.


 (load T) is similar to (apply load (argv)), with the difference that it
 will eat the arguments, while 'argv' leaves them in place. For
 example, the following script (let's call it a)

#!/usr/bin/picolisp /usr/lib/picolisp/lib.l
(apply load (argv))
(load T)
(bye)

 demonstrates this:

$ ./a -println 123
123
123

 Cheers,
 - Alex


-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe


load recursively

2010-09-07 Thread Jon Kleiser
Hi,

In the docs on the 'load' function I read that, When any is T, all
remaining command line arguments are loaded recursively. Can somebody
explain what this recursive loading is?

/Jon

-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe