Skip to content

Commit

Permalink
std/misc/vector (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
fare authored Nov 21, 2023
1 parent 26b3077 commit ee8beee
Show file tree
Hide file tree
Showing 9 changed files with 388 additions and 91 deletions.
1 change: 1 addition & 0 deletions doc/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ module.exports = {
'misc/number',
'misc/shuffle',
'misc/uuid',
'misc/vector',
]
}
]
Expand Down
17 changes: 13 additions & 4 deletions doc/reference/std/misc/list-builder.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# List builder

The `:std/misc/list-builder` library provides
common bindings for building lists.

::: tip To use the bindings from this module:
```scheme
(import :std/misc/list-builder)
```
:::

## with-list-builder

``` scheme
```scheme
(with-list-builder (put! [peek]) body ...) -> list
put! := function identifier that modifies internal list
Expand All @@ -14,7 +23,7 @@ so *put!* and *peek* can be used without wrapping them in a lambda first.
`with-list-builder` returns the internal list at the end.

::: tip Examples:
``` scheme
```scheme
> (import :std/iter)
> (with-list-builder (put!)
(for (n (in-iota 100 1))
Expand All @@ -30,7 +39,7 @@ so *put!* and *peek* can be used without wrapping them in a lambda first.

## call-with-list-builder

``` scheme
```scheme
(call-with-list-builder proc) -> list
proc := procedure that takes two proc identifiers as input
Expand All @@ -49,7 +58,7 @@ with `copy-list` if you want not to be affected by these mutations.
Finally, `call-with-list-builder` returns the constructed list.

::: tip Examples:
``` scheme
```scheme
> (import :std/iter)
> (call-with-list-builder
(lambda (put! peek)
Expand Down
Loading

0 comments on commit ee8beee

Please sign in to comment.