public inbox for
 help / color / mirror / Atom feed
From: Damien Mattei <>
To: Kawa <>
Subject: Re: behavior of CASE with strings PART 2
Date: Fri, 20 Jan 2017 22:54:00 -0000	[thread overview]
Message-ID: <> (raw)

Hi Per,

i could use string->symbol instead of strings with the normal CASE but
i finally wrote a macro for CASE with strings,
it was harder than expected , i learned macro at university with the
define-macro style ,i was familiar with this style, now define-syntax
is used, here is my macro:

(define-syntax case-string

  (syntax-rules ( => )

    ;; (define dog "dog")
    ;; (case-string dog (("dog") "animal")   (else => "mineral or vegetable"))
    ((case-string var
          (else => res-else  ...))

     (if (member var (car (quote lst)))
       (cadr (quote lst))

    ;; (define cat "cat")
    ;; (case-string cat (("dog") "animal") (("cat") "my daughter say
cats are not animals!")  (else => "mineral or vegetable"))
    ((case-string var
              (else => res-else ...))

     (if (member var (car (quote lst)))
     (cadr (quote lst))
     (case-string var
              (else => res-else ...))))

    ;;(case-string dog  (else => "silly case"))
    ((case-string var
          (else => res-else ...))


i'm not sure if this macro is r5rs compliant but i have test it
working. I will test it monday in our Kawa apps in Tomcat but i'm
almost sure it will solve all the errors.



             reply	other threads:[~2017-01-20 22:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20 22:54 Damien Mattei [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-01-17 10:07 Damien MATTEI
2017-01-17 13:24 ` Per Bothner
2017-01-17 15:57   ` Jamison Hope
2017-01-18  6:37     ` Per Bothner
2017-01-19  4:53       ` Per Bothner
2017-01-19 10:04         ` Damien MATTEI
2017-01-19 16:00           ` Per Bothner
2017-01-21  9:47         ` Damien Mattei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).