changeset 19475 | 8aa2b380614a |
parent 17796 | 86daafee72d6 |
child 19507 | b386fcdc9945 |
19474:70223ad97843 | 19475:8aa2b380614a |
---|---|
141 NONE => NONE |
141 NONE => NONE |
142 | SOME (a, s2) => |
142 | SOME (a, s2) => |
143 (case Seq.pull s2 of |
143 (case Seq.pull s2 of |
144 NONE => NONE |
144 NONE => NONE |
145 | SOME (a2,s3) => |
145 | SOME (a2,s3) => |
146 SOME (a, all_but_last_of_seq (Seq.cons (a2,s3)))) |
146 SOME (a, all_but_last_of_seq (Seq.cons a2 s3))) |
147 in |
147 in |
148 Seq.make f |
148 Seq.make f |
149 end; |
149 end; |
150 |
150 |
151 fun ALL_BUT_LAST r st = all_but_last_of_seq (r st); |
151 fun ALL_BUT_LAST r st = all_but_last_of_seq (r st); |
176 fun skip_occs n sq = |
176 fun skip_occs n sq = |
177 case Seq.pull sq of |
177 case Seq.pull sq of |
178 NONE => skipmore n |
178 NONE => skipmore n |
179 | SOME (h,t) => |
179 | SOME (h,t) => |
180 (case Seq.pull h of NONE => skip_occs n t |
180 (case Seq.pull h of NONE => skip_occs n t |
181 | SOME _ => if n <= 1 then skipseq (Seq.cons (h, t)) |
181 | SOME _ => if n <= 1 then skipseq (Seq.cons h t) |
182 else skip_occs (n - 1) t) |
182 else skip_occs (n - 1) t) |
183 in (skip_occs m s) end; |
183 in (skip_occs m s) end; |
184 |
184 |
185 (* handy function for re-arranging Sequence operations *) |
185 (* handy function for re-arranging Sequence operations *) |
186 (* [[a,b,c],[d,e],...] => flatten [[a,d,...], [b,e,...], [c, ...]] *) |
186 (* [[a,b,c],[d,e],...] => flatten [[a,d,...], [b,e,...], [c, ...]] *) |