- Use `runtime.info.get_stack_trace()` to get the current stack trace.
- Used in assertions and heap allocator for better error reporting
- `Optional.with` for running a block of code with the value in an Optional, if one is present.
-- `iter.flatten`
- `-Dvariable=value` command line option to add symbols to the `runtime.vars` package.
- `--no-type-info` command line option to omit type information from the binary.
-- `core.encoding.hex`
- - Quickly convert a byte array to and from its hex equivalent.
- `Allocator.move`. Moves a value into an allocator, returning a pointer to it.
- This is a copy operation (and might be renamed later)
+- `core.encoding.hex` package
+ - Quickly convert a byte array to and from its hex equivalent.
- `os.path_clean`
- `os.path_directory`
- `os.path_extension`
- `os.path_split`
+- `slice.equal`
+- `iter.find`
+- `iter.flatten`
Removals:
- Remove old syntax for quoted blocks, `#quote` and `#()`.
flatten :: flatten;
enumerate :: enumerate;
+ find :: find;
fold :: fold;
count :: count;
some :: some;
// Iterator reducing
//
+find :: #match #local {}
+
+#overload
+find :: macro (it: $T/Iterable, predicate: $F) =>
+ #this_package.find(#this_package.as_iter(it), predicate);
+
+#overload
+find :: (it: Iterator($T), predicate: (T) -> bool) -> ? T {
+ for v: it {
+ if predicate(v) {
+ return v;
+ }
+ }
+
+ return .{};
+}
+
+
#doc """
Incremently calls `combine` on the yielded value and the
accumulated value, producing a new accumulated value. Returns
}
+#local HasEquals :: interface (t: $T) {
+ { t == t } -> bool;
+}
+
+equal :: (arr1: [] $T/HasEquals, arr2: [] T) -> bool {
+ if arr1.count != arr2.count do return false;
+
+ for i: arr1.count {
+ if !(arr1[i] == arr2[i]) do return false;
+ }
+
+ return true;
+}
+
+
#local fold_idx_elem :: (arr: [] $T, $cmp: Code) -> (i32, T) {
idx := 0;
elem := arr[0];