1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-20 02:07:40 +00:00

take-drop dictionaries

Return table for `take` of dictionary types.
Allow `drop` of dictionary types.
This commit is contained in:
primo-ppcg
2023-06-07 19:20:05 +07:00
parent 472ec730b5
commit b5407ac708
2 changed files with 29 additions and 0 deletions

View File

@@ -513,6 +513,14 @@
(def sqr2 (drop 10 (squares)))
(assert (deep= (take 1 sqr2) @[100]) "drop fiber next value")
(def dict @{:a 1 :b 2 :c 3 :d 4 :e 5})
(def dict1 (take 2 dict))
(def dict2 (drop 2 dict))
(assert (= (length dict1) 2) "take dictionary")
(assert (= (length dict2) 3) "drop dictionary")
(assert (deep= (merge dict1 dict2) dict) "take-drop symmetry for dictionary")
# Comment macro
# issue #110 - 698e89aba
(comment 1)