I was reading the picolip documents ref, tutorial and function reference
and I'm afraid I misunderstand some concepts, so I'm asking a bunch of
questions in the hope you can help to achieve a better picolisp
understanding

1- In the ref document it's said talking about types in picolisp:

   - three base data types: Numbers, Symbols and Cons Pairs (Lists),
   - the three scope variations of symbols: Internal, Transient and
   External, and
   - the special symbol NIL.

    suggesting dotted pairs are the same as lists, both are
indistinguishable so it should be possible to write any list as a dotted
pair, i. e. (1 2) = (1 . (2 . NIL)) but what is the list for (1 . 2) dotted
pair?


2- In the same doc talking about function arguments you can read "A lambda
expression always has a list of executable expressions as its CDR. The CAR,
however, must be a either a list of symbols, or a single symbol, and it
controls the evaluation of the arguments to the executable function
according to the following rules:
When the CAR is a list of symbols For each of these symbols an argument is
evaluated, then the symbols are bound simultaneously to the results. The
body of the lambda expression is executed, then the VAL's of the symbols
are restored to their original values. This is the most common case, a
fixed number of arguments is passed to the function. Otherwise, when the
CAR is the symbol @ All arguments are evaluated and the results kept
internally in a list. The body of the lambda expression is executed, and
the evaluated arguments can be accessed sequentially with the args
<http://www.software-lab.de/doc/refA.html#args>, next
<http://www.software-lab.de/doc/refN.html#next>, arg
<http://www.software-lab.de/doc/refA.html#arg> and rest
<http://www.software-lab.de/doc/refR.html#rest> functions. This allows to
define functions with a variable number of evaluated arguments. Otherwise,
when the CAR is a single symbol The symbol is bound to the whole
unevaluated argument list. The body of the lambda expression is executed,
then the symbol is restored to its original value. This allows to define
functions with unevaluated arguments. Any kind of interpretation and
evaluation of the argument list can be done inside the expression body."Also
the doc said the rules for parameters may be combined and show several
examples:


a)   : (de foo (X Y . Z)                 # CAR is a list with a dotted-pair
tail
According with the parameters rules the first is supposed to bind X to the
first evaluated parameter, Y to the second and Z to the rest of parameters
but here the rule to apply is the first one, car is a list of symbols (X, Y
and Z the last two in the dotted pair Y.Z) so every symbol must be binded
to evaluated parameters, thus a funcion call like:

(foo (1 2 3 4))

should bind 1 to X, 2 to Y and 3 to Z discarding 4 but the examples says it
really binds 1 to X, 2 to Y and (3 4) to Z thus effectively merging first
and third rule, the question is why? since the CAR is not a single symbol
but a list and also the dotted-pair tail (Y.Z) is not a single symbol but a
dotted pair

b)  : (de foo (X . @)                   # CAR is a dotted-pair with '@'

This case is similar to the previous but merging first and second rules but
in this case first rule doesn't apply because as comment remarks CAR is a
dotted pair not a list


3-  In the function reference I see several times functions described with
dots in parameter lists, I think it's related to question 2 and it is just
using the merging-rules parameters but what's the difference between these
two notations:

  -  (dbs+ 'num . lst)

  -  (delete 'any 'lst) -> lst

and what means the following notation?

  -  (dbs . lst)

4- Usually in classical lisp syntax you must use dot surrounded by spaces
to indicate a dotted pair, I supposed this will be the same in picolisp
because of fixed point numbers notation so you always shoud use (sym . sym)
to write a dotted paid in particular with transient symbols ("hello" .
"world") but I saw in this lists messages seeming to use the notation
("hello"."world") to write a dotted pair, is it allowed? or maybe is
another kind of data type?



thanks for your replies

Reply via email to