unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Andreas Reuleaux <rx@a-rx.info>
To: guile-user <guile-user@gnu.org>
Subject: hashmark in symbols
Date: Mon, 02 Jan 2023 02:27:25 +0000	[thread overview]
Message-ID: <87y1qlvfg2.fsf@laptop> (raw)

Hi,

in common lisp I get e.g.

--8<---------------cut here---------------start------------->8---
* (format nil "~a" '\#444)
"#444"
--8<---------------cut here---------------end--------------->8---

(assuming #444 is a css color - that is my use case anyway -
and thus likewise for any other color)

Now, apparently in Guile this is not the case:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (format #f "~a" '\#444)
$158 = "#{\\#444}#"
--8<---------------cut here---------------end--------------->8---

And likewise

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (symbol->string '\#444)
$159 = "\\#444"
--8<---------------cut here---------------end--------------->8---


Now I am tempted to case split (after (symbol->string ...) as above):

  if the resulting string starts with \\# then cut off the \\ part
  otherwise ...

but this seems overly complicated!? And is not really what I want! Is
there any other (readable) way to specify the hashmark in a symbol
(assuming \hashmark here, but this is wrong of course), so that

--8<---------------cut here---------------start------------->8---
(symbol->string '\hashmark444)
--8<---------------cut here---------------end--------------->8---

just works: results in "#444" (not "\\#444") ?

PS: I am experimenting with #\x0023, like so

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> #\x0023
$181 = #\#
--8<---------------cut here---------------end--------------->8---

but I still have no clue, how to write a simple symbol, that when
translated to a string, results in "#444".


Thanks in advance,
  -A



             reply	other threads:[~2023-01-02  2:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-02  2:27 Andreas Reuleaux [this message]
2023-01-02  6:04 ` hashmark in symbols lloda
2023-01-02  6:25   ` Andreas Reuleaux
2023-01-02  6:59     ` Taylan Kammer
2023-01-02 16:20       ` Andreas Reuleaux

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=87y1qlvfg2.fsf@laptop \
    --to=rx@a-rx.info \
    --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).