GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing noogle.dev — Noogle - Simply find Nix API reference documentation.

Noogλe

search input

Function of the day

lib.trivial.splitByAndCompare

  • Split type into two subtypes by predicate p, take all elements of the first subtype to be less than all the elements of the second subtype, compare elements of a single subtype with yes and no respectively.

    Inputs

    p

    Predicate

    yes

    Comparison function if predicate holds for both values

    no

    Comparison function if predicate holds for neither value

    a

    First value to compare

    b

    Second value to compare

    Type

    splitByAndCompare :: (a -> Bool) -> (a -> a -> Int) -> (a -> a -> Int) -> (a -> a -> Int)
    

    Examples

    lib.trivial.splitByAndCompare usage example

    let cmp = splitByAndCompare (hasPrefix "foo") compare compare; in
    
    cmp "a" "z" => -1
    cmp "fooa" "fooz" => -1
    
    cmp "f" "a" => 1
    cmp "fooa" "a" => -1
    # while
    compare "fooa" "a" => 1
    
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.