This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [bigloo] behavior of CASE with strings


On Tue, Jan 17, 2017 at 8:27 PM, Bent Phillipsen <bent.phillipsen@gmail.com> wrote:
This has the consequence that stings cannot be used as key and clause in
case expressions in a well defined way (or at least portable way). You can
however easily define a macro that *also* can use strings. You can write
your own; but simply taking the case macro defined in R5RS (p.43) ensures
that all corner cases are handled correctly. You then just need to replace
'memv' with 'member' (this has the effect of testing equivalence with equal?
instead of eqv?). You probably want to change the name of the macro also,
for instance to case-member, to avoid shadowing the original case
expression. You will get something like the following, which should work and
which I think is portable. (There is of cause a (mostly insignificant)
performance penalty in testing with equal? instead of eqv?):

In Kawa 'case' is optimized, so the performance penalty of re-implementing
case "by hand" would be more significant.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]