comparison lib/ur/list.ur @ 1322:80bff6449f41

Fix a bug in C list unurlification
author Adam Chlipala <adam@chlipala.net>
date Sun, 21 Nov 2010 15:43:24 -0500
parents 4172863d049d
children 9e0fa4f6ac93
comparison
equal deleted inserted replaced
1321:4172863d049d 1322:80bff6449f41
306 end 306 end
307 in 307 in
308 sort' ls 308 sort' ls
309 end 309 end
310 310
311 val nth [a] =
312 let
313 fun nth (ls : list a) (n : int) : option a =
314 case ls of
315 [] => None
316 | x :: ls' =>
317 if n <= 0 then
318 Some x
319 else
320 nth ls' (n-1)
321 in
322 nth
323 end
324
311 fun assoc [a] [b] (_ : eq a) (x : a) = 325 fun assoc [a] [b] (_ : eq a) (x : a) =
312 let 326 let
313 fun assoc' (ls : list (a * b)) = 327 fun assoc' (ls : list (a * b)) =
314 case ls of 328 case ls of
315 [] => None 329 [] => None