Page 1 of 1

(float) with elements of the list

Posted: Wed Nov 07, 2012 3:25 pm
by denis
Some strange behavior:

Code: Select all

(set 'lst '("23" "hello" "3.14"))
(float (lst 1))
; -> "3.14" instead of nil
Why so?

Re: (float) with elements of the list

Posted: Wed Nov 07, 2012 3:53 pm
by cormullion

Code: Select all

newLISP v.10.3.2 64-bit on OSX IPv4/6 UTF-8, execute 'newlisp -h' for more info.

> (set 'lst '("23" "hello" "3.14"))
("23" "hello" "3.14")
> (float (lst 1))
nil
> 
and

Code: Select all

newLISP v.10.4.4 on OSX IPv4/6 UTF-8 libffi, execute 'newlisp -h' for more info.

> (set 'lst '("23" "hello" "3.14"))
("23" "hello" "3.14")
> (float (lst 1))
"3.14"
> 
indicate some kind of regression over the last year. I haven't got the intermediate versions here to test when this happened...

Re: (float) with elements of the list

Posted: Wed Nov 07, 2012 6:44 pm
by rickyboy
I get the same thing on 10.4.1. But note that (lst 1) returns "hello", as expected.

Code: Select all

newLISP v.10.4.1 on Win32 IPv4/6 libffi, execute 'newlisp -h' for more info.

> (set 'lst '("23" "hello" "3.14"))
("23" "hello" "3.14")
> (float (lst 1))
"3.14"
> (lst 1)
"hello"
Good catch, denis.

Re: (float) with elements of the list

Posted: Wed Nov 07, 2012 8:11 pm
by jopython
Same issue on my Linux desktop.

Code: Select all

newLISP v.10.4.3 on Linux IPv4/6 UTF-8 libffi, execute 'newlisp -h' for more info.
> (set 'lst '("23" "hello" "3.14"))
("23" "hello" "3.14")
> (float (lst 1))
"3.14"

Re: (float) with elements of the list

Posted: Wed Nov 07, 2012 8:47 pm
by Lutz
This is a bug in the 'float' function when using it on list elements, introduced in a development release before 10.4.0 and is fixed now in 10.4.5 in progress:

http://www.newlisp.org/downloads/develo ... nprogress/

I will do a maintenance release as soon as I am back in the US next week, probably on the 15th of November.