Skip to content

Create stack-based accumulation commands#107

Draft
okamsn wants to merge 59 commits intomasterfrom
stack-cmds
Draft

Create stack-based accumulation commands#107
okamsn wants to merge 59 commits intomasterfrom
stack-cmds

Conversation

@okamsn
Copy link
Copy Markdown
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))

okamsn added 26 commits February 9, 2022 20:41
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