(float) with elements of the list

Started by denis, November 07, 2012, 07:25:41 AM

Previous topic - Next topic

denis

Some strange behavior:



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


Why so?

cormullion

#1
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


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...

rickyboy

#2
I get the same thing on 10.4.1.  But note that (lst 1) returns  "hello", as expected.


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.
(λx. x x) (λx. x x)

jopython

#3
Same issue on my Linux desktop.



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"

Lutz

#4
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/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/



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