public inbox for
 help / color / mirror / Atom feed
From: Duncan Mak <>
To: kawa mailing list <>
Subject: Extending functional call syntax for Sequences to include Maps
Date: Fri, 3 Jul 2020 17:24:54 -0400	[thread overview]
Message-ID: <> (raw)


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) ⇒ 7

More concisely, you can use (Kawa-specific) function call syntax:

(vec1 3) ⇒ 8

Which is pretty neat (and reminds me of what they did in Clojure also,

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)     ; ⇒ "Joe"
({:age 42 :name "Joe"} :age)      ; ⇒ 42
({:age 42 :name "Joe"} :unknown)  ; ⇒ nil



             reply	other threads:[~2020-07-03 21:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 21:24 Duncan Mak [this message]
2020-07-03 22:05 ` Per Bothner
2020-07-04  4:07   ` Duncan Mak
2020-07-15 18:44   ` Jamison Hope
2020-07-16  5:24     ` Per Bothner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).