On Tue, 10 Nov 2009, Javier wrote:
Hello, I'm new to the list and Picolisp.
I tried this, and obtained a segfault:
: ('(1 2) 6)
ViolaciĆ³n de segmento
But, if i try:
: ('(a b c) 6)
-> NIL
I mostly understand why, but it was a surprise that Picolisp responded with a
segfault instead of an error.
Does this means that Picolisp doesn't check if a number is a function but it
does when it is a symbol?
In that particular example, the problem is that a number can't be used as
variables.
When you do:
: (de foo H
H)
: (foo 1 2 3)
-> (1 2 3)
: foo
-> (H H)
so you can also do:
('(H H) 1 2 3)
-> (1 2 3)
If we take your first example and revert it to a 'de form we get:
: (de foo 1
2)
I bet you know what happens here; you are trying to use a number as a variable,
which is illegal -> crash (besides it does not make sense anyway)
Regarding the error, checking for these things is an unnecessary overhead.
- Arm