Hi Tomas,

> > Yes. But on the other hand, missing arguments usually default to NIL in
> > picoLisp. Makes not much sense in the case of 'onOff'.
> I know, but it still doesn't make sense even in v2.3.7.

That's not what I mean, it has nothing to do with the version.

> : (onOff)
> is the same as
> : (onOff . NIL)
> Now using this logic, 
> : (onOff A B)
> shoud be the same as:
> : (onOff A B . NIL)
> why is it trying to set NIL in the first case and not in the second
> one?;-)

All functions ignore atomic CDRs of the last argument cell. You could
also try (onOff A B . X), the 'X' will be simply ignored.

Functions are free in how they evaluate their arguments. In cases where
zero arguments (as in 'onOff') are not to be expected, the function goes
straight on and "takes" the first argument, which happens to be NIL in
this case. So 'onOff' does not distinguish (nor even check) the
difference between



   (onOff NIL)

There is no practical reason to do so, because calling 'onOff' without
arguments makes no sense. Remember, it is a non-evaluating function, and
cannot be called in a less predictable way (e.g. being passed through
'apply', mappings etc.).

I think that most functions in PicoLisp behave like this. Try 'list',
for example:

   : (list NIL)
   -> (NIL)
   : (list)    
   -> (NIL)

It does not care to check for the first argument.

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

Reply via email to