diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-11-18 20:11:31 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-11-18 20:11:31 +0100 |
commit | 5bde1a7f4936e991c86da20fe0a143b527161ae2 (patch) | |
tree | a3ff2065b86b20ec1ef0b4eabd047dc0dee18c4b /mew.svnwiki | |
parent | 66cd2fda549d7708acb8685933e619b0922885d5 (diff) | |
download | mew-5bde1a7f4936e991c86da20fe0a143b527161ae2.tar.gz mew-5bde1a7f4936e991c86da20fe0a143b527161ae2.tar.xz mew-5bde1a7f4936e991c86da20fe0a143b527161ae2.zip |
inject: use generator-xfold, immediately xfold if generator is passed
Diffstat (limited to 'mew.svnwiki')
-rw-r--r-- | mew.svnwiki | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mew.svnwiki b/mew.svnwiki index 3b4fb3f..629d11b 100644 --- a/mew.svnwiki +++ b/mew.svnwiki @@ -458,12 +458,13 @@ Like {{generator-fold}}, but {{<f>}} always takes the accumulator as first arguments, and the items after. This is more practical when multiple {{<generators>}} are passed. -<procedure>(inject <f> <init>?)</procedure> +<procedure>(inject <f> <init>? <g>?)</procedure> Returns a procedure that takes an generator (or something convertible -by {{gen}}) and folds the function {{<f>}} over its values. If given, +by {{gen}}) and xfolds the function {{<f>}} over its values. If given, folding starts with {{<init>}}, else with the first element yielded by the generator. If the generator is empty, return {{(<f>)}}. +If {{<g>}} is passed, immediately fold over the generator {{<g>}}. <procedure>(odometer <wheels>...)</procedure> |