Loops without any clauses now run the body at least once.
Small updates to readme.
This commit is contained in:
parent
06a11fc892
commit
685fe86f36
2 changed files with 26 additions and 24 deletions
16
README.md
16
README.md
|
@ -1,7 +1,5 @@
|
|||
# goof-loop - a scheme looping facility
|
||||
|
||||
WARNING: Currently beta-quality.
|
||||
|
||||
goof-loops aims to be an amalgamation of the racket for loops and Alex Shinn's (chibi-loop). We are many that found racket's for loops a breeze of fresh air, but in the end their most general forms (for/fold and for/foldr) are kinda odd to work with. If you choose not to use those general for loops, you cannot express arbitrary transformations, like say a fibonacci sequence, since for clauses cannot reference eachother. goof-loop tries to fix this:
|
||||
|
||||
```
|
||||
|
@ -50,19 +48,21 @@ while and until are removed in favour of :break.
|
|||
|
||||
:when and :unless are added to better control when the loop body is executed (and accumulators accumulated)
|
||||
|
||||
with-clauses are removed in favour of (:for var (in init [step [stop]])) or (:acc var (folding init [step])) in case of accumulators.
|
||||
with-clauses are removed in favour of (:for var (in init [step [stop]])) in case of loop clauses, or (:acc var (folding init [step])) in case of accumulators.
|
||||
|
||||
### Regressions compared to foof-loop
|
||||
|
||||
only accumulating clauses are visible in the final-expression. This is due to sequence clauses not being promoted through to outer loops (since they should not keep their state).
|
||||
only accumulating clauses are visible in the final-expression. This is due to sequence clauses not being promoted through to outer loops (since they should not keep their state if an inner loop is exited).
|
||||
|
||||
Due to clause reordering, positional updates are not supported. If you want to update your loop vars, do so using named update (see below).
|
||||
|
||||
### changes
|
||||
|
||||
(with var [init [step [guard]]]) => (:for var (in init [step [stop-expr]])). guard was a procedure, but now it is an expression.
|
||||
(with var [init [step [guard]]]) => (:for var (in init [step [stop-expr]])).
|
||||
|
||||
(with var 10 (- var 1) negative?) => (:for var (in 10 (- var 10) (negative? var)))
|
||||
guard was a procedure, but now it is an expression.
|
||||
|
||||
(with var 10 (- var 1) negative?) => (:for var (in 10 (- var 10) (negative? var)))
|
||||
|
||||
### similarities
|
||||
|
||||
|
@ -242,9 +242,9 @@ $5 = (let loopy-loop ((cursor (read)))
|
|||
```
|
||||
|
||||
## Todo
|
||||
Tests and documentation.
|
||||
Tests!
|
||||
|
||||
Fix the inlining behavious of some of the :for iterators.
|
||||
Finish documentation.
|
||||
|
||||
add generator support for all provided iterators
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue