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

change revRange to same argument types as range #374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on May 6, 2022

  1. change revRange to same argument types as range

    This allows it to iterate returning ?Nat instead of ?Int so it can be used in arrays.
    As range starts at Nat I figured that negative numbers weren't that important anyway. Maybe range should be (Nat, Nat) too? So then you've got the two functions that are easily used with arrays. Could always add rangeInt separately.
    
    This is my first pull request so if I've screwed anything up DONT HOLD BACK!
    
    Here are the tests I used
    
    // revRange
    do {
      let rev = LIter.revRange(0, 0);
      assert(rev.next() == ?0);
      assert(rev.next() == null);
    };
    do {
      let rev = LIter.revRange(3, 1);
      assert(rev.next() == ?3);
      assert(rev.next() == ?2);
      assert(rev.next() == ?1);
      assert(rev.next() == null);
    };
    borovan committed May 6, 2022
    Configuration menu
    Copy the full SHA
    45f6de5 View commit details
    Browse the repository at this point in the history