From 026e50ceaad69147ae05386ea342861d18021cd5 Mon Sep 17 00:00:00 2001 From: Alexander Abushkevich Date: Wed, 24 Feb 2016 15:14:13 +1300 Subject: Return lists in their original order in span function --- lib/ur/list.ur | 4 ++-- 1 file 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 -- cgit v1.2.3