equal
deleted
inserted
replaced
70 |
70 |
71 fun get_prompt prompt src = get (set_prompt prompt src); |
71 fun get_prompt prompt src = get (set_prompt prompt src); |
72 |
72 |
73 fun get_single src = |
73 fun get_single src = |
74 (case get src of |
74 (case get src of |
75 ([], _) => None |
75 ([], _) => NONE |
76 | (x :: xs, src') => Some (x, unget (xs, src'))); |
76 | (x :: xs, src') => SOME (x, unget (xs, src'))); |
77 |
77 |
78 fun exhaust src = |
78 fun exhaust src = |
79 (case get src of |
79 (case get src of |
80 ([], _) => [] |
80 ([], _) => [] |
81 | (xs, src') => xs @ exhaust src'); |
81 | (xs, src') => xs @ exhaust src'); |
91 if null xs orelse not (null xs') then (xs', src') |
91 if null xs orelse not (null xs') then (xs', src') |
92 else drain_mapfilter f prompt src' |
92 else drain_mapfilter f prompt src' |
93 end; |
93 end; |
94 |
94 |
95 fun mapfilter f src = make_source [] src default_prompt (drain_mapfilter f); |
95 fun mapfilter f src = make_source [] src default_prompt (drain_mapfilter f); |
96 fun filter pred = mapfilter (fn x => if pred x then Some x else None); |
96 fun filter pred = mapfilter (fn x => if pred x then SOME x else NONE); |
97 |
97 |
98 |
98 |
99 |
99 |
100 (** build sources **) |
100 (** build sources **) |
101 |
101 |