comparison demo/more/dlist.ur @ 958:3aaac251a5af

Pseudo-sort working with filters
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Sep 2009 19:15:10 -0400
parents 2831be2daf2e
children 7e7edfb6fe82
comparison
equal deleted inserted replaced
957:2831be2daf2e 958:3aaac251a5af
160 let 160 let
161 val pos = case prev of 161 val pos = case prev of
162 None => headPos dl 162 None => headPos dl
163 | Some prev => tailPos prev tl tlTop 163 | Some prev => tailPos prev tl tlTop
164 in 164 in
165 b <- r.Filter v;
165 tl' <- signal tl; 166 tl' <- signal tl;
166 listOut (Some tl) tl' ((v, pos) :: acc) 167 listOut (Some tl) tl' (if b then
168 (v, pos) :: acc
169 else
170 acc)
167 end 171 end
168 in 172 in
169 listOut None hd [] 173 listOut None hd []
170 end); 174 end);
171 elems <- sort (fn v1 v2 => cmp v1.1 v2.1) elems; 175 elems <- sort (fn v1 v2 => cmp v1.1 v2.1) elems;