diff --git a/pure.spl b/pure.spl index e286e40..f0e429f 100644 --- a/pure.spl +++ b/pure.spl @@ -31,7 +31,7 @@ func or { a||b | with a b ; func alit-end { array | with type ; def array 0 anew =array while { dup type eq not } { - 0 1 anew dup:set; array aadd =array + awrap array aadd =array } pop array } @@ -41,8 +41,9 @@ func read-file { str | with path ; 1024 stream:read-to-end:to-str } -func acopy { | with from to idxsrc idxdst len ; +func acopy { array | with from to idxsrc idxdst len ; len:foreach<{ | with i ; i idxsrc + from:get i idxdst + to:set; }> + to } diff --git a/std.spl b/std.spl index 2d2345c..faa9d6e 100644 --- a/std.spl +++ b/std.spl @@ -478,6 +478,10 @@ func assert-eq { any any | with a b ; a b } +func awrap { array | with item ; + item 1 anew =item 0 item:set; item +} + func [ { shadow | "array" "shadow" settype }