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

Improve boolean and some iteration commands, unify tests #144

Merged
merged 3 commits into from
Aug 12, 2023
Merged

Conversation

okamsn
Copy link
Owner

@okamsn okamsn commented Dec 10, 2022

  • Make it an error to use the same iteration var for multiple iteration commands.

    • Add loopy--other-vars for the set commands.
      These variables don't work exactly like iteration or accumulation variables,
      so it needs it's own group.
  • Improve boolean commands by making their behavior more like accumulation
    commands.

    • Switch to loopy-result instead of a variable based on the loop name.
    • Use accumulation variables instead of iteration variables.
    • Make boolean commands exit via leave.
    • Check the compatibility of the used boolean commands during expansion,
      like we already do with accumulation commands.
    • Add :into to the boolean commands.
  • Improve cons, cycle, iter, numbers, and seq-index, by defaulting
    to avoiding updating the iteration variables during the loop. This lets us
    avoid indirect variables and produce faster code. This can be overridden
    using the with (or without) special macro arguments.

    • For cycle in particular, we now allow it to do the opposite.
    • Add predicates loopy--with-boundp and loopy--command-boundp.
  • Update Org doc and changelog with these changes.

@okamsn okamsn added enhancement New feature or request breaking changes labels Dec 10, 2022
@okamsn
Copy link
Owner Author

okamsn commented Dec 10, 2022

Also, add destructuring to iter, which we apparently forgot to do.

@okamsn okamsn mentioned this pull request Dec 10, 2022
3 tasks
@okamsn okamsn changed the title Improve boolean commands and some iteration commands. Improve boolean commands, some iteration commands, unify tests Dec 14, 2022
@okamsn okamsn changed the title Improve boolean commands, some iteration commands, unify tests Improve boolean and some iteration commands, unify tests Dec 14, 2022
@okamsn
Copy link
Owner Author

okamsn commented Dec 14, 2022

  • Make the expanded test prefixed by what is tested. So, instead of
    one test list that tests both loopy and loop-iter, it should expand
    to multiple tests loopy/list, iter-bare/list, and
    iter-keyword/list. The name will be more informative when things fail.
  • Instead of relying on generic errors, try to use more defined errors from
    define-error. We can then name these errors in the tests for more
    robustness.

okamsn added 2 commits May 6, 2023 18:33
- Make it an error to use the same iteration var for multiple iteration commands.
  - Add `loopy--other-vars` for the `set` commands.
    These variables don't work exactly like iteration or accumulation variables,
    so it needs it's own group.

- Improve boolean commands by making their behavior more like accumulation
  commands.
  - Switch to `loopy-result` instead of a variable based on the loop name.
  - Use accumulation variables instead of iteration variables.
  - Make boolean commands exit via `leave`.
  - Check the compatibility of the used boolean commands during expansion,
    like we already do with accumulation commands.
  - Add `:into` to the boolean commands.

- Improve `cons`, `cycle`, `iter`, `numbers`, and `seq-index`, by defaulting
  to avoiding updating the iteration variables during the loop.  This lets us
  avoid indirect variables and produce faster code.   This can be overridden
  using the `with` (or `without`) special macro arguments.
  - For `cycle` in particular, we now allow it to do the opposite.
  - Add predicates `loopy--with-boundp` and `loopy--command-boundp`.

- Update Org doc and changelog with these changes.
@okamsn okamsn force-pushed the better-init branch 2 times, most recently from da2fa46 to 9b63fee Compare May 6, 2023 22:38
@okamsn okamsn force-pushed the better-init branch 3 times, most recently from f60229e to dc93277 Compare August 11, 2023 02:59
- Separate, clean up, and add tests.

- Unify most command tests for `loopy` and `loopy-iter`.

- Add more errors which can be signaled in `loopy-misc.el`.
  Use these signals to better test expected failures.

- Simplify explanation of boolean commands.

- Remove unused functions.
  - `loopy--quoted-symbol-p`: We still use `loopy--quoted-form-p`.
  - `loopy--quote-if-car-not-symbol-or-lambda`

- Remove unused functions `loopy--get-optimized-accum`,
  `loopy--accum-code-expansion`. We replaced these functions with
  `loopy--expand-optimized-accum` and using Emacs's own macro expansion
  facilities a while ago.
  - Remove functions.
  - Replace references to removed function with references to the new function.

- Replace use of removed `loopy--quoted-symbol-p` with `loopy--quoted-form-p` in
  `find`.

- Make `loopy--with-bound-p` return value and place.

- Make `loopy--command-bound-p` return value and place.

- Remove unused `loopy-test-structure` from default tests.  Still used
  elsewhere.

- Clarify examples for `find`.

- Mark that a test is expected to fail on Emacs 27 due to byte compilation
  errors.

- Remove duplicate tests from `iter-tests.el`.
@okamsn okamsn merged commit f4f389f into master Aug 12, 2023
5 checks passed
@okamsn okamsn mentioned this pull request Aug 12, 2023
@okamsn okamsn deleted the better-init branch February 25, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking changes enhancement New feature or request tests Concerning the ERT tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant