From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60066 invoked by alias); 20 Jan 2017 22:54:59 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 60053 invoked by uid 89); 20 Jan 2017 22:54:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.0 required=5.0 tests=AWL,BAYES_20,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=daughter, animals, definesyntax, lst X-HELO: mail-ot0-f180.google.com Received: from mail-ot0-f180.google.com (HELO mail-ot0-f180.google.com) (74.125.82.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Jan 2017 22:54:57 +0000 Received: by mail-ot0-f180.google.com with SMTP id 104so66114523otd.3 for ; Fri, 20 Jan 2017 14:54:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=kVX+Y5ogxKy0QdG91dAIRp76cDniLZdVtyP4MHo1IhI=; b=eeO4PrhzHReKb262Ac0PWYVp/dync0t3IxQYKjVeZ0YVOqc21gDjwZDfpv40XFl7K9 4CZ2FdpRg0P7kzhx5dhCM1j6PlJpho1LpJx+UgiFOGRuxzozUQ5kdrh37kuOAPZPQ+Kl UPxxp8IOJLOFQz9R6OpXrao+3lXNcM6LdI/9OZEoRBIL0jATm/b2y5Hyv+f8fw++6b3f o8eWMST26okIlO944fYihzIn2kC0gAWcMQNLOa3wpcypK4hm/Ki2qedCFd+R+U1D264N honPXpTYr93qphIiw3Q4Ql9PoKGKwOi/pTuLR7HEfH+bUfI/Le9OzCUL6eVCmp3fFokJ 0opw== X-Gm-Message-State: AIkVDXI9pQ8/NeDAGxlNewaApN24W7KTY3QOnlxjLGLZN0u+YbS4cOAaByJiXE30YVMuU/KNL7hv4I2UUJZlnA== X-Received: by 10.157.7.6 with SMTP id 6mr9171712ote.194.1484952895501; Fri, 20 Jan 2017 14:54:55 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.143.105 with HTTP; Fri, 20 Jan 2017 14:54:35 -0800 (PST) From: Damien Mattei Date: Fri, 20 Jan 2017 22:54:00 -0000 Message-ID: Subject: Re: behavior of CASE with strings PART 2 To: Kawa Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2017-q1/txt/msg00030.txt.bz2 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 lst (else => res-else ...)) (if (member var (car (quote lst))) (cadr (quote lst)) (begin res-else ...))) ;; (define cat "cat") ;; (case-string cat (("dog") "animal") (("cat") "my daughter say cats are not animals!") (else => "mineral or vegetable")) ((case-string var lst lst2 ... (else => res-else ...)) (if (member var (car (quote lst))) (cadr (quote lst)) (case-string var lst2 ... (else => res-else ...)))) ;;(case-string dog (else => "silly case")) ((case-string var (else => res-else ...)) (begin 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. Regards, Damien