From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id 75DE4386F037 for ; Mon, 29 Jun 2020 20:51:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 75DE4386F037 Received: by mail-lj1-x236.google.com with SMTP id 9so19852573ljv.5 for ; Mon, 29 Jun 2020 13:51:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vVFOS9gOAH8ocyZ9v3kNU7aVpUmvp9xn3bizMQhyj6I=; b=jlMf1TblVoSPe58VYhEQgDUyvSwhY7fDvq2Yq2/drqqIkZ+XABYYZMPdzg9yaGgQtk FDYFxNizfoNRLNTWKQ3gtUeW1Ie5OYVxvZ4+PCFFcQMamNOPLnVfAAWaL76gWEmnEYxI l6kk/WfV2SVMtz3jsY1R8EWdwgAu8Nf4AgvwGA9W1W8GCoqHpA9vTAGjf7Snuvb8sYtz NKKbnQa/G2jj032/i1jZSGN1Og2N8Db1EF0/08j/bOPdwmBYFkBwDlpdzdDJ1tHMWIYG DDq9g3RPDcLrjoK27w92DPHm3mgaC2mfzNSb0Ihej44TKwuOP0F4ZVVlxE7itLT5nh4X apvw== X-Gm-Message-State: AOAM53135qEuOowvAhRzVxLvo5qBAf6Z8raIP5FJ2/nXyv8vajsBNGO3 GGNcS39K4yPYrCUqWIFqFZZh43nkdIT4Oh/z/UcP7l8BO9U= X-Google-Smtp-Source: ABdhPJysP9E1vZsEKSyK7sMCtSTzk0TB/i9jOSbasOT5YWfyS497FMPgRSmKFEJvn/5Duh2B3eEy3YHeyutlrcxbUUg= X-Received: by 2002:a05:651c:2cc:: with SMTP id f12mr8433030ljo.329.1593463862805; Mon, 29 Jun 2020 13:51:02 -0700 (PDT) MIME-Version: 1.0 References: <04256eab-fe24-417b-9f0d-fc554c9add96@www.fastmail.com> In-Reply-To: From: Duncan Mak Date: Mon, 29 Jun 2020 16:50:26 -0400 Message-ID: Subject: Re: questions on libraries, pattern matching etc To: Per Bothner Cc: kawa mailing list X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2020 20:51:08 -0000 Hello Per, About the syntax for a match macro, work on SRFI 200 (draft) just started: https://srfi.schemers.org/srfi-200/srfi-200.html What do you think about adopting the syntax for the Wright-Cartwright-Shinn matcher? I've been trying to use match.scm (and its variants) in Kawa and simple patterns kinda work, but I see that: - matching records - matching quasiquotes These two parts don't seem to be working. For now, I've backed out of using match.scm due to the missing features, but it'd really be nice to have a match macro that comes with Kawa scheme, following one of the grammar listed in the SRFI. Going a different direction, this design for a CASE* macro is also interesting, https://github.com/axch/pattern-case/blob/master/pattern-matching.txt Duncan. On Sun, Dec 15, 2019 at 7:59 PM Per Bothner wrote: > On 12/15/19 3:46 PM, Ben wrote: > > hi > > I'd like to test how I can use pattern match in Kawa. First I did try to > use Kawas pattern matching function, but from what I saw it is a bit > limited, for example there is no matching of lists. > > Actually, there is matching of lists, but by matching them as general > sequences: > > #|kawa:1|# (! [a b c @rest] [1 2 3 4 5 6]) > #|kawa:2|# (format "a: ~a b: ~a c: ~a rest: ~a~%" a b c rest) > a: 1 b: 2 c: 3 rest: #(4 5 6) > > Implementing more general matching is mainly an issue of design including > deciding on a syntax. > Fundamentally, should be syntax for matching a pair be: > > (! (pat_car . pat_cdr) value) > > or: > > (! (cons pat_car pat_cdr) value) > > or something else? > The latter is used in Racket, and is more flexible, I believe, but not as > elegant - > which ties back to fundamental awkwardness with the Scheme evaluation > model. > > Of course once we/I decide on a syntax, then it needs to be implemented, > but > should be fairly straight-forward, given the existing framework. > -- > --Per Bothner > per@bothner.com http://per.bothner.com/ > -- Duncan.