From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109811 invoked by alias); 21 Jan 2017 09:47:19 -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 109798 invoked by uid 89); 21 Jan 2017 09:47:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=HX-Received:Sat, HX-Envelope-From:sk:damien., definesyntax, H*Ad:D*inria.fr X-HELO: mail-oi0-f50.google.com Received: from mail-oi0-f50.google.com (HELO mail-oi0-f50.google.com) (209.85.218.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 21 Jan 2017 09:47:08 +0000 Received: by mail-oi0-f50.google.com with SMTP id u143so56093291oif.3 for ; Sat, 21 Jan 2017 01:47:08 -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:in-reply-to:references:from:date :message-id:subject:to; bh=LUFIAzMaQF4OIUEKYnmaBgMfgwRAo+wouLqpHkuLY+w=; b=ZdTg5xtccTlmNkoBNajCl2AIu0YhmzP26jz8ID+DZY7d886z5zfN+ShvSL4Y+ij/AQ tZDPQDapUBpkxnQ7pzImmU49U+8PFQGyr0I+m2cKF0j1IJB1c+t/1nkmBtHdrRyiU42u H4jtr404ba04LnRZI+w+kFxdfk4eHv0hcu3e8cSWcaOb8F2raLJUDMXIWPKx7yJ2bOMQ IihdLMczvpwhPArkHQJkU/h7mJi/2ThCITy4UZ/9+Fmp3tQlUJxw0lb/IZJk9tvOkDxU YCgp+R3g529ISu/1aUE+KpIMlTFDpldPUkLXbscqAf/9sg+ldxoBhf0KAtRh+/5ASYmL h6+A== X-Gm-Message-State: AIkVDXIWUPNpnaZOIglmraX0DKSDC/iiY9bDEE6kYzwKEzXsfHntdM1Tj8j39NyIR+hoeZIW4FO5hfHxkV82ZA== X-Received: by 10.202.82.141 with SMTP id g135mr816671oib.42.1484992026803; Sat, 21 Jan 2017 01:47:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.143.105 with HTTP; Sat, 21 Jan 2017 01:46:46 -0800 (PST) In-Reply-To: <7b059bf7-e537-1338-de60-6a6a93baaae8@bothner.com> References: <201701171107.25991.Damien.Mattei@unice.fr> <7b059bf7-e537-1338-de60-6a6a93baaae8@bothner.com> From: Damien Mattei Date: Sat, 21 Jan 2017 09:47:00 -0000 Message-ID: Subject: Re: behavior of CASE with strings PART 2 To: Kawa , bigloo@sophia.inria.fr Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2017-q1/txt/msg00031.txt.bz2 Hi Per, in my opinion , rather than following Racket guide lines that are complex , i prefer to write macro some times, and do things that are R*RS compliant because it's the best way to keep progams compatible as i use many scheme implementations,Kawa,Bigloo,Racket . the last macro i wrote case-string is working with Kawa and Racket (even with #lang r5rs activated! should not work) but not with Bigloo because the macro is not r5rs compliant ,it has some variable after the ellipsis, and it is forbidden in r5rs and r7rs. ( http://www.schemers.org/Documents/Standards/R5RS/HTML/ ) i will try to understand how this one : (define-syntax case (syntax-rules (else) ((case (key ...) clauses ...) (let ((atom-key (key ...))) (case atom-key clauses ...))) ((case key (else result1 result2 ...)) (begin result1 result2 ...)) ((case key ((atoms ...) result1 result2 ...)) (if (memv key '(atoms ...)) (begin result1 result2 ...))) ((case key ((atoms ...) result1 result2 ...) clause clauses ...) (if (memv key '(atoms ...)) (begin result1 result2 ...) (case key clause clauses ...))))) works next week.... and modify it for strings regards, damien On Thu, Jan 19, 2017 at 5:53 AM, Per Bothner wrote: > > > 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/