<< Back to previous view

[CLJS-623] Keyword dosen't work as a function of map Created: 16/Oct/13  Updated: 20/Oct/13  Resolved: 20/Oct/13

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Andrzej Fricze Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: keywords, lookup, maps

Compiling with [org.clojure/clojurescript "0.0-1934"]. Using Light Table to develop.


String version access to map

("a" {"a" "ala" :b "bala"}) ;; returns "ala"

unfortunately, the keyword version

(:b {"a" "ala" :b "bala"}) ;; returns nil

I've tried using keyword as function of map, and map as a function with keyword arg. Even using vector as a key in a map works properly, only if map is called with key arg, but still, it works

({[1 2] "ala" :c "bala"} [1 2]) ;; returns "ala"

({"a" "ala" :b "bala"} :b) ;; still nil

Comment by Travis Thieman [ 17/Oct/13 10:39 AM ]

Using the latest version of ClojureScript and script/repl and script/repljs, I observe the following:

1. Your first string example doesn't work in either Clojure or ClojureScript. This is expected behavior as far as I know; you can't access maps using a string the same way you can with a keyword.

2. Your second example, (:b {"a" "ala" :b "bala"}) works fine for me in both Clojure and ClojureScript REPLs.

3. Third example works fine.

4. Fourth example returns "bala" for me in both REPLs.

If you are actually seeing this behavior, my guess would be that the issue is with Light Table. Can you reproduce this in a REPL outside of Light Table?

Comment by Andrzej Fricze [ 18/Oct/13 4:08 PM ]

I've checked in ClojureScript REPL and it works, indeed. You're right, it must be Light Table case. Very sorry for interrupting then.

Generated at Fri Jan 19 08:09:31 CST 2018 using JIRA 4.4#649-r158309.