unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: David Masterson <dsmasterson92630@outlook.com>, help-gnu-emacs@gnu.org
Subject: Re: Elisp - quoting or not?
Date: Sat, 05 Dec 2020 08:21:38 +0200	[thread overview]
Message-ID: <87r1o4zsb1.fsf@iki.fi> (raw)
In-Reply-To: <SJ0PR03MB54559027D9A8450F2F84BA1B9BF00@SJ0PR03MB5455.namprd03.prod.outlook.com>

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

* 2020-12-04 21:15:00-08, David Masterson wrote:

> I give up -- what's the proper way of doing this?
>
> (setq ab '("a" . "b")
>       cd '("c" . "d")
>       abcd '(ab cd))
>
> What I want is a result for abcd to be '(("a" . "b") ("c" . "d")). I
> imagine I need to use cons/car/cdr, but I'm not sure how.

I would not use quotes there:

    (setq ab (cons "a" "b")
          cd (cons "c" "d")
          abcd (list ab cd))

You can use "'", "`" and "," reader "macros" if you want:

    (setq ab '("a" . "b")
          cd '("c" . "d")
          abcd `(,ab ,cd))

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

  parent reply	other threads:[~2020-12-05  6:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-05  5:15 Elisp - quoting or not? David Masterson
2020-12-05  6:12 ` An Liu
2020-12-05  6:12   ` An Liu
2020-12-05  8:57     ` tomas
2020-12-05 12:31       ` Pankaj Jangid
2020-12-05  6:14 ` Alexis Roda
2020-12-06  2:11   ` David Masterson
2020-12-05  6:21 ` Teemu Likonen [this message]
2020-12-05  6:42 ` Arthur Miller

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/emacs/

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

  git send-email \
    --in-reply-to=87r1o4zsb1.fsf@iki.fi \
    --to=tlikonen@iki.fi \
    --cc=dsmasterson92630@outlook.com \
    --cc=help-gnu-emacs@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).