Hi Lutz,
I have defined the following func:
(define (type val)
(if
(float? val) 'float
(integer? val) 'integer
(lambda? val) 'lambda
(list? val) 'list
(macro? val) 'macro
(string? val) 'string
(symbol? val) 'symbol
(atom? val) 'atom))
in a file called tools.lsp, now when I load this file, I get an error:
> (load "tools.lsp")
invalid lambda expression : [text]lambda
(list? val) 'list
(macro? val) 'macro
(string? val) 'string
(symbol? val) 'symbol
(atom? val) 'atom))
Hi Ingo,
If you change the results from symbols into strings, you should get what you wanted. The symbols are conflicting with the names of the functions, which are symbols!
m i c h a e l
Using symbols is fine. It's the "lambda" (and "fn", "lambda-macro", "fn-macro") the only strings which are wired into the scanner and only accepted after an opening parenthesis to identify a lambda type expression or list. Use another word as a workaround. These words should not be used as symbols and are part of the newLISP syntax.
For example
(lambda)
is not a list with one symbol lambda but an empty lambda list:
(empty? (lambda)) => true
(length (lambda)) => 0
(first (lambda)) => nil
(lambda? (lambda)) => true
Lutz
See also:
http://newlisp.org/newlisp_manual.html#lambda_expressions
*embarrassed* I guess this Lutz guy knows something about this subject, so I will defer to him ;-)
m i c h a e l
Ahh, thank you.