comparison lib/ur/list.ur @ 1481:3061d1bf4b2d

recToList
author Robin Green <greenrd@greenrd.org>
date Mon, 27 Jun 2011 21:36:32 +0100
parents d328983dc5a6
children ada582d07ae1
comparison
equal deleted inserted replaced
1480:aa0c6382aa57 1481:3061d1bf4b2d
351 351
352 fun assocAdd [a] [b] (_ : eq a) (x : a) (y : b) (ls : t (a * b)) = 352 fun assocAdd [a] [b] (_ : eq a) (x : a) (y : b) (ls : t (a * b)) =
353 case assoc x ls of 353 case assoc x ls of
354 None => (x, y) :: ls 354 None => (x, y) :: ls
355 | Some _ => ls 355 | Some _ => ls
356
357 fun recToList [a ::: Type] [r ::: {Unit}] (fl : folder r)
358 = @foldUR [a] [fn _ => list a] (fn [nm ::_] [rest ::_] [[nm] ~ rest] x xs =>
359 x :: xs) [] fl