From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70557 invoked by alias); 16 Jan 2017 13:34:45 -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 70547 invoked by uid 89); 16 Jan 2017 13:34:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*R:D*fr, Hx-languages-length:1795, observe, H*Ad:U*kawa X-HELO: mail3-relais-sop.national.inria.fr Received: from mail3-relais-sop.national.inria.fr (HELO mail3-relais-sop.national.inria.fr) (192.134.164.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Jan 2017 13:34:41 +0000 Received: from redrock.inria.fr ([138.96.19.81]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jan 2017 14:34:13 +0100 From: Manuel.Serrano@inria.fr To: Damien MATTEI Cc: Kawa mailing list , bigloo@sophia.inria.fr Subject: Re: [bigloo] behavior of CASE with strings Date: Mon, 16 Jan 2017 13:34:00 -0000 Message-ID: <2017116143211.587ccb5b@redrock.inria.fr> References: <201701121129.54147.Damien.Mattei@unice.fr> Reply-To: Manuel.Serrano@inria.fr Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-q1/txt/msg00014.txt.bz2 Hi Damien, Bigloo complies with the R5RS specification (see section 4.2) that says: -----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|----- case ..., library syntax Syntax: may be any expression. Each should have the form (( ...,) ...,), where each is an external representation of some object. All the s must be distinct. The last may be an ``else clause,'' which has the form (else ...,). Semantics: A case expression is evaluated as follows. is evaluated and its result is compared against each . If the result of evaluating is equivalent (in the sense of eqv?; see section Equivalence predicates) to a , then the expressions in the corresponding are evaluated from left to right and the result(s) of the last expression in the is(are) returned as the result(s) of the case expression. If the result of evaluating is different from every , then if there is an else clause its expressions are evaluated and the result(s) of the last is(are) the result(s) of the case expression; otherwise the result of the case expression is unspecified. (case (* 2 3) ((2 3 5 7) 'prime) ((1 4 6 8 9) 'composite)) => composite (case (car '(c d)) ((a) 'a) ((b) 'b)) => unspecified (case (car '(c d)) ((a e i o u) 'vowel) ((w y) 'semivowel) (else 'consonant)) => consonant -----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|----- You can observe that with: (pp (expand '(case x (("foo") 1) (("bar" ) 2)))) => (let ((case-value x)) (if (eqv? case-value '"foo") 1 (if (eqv? case-value '"bar") 2 #unspecified))) Cheers, -- Manuel