Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create stack-based accumulation commands #107

Draft
wants to merge 59 commits into
base: master
Choose a base branch
from
Draft

Create stack-based accumulation commands #107

wants to merge 59 commits into from

Conversation

okamsn
Copy link
Owner

@okamsn okamsn commented Nov 6, 2021

Fixed #103.

We require that only accumulation commands can edit the variable. While we do
have generic commands like reduce and accumulate, it would still be
convenient to have others.

Possible candidates:

  • (drop VAR N :at POS) with alias pop. pos defaults to start.
  • (drop-while VAR COND) with alias pop-while
  • take for the opposite of drop
  • take-while for the opposite of drop-while
  • diff or difference for an operation like seq-difference

For now, we've decided to have the commands initialize variables and their
preferred positions for optimization.

TODO: Should the *-while commands support expressions, as in find?
For example, should (drop-while VAR EXPR) (as opposed to (drop-while VAR PRED) be equivalent to the following? While the alternative is wordy, is the
operation that common?

(subloop (without VAR)
         (while EXPR)
         (drop VAR 1))

We use this function in the expansion of the `drop-while` command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add commands to manipulate an accumulation like a stack
1 participant