From: Ricardo Wurmus <rekado@elephly.net>
To: Hartmut Goebel <h.goebel@crazy-compilers.com>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: What is wrong with these few lines of guile code?
Date: Fri, 03 Nov 2017 17:09:35 +0100 [thread overview]
Message-ID: <87bmkjgx8g.fsf@elephly.net> (raw)
In-Reply-To: <0086dc34-2b3a-25f6-2420-2dfe18568e13@crazy-compilers.com>
Hartmut Goebel <h.goebel@crazy-compilers.com> writes:
> Am 31.10.2017 um 18:50 schrieb Christopher Baines:
>> This matches the error you're getting, as #~ is short for (gexp ...) as
>> I understand it.
>
> Thanks you, this did the trick :-) Although this reminds my on the magic
> signs in perl :-(
It’s a reader macro. They all start with # and are followed by a
character. You can install a reader macro to transform the expression
as it is read. For example, I used a reader macro in earlier versions
of my operating system configuration so that I can avoid wrapping file
contents in string quotes.
Reader macros are frowned upon when they are added for no good reason.
A reader macro is used here, because to Schemers it comes natural to use
syntax like “`” (quasiquote), “'” (quote), “,” (unquote), and “,@”
(unquote-splicing). Gexps are analogous to quoted S-expressions, so
(gexp …) “quotes” and (ungexp …) unquotes, etc. The reader extensions
positively affect readability as they strip off one layer of
parenthetical expressions, at the cost of extra syntax.
For more information on the thinking behind Gexps and their relation to
quasiquotation see Ludo’s excellent paper “Code Staging in GNU Guix”,
available at <https://hal.inria.fr/hal-01580582/en>.
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
next prev parent reply other threads:[~2017-11-03 23:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 13:41 What is wrong with these few lines of guile code? Hartmut Goebel
2017-10-31 14:02 ` Mike
2017-10-31 17:50 ` Christopher Baines
2017-11-03 14:34 ` Hartmut Goebel
2017-11-03 16:09 ` Ricardo Wurmus [this message]
2017-11-04 11:46 ` Pjotr Prins
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://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bmkjgx8g.fsf@elephly.net \
--to=rekado@elephly.net \
--cc=guix-devel@gnu.org \
--cc=h.goebel@crazy-compilers.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
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).