1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-30 15:13:03 +00:00

Fix a divide by 0 error when table is too small.

This commit is contained in:
Calvin Rose
2017-05-04 11:34:24 -04:00
parent bc82ce348a
commit 6ca5a76286
3 changed files with 6 additions and 10 deletions

View File

@@ -25,6 +25,3 @@
'literalsArray []
'slotMap []
}))
# Push a scope onto the compiler

View File

@@ -6,7 +6,7 @@
# Pretty print an array or tuple
(: print-seq (fn [start end a seen]
(: seen (if seen seen {}))
(if (get seen s) (get seen s)
(if (get seen a) (get seen a)
(do
(: parts [])
(: len (length a))
@@ -18,7 +18,7 @@
(if (> len 0) (pop! parts))
(push! parts end)
(: ret (apply string start parts))
(set! seen s ret)
(set! seen a ret)
ret))))
# Pretty print an object or struct
@@ -53,7 +53,4 @@
(: h (get handlers (type x)))
((if h h tostring) x seen)))
(print (pp [1 {4 5 6 7} 2 3]))
# Module export pattern - last expression in file is value of module
pp
# (print (pp [1 {4 5 6 7} 2 3]))