Pattern Matching in Scheme
Posted
by kunjaan
on Stack Overflow
See other posts from Stack Overflow
or by kunjaan
Published on 2009-06-27T17:51:50Z
Indexed on
2010/06/08
21:12 UTC
Read the original article
Hit count: 365
How do I accept the following input?
(list of 0 or more charcters and ends with 3) or
(list of 1 or more characters 4 and 0 or more characters after 4)
something like
(match ( list 3)) -> #t
(match ( list 1 2 3)) -> #t
(match (list 1 2 3 4)) -> #t
(match (list 1 2 3 4 5)) -> #t
(match (list 4)) -> #f
EDIT: THIS IS NOT MY HOMEWORK. I trying to write something like ELIZA from PAIP but I know only how to write a pattern that begins with a word.
© Stack Overflow or respective owner