newLISP Fan Club

Forum => newLISP in the real world => Topic started by: cameyo on March 16, 2021, 02:50:41 PM

Title: Problem to update an array
Post by: cameyo on March 16, 2021, 02:50:41 PM
I have the following situation:
(setq j (array 256 '(-1)))
(setq str "abc")
(char (str 1))
;-> 98
(integer? (char (str 1)))
;-> true

Now i want to update a value of the array j:

Using the number 98 works:
(setf (j 98) 2)
;-> 2

Reference with a variable works too:
(setq idx (char (str 1)))
;-> 98
(setf (j idx) 2)
;-> 2

Why the following expressions raise an error?
(setf (j (char (str 1))) 2)
;-> ERR: string expected : 2

Using a string as value works:
(setf (j (char (str 1))) "2")
;-> "2"

Thanks.
Title: Re: Problem to update an array
Post by: Lutz on March 17, 2021, 10:08:50 AM
This is fixed here: http://www.newlisp.org/downloads/development/inprogress/



Was a bug in 'char' when used by 'setf'.
Title: Re: Problem to update an array
Post by: cameyo on March 17, 2021, 11:33:02 AM
Thanks.

When will be released a compiled version?

Best regards,

cameyo
Title: Re: Problem to update an array
Post by: Lutz on March 18, 2021, 11:43:01 AM
At the moment I only can compile on FreeBSD 12.2 (Intel CPU), OpenBSD 5.5 (amd64 CPU) and MacOS 11.2.2 (Intel).

No access to Windows or Linux at the moment. What do your need?
Title: Re: Problem to update an array
Post by: cameyo on March 18, 2021, 12:31:40 PM
Windows and MacOS. But I can wait without any problems.

Thank you.
Title: Re: Problem to update an array
Post by: Lutz on March 19, 2021, 07:59:36 AM
You can find a macOS executable here:

http://www.newlisp.org/downloads/development/inprogress/macOS/
Title: Re: Problem to update an array
Post by: cameyo on March 19, 2021, 01:16:49 PM
Very nice.

Thank you.