Re: string is read-only

2022-08-03 Thread Pierpaolo Bernardi
Il giorno 3 agosto 2022, alle ore 13:36, Damien Mattei ha scritto: >On Wed, Aug 3, 2022 at 12:59 PM Maxime Devos wrote: >> >> (My unverified hypothesis on why you aren't seeing an error here.) >> >> >>  it would be a big change and very strange :-O if the few lines of code >below in scheme

Re: string is read-only

2022-08-03 Thread Damien Mattei
> > It's how all Lisps, including guile, works. So, yes, if one is > interested in these languages, this is interesting knowledge :) > Pierpaolo you sense of humour is tickling me :-) i admit it is not common nowadays to set-car! or set-cdr! and my teachers at the time i learn it forbided it and

Re: string is read-only

2022-08-03 Thread Damien Mattei
On Wed, Aug 3, 2022 at 12:59 PM Maxime Devos wrote: > > (My unverified hypothesis on why you aren't seeing an error here.) > > > it would be a big change and very strange :-O if the few lines of code below in scheme returned an error on lists: but no restrictions with lists in Guile:

Re: string is read-only

2022-08-03 Thread Maxime Devos
On 03-08-2022 12:55, Damien Mattei wrote: but no restrictions with lists in Guile: scheme@(guile-user)> (define lst '(1 2 3)) scheme@(guile-user)> (set-car! lst 7) scheme@(guile-user)> lst (7 2 3) Non-empty lists are pairs and the second part of the pair is another list -- in Guile, this is

Re: string is read-only

2022-08-03 Thread Damien Mattei
wrote: > > scheme@(guile-user)> (define str2 "hello") > > scheme@(guile-user)> (string-set! str2 4 #\a) > > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > > string is read-only: "hello" > > It's not -- the existence of read-only strin

Re: string is read-only

2022-08-03 Thread Taylan Kammer
er)> (define str2 "hello") >>> scheme@(guile-user)> (string-set! str2 4 #\a) >>> ice-9/boot-9.scm:1669:16: In procedure raise-exception: >>> string is read-only: "hello" >>> >>> Entering a new prompt.  Type `,bt' for a ba

Re: string is read-only

2022-08-03 Thread Jean Abou Samra
in conditions; type `,show c' for details. >>>> >>>> Enter `,help' for help. >>>> scheme@(guile-user)> (define str2 "hello") >>>> scheme@(guile-user)> (string-set! str2 4 #\a) >>>> ice-9/boot-9.scm:1669:16: In procedure raise-e

Re: string is read-only

2022-08-03 Thread Ricardo G. Herdt
Hi, Am 03.08.2022 11:41 schrieb Maxime Devos: I'm not aware of explicit documentation that string literals may not be modified (and in this case, cannot be modified). However, see the following mail on string mutability and program text: R7RS has a chapter mentioning this (3.4. Storage

Re: string is read-only

2022-08-03 Thread Jean Abou Samra
This program is free software, and you are welcome to redistribute it >> under certain conditions; type `,show c' for details. >> >> Enter `,help' for help. >> scheme@(guile-user)> (define str2 "hello") >> scheme@(guile-user)> (string-set! str2 4 #

Re: Fwd: string is read-only

2022-08-03 Thread Maxime Devos
On 03-08-2022 11:51, Damien Mattei wrote: ok and i suppose it is the standard, i have been confused by other schemes or racket where my code worked: It happens to work in Guile too, when you use the interpreter instead of the compiler: scheme@(guile-user)> (eval `(let ((a ,(string-copy

Fwd: string is read-only

2022-08-03 Thread Damien Mattei
-- Forwarded message - From: Damien Mattei Date: Wed, Aug 3, 2022 at 11:51 AM Subject: Re: string is read-only To: Thomas Morley ok and i suppose it is the standard, i have been confused by other schemes or racket where my code worked: CHICKEN (c) 2008-2019, The CHICKEN Team (c

Re: string is read-only

2022-08-03 Thread Taylan Kammer
n conditions; type `,show c' for details. > > Enter `,help' for help. > scheme@(guile-user)> (define str2 "hello") > scheme@(guile-user)> (string-set! str2 4 #\a) > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > string is read-only: "hello"

Re: string is read-only

2022-08-03 Thread Maxime Devos
On 03-08-2022 11:12, Damien Mattei wrote: scheme@(guile-user)> (define str2 "hello") scheme@(guile-user)> (string-set! str2 4 #\a) ice-9/boot-9.scm:1669:16: In procedure raise-exception: string is read-only: "hello" It's not -- the existence of read-only strings is

Re: string is read-only

2022-08-03 Thread Thomas Morley
it > under certain conditions; type `,show c' for details. > > Enter `,help' for help. > scheme@(guile-user)> (define str2 "hello") > scheme@(guile-user)> (string-set! str2 4 #\a) > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > string is r

string is read-only

2022-08-03 Thread Damien Mattei
@(guile-user)> (define str2 "hello") scheme@(guile-user)> (string-set! str2 4 #\a) ice-9/boot-9.scm:1669:16: In procedure raise-exception: string is read-only: "hello" Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]> ,q