This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: behavior of CASE with strings PART 2
On 01/17/2017 10:36 PM, Per Bothner wrote:
I think this is something to think of for the Kawa 3.0 release,
using the new PATTERN construct in each clause.
The invoke branch has a 'match' form, which has the syntax:
(match TARGET-EXPR (PATTERN BODY...) ...)
This matches TARGET-EXPR against each PATTERN, until one matches,
at which point the BODY... forms are evaluated.
This is the 'match' form from Racket:
https://docs.racket-lang.org/guide/match.html
https://docs.racket-lang.org/reference/match.html
Unfortunately, the implemented forms of PATTERN are very
limited, but the intention to allow literals and quoted forms.
These will be compared using equal?, so you will be able to write:
(match "yes"
("no" #f)
("yes" #t))
THIS IS NOT YET IMPLEMENTED. (It's not conceptually hard; I just need to
decide the best way to present such match forms.)
I think this is the generalization of 'case' that we're looking for.
--
--Per Bothner
per@bothner.com http://per.bothner.com/