You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: parser/src/defs.rs
+10-5Lines changed: 10 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -3074,22 +3074,27 @@ primitive!(
3074
3074
/// Many of the examples here can be better expressed using array operations, and are merely demonstrative.
3075
3075
///
3076
3076
/// We can express a simple recursive factorial function like so.
3077
-
/// ex: Fact ← recur(<2|-1|×)
3077
+
/// ex: # Experimental!
3078
+
/// : Fact ← recur(<2|-1|×)
3078
3079
/// : Fact 5
3079
3080
/// : Fact 7
3080
3081
/// The [less than]`2` determines when to cease recursion. The [subtract]`1` is the next recursive call, the "child node". The [multiply] gets called on a node and the result of its child.
3081
3082
///
3082
3083
/// We can express the classic recursive fibanacci function in a similar way. In this example, the second function returns two children. The third function ignores the parent node and simply adds the results of the children.
3083
-
/// ex: Fib ← recur(<2|⊃[-1|-2]|/+)
3084
+
/// ex: # Experimental!
3085
+
/// : Fib ← recur(<2|⊃[-1|-2]|/+)
3084
3086
/// : Fib 10
3085
-
/// Because a boolean result from the first function returns a node as its own result, that example interprets the 0th fibonacci number to be `0``.
3087
+
/// Because a boolean result from the first function returns a node as its own result, that example interprets the 0th fibonacci number to be `0`.
3086
3088
/// If we instead want the 0th fibonacci to be `1`, we can return a list of 0 or 1 items from the first function instead. A 1-item list is interpreted as a leaf node, with that item as the result.
3087
-
/// ex: Fib ← recur(▽⊙1<2|⊃[-1|-2]|/+)
3089
+
/// In this example, we use `keep``dip``1` to return `[1]` if the node is `less than``2` or `[]` if it is not.
3090
+
/// ex: # Experimental!
3091
+
/// : Fib ← recur(▽⊙1<2|⊃[-1|-2]|/+)
3088
3092
/// : Fib 10
3089
3093
///
3090
3094
/// The results of a node's children will be passed to the third function as an array. The creation of this array will fail if the results of the children have incompatible shapes. There is an acception for box lists, which will be [join]ed instead of used as rows. This makes it possible to combine variable-length lists.
3091
3095
/// One example use case for this is listing all files in all subdirectories.
0 commit comments