hy/tests/lang/colls.hy
Gergely Nagy a7cd70c84a compiler: Make maps and lists able to look up their params
As a neat syntactic sugar, it's very neat if maps and lists are able
to work as if they were functions, and look up their arguments.

This implements just that, by translating (map key) to (index map key)
internally, and (list idx) to (index list idx).

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2013-01-12 00:50:08 +01:00

6 lines
101 B
Hy

(defn test-map-index []
({"foo" "bar"} "foo"))
(defn test-list-index []
(["first" "second"] 1))