Commit graph

76 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
5668706b88 Added a simple installation instruction
Very basic.
2022-03-06 21:35:06 +01:00
Linus
5381bf5f69 Addendum simplified install
Forgot to change a path.
2022-03-06 21:17:38 +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
88f138849e Fix typo in readme
* README.md: fix an example so that it actualy works.
2021-09-25 21:31:48 +02:00
Linus
f5a3629b56 Make let-kw-form more portable to other syntax-case schemes
* goof.scm (let-kw-form): don't use guile-specific with-ellipsis.
2021-09-25 21:27:50 +02:00
Linus
050f88d678 Fixed misnamed export
* goof.scm: in-vector-reverse and in-string-reverse now properly
exported.
2021-09-25 21:21:29 +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
1de0a624f5 Updated readme
Small changes.
2021-05-26 20:32:09 +02:00
Linus
189f1d045d Made sure loop loops
Fix subloop :acc semantics.

clarify code comments.
2021-05-25 22:07:53 +02:00
Linus
307240383a Changed semantics of pure loop form
Now an empty clause list means execute body once.

any kind of clause means: loop. regardless of for or no for clause.
2021-05-23 22:10:23 +02:00
Linus
e057a6b8fe loops without subloops can now use :for clauses in final-expr 2021-05-21 20:42:10 +02:00
Linus
9988434554 Clarified readme regarding final-expr 2021-05-21 10:22:21 +02:00
Linus
6d305d416b Added passage about maybe automagically looping 2021-05-21 10:20:38 +02:00
Linus
10ba6bd9d2 Fixed documentation warning 2021-05-21 10:12:51 +02:00
Linus
dd1589ab3a Changed documentation to reflect recent changes 2021-05-21 10:09:07 +02:00
Linus
93134a1b21 Made => implicit if we have accumulators
If there are accumulators, their final values will be returned if no
final-expr is given.

(loop ((:for a (up-from 1 11))
       (:acc lst (listing (* a a))))
  => lst)

becomes simply:

(loop ((:for a (up-from 1 11))
       (:acc lst (listing (* a a)))))
2021-05-18 20:39:37 +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
aa77fef2ad Fix example in readme
forgot parens.
2021-05-18 18:18:17 +02:00
Linus
f6d22792b0 Don't know git. 2021-05-18 18:17:10 +02:00
Linus
c65ab9cb15 Some more changes to readme 2021-05-18 18:15:41 +02:00
Linus
20471c01c2 Added annotations for code highlighting 2021-05-18 18:15:09 +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
769553832b Start of something big
This marks a deviation from the foof-loop inheritance, and a path
towards a more lexical scope. :for clauses are now bound to the top of
each loop, and the following :bind, :when, :unless, :break, :final and
:acc clauses now follow a the lexical order of when they were
introduced... At least, that's the plan. This commit makes :for, :bind,
:when, :unless and :break work. The rest is broken.

and :let+:let* are no more.
2021-05-16 20:13:55 +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
5d07594f53 Tagged a release 2021-05-11 13:36:05 +02:00
Linus
1cd5e4edaa Added beta warning
I'm about to tag a release. Beta quality warning is probably an
understatement.
2021-05-11 13:34:13 +02:00
Linus
5a92ba298d Updated the documentation, added pointer to hosted version 2021-05-11 13:27:09 +02:00
Linus
66e435aa92 updated the documentation
Added stop-before, stop-after, in-cycle and in-indexed to the
documentation.

Also clarified (and examplified) the erathostenes example.
2021-05-11 11:14:22 +02:00
Linus
6f0c6e636f Fixed error reporting of missing :for clause 2021-05-11 10:00:46 +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
524933d29f Same as previous commit.
I forgot to edit the documentation for down-to.
2021-03-18 12:46:07 +01:00
Linus
78aed79463 Updated documentation to reflect previous change. 2021-03-18 12:43:56 +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
90c2c6bfdf New documentation
Added a "Porting" section.

Some clarifications.
2021-03-11 14:42:52 +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
79b7c4eedd Clarified expansion
The expansion of (loop ...) without subloops is now the same as loop
with subloops.
2021-03-11 14:35:07 +01:00
Linus
f90d83b6a0 Mention documentation in the readme
The readme is awful, but now it at least points to the documentation.
2021-03-07 22:26:15 +01:00
Linus
74514bb4d1 Fixed the documentation a bit
Added some more info. It still looks awful.
2021-03-07 22:19:13 +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
7b3814c430 More parentheses
I have changed my mind about the clause forms. They should, with the
exception of :subloop, be parethesised: :when test => (:when test).
2021-02-18 21:19:12 +01:00
Linus
a545c1cbd7 Fix a bug where simple loops did not bind let bindings correctly
add check whether a loop clause exists to avoid the ultra-shit errors that happen if you
accidentally write (up-form ...)
2021-02-09 22:02:40 +01:00
Linus
d48ed19e43 Fix the previous commit. Now also the simple loops are ensured to execute once if no for-clauses are given.
Instead of throwing a syntax-error...
2021-01-28 20:37:05 +01:00
Linus
685fe86f36 Loops without any clauses now run the body at least once.
Small updates to readme.
2021-01-28 20:18:15 +01:00
Linus
06a11fc892 Modularized the code
Everything in goof-impl.scm is portable (r7rs) syntax-rules. The non-portable parts
, most notably the let-kw-form macro is in the module definition goof.scm.
2021-01-28 20:01:24 +01:00
Linus
969b9a029a Added basic documentation
WIP.
2021-01-28 13:30:32 +01:00