fix random(dict)
bug
This commit is contained in:
parent
533a40bd45
commit
9db10edd5c
|
@ -918,7 +918,7 @@ fn random {
|
||||||
}
|
}
|
||||||
(d as :dict) -> {
|
(d as :dict) -> {
|
||||||
let key = do d > keys > random
|
let key = do d > keys > random
|
||||||
get (d, key)
|
get (key, d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,19 +21,19 @@
|
||||||
(def out @{:errors errors :draw draw :result result :console console})
|
(def out @{:errors errors :draw draw :result result :console console})
|
||||||
(def scanned (s/scan source))
|
(def scanned (s/scan source))
|
||||||
(when (any? (scanned :errors))
|
(when (any? (scanned :errors))
|
||||||
(set (out :errors) (scanned :errors))
|
# (set (out :errors) (scanned :errors))
|
||||||
(each err (scanned :errors)
|
(each err (scanned :errors)
|
||||||
(e/scan-error err))
|
(e/scan-error err))
|
||||||
(break (-> out j/encode string)))
|
(break (-> out j/encode string)))
|
||||||
(def parsed (p/parse scanned))
|
(def parsed (p/parse scanned))
|
||||||
(when (any? (parsed :errors))
|
(when (any? (parsed :errors))
|
||||||
(set (out :errors) (parsed :errors))
|
# (set (out :errors) (parsed :errors))
|
||||||
(each err (parsed :errors)
|
(each err (parsed :errors)
|
||||||
(e/parse-error err))
|
(e/parse-error err))
|
||||||
(break (-> out j/encode string)))
|
(break (-> out j/encode string)))
|
||||||
(def validated (v/valid parsed ctx))
|
(def validated (v/valid parsed ctx))
|
||||||
(when (any? (validated :errors))
|
(when (any? (validated :errors))
|
||||||
(set (out :errors) (validated :errors))
|
# (set (out :errors) (validated :errors))
|
||||||
(each err (validated :errors)
|
(each err (validated :errors)
|
||||||
(e/validation-error err))
|
(e/validation-error err))
|
||||||
(break out))
|
(break out))
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
(set result (i/interpret (parsed :ast) ctx))
|
(set result (i/interpret (parsed :ast) ctx))
|
||||||
([err]
|
([err]
|
||||||
(e/runtime-error err)
|
(e/runtime-error err)
|
||||||
(set (out :errors) [err])
|
# (set (out :errors) [err])
|
||||||
(break (-> out j/encode string))))
|
(break (-> out j/encode string))))
|
||||||
(setdyn :out stdout)
|
(setdyn :out stdout)
|
||||||
(set (out :result) (b/show result))
|
(set (out :result) (b/show result))
|
||||||
|
@ -53,7 +53,4 @@
|
||||||
(set (out :draw) (post :draw))
|
(set (out :draw) (post :draw))
|
||||||
(-> out j/encode string))
|
(-> out j/encode string))
|
||||||
|
|
||||||
(-> (ludus `
|
|
||||||
random (1, 3)
|
|
||||||
`) j/decode)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user