Commit graph

76 commits

Author SHA1 Message Date
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
5f96ef4fb0 Promote accumulator lets to the outermost let
This is a bug I never hit, due to me only having accumulators that gets passed along. However,
something like vectoring or hashing should behave like (in-vector ...), which means the let binding
needs to be propagated upwards.
* goof.scm change cl-next/acc to promote let bindings for accumulators to the outermost let.
2021-01-01 22:00:39 +01:00
Linus
02fd0199ec Added a docfile without any tools to generate the proper docs.
I can't seem to find my old xslt files.
2020-12-29 22:01:44 +01:00
Linus
bd2a69a16c Readme change. Beta quality! 2020-12-16 20:19:43 +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
Linus
317b3e732b Fix markdown in README.md to not show like HTML. 2020-12-16 19:59:03 +01:00
Linus
2d35c9d6cf Polishing the README and iterator protocol.
* README.md: added some small documentation and loop expansion.
 * goof.scm: Changed the iterator protocol to not use unnecessary :acc and :fors.
 * iterators.scm: see above.
 * ref-let.scm: a new macro to allow multiple values and pattern matching to co-exist for body-bindings.
2020-12-16 19:54:55 +01:00
Linus
aab9fcabb0 Extracted the innermost recuring form into a separate form to facilitate inlining
Guile wasn't properly doing DCE when there are no :final guards, so I did it as a macro.
2020-12-02 21:39:47 +01:00
Linus
2dc4a72790 Added pattern matching
ref variables now do pattern matching. This means that, say, the
variable binding the (car cursor) in (in-list ...) can be a (ice-9 match) pattern:

(loop/list (((a . b) (in-list '((1 ignore) (2 ignore) (3 ignore))))
  a)
;; => (1 2 3)
2020-12-02 21:17:42 +01:00
Linus
093d1319d9 Fixed a bug with a forgotten :acc.
Inlined the in-file bindings, with the risk of exposing it to a misguided set!.
2020-12-01 20:54:42 +01:00
Linus
c53a08c769 Made simple loops better. Now with correct syntax proliferation.w 2020-12-01 20:53:25 +01:00
Linus
0c110dd080 Big, buggy commit
:for clauses now have finalizers! This means (in-file "path") now works. This meant I had to do some restructuring of many nasty pieces of code, but I believe it works. cl-next was broken up into cl-next/acc and cl-next/for. Accumulators have to pass :acc to (cl-next/acc ...). I plan for :for clauses to do the same.

I fixed tests.scm and README.md to reflect the de-racketification of the for loops.
2020-11-25 20:40:48 +01:00
Linus
1a826f86e2 Undid racketification, because not diffrentiating between :for and :acc means that errors become very strange and unhelpful.
Added simple forms, like loop/list that accumulates bodies into a list.

Add :final that works like in racket:
(loop/list ((:for a (in-list '(1 2 3))) :final (= a 2)) (display a))
=> (1 2)
2020-11-22 21:47:48 +01:00
Linus
80464ebe48 Added some simple versions of loop
loop/first loop/last loop/sum loop/product now added.
2020-11-09 23:18:58 +01:00
Linus
17d72f2cea Added generator sequences
Basic hack of in-cycle and in-indexed
2020-11-09 22:57:18 +01:00
Linus
30b73286b3 Forgot some updates in the readme to accompany previous commit. 2020-11-09 13:44:55 +01:00
Linus
a3244a065a Update readme to reflect recent changes.wq 2020-11-09 13:35:43 +01:00
Linus
2c182da570 Racketifying goof-loop
I have racketified goof loops. No :for or :acc needed, and :when, :unless, and :break are no longer parethesised.
:acc blah (in ...) and :for blah (in ...) has been changed to
(blah (folding ...)) and (blah (in ...))
2020-11-09 13:30:02 +01:00
Linus
716c26c7ce Removed unused, undefined exports.
Shedded some garbage from helpers.scm
2020-11-04 23:20:19 +01:00
Linus
be9ac1a55d Intermediate loops
goof.scm
  * Changed cl-next to properly push all intermediate loops
  * Changed emit-many/rest to emit intermediate loops
  * Added loop/list as a shorthand for just accumulating lists.

tests.scm
  * Collected some things I wanted ta have to track regressions.

README.md
  * Reflect above changes
2020-11-04 23:15:32 +01:00
Linus
f2496604d5 Fixed named update and a bug in accumulating
* goof.scm: Removed positional updates and fixed named updates
 * iterators.scm: Fixed bug in accumulating where only lists were supported.
2020-11-04 11:58:58 +01:00
Linus
b3efccb4aa Clarified readme regarding named update. 2020-11-02 22:20:52 +01:00
Linus
dd86fc8a0b Added a LICENCE file and fixed a small readme error. 2020-11-02 22:17:48 +01:00
Linus
ef96da9658 First commit 2020-11-02 22:11:45 +01:00