ref: 3c1277e37fbaea87d770d4a64a5029c4a693bb63
parent: d515158d85a5361cd9127f13424e4242226ab9b0
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Feb 5 07:44:20 EST 2016
Add missing file.
--- /dev/null
+++ b/lib/std/striter.myr
@@ -1,0 +1,31 @@
+use "die"
+use "types"
+use "utf"
+
+pkg std =
+ type chariter = struct
+ rest : byte[:]
+ ;;
+
+ impl iterable chariter -> char
+
+ const bychar : (str : byte[:] -> chariter)
+;;
+
+impl iterable chariter -> char =
+ __iternext__ = {ci, c
+ if ci.rest.len == 0
+ -> false
+ ;;
+ (c#, ci.rest) = strstep(ci.rest)
+ -> true
+ }
+
+ __iterfin__ = {ci, c
+ }
+;;
+
+const bychar = {str
+ -> [.rest = str]
+}
+