(cut "abc" 0) ;=> "abc" (cut "abc" 0 -1) ;=> "abc" (cut "abc" -3 -2) ;=> "ab"
(def lastmatch (pat seq) (catch (if (isa pat 'fn) (let leng (- (len seq) 1) (for i 0 leng (when (pat (seq (- leng i))) (throw (- leng i))))) (let leng (- (len seq) (len pat)) (for i 0 leng (when (headmatch pat seq (- leng i)) (throw (- leng i)))))) nil))