unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: guile-user@gnu.org
Subject: Re: Surprising behavior of eq?
Date: Sun, 20 Sep 2020 18:18:21 +0200	[thread overview]
Message-ID: <20200920161821.GA15676@tuxteam.de> (raw)
In-Reply-To: <d6da5e36-8532-065d-a3b6-00fd3606324c@posteo.de>

[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

On Sun, Sep 20, 2020 at 05:37:45PM +0200, Zelphir Kaltstahl wrote:
> Hello John, hello Stefan!

[...]

> Of course SO is not a standard. Either it is simply wrong, or I
> misunderstood "primitive values" in that phrase. I thought: "Ah strings
> are a primitive value, so eqv? should work in all cases when comparing
> strings." However, this has been debunked.

Strings are mutable in Guile, so probably not what's called "primitive
values":

  scheme@(guile-user)> (define str (string-copy "the quick brown fox"))
  scheme@(guile-user)> (string-set! str 6 #\a)
  scheme@(guile-user)> str
  $3 = "the quack brown fox"

But string literals bark at you if you try to mutate them (that's why
I slyly created that one with `string-copy'):

  scheme@(guile-user)> (define str "the quick brown fox")
  scheme@(guile-user)> (string-set! str 6 #\a)
  ice-9/boot-9.scm:1669:16: In procedure raise-exception:
  string is read-only: "the quick brown fox"

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2020-09-20 16:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20 12:16 Surprising behavior of eq? Zelphir Kaltstahl
2020-09-20 12:19 ` Zelphir Kaltstahl
2020-09-20 12:58   ` Christopher Lemmer Webber
2020-09-20 13:09   ` Zelphir Kaltstahl
2020-09-20 13:52     ` John Cowan
2020-09-20 15:37       ` Zelphir Kaltstahl
2020-09-20 16:18         ` tomas [this message]
2020-09-20 17:05         ` John Cowan
2020-09-20 20:51           ` Linus Björnstam
2020-09-20 21:42             ` John Cowan
2020-09-20 13:57     ` Stefan Schmiedl
2020-09-20 15:42       ` Zelphir Kaltstahl
2020-09-20 17:26 ` Taylan Kammer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200920161821.GA15676@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).