Page 1 of 1

Problem to update an array

Posted: Tue Mar 16, 2021 9:50 pm
by cameyo
I have the following situation:

Code: Select all

(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:

Code: Select all

(setf (j 98) 2)
;-> 2
Reference with a variable works too:

Code: Select all

(setq idx (char (str 1)))
;-> 98
(setf (j idx) 2)
;-> 2
Why the following expressions raise an error?

Code: Select all

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

Code: Select all

(setf (j (char (str 1))) "2")
;-> "2"
Thanks.

Re: Problem to update an array

Posted: Wed Mar 17, 2021 5:08 pm
by Lutz
This is fixed here: http://www.newlisp.org/downloads/develo ... nprogress/

Was a bug in 'char' when used by 'setf'.

Re: Problem to update an array

Posted: Wed Mar 17, 2021 6:33 pm
by cameyo
Thanks.
When will be released a compiled version?
Best regards,
cameyo

Re: Problem to update an array

Posted: Thu Mar 18, 2021 6:43 pm
by Lutz
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?

Re: Problem to update an array

Posted: Thu Mar 18, 2021 7:31 pm
by cameyo
Windows and MacOS. But I can wait without any problems.
Thank you.

Re: Problem to update an array

Posted: Fri Mar 19, 2021 2:59 pm
by Lutz
You can find a macOS executable here:
http://www.newlisp.org/downloads/develo ... ess/macOS/

Re: Problem to update an array

Posted: Fri Mar 19, 2021 8:16 pm
by cameyo
Very nice.
Thank you.