ClojureScript

Keyword dosen't work as a function of map

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    Compiling with [org.clojure/clojurescript "0.0-1934"]. Using Light Table to develop.

Description

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

Activity

Hide
Travis Thieman added a comment -

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?

Show
Travis Thieman added a comment - 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?
Hide
Andrzej Fricze added a comment -

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

Show
Andrzej Fricze added a comment - I've checked in ClojureScript REPL and it works, indeed. You're right, it must be Light Table case. Very sorry for interrupting then.
David Nolen made changes -
Field Original Value New Value
Resolution Declined [ 2 ]
Status Open [ 1 ] Resolved [ 5 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: