summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexander Abushkevich <alex@abushkevi.ch>2016-02-24 15:14:13 +1300
committerGravatar Alexander Abushkevich <alex@abushkevi.ch>2016-02-24 15:14:13 +1300
commit026e50ceaad69147ae05386ea342861d18021cd5 (patch)
tree295d7275e3a220c2beb03faa22fdb8959907700b
parent746e16d83aaf284f996bcc6d61f0d9ba99c099b2 (diff)
Return lists in their original order in span function
-rw-r--r--lib/ur/list.ur4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ur/list.ur b/lib/ur/list.ur
index f3bb0587..eac5ab0c 100644
--- a/lib/ur/list.ur
+++ b/lib/ur/list.ur
@@ -439,8 +439,8 @@ fun span [a] (f:(a -> bool)) (ls:list a) : list a * list a =
let
fun span' f acc ls =
case ls of
- [] => (acc, [])
- | x :: xs => if (f x) then span' f (x :: acc) xs else (acc, ls)
+ [] => (rev acc, [])
+ | x :: xs => if (f x) then span' f (x :: acc) xs else (rev acc, ls)
in
span' f [] ls
end