[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: List-of-lists data structure
From: |
Thien-Thi Nguyen |
Subject: |
Re: List-of-lists data structure |
Date: |
Sun, 13 Apr 2014 10:13:15 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
() 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
pgptY0K_UMJdh.pgp
Description: PGP signature