From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id A4DEB3844079 for ; Fri, 3 Jul 2020 21:25:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A4DEB3844079 Received: by mail-lf1-x130.google.com with SMTP id d21so19244607lfb.6 for ; Fri, 03 Jul 2020 14:25:32 -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:from:date:message-id:subject:to; bh=tYNNkSe4GHWo+xe8YphOSJ1/c9MgAI/Th2QsuRNYjMQ=; b=UgSKN9vsMVsTiedOvV5KMNrijSiN6cgYPJg2C6OTG51FgsUsokvuPcTP4BIAIHB8WX zQs5ui4mgLTmnM3H41mLEjhgyRXqmQ6AzQ0Pwn1aNmUy3PBcwuhxZ5RPMV9R7P9RVDX+ 2KgUartlki5U7l7ujK3OsML8kitIXzTO9NQNNQiIR6H2HUu/5dtbM4Aby3yO854WLSwl A81k6fpK+jYCaBynLzY+Y1xoHS6IlQQhYONQUyGLikLG/OBagcuLwG9iXCW+/KM7kgJD 9CQKUewacDO90F+ULaPBylbbROXmbnMf7X8pSQsC33Ri1ddHF5XZf7/zHTShMWz1HVL1 Oi2A== X-Gm-Message-State: AOAM533fvTnd1RcB0WVkRorDE0GDY1VmEf+PIUPbivet6Y8suoD3QQLU dYrDEtpJDpCW+3NDCYeJzw2IfDRxH+tt02nMxp1/+HK773g= X-Google-Smtp-Source: ABdhPJzz53HjDajgJ0R0knfBoVOB5O8uv9dilbZ1NVOs/0Aj5UyZZ5xbEuQ0hLzrr4moC68Qgt5RRH+SJi/X/ZWuPcI= X-Received: by 2002:a19:c78d:: with SMTP id x135mr23032035lff.82.1593811530674; Fri, 03 Jul 2020 14:25:30 -0700 (PDT) MIME-Version: 1.0 From: Duncan Mak Date: Fri, 3 Jul 2020 17:24:54 -0400 Message-ID: Subject: Extending functional call syntax for Sequences to include Maps To: kawa mailing list X-Spam-Status: No, score=-3.1 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" Content-Transfer-Encoding: quoted-printable 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: Fri, 03 Jul 2020 21:25:34 -0000 Hello, I've been reading the Kawa docs quite seriously when I was looking to learn the Pattern design. I noticed that Sequences implement Procedure, as shown here in the documentation: To extract an element from Scheme sequence of type stype there is usually a function stype-ref. For example: (define vec1 (vector 5 6 7 8)) (vector-ref vec1 2) =E2=87=92 7 More concisely, you can use (Kawa-specific) function call syntax: (vec1 3) =E2=87=92 8 Which is pretty neat (and reminds me of what they did in Clojure also, http://clojure-doc.org/articles/language/functions.html#sets-as-functions). 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 [0] http://clojure-doc.org/articles/language/functions.html#maps-as-functions Duncan.