Problem to update an array

Started by cameyo, March 16, 2021, 02:50:41 PM

Previous topic - Next topic

cameyo

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.

Lutz

#1
This is fixed here: http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/



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

cameyo

#2
Thanks.

When will be released a compiled version?

Best regards,

cameyo

Lutz

#3
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?

cameyo

#4
Windows and MacOS. But I can wait without any problems.

Thank you.

Lutz

#5
You can find a macOS executable here:

http://www.newlisp.org/downloads/development/inprogress/macOS/">http://www.newlisp.org/downloads/develo ... ess/macOS/">http://www.newlisp.org/downloads/development/inprogress/macOS/

cameyo

#6
Very nice.

Thank you.