1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-28 21:15:14 +00:00

Update core and some examples to use the new

syntax.
This commit is contained in:
Calvin Rose
2018-11-29 14:03:45 -05:00
parent b0c45fd15e
commit 7dbad20150
4 changed files with 80 additions and 153 deletions

View File

@@ -4,10 +4,11 @@
(def tab @{})
(def solutions @{})
(def len (length s))
(loop [k :range [0 len]]
(put tab (get s k) k))
(loop [i :range [0 len], j :range [0 len]]
(def k (get tab (- 0 (get s i) (get s j))))
(when (and k (not= k i) (not= k j) (not= i j))
(put solutions {i true j true k true} true)))
(for k 0 len
(put tab s@k k))
(for i 0 len
(for j 0 len
(def k (get tab (- 0 s@i s@j)))
(when (and k (not= k i) (not= k j) (not= i j))
(put solutions {i true j true k true} true))))
(map keys (keys solution)))