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

lolo-iterator should be more robust #3

Open
bel28kent opened this issue Jun 16, 2024 · 0 comments
Open

lolo-iterator should be more robust #3

bel28kent opened this issue Jun 16, 2024 · 0 comments
Labels
exception-handling This code needs to implement exceptions. robustness This code could be more robust (missing conditions)

Comments

@bel28kent
Copy link
Owner

bel28kent commented Jun 16, 2024

In lines 83–94, the helper would be more robust if it checked for both lolot and lolon to be empty. If only one is empty, it should throw an exception.

          ; (listof (listof Token)) (listof (listof Natural)) -> (listof (listof (listof Token)))
          (define (lolo-iterator lolot lolon)
            ; spine-list: (listof (listof Token)). Accumulates the output of lon-iterator calls.
            ;
            (local [(define (lolo-iterator lolot lolon spine-list)
                      (cond [(andmap empty? lolot) (reverse spine-list)]
                            [else
                              (local [(define output (lon-iterator lolot (first lolon)))]
                                (lolo-iterator (acc-remaining output)
                                               (rest lolon)
                                               (cons (acc-spine-list output) spine-list)))]))]
              (lolo-iterator lolot lolon empty)))
@bel28kent bel28kent added robustness This code could be more robust (missing conditions) exception-handling This code needs to implement exceptions. labels Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exception-handling This code needs to implement exceptions. robustness This code could be more robust (missing conditions)
Projects
None yet
Development

No branches or pull requests

1 participant