Embedded lists with match?

Started by methodic, December 16, 2009, 10:27:01 AM

Previous topic - Next topic

methodic

Is something like this possible:
(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

#1
Possibly:


> (match '(? (* "that one" *)) lst)
;-> ("key" ("this one") ("other one"))

Lutz

#2
... and this same pattern would work for the others too, as the * star stands for 0, 1 or more:


(match '(? (* "this one" *)) lst)
(match '(? (* "other one" *)) lst)