Strange infix behaviour

Q&A's, tips, howto's
Locked
HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Strange infix behaviour

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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

More strange:

Code: Select all

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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Lutz,

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

Locked