Page 1 of 1

Strange infix behaviour

Posted: Sat Mar 26, 2005 4:49 pm
by HPW
What is returned from infix:

Code: Select all

> (INFIX:xlate "3 + 4")
(add 3 4)
> (eval(INFIX:xlate "3 + 4"))

value expected in function add : 3

> (integer?(nth 1 (INFIX:xlate "3 + 4")))
nil
> (float?(nth 1 (INFIX:xlate "3 + 4")))
nil
> (string?(nth 1 (INFIX:xlate "3 + 4")))
nil
What this?

Posted: Sat Mar 26, 2005 5:07 pm
by HPW
More strange:

Code: Select all

> (symbol?(nth 1 (INFIX:xlate "3 + 4")))
true

Posted: Sat Mar 26, 2005 5:14 pm
by HPW
Sequential rollback until 8.200:

There it was working:

Code: Select all

> (INFIX:xlate "3 + 4")
(add 3 4)
> (eval(INFIX:xlate "3 + 4"))
7
> 
Seems context related.

Ps: infix.lsp from 8.2 and 8.4.7 are identical.

Posted: Sat Mar 26, 2005 6:07 pm
by Lutz
After 8.2 newLISP is able to make a symbol out of number and that changes the logic in the function 'make-expresion'. Make the following change:

Code: Select all


;; in make-expresion change

            (if (not (or (set 'var (symbol vars))
                         (set 'var (float vars)) ))

;; to this

            (if (not (or (set 'var (float vars))
                         (set 'var (symbol vars)) ))

Lutz

ps: I uploaded a fixed version also to http://newlisp.org/index.cgi?page=Downloads

Posted: Sat Mar 26, 2005 7:37 pm
by HPW
Lutz,

thanks for the quick fix!
I need the infix-parser much for my project.