1. 18

  2. 3

    One thing that stands out as a little awkward is the syntax for defining a dict.

    => {"dog" "bark"
    ... "cat" "meow"}
    {'dog': 'bark', 'cat': 'meow'}

    I would think the pairing should be more explicit:

    => {("dog" "bark")
    ... ("cat" "meow")}
    {'dog': 'bark', 'cat': 'meow'}

    This would actually fall in line with the pythonic way of converting a list to a dict:

    >>> b = [('dog', 'bark'), ('cat', 'meow')]
    >>> dict(a)
    {'dog': 'bark', 'cat': 'meow'}

    Regardless, the quickstart is actually a pretty nice little introduction to lisp for python programmers.

    1. 1

      The syntax is very similar to Clojure:

      http://clojure.org/reader (see the maps point)

      What I found surprising is that they’re actually implemented as association lists (not Python dicts). To get keys you have to do something like this:

      (defn dict-keys [d]
        (slice d 0 None 2))

      I couldn’t see that in the stdlib so I’ll probably submit a pull request and find out :)

      1. 2

        Nevermind, they eventually get compiled down to Python dicts:

        => (.values {1 2 3 4})
        [2L, 4L]
        => (.keys {1 2 3 4})
        [1L, 3L]

        I was confused before because I had a raw HyDict via a macro :(