There's a bug in the cut function in arc.arc. end (64) should be higher than start (128) but if it's not cut breaks. (cut "test" 128 64)
Error: "make-string: contract violation\n expected: exact-nonnegative-integer?\n given: -64"
The strange thing is I got this bug trying to visit a url served by Arc.Is this a known issue in Anarki? For whatever it's worth this bug is fixed if you force start to be equal to end when start is higher than end: ;; fix bug in cut
(def cut (seq start (o end))
(let end (if (no end) (len seq)
(< end 0) (+ (len seq) end)
end)
(if (> start end) ;; the bug fix
(= end start))
(if (isa seq 'string)
(let s2 (newstring (- end start))
(for i 0 (- end start 1)
(= (s2 i) (seq (+ start i))))
s2)
(firstn (- end start) (nthcdr start seq)))))
|