Commit graph

19 commits

Author SHA1 Message Date
Linus Björnstam
a47d6d992b fix folding, add :continue
Fix foldig to be an :acc version of in.

:continue will stop the subloop and start the next iteration of the
outer loop
2023-10-30 21:56:54 +01:00
Linus
ec2b65612c Simplified install 2022-03-06 21:15:30 +01:00
Linus
2775e70fd0 guard if in accumulators is now :if.
All auxiliary syntax is now prefixed by :.
2021-09-27 21:36:02 +02:00
Linus
832c414260 Changes for the better
* goof-impl.scm (loop/first loop/last): add ability to specify a
:default value. Added auxiliary syntax :default.
 * goof/iterators.scm (accumulating hash(q|v)ing): changed auxiliary
keyword from initial -> :initial.
 * goof.scm: export extra keywords
 * doc.html
 * doc.xml : document changes. fix bugs.
2021-08-17 21:36:13 +02:00
Linus
7a1137e579 Changed accumulator test/bind order to bind/test
This means vectoring exits directly when the index loop variable =
:length.

It also means :final has to change.
2021-05-18 19:57:02 +02:00
Linus
2c323be362 Big change: lexical scoping
This introduces lexical scoping of for clauses. See README.md
2021-05-18 18:12:01 +02:00
Linus
cccc324ecd Made all mutating accumulators visible in the body
Previously hashing and vectoring hid the resulting hash before
the final-function. This is no longer the case.

Also, now some of the tests work...
2021-05-12 12:54:29 +02:00
Linus
a38170a25b Added stop-after and stop-before
These are equivalent to their racket for loop counterparts, and creates
an iterator that signals exhaustion befor or after yielding a value
where a predicate returns true. Not useful in non-nested loops, but
could be useful in inner loops where you want to exit to an outerloop
instead of :break-ing.

Also fixed some bugs in other generator clauses.
2021-05-11 09:48:21 +02:00
Linus
3908019bbc Added some tests.
Fixed some things I noticed when testing the tests.
2021-03-22 19:30:09 +01:00
Linus
5847bd21d4 Fixed :final and make to, by => :to :by
I had a bug. I had an inconsistency. Don't worry. All is fixed.
2021-03-18 12:41:39 +01:00
Linus
f6d7b01793 Refactored for-clauses to take :for for better error reporting
At least in the future
2021-03-16 19:30:08 +01:00
Linus
172d0aa180 Changed the loop protocol for :acc clauses
The third clause (the "check" clause) now breaks the entire
iteration for :acc clauses instead of just exiting the current subloop.

This is much saner, and was immediately usable in vectoring.
2021-03-11 22:18:29 +01:00
Linus
f0900a0497 Added some generator clauses to the iterators
in-vector, in-string and all other indexed for clauses
now have generator clauses.

in-hash now has a generator clause.
2021-03-11 14:38:26 +01:00
Linus
bb0de3e949 Added some generator clauses
Now in-file, in-port, in-lists and in-generator have generator clauses
2021-02-18 22:08:34 +01:00
Linus
969b9a029a Added basic documentation
WIP.
2021-01-28 13:30:32 +01:00
Linus
93aa5aa439 Simplified the iterator protocol.
There is no need for :acc clauses to intoduce loop variables, or for :for clauses to introduce acc clauses.
They are now changed.

 * goof.scm (cl-next/acc cl-next/for): removed the unused matchings for loop-vars and acc-vars respectively.
 * goof/iterators.scm (all iterators): simplified it.
2021-01-06 21:24:15 +01:00
Linus
7311da2ec2 Add the vectoring accumulator.
Currently undocumented and untested.
2021-01-02 21:43:10 +01:00
Linus
f492a5278b Added hashing, hashqing hashving och in-hash. 2021-01-02 12:03:03 +01:00
Linus
7ddb707bb7 Made it a module.
Put it in any directory, run guile -L . and then import (goof) in that directory.
2020-12-16 20:17:13 +01:00