Strange infix behaviour

Started by HPW, March 26, 2005, 08:49:48 AM

Previous topic - Next topic

HPW

What is returned from infix:

> (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?
Hans-Peter

HPW

#1
More strange:



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

HPW

#2
Sequential rollback until 8.200:



There it was working:



> (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.
Hans-Peter

Lutz

#3
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:




;; 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">http://newlisp.org/index.cgi?page=Downloads

HPW

#4
Lutz,



thanks for the quick fix!

I need the infix-parser much for my project.
Hans-Peter