From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-f65.google.com (mail-ua1-f65.google.com [209.85.222.65]) by sourceware.org (Postfix) with ESMTPS id 475F638754A1 for ; Wed, 15 Jul 2020 18:44:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 475F638754A1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=alum.mit.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=j.r.hope@gmail.com Received: by mail-ua1-f65.google.com with SMTP id l12so954782uak.7 for ; Wed, 15 Jul 2020 11:44:33 -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:content-transfer-encoding; bh=1kxGwIGXorOXFDmGQ8GaN+J6VuclaBp9p+aiuevSp0Y=; b=byhbSiF/rwc/ZEh9T1YPkdbSxL4a3EBYi2Ctmaz03za8t5ocJmn3pXevGfnfEiRND4 1CQm3ScOc4FrgXoAnot0KXZeHO+cW8u21RceRymB810PggJbLHUUhP2QzWFvbW6WLRYF CgT3bhJF4PPcH2g1mmyIbAPqtXgAF4kvjh8V7o6Cnc82x7zwVx0hX1EBKDhtjnu9Dav2 BoLtmAsnDpT0qvgu9Ra7FaCpC0m+3heBJN0l2+uy6EW2cy6gI84ZFF+h4lI6XZwkYujj 9xxVvRfHsg+0+mX3+9l+ml02JP1HKPxkGrLNHkaf7Hjlh/xu+v1ziwK5uu+hijtvOKcj wiHA== X-Gm-Message-State: AOAM533fbuRu1tIJoGbr8Xa8Ww5utgLuiQXrJH78et9BFI5DkTDho1OG 2iOcIgM2ZCwLrJCqH8WbB1HfzDNsv47XYvEQd/ny1Man X-Google-Smtp-Source: ABdhPJySR2We/p6y1xVqkaYTCzAX3KG6D3ovhA5o8BPTLHtHDNactdj4HE6D2WeFkn+P+9+cbkYl7YNvLZkfTV47Fck= X-Received: by 2002:ab0:48:: with SMTP id 66mr743371uai.40.1594838672405; Wed, 15 Jul 2020 11:44:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jamison Hope Date: Wed, 15 Jul 2020 14:44:21 -0400 Message-ID: Subject: Re: Extending functional call syntax for Sequences to include Maps To: kawa mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 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: Wed, 15 Jul 2020 18:44:35 -0000 On Fri, Jul 3, 2020 at 6:05 PM Per Bothner wrote: > > On 7/3/20 2:24 PM, Duncan Mak via Kawa wrote: > > More concisely, you can use (Kawa-specific) function call syntax: > > > > (vec1 3) =E2=87=92 8 > > > > > > I was a little disappointed when I found out that this doesn't work for > > Maps, which is also something Clojure allows [0]: > > > > ;; This is Clojure not Scheme > > > > ({:age 42 :name "Joe"} :name) ; =E2=87=92 "Joe" > > ({:age 42 :name "Joe"} :age) ; =E2=87=92 42 > > ({:age 42 :name "Joe"} :unknown) ; =E2=87=92 nil > > I vaguely remember discussing this some years ago, and I think the main > (conceptual) problem is how to handle arguments with no binding, i.e. > the 3rd case above. By analogy with sequences, it should throw an > exception - which may not be the most convenient > > I mentioned a couple of possible approaches, but I don't recall > what they were. I think I was leaning towards a way to specify > a default value - and throw an exception when no default was specified. > > I haven't been able to find that email, so far. I suspect you're remembering this conversation we had five (!) years ago: https://sourceware.org/pipermail/kawa/2015q1/006284.html You were leaning toward throwing an exception on no-default, and I was leaning toward returning #!null for simplicity/consistency with Java, and also because #!null is treated as false, which is like what assq/assv/assoc and memq/memv/member return for an absent key. -J > > A possibly solution: > > (htab key [default]) > > If there is no entry for key in htab, then default is returned > if specified; otherwise an exception is thrown. > > You should also be able to do: > > (set! (htab key) new-value) > -- > --Per Bothner > per@bothner.com http://per.bothner.com/ --=20 Jamison Hope