-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
structures
, waypoints
, and tagmembers
commands return lists (
#2260) Change `structure`, `waypoint`, and `tagmembers` to return lists; also make `waypoint`, `tagmembers` and `hastag` pure functions, since their output within a given scenario will never change. More specifically: - Changes the type of `waypoint : Text -> Int -> (Int * Int)` to just return the waypoint with the given index (wrapping around), or throw an exception if there are no waypoints with the given name. - Adds a new `waypoints : Text -> (rec l. Unit + Text * l)` function that returns the list of all waypoints with a given name. - Change `structure` to `structures : Text -> Cmd (rec l. Unit + (Int * Int) * l)`, returning the list of all structure locations of the given name - Change `tagmembers` to have type `tagmembers : Text -> (rec l. Unit + Text * l)` - Change `hastag` to have type `hastag : Text -> Text -> Bool` In the vast majority of cases, this greatly simplified the code for various scenario setups and solutions, though there is still a bit of code duplication for things like calculating the length of a list. But even this can easily be improved once we have #495 and can make a standard library of list functions and import it within scenario code. The reason I kept an indexing function for waypoints but not for structures or tags is that iterating through waypoints incrementally while doing other stuff in between seems like a common thing to want to do, and passing around a list of waypoints and manually indexing into it sounds tedious. However, for structures and tags this is much less common; typically we just want to get a list and then do something with all of them right away.
- Loading branch information
Showing
46 changed files
with
307 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.