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

Implement more world manipulation functions in world DSL #1584

Closed
Tracked by #1969
byorgey opened this issue Oct 17, 2023 · 2 comments · Fixed by #1990
Closed
Tracked by #1969

Implement more world manipulation functions in world DSL #1584

byorgey opened this issue Oct 17, 2023 · 2 comments · Fixed by #1990
Labels
C-Low Hanging Fruit Ideal issue for new contributors. L-World DSL World description language Z-Feature A new feature to be added to the game.

Comments

@byorgey
Copy link
Member

byorgey commented Oct 17, 2023

We should add more functions such as:

  • reflectV
  • reflectH
  • offset/translate

See original design discussion at #1320 (comment) .

@byorgey byorgey added Z-Feature A new feature to be added to the game. C-Low Hanging Fruit Ideal issue for new contributors. L-World DSL World description language labels Oct 17, 2023
@byorgey
Copy link
Member Author

byorgey commented Jun 24, 2024

It occurs to me that IF it were straightforward to add lambdas (I'm really not sure about that), then it would be simpler to add a single primitive imap with type (int -> int -> a -> b) -> W a -> W b, with which one could implement all of these (and others besides).

@byorgey
Copy link
Member Author

byorgey commented Jun 25, 2024

Actually, I just realized we can do without lambdas in this case! We can give imap the type

imap : W int -> W int -> W a -> W a

The first two arguments say, for each location, the x- and y-coordinates to look up to get the contents for that cell. For example, to implement horizontal reflection you could use imap (-x) y. To implement rotation by 90 degrees you could imap y (-x), and so on.

@byorgey byorgey linked a pull request Jun 25, 2024 that will close this issue
@mergify mergify bot closed this as completed in #1990 Jun 26, 2024
@mergify mergify bot closed this as completed in 1735416 Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Low Hanging Fruit Ideal issue for new contributors. L-World DSL World description language Z-Feature A new feature to be added to the game.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant