[plt-scheme] Pattern matching help
Hello,
Code :
(match-let ([(list item rest-of-lst ...) (list (list 'eat 'cake))])
(match (list (list 'some 'dah) (list 'hmm 'ta) (list 'life 'sucks))
((list item next-item rest-items ...)
(printf "~a: ~a\n" item (cons next-item rest-items)))
(_ 'false)))
I want the item identifier bound by the match-let to be a value in a
second match's first clause.How do i do that?
It should became like this:
(match-let ([(list item rest-of-lst ...) (list (list 'eat 'cake))])
(match (list (list 'some 'dah) (list 'hmm 'ta) (list 'life 'sucks))
((list (list 'eat 'cake) next-item rest-items ...) ; item-> (list
'eat 'cake)
(printf "~a: ~a\n" item (cons next-item rest-items)))
(_ 'false)))
Thanks