Q&A's, tips, howto's
-
methodic
- Posts: 58
- Joined: Tue May 10, 2005 5:04 am
Post
by methodic »
Is something like this possible:
Code: Select all
(set 'lst '("key ("this one" "that one" "other one")))
(match '(? ("that one")) lst)
Basically I need to go backwards in referencing the key with one of it's elements.
Thanks in advance!
-
cormullion
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
-
Contact:
Post
by cormullion »
Possibly:
Code: Select all
> (match '(? (* "that one" *)) lst)
;-> ("key" ("this one") ("other one"))
-
Lutz
- Posts: 5289
- Joined: Thu Sep 26, 2002 4:45 pm
- Location: Pasadena, California
-
Contact:
Post
by Lutz »
... and this same pattern would work for the others too, as the * star stands for 0, 1 or more:
Code: Select all
(match '(? (* "this one" *)) lst)
(match '(? (* "other one" *)) lst)