From: Thien-Thi Nguyen <ttn@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: List-of-lists data structure
Date: Sun, 13 Apr 2014 10:13:15 +0200 [thread overview]
Message-ID: <87ha5x7ilg.fsf@zigzag.favinet> (raw)
In-Reply-To: <CAA6UvuG=O_sBcY1RvfCohQhMs312R=F5pEyJrAKiG+2ngDD0xg@mail.gmail.com> (Jacob Gerlach's message of "Sat, 12 Apr 2014 09:46:47 -0400")
[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]
() Jacob Gerlach <jacobgerlach@gmail.com>
() Sat, 12 Apr 2014 09:46:47 -0400
(setq name-and-keyword-list
'("pFoo" ("foo" "bar" "baz")))
Here, note that the car of ‘name-and-keyword-list’ is indeed "pFoo", a
single string, while the cdr is ‘(("foo" "bar" "baz"))’, a list of one
element, a sub-list of three string elements. Is that what you want?
(setq name-and-keyword-list
'("pFoo" ("foo" "bar" "baz"))
'("pBar" ("apples" "pears" "orange")))
Is this a simple syntax error, or am I approaching this data
structure in the wrong way?
Yes. :-D
In the ‘setq’ docstring (via ‘C-h f setq RET’), the prototype is:
(setq [SYM VAL]...)
which on first blush seems to imply that multiple VAL are possible, due
to the ellipses at the end of the form. But that's not right! You have
to distribute the ellipses properly, kind of like (A+D)C => AC+DC. The
upshot is that each SYM has its own VAL. That's the syntax error part.
The approaching the data structure in the wrong way part is a matter of
pov. When you teach someone to dance, maybe left is right but right is
wrong (and maybe not!). I think Perlis would appreciate your focus.
--
Thien-Thi Nguyen
GPG key: 4C807502
(if you're human and you know it)
read my lisp: (responsep (questions 'technical)
(not (via 'mailing-list)))
=> nil
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2014-04-13 8:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-12 13:46 List-of-lists data structure Jacob Gerlach
2014-04-12 20:07 ` Stefan Monnier
2014-04-13 8:13 ` Thien-Thi Nguyen [this message]
[not found] ` <mailman.19545.1397376560.10748.help-gnu-emacs@gnu.org>
2014-04-13 18:47 ` Jacob Gerlach
[not found] <mailman.19516.1397327481.10748.help-gnu-emacs@gnu.org>
2014-04-13 7:49 ` Joost Kremers
2014-04-13 18:44 ` Jacob Gerlach
2014-04-13 18:59 ` Joost Kremers
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ha5x7ilg.fsf@zigzag.favinet \
--to=ttn@gnu.org \
--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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.