/*---------------------------------------------------------------------------
  Copyright 2012-2024, Microsoft Research, Daan Leijen.

  This is free software; you can redistribute it and/or modify it under the
  terms of the Apache License, Version 2.0. A copy of the License can be
  found in the LICENSE file at the root of this distribution.
---------------------------------------------------------------------------*/

// Standard `:list` functions.
module std/core/liststd/core/list

import std/core/typesstd/core/types
import std/core/undivstd/core/undiv
import std/core/hndstd/core/hnd
import std/core/exnstd/core/exn
import std/core/charstd/core/char
import std/core/stringstd/core/string
import std/core/intstd/core/int
import std/core/vectorstd/core/vector


// Return the head of list if the list is not empty.
pub fbip fun maybe/headstd/core/list/maybe/head: forall<a> (xs : list<a>) -> maybe<a>( xsxs: list<$625> : liststd/core/types/list: V -> V<aa: V> )result: -> total maybe<650> : maybestd/core/types/maybe: V -> V<aa: V>
  match xsxs: list<$625>
    Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $625) -> Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(xx: $625)
    _       -> Nothingstd/core/types/Nothing: forall<a> maybe<a>

// Return the head of list with a default value in case the list is empty.
pub fbip fun headstd/core/list/head: forall<a> (xs : list<a>, default : a) -> a( xsxs: list<$655> : liststd/core/types/list: V -> V<aa: V>, defaultdefault: $655 : aa: V )result: -> total 671 : astd/core/types/total: E
  match xsxs: list<$655>
    Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $655) -> xx: $655
    _       -> defaultdefault: $655

// Return the tail of list. Returns the empty list if `xs` is empty.
pub fbip fun tailstd/core/list/tail: forall<a> (xs : list<a>) -> list<a>( xsxs: list<$676> : liststd/core/types/list: V -> V<aa: V> )result: -> total list<694> : liststd/core/types/list: V -> V<aa: V>
  match xsxs: list<$676>
    Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(_,xxxx: list<$676>) -> xxxx: list<$676>
    _          -> [std/core/types/Nil: forall<a> list<a>]std/core/types/Nil: forall<a> list<a>

// Is the list empty?
pub fip fun is-emptystd/core/list/is-empty: forall<a> (xs : list<a>) -> bool( ^xsxs: list<$699> : liststd/core/types/list: V -> V<aa: V> )result: -> total bool : boolstd/core/types/bool: V
  match xsxs: list<$699>
    Nilstd/core/types/Nil: forall<a> list<a> -> Truestd/core/types/True: bool
    _   -> Falsestd/core/types/False: bool


// ----------------------------------------------------------------------------
// List functions
// ----------------------------------------------------------------------------

// Returns a singleton list.
pub fip(1) fun singlestd/core/list/single: forall<a> (x : a) -> list<a>(xx: _720)result: -> total list<734>
  [std/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>xx: _720]std/core/types/Nil: forall<a> list<a>

// Returns the length of a list.
pub fun lengthstd/core/list/length: forall<a> (xs : list<a>) -> int(xsxs: list<_775>)result: -> total int
  fun lenlen: forall<a> (ys : list<a>, acc : int) -> int(ysys: list<_749>,accacc: int)result: -> total int
    match ysys: list<_749>
      Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(_,yyyy: list<_749>) -> yyyy: list<_749>.lenlen: (ys : list<_749>, acc : int) -> int(accacc: int+std/core/int/(+): (x : int, y : int) -> int1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001
) Nilstd/core/types/Nil: forall<a> list<a> -> accacc: int
xsxs: list<_775>.lenlen: (ys : list<_775>, acc : int) -> int(0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
) // Returns an integer list of increasing elements from `lo` to `hi` // (including both `lo` and `hi` ). // If `lo > hi` the function returns the empty list. pub fun range/liststd/core/list/range/list: (lo : int, hi : int) -> list<int>( lolo: int: intstd/core/types/int: V, hihi: int: intstd/core/types/int: V )result: -> total list<int> : totalstd/core/types/total: E liststd/core/types/list: V -> V<intstd/core/types/int: V> if lolo: int <=std/core/int/(<=): (x : int, y : int) -> bool hihi: int then Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>( lolo: int, liststd/core/list/range/list: (lo : int, hi : int) -> list<int>( pretend-decreasingstd/core/undiv/pretend-decreasing: (x : int) -> int(lolo: int.incstd/core/int/inc: (i : int) -> int), hihi: int ) ) else Nilstd/core/types/Nil: forall<a> list<a> // Returns an integer list of increasing elements from `lo` to `hi` with stride `stride`. // If `lo > hi` the function returns the empty list. pub fun stride/liststd/core/list/stride/list: (lo : int, hi : int, stride : int) -> list<int>( lolo: int: intstd/core/types/int: V, hihi: int: intstd/core/types/int: V, stridestride: int : intstd/core/types/int: V )result: -> total list<int> : totalstd/core/types/total: E liststd/core/types/list: V -> V<intstd/core/types/int: V> if lolo: int <=std/core/int/(<=): (x : int, y : int) -> bool hihi: int then Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>( lolo: int, liststd/core/list/stride/list: (lo : int, hi : int, stride : int) -> list<int>( pretend-decreasingstd/core/undiv/pretend-decreasing: (x : int) -> int(lolo: int +std/core/int/(+): (x : int, y : int) -> int stridestride: int), hihi: int, stridestride: int )) else Nilstd/core/types/Nil: forall<a> list<a> // Applies a function `f` to list of increasing elements from `lo` to `hi` // (including both `lo` and `hi` ). // If `lo > hi` the function returns the empty list. pub fun function/liststd/core/list/function/list: forall<a,e> (lo : int, hi : int, f : (int) -> e a) -> e list<a>( lolo: int: intstd/core/types/int: V, hihi: int: intstd/core/types/int: V, ff: (int) -> $1997 $1996 : intstd/core/types/int: V -> ee: E aa: V )result: -> 2057 list<2056> : ee: E liststd/core/types/list: V -> V<aa: V> if lolo: int <=std/core/int/(<=): (x : int, y : int) -> $1997 bool hihi: int then Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>( ff: (int) -> $1997 $1996(lolo: int), liststd/core/list/function/list: (lo : int, hi : int, f : (int) -> $1997 $1996) -> $1997 list<$1996>( pretend-decreasingstd/core/undiv/pretend-decreasing: (x : int) -> $1997 int(lolo: int.incstd/core/int/inc: (i : int) -> $1997 int), hihi: int, ff: (int) -> $1997 $1996 )) else Nilstd/core/types/Nil: forall<a> list<a> // Returns an integer list of increasing elements from `lo` to `hi` with stride `stride`. // If `lo > hi` the function returns the empty list. pub fun stridefunction/liststd/core/list/stridefunction/list: forall<a,e> (lo : int, hi : int, stride : int, f : (int) -> e a) -> e list<a>( lolo: int: intstd/core/types/int: V, hihi: int: intstd/core/types/int: V, stridestride: int : intstd/core/types/int: V, ff: (int) -> $2175 $2174 : intstd/core/types/int: V -> ee: E aa: V )result: -> 2237 list<2236> : ee: E liststd/core/types/list: V -> V<aa: V> if lolo: int <=std/core/int/(<=): (x : int, y : int) -> $2175 bool hihi: int then Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>( ff: (int) -> $2175 $2174(lolo: int), liststd/core/list/stridefunction/list: (lo : int, hi : int, stride : int, f : (int) -> $2175 $2174) -> $2175 list<$2174>( pretend-decreasingstd/core/undiv/pretend-decreasing: (x : int) -> $2175 int(lolo: int +std/core/int/(+): (x : int, y : int) -> $2175 int stridestride: int), hihi: int, stridestride: int, ff: (int) -> $2175 $2174 )) else Nilstd/core/types/Nil: forall<a> list<a> // Create a list of characters from `lo` to `hi` (including `hi`). pub fun char/liststd/core/list/char/list: (lo : char, hi : char) -> list<char>( lolo: char : charstd/core/types/char: V, hihi: char : charstd/core/types/char: V )result: -> total list<char> : totalstd/core/types/total: E liststd/core/types/list: V -> V<charstd/core/types/char: V> liststd/core/list/range/list: (lo : int, hi : int) -> list<int>(lolo: char.intstd/core/char/int: (char) -> int, hihi: char.intstd/core/char/int: (char) -> int).mapstd/core/list/map: (xs : list<int>, f : (int) -> char) -> list<char>( charstd/core/char/int/char: (i : int) -> char ) // Element-wise list equality pub fun (==)std/core/list/(==): forall<a,e> (xs : list<a>, ys : list<a>, @implicit/(==) : (a, a) -> e bool) -> e bool( xsxs: list<$786> : liststd/core/types/list: V -> V<aa: V>, ysys: list<$786> : liststd/core/types/list: V -> V<aa: V>, (@implicit/==)?(==): ($786, $786) -> $787 bool : (aa: V,aa: V) -> ee: E boolstd/core/types/bool: V )result: -> 867 bool : ee: E boolstd/core/types/bool: V match xsxs: list<$786> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $786,xxxx: list<$786>) -> match ysys: list<$786> Nilstd/core/types/Nil: forall<a> list<a> -> Falsestd/core/types/False: bool Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $786,yyyy: list<$786>) -> (xx: $786==?(==): ($786, $786) -> $787 boolyy: $786) &&std/core/types/(&&): (x : bool, y : bool) -> $787 bool (xxxx: list<$786>==std/core/list/(==): (xs : list<$786>, ys : list<$786>, @implicit/(==) : ($786, $786) -> $787 bool) -> $787 bool
?(==)=?(==)
yyyy: list<$786>) Nilstd/core/types/Nil: forall<a> list<a> -> match ysys: list<$786> Nilstd/core/types/Nil: forall<a> list<a> -> Truestd/core/types/True: bool Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a> -> Falsestd/core/types/False: bool
// Order on lists pub fun cmpstd/core/list/cmp: forall<a,e> (xs : list<a>, ys : list<a>, @implicit/cmp : (a, a) -> e order) -> e order( xsxs: list<$887> : liststd/core/types/list: V -> V<aa: V>, ysys: list<$887> : liststd/core/types/list: V -> V<aa: V>, @implicit/cmp?cmp: ($887, $887) -> $888 order : (aa: V,aa: V) -> ee: E orderstd/core/types/order: V )result: -> 963 order : ee: E orderstd/core/types/order: V match xsxs: list<$887> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $887,xxxx: list<$887>) -> match ysys: list<$887> Nilstd/core/types/Nil: forall<a> list<a> -> Gtstd/core/types/Gt: order Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $887,yyyy: list<$887>) -> match cmp?cmp: ($887, $887) -> $888 order(xx: $887,yy: $887) Eqstd/core/types/Eq: order -> cmpstd/core/list/cmp: (xs : list<$887>, ys : list<$887>, @implicit/cmp : ($887, $887) -> $888 order) -> $888 order
?cmp=?cmp
(xxxx: list<$887>,yyyy: list<$887>) lglg: order -> lglg: order Nilstd/core/types/Nil: forall<a> list<a> -> match ysys: list<$887> Nilstd/core/types/Nil: forall<a> list<a> -> Eqstd/core/types/Eq: order Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a> -> Ltstd/core/types/Lt: order
// Order2 on lists pub fun order2std/core/list/order2: forall<a,e> (xs : list<a>, ys : list<a>, @implicit/order2 : (a, a) -> e order2<a>) -> e order2<list<a>>(xsxs: list<$2401> : liststd/core/types/list: V -> V<aa: V>, ysys: list<$2401>: liststd/core/types/list: V -> V<aa: V>, ^@implicit/order2?order2: ($2401, $2401) -> $2402 order2<$2401>: (aa: V, aa: V) -> ee: E order2std/core/types/order2: V -> V<aa: V>)result: -> 2647 order2<list<2646>>: ee: E order2std/core/types/order2: V -> V<liststd/core/types/list: V -> V<aa: V>> match xsxs: list<$2401> Nilstd/core/types/Nil: forall<a> list<a> -> match ysys: list<$2401> Nilstd/core/types/Nil: forall<a> list<a> -> Eq2std/core/types/Eq2: forall<a> (eq : a) -> order2<a>(Nilstd/core/types/Nil: forall<a> list<a>) ys'ys': list<$2401> -> Lt2std/core/types/Lt2: forall<a> (lt : a, gt : a) -> order2<a>(Nilstd/core/types/Nil: forall<a> list<a>, ys'ys': list<$2401>) Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $2401,xxxx: list<$2401>) -> match ysys: list<$2401> Nilstd/core/types/Nil: forall<a> list<a> -> Gt2std/core/types/Gt2: forall<a> (lt : a, gt : a) -> order2<a>(Nilstd/core/types/Nil: forall<a> list<a>, Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $2401,xxxx: list<$2401>)) Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $2401,yyyy: list<$2401>) -> match order2?order2: ($2401, $2401) -> $2402 order2<$2401>(xx: $2401,yy: $2401) Eq2std/core/types/Eq2: forall<a> (eq : a) -> order2<a>(zz: $2401) -> match order2std/core/list/order2: (xs : list<$2401>, ys : list<$2401>, @implicit/order2 : ($2401, $2401) -> $2402 order2<$2401>) -> $2402 order2<list<$2401>>
?order2=?order2
(xxxx: list<$2401>,yyyy: list<$2401>) Eq2std/core/types/Eq2: forall<a> (eq : a) -> order2<a>(zzzz: list<$2401>) -> Eq2std/core/types/Eq2: forall<a> (eq : a) -> order2<a>(Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(zz: $2401,zzzz: list<$2401>)) Lt2std/core/types/Lt2: forall<a> (lt : a, gt : a) -> order2<a>(xx'xx': list<$2401>, yy'yy': list<$2401>) -> Lt2std/core/types/Lt2: forall<a> (lt : a, gt : a) -> order2<a>(Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(zz: $2401,xx'xx': list<$2401>), Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(zz: $2401,yy'yy': list<$2401>)) Gt2std/core/types/Gt2: forall<a> (lt : a, gt : a) -> order2<a>(yy'yy': list<$2401>, xx'xx': list<$2401>) -> Gt2std/core/types/Gt2: forall<a> (lt : a, gt : a) -> order2<a>(Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(zz: $2401,yy'yy': list<$2401>), Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(zz: $2401,xx'xx': list<$2401>)) Lt2std/core/types/Lt2: forall<a> (lt : a, gt : a) -> order2<a>(x'x': $2401,y'y': $2401) -> Lt2std/core/types/Lt2: forall<a> (lt : a, gt : a) -> order2<a>(Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(x'x': $2401,xxxx: list<$2401>), Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(y'y': $2401,yyyy: list<$2401>)) Gt2std/core/types/Gt2: forall<a> (lt : a, gt : a) -> order2<a>(y'y': $2401,x'x': $2401) -> Gt2std/core/types/Gt2: forall<a> (lt : a, gt : a) -> order2<a>(Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(y'y': $2401,yyyy: list<$2401>), Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(x'x': $2401,xxxx: list<$2401>)
) // Show a list pub fun showstd/core/list/show: forall<a,e> (xs : list<a>, @implicit/show : (a) -> e string) -> e string( xsxs: list<$4134> : liststd/core/types/list: V -> V<aa: V>, @implicit/show?show: ($4134) -> $4135 string : aa: V -> ee: E stringstd/core/types/string: V )result: -> 4210 string : ee: E stringstd/core/types/string: V "["literal: string
count= 1
++std/core/types/(++): (x : string, y : string) -> $4135 string xsxs: list<$4134>.mapstd/core/list/map: (xs : list<$4134>, f : ($4134) -> $4135 string) -> $4135 list<string>(show?show: ($4134) -> $4135 string).joinstd/core/list/joinsep/join: (xs : list<string>, sep : string) -> $4135 string(","literal: string
count= 1
) ++std/core/types/(++): (x : string, y : string) -> $4135 string "]"literal: string
count= 1
// _deprecated_, use `list/show` instead. pub fun show-liststd/core/list/show-list: forall<a,e> (xs : list<a>, show-elem : (a) -> e string) -> e string( xsxs: list<$4227> : liststd/core/types/list: V -> V<aa: V>, show-elemshow-elem: ($4227) -> $4228 string : (aa: V) -> ee: E stringstd/core/types/string: V )result: -> 4250 string : ee: E stringstd/core/types/string: V showstd/core/list/show: (xs : list<$4227>, @implicit/show : ($4227) -> $4228 string) -> $4228 string(xsxs: list<$4227>,@implicit/show=show-elemshow-elem: ($4227) -> $4228 string) // Zip two lists together by pairing the corresponding elements. // The returned list is only as long as the smallest input list. pub fbip fun zipstd/core/list/zip: forall<a,b> (xs : list<a>, ys : list<b>) -> list<(a, b)>( xsxs: list<$4257> : liststd/core/types/list: V -> V<aa: V>, ysys: list<$4258> : liststd/core/types/list: V -> V<bb: V> )result: -> total list<(4326, 4327)> : liststd/core/types/list: V -> V<(std/core/types/tuple2: (V, V) -> Vaa: V,bb: V)> match xsxs: list<$4257> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $4257,xxxx: list<$4257>) -> match ysys: list<$4258> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $4258,yyyy: list<$4258>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>((std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)xx: $4257,yy: $4258)std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b),zipstd/core/list/zip: (xs : list<$4257>, ys : list<$4258>) -> list<($4257, $4258)>(xxxx: list<$4257>,yyyy: list<$4258>)) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> // Zip two lists together by apply a function `f` to all corresponding elements. // The returned list is only as long as the smallest input list. pub fbip fun zipwithstd/core/list/zipwith: forall<a,b,c,e> (xs : list<a>, ys : list<b>, f : (a, b) -> e c) -> e list<c>( xsxs: list<$4335> : liststd/core/types/list: V -> V<aa: V>, ysys: list<$4336> :liststd/core/types/list: V -> V<bb: V>, ^ff: ($4335, $4336) -> $4338 $4337 : (aa: V,bb: V) -> ee: E cc: V )result: -> 4410 list<4409> : ee: E liststd/core/types/list: V -> V<cc: V> match xsxs: list<$4335> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $4335,xxxx: list<$4335>) -> match ysys: list<$4336> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $4336,yyyy: list<$4336>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(ff: ($4335, $4336) -> $4338 $4337(xx: $4335,yy: $4336),zipwithstd/core/list/zipwith: (xs : list<$4335>, ys : list<$4336>, f : ($4335, $4336) -> $4338 $4337) -> $4338 list<$4337>(xxxx: list<$4335>,yyyy: list<$4336>,ff: ($4335, $4336) -> $4338 $4337)) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> _ -> Nilstd/core/types/Nil: forall<a> list<a> // Zip two lists together by apply a function `f` to all corresponding elements // and their index in the list. // The returned list is only as long as the smallest input list. pub fbip fun zipwith-indexedstd/core/list/zipwith-indexed: forall<a,b,c,e> (xs0 : list<a>, ys0 : list<b>, f : (int, a, b) -> e c) -> e list<c>( xs0xs0: list<$4497> : liststd/core/types/list: V -> V<aa: V>, ys0ys0: list<$4498> :liststd/core/types/list: V -> V<bb: V>, ^ff: (int, $4497, $4498) -> $4500 $4499 : (intstd/core/types/int: V,aa: V,bb: V) -> ee: E cc: V )result: -> 4539 list<4538> : ee: E liststd/core/types/list: V -> V<cc: V> zipwith-iterstd/core/list/zipwith-iter: (i : int, xs : list<$4497>, ys : list<$4498>, f : (int, $4497, $4498) -> $4500 $4499) -> $4500 list<$4499>(0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
,xs0xs0: list<$4497>,ys0ys0: list<$4498>,ff: (int, $4497, $4498) -> $4500 $4499
) fbip fun zipwith-iterstd/core/list/zipwith-iter: forall<a,b,c,e> (i : int, xs : list<a>, ys : list<b>, f : (int, a, b) -> e c) -> e list<c>( ii: int, xsxs: list<_4431>, ysys: list<_4436>, ^ff: (int, _4431, _4436) -> _4427 _4442 )result: -> _4427 list<_4442> match xsxs: list<_4431> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: _4431,xxxx: list<_4431>) -> match ysys: list<_4436> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: _4436,yyyy: list<_4436>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(ff: (int, _4431, _4436) -> _4427 _4442(ii: int,xx: _4431,yy: _4436),zipwith-iterstd/core/list/zipwith-iter: (i : int, xs : list<_4431>, ys : list<_4436>, f : (int, _4431, _4436) -> _4427 _4442) -> _4427 list<_4442>(ii: int+std/core/int/(+): (x : int, y : int) -> _4427 int1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001
,xxxx: list<_4431>,yyyy: list<_4436>,ff: (int, _4431, _4436) -> _4427 _4442)) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a>
// Unzip a list of pairs into two lists pub fun unzipstd/core/list/unzip: forall<a,b> (xs : list<(a, b)>) -> (list<a>, list<b>)( xsxs: list<($4552, $4553)> : liststd/core/types/list: V -> V<(std/core/types/tuple2: (V, V) -> Vaa: V,bb: V)> )result: -> total (list<4755>, list<4756>) : (std/core/types/tuple2: (V, V) -> Vliststd/core/types/list: V -> V<aa: V>,liststd/core/types/list: V -> V<bb: V>) fun iteriter: forall<a,b,c,d> (ys : list<(a, b)>, acc1 : cctx<c,list<a>>, acc2 : cctx<d,list<b>>) -> (c, d)( ysys: list<(_4565, _4566)>, acc1acc1: cctx<_4610,list<_4565>>, acc2acc2: cctx<_4653,list<_4566>> )result: -> total (_4610, _4653) match ysys: list<(_4565, _4566)> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>((std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)xx: _4565,yy: _4566)std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b),xxxx: list<(_4565, _4566)>) -> iteriter: (ys : list<(_4565, _4566)>, acc1 : cctx<_4610,list<_4565>>, acc2 : cctx<_4653,list<_4566>>) -> (_4610, _4653)(xxxx: list<(_4565, _4566)>,acc1acc1: cctx<_4610,list<_4565>> ++std/core/types/cctx/(++): (c1 : cctx<_4610,list<_4565>>, c2 : cctx<list<_4565>,list<_4565>>) -> cctx<_4610,list<_4565>> ctxctx: cctx<list<_4565>,list<_4565>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: _4565,holehole: list<_4565>),acc2acc2: cctx<_4653,list<_4566>> ++std/core/types/cctx/(++): (c1 : cctx<_4653,list<_4566>>, c2 : cctx<list<_4566>,list<_4566>>) -> cctx<_4653,list<_4566>> ctxctx: cctx<list<_4566>,list<_4566>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: _4566,holehole: list<_4566>)) Nilstd/core/types/Nil: forall<a> list<a> -> (std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)acc1acc1: cctx<_4610,list<_4565>> ++.std/core/types/cctx/(++.): (c : cctx<_4610,list<_4565>>, x : list<_4565>) -> _4610 Nilstd/core/types/Nil: forall<a> list<a>,acc2acc2: cctx<_4653,list<_4566>> ++.std/core/types/cctx/(++.): (c : cctx<_4653,list<_4566>>, x : list<_4566>) -> _4653 Nilstd/core/types/Nil: forall<a> list<a>)std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b) iteriter: (ys : list<($4552, $4553)>, acc1 : cctx<list<$4552>,list<$4552>>, acc2 : cctx<list<$4553>,list<$4553>>) -> (list<$4552>, list<$4553>)(xsxs: list<($4552, $4553)>,ctxctx: ctx<list<$4552>> holehole: list<$4552>,ctxctx: ctx<list<$4553>> holehole: list<$4553>) // Unzip a list of triples into three lists pub fun unzip3std/core/list/unzip3: forall<a,b,c> (xs : list<(a, b, c)>) -> (list<a>, list<b>, list<c>)( xsxs: list<($4764, $4765, $4766)> : liststd/core/types/list: V -> V<(std/core/types/tuple3: (V, V, V) -> Vaa: V,bb: V,cc: V)>)result: -> total (list<5054>, list<5055>, list<5056>) : (std/core/types/tuple3: (V, V, V) -> Vliststd/core/types/list: V -> V<aa: V>,liststd/core/types/list: V -> V<bb: V>,liststd/core/types/list: V -> V<cc: V>) fun iteriter: forall<a,b,c,d,a1,b1> (ys : list<(a, b, c)>, acc1 : cctx<d,list<a>>, acc2 : cctx<a1,list<b>>, acc3 : cctx<b1,list<c>>) -> (d, a1, b1)( ysys: list<(_4780, _4781, _4782)>, acc1acc1: cctx<_4826,list<_4780>>, acc2acc2: cctx<_4869,list<_4781>>, acc3acc3: cctx<_4912,list<_4782>> )result: -> total (_4826, _4869, _4912) match ysys: list<(_4780, _4781, _4782)> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>((std/core/types/Tuple3: forall<a,b,c> (fst : a, snd : b, thd : c) -> (a, b, c)xx: _4780,yy: _4781,zz: _4782)std/core/types/Tuple3: forall<a,b,c> (fst : a, snd : b, thd : c) -> (a, b, c),xxxx: list<(_4780, _4781, _4782)>) -> iteriter: (ys : list<(_4780, _4781, _4782)>, acc1 : cctx<_4826,list<_4780>>, acc2 : cctx<_4869,list<_4781>>, acc3 : cctx<_4912,list<_4782>>) -> (_4826, _4869, _4912)(xxxx: list<(_4780, _4781, _4782)>,acc1acc1: cctx<_4826,list<_4780>> ++std/core/types/cctx/(++): (c1 : cctx<_4826,list<_4780>>, c2 : cctx<list<_4780>,list<_4780>>) -> cctx<_4826,list<_4780>> ctxctx: cctx<list<_4780>,list<_4780>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: _4780,holehole: list<_4780>),acc2acc2: cctx<_4869,list<_4781>> ++std/core/types/cctx/(++): (c1 : cctx<_4869,list<_4781>>, c2 : cctx<list<_4781>,list<_4781>>) -> cctx<_4869,list<_4781>> ctxctx: cctx<list<_4781>,list<_4781>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: _4781,holehole: list<_4781>),acc3acc3: cctx<_4912,list<_4782>> ++std/core/types/cctx/(++): (c1 : cctx<_4912,list<_4782>>, c2 : cctx<list<_4782>,list<_4782>>) -> cctx<_4912,list<_4782>> ctxctx: cctx<list<_4782>,list<_4782>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(zz: _4782,holehole: list<_4782>)) Nilstd/core/types/Nil: forall<a> list<a> -> (std/core/types/Tuple3: forall<a,b,c> (fst : a, snd : b, thd : c) -> (a, b, c)acc1acc1: cctx<_4826,list<_4780>> ++.std/core/types/cctx/(++.): (c : cctx<_4826,list<_4780>>, x : list<_4780>) -> _4826 Nilstd/core/types/Nil: forall<a> list<a>,acc2acc2: cctx<_4869,list<_4781>> ++.std/core/types/cctx/(++.): (c : cctx<_4869,list<_4781>>, x : list<_4781>) -> _4869 Nilstd/core/types/Nil: forall<a> list<a>,acc3acc3: cctx<_4912,list<_4782>> ++.std/core/types/cctx/(++.): (c : cctx<_4912,list<_4782>>, x : list<_4782>) -> _4912 Nilstd/core/types/Nil: forall<a> list<a>)std/core/types/Tuple3: forall<a,b,c> (fst : a, snd : b, thd : c) -> (a, b, c) iteriter: (ys : list<($4764, $4765, $4766)>, acc1 : cctx<list<$4764>,list<$4764>>, acc2 : cctx<list<$4765>,list<$4765>>, acc3 : cctx<list<$4766>,list<$4766>>) -> (list<$4764>, list<$4765>, list<$4766>)(xsxs: list<($4764, $4765, $4766)>,ctxctx: ctx<list<$4764>> holehole: list<$4764>,ctxctx: ctx<list<$4765>> holehole: list<$4765>,ctxctx: ctx<list<$4766>> holehole: list<$4766>) // Unzip a list of quadruples into four lists pub fun unzip4std/core/list/unzip4: forall<a,b,c,d> (xs : list<(a, b, c, d)>) -> (list<a>, list<b>, list<c>, list<d>)( xsxs: list<($5067, $5068, $5069, $5070)> : liststd/core/types/list: V -> V<(std/core/types/tuple4: (V, V, V, V) -> Vaa: V,bb: V,cc: V,dd: V)>)result: -> total (list<5444>, list<5445>, list<5446>, list<5447>) : (std/core/types/tuple4: (V, V, V, V) -> Vliststd/core/types/list: V -> V<aa: V>,liststd/core/types/list: V -> V<bb: V>,liststd/core/types/list: V -> V<cc: V>,liststd/core/types/list: V -> V<dd: V>) fun iteriter: forall<a,b,c,d,a1,b1,c1,d1> (ys : list<(a, b, c, d)>, acc1 : cctx<a1,list<a>>, acc2 : cctx<b1,list<b>>, acc3 : cctx<c1,list<c>>, acc4 : cctx<d1,list<d>>) -> (a1, b1, c1, d1)( ysys: list<(_5086, _5087, _5088, _5089)>, acc1acc1: cctx<_5133,list<_5086>>, acc2acc2: cctx<_5176,list<_5087>>, acc3acc3: cctx<_5219,list<_5088>>, acc4acc4: cctx<_5262,list<_5089>> )result: -> total (_5133, _5176, _5219, _5262) match ysys: list<(_5086, _5087, _5088, _5089)> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>((std/core/types/Tuple4: forall<a,b,c,d> (fst : a, snd : b, thd : c, field4 : d) -> (a, b, c, d)xx: _5086,yy: _5087,zz: _5088,ww: _5089)std/core/types/Tuple4: forall<a,b,c,d> (fst : a, snd : b, thd : c, field4 : d) -> (a, b, c, d),xxxx: list<(_5086, _5087, _5088, _5089)>) -> iteriter: (ys : list<(_5086, _5087, _5088, _5089)>, acc1 : cctx<_5133,list<_5086>>, acc2 : cctx<_5176,list<_5087>>, acc3 : cctx<_5219,list<_5088>>, acc4 : cctx<_5262,list<_5089>>) -> (_5133, _5176, _5219, _5262)(xxxx: list<(_5086, _5087, _5088, _5089)>,acc1acc1: cctx<_5133,list<_5086>> ++std/core/types/cctx/(++): (c1 : cctx<_5133,list<_5086>>, c2 : cctx<list<_5086>,list<_5086>>) -> cctx<_5133,list<_5086>> ctxctx: cctx<list<_5086>,list<_5086>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: _5086,holehole: list<_5086>),acc2acc2: cctx<_5176,list<_5087>> ++std/core/types/cctx/(++): (c1 : cctx<_5176,list<_5087>>, c2 : cctx<list<_5087>,list<_5087>>) -> cctx<_5176,list<_5087>> ctxctx: cctx<list<_5087>,list<_5087>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: _5087,holehole: list<_5087>),acc3acc3: cctx<_5219,list<_5088>> ++std/core/types/cctx/(++): (c1 : cctx<_5219,list<_5088>>, c2 : cctx<list<_5088>,list<_5088>>) -> cctx<_5219,list<_5088>> ctxctx: cctx<list<_5088>,list<_5088>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(zz: _5088,holehole: list<_5088>),acc4acc4: cctx<_5262,list<_5089>> ++std/core/types/cctx/(++): (c1 : cctx<_5262,list<_5089>>, c2 : cctx<list<_5089>,list<_5089>>) -> cctx<_5262,list<_5089>> ctxctx: cctx<list<_5089>,list<_5089>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(ww: _5089,holehole: list<_5089>)) Nilstd/core/types/Nil: forall<a> list<a> -> (std/core/types/Tuple4: forall<a,b,c,d> (fst : a, snd : b, thd : c, field4 : d) -> (a, b, c, d)acc1acc1: cctx<_5133,list<_5086>> ++.std/core/types/cctx/(++.): (c : cctx<_5133,list<_5086>>, x : list<_5086>) -> _5133 Nilstd/core/types/Nil: forall<a> list<a>,acc2acc2: cctx<_5176,list<_5087>> ++.std/core/types/cctx/(++.): (c : cctx<_5176,list<_5087>>, x : list<_5087>) -> _5176 Nilstd/core/types/Nil: forall<a> list<a>,acc3acc3: cctx<_5219,list<_5088>> ++.std/core/types/cctx/(++.): (c : cctx<_5219,list<_5088>>, x : list<_5088>) -> _5219 Nilstd/core/types/Nil: forall<a> list<a>,acc4acc4: cctx<_5262,list<_5089>> ++.std/core/types/cctx/(++.): (c : cctx<_5262,list<_5089>>, x : list<_5089>) -> _5262 Nilstd/core/types/Nil: forall<a> list<a>)std/core/types/Tuple4: forall<a,b,c,d> (fst : a, snd : b, thd : c, field4 : d) -> (a, b, c, d) iteriter: (ys : list<($5067, $5068, $5069, $5070)>, acc1 : cctx<list<$5067>,list<$5067>>, acc2 : cctx<list<$5068>,list<$5068>>, acc3 : cctx<list<$5069>,list<$5069>>, acc4 : cctx<list<$5070>,list<$5070>>) -> (list<$5067>, list<$5068>, list<$5069>, list<$5070>)(xsxs: list<($5067, $5068, $5069, $5070)>,ctxctx: ctx<list<$5067>> holehole: list<$5067>,ctxctx: ctx<list<$5068>> holehole: list<$5068>,ctxctx: ctx<list<$5069>> holehole: list<$5069>,ctxctx: ctx<list<$5070>> holehole: list<$5070>) // Take the first `n` elements of a list (or fewer if the list is shorter than `n`) pub fun takestd/core/list/take: forall<a> (xs : list<a>, n : int) -> list<a>( xsxs: list<$979> : liststd/core/types/list: V -> V<aa: V>, nn: int : intstd/core/types/int: V )result: -> total list<1024> : liststd/core/types/list: V -> V<aa: V> match xsxs: list<$979> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $979,xxxx: list<$979>) | nn: int >std/core/int/(>): (x : int, y : int) -> bool 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
-> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $979, takestd/core/list/take: (xs : list<$979>, n : int) -> list<$979>(xxxx: list<$979>, nn: int -std/core/int/(-): (x : int, y : int) -> int 1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001
)) _ -> Nilstd/core/types/Nil: forall<a> list<a>
// Drop the first `n` elements of a list (or fewer if the list is shorter than `n`) pub fun dropstd/core/list/drop: forall<a> (xs : list<a>, n : int) -> list<a>( xsxs: list<$1029> : liststd/core/types/list: V -> V<aa: V>, nn: int : intstd/core/types/int: V )result: -> total list<1064> : liststd/core/types/list: V -> V<aa: V> match xsxs: list<$1029> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(_,xxxx: list<$1029>) | nn: int >std/core/int/(>): (x : int, y : int) -> bool 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
-> dropstd/core/list/drop: (xs : list<$1029>, n : int) -> list<$1029>(xxxx: list<$1029>, nn: int -std/core/int/(-): (x : int, y : int) -> int 1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001
) _ -> xsxs: list<$1029>
// Apply a function `f` to each element of the input list in sequence. pub fip fun mapstd/core/list/map: forall<a,b,e> (xs : list<a>, f : (a) -> e b) -> e list<b>(xsxs: list<$2296> : liststd/core/types/list: V -> V<aa: V>, ^ff: ($2296) -> $2298 $2297 : aa: V -> ee: E bb: V)result: -> 2357 list<2356> : ee: E liststd/core/types/list: V -> V<bb: V> match xsxs: list<$2296> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $2296,xxxx: list<$2296>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(ff: ($2296) -> $2298 $2297(xx: $2296), xxxx: list<$2296>.mapstd/core/list/map: (xs : list<$2296>, f : ($2296) -> $2298 $2297) -> $2298 list<$2297>(ff: ($2296) -> $2298 $2297)) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> // Apply a function `f` to each element of the input list in sequence where takes // both the index of the current element and the element itself as arguments. pub fun map-indexedstd/core/list/map-indexed: forall<a,b,e> (xs : list<a>, f : (idx : int, value : a) -> e b) -> e list<b>(xsxs: list<$2663> : liststd/core/types/list: V -> V<aa: V>, ff: (idx : int, value : $2663) -> $2665 $2664 : (idx : intstd/core/types/int: V, value : aa: V) -> ee: E bb: V)result: -> 2723 list<2722> : ee: E liststd/core/types/list: V -> V<bb: V> fun map-idxmap-idx: (ys : list<$2663>, i : int) -> $2665 list<$2664>(ysys: list<$2663>,ii: int)result: -> $2665 list<$2664> match ysys: list<$2663> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $2663,yyyy: list<$2663>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(ff: (idx : int, value : $2663) -> $2665 $2664(ii: int,yy: $2663), map-idxmap-idx: (ys : list<$2663>, i : int) -> $2665 list<$2664>(yyyy: list<$2663>,ii: int+std/core/int/(+): (x : int, y : int) -> $2665 int1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001
)) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a>
map-idxmap-idx: (ys : list<$2663>, i : int) -> $2665 list<$2664>(xsxs: list<$2663>,0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
) // Apply a function `f` to each element of the input list in sequence where `f` takes // both the current element and the tail list as arguments. pub fun map-peekstd/core/list/map-peek: forall<a,b,e> (xs : list<a>, f : (value : a, rest : list<a>) -> e b) -> e list<b>(xsxs: list<$2733> : liststd/core/types/list: V -> V<aa: V>, ff: (value : $2733, rest : list<$2733>) -> $2735 $2734 : (value : aa: V, rest : liststd/core/types/list: V -> V<aa: V>) -> ee: E bb: V)result: -> 2785 list<2784> : ee: E liststd/core/types/list: V -> V<bb: V> fun mappeekmappeek: (ys : list<$2733>) -> $2735 list<$2734>(ysys: list<$2733>)result: -> $2735 list<$2734> match ysys: list<$2733> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $2733,yyyy: list<$2733>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(ff: (value : $2733, rest : list<$2733>) -> $2735 $2734(yy: $2733,yyyy: list<$2733>), yyyy: list<$2733>.mappeekmappeek: (ys : list<$2733>) -> $2735 list<$2734>) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> mappeekmappeek: (ys : list<$2733>) -> $2735 list<$2734>(xsxs: list<$2733>) // Apply a function `f` to each element of the input list in sequence where takes // both the index of the current element, the element itself, and the tail list as arguments. pub fun map-indexed-peekstd/core/list/map-indexed-peek: forall<a,b,e> (xs : list<a>, f : (idx : int, value : a, rest : list<a>) -> e b) -> e list<b>(xsxs: list<$2795> : liststd/core/types/list: V -> V<aa: V>, ff: (idx : int, value : $2795, rest : list<$2795>) -> $2797 $2796 : (idx : intstd/core/types/int: V, value : aa: V, rest : liststd/core/types/list: V -> V<aa: V> ) -> ee: E bb: V)result: -> 2856 list<2855> : ee: E liststd/core/types/list: V -> V<bb: V> fun mapidxmapidx: (ys : list<$2795>, i : int) -> $2797 list<$2796>(ysys: list<$2795>,ii: int)result: -> $2797 list<$2796> match ysys: list<$2795> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $2795,yyyy: list<$2795>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(ff: (idx : int, value : $2795, rest : list<$2795>) -> $2797 $2796(ii: int,yy: $2795,yyyy: list<$2795>), mapidxmapidx: (ys : list<$2795>, i : int) -> $2797 list<$2796>(yyyy: list<$2795>,ii: int+std/core/int/(+): (x : int, y : int) -> $2797 int1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001
)) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a>
mapidxmapidx: (ys : list<$2795>, i : int) -> $2797 list<$2796>(xsxs: list<$2795>,0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
) // Reverse a list. pub fip fun reversestd/core/list/reverse: forall<a> (xs : list<a>) -> list<a>(xsxs: list<$1127> : liststd/core/types/list: V -> V<aa: V>)result: -> total list<1145> : liststd/core/types/list: V -> V<aa: V> reverse-appendstd/core/list/reverse-append: (xs : list<$1127>, tl : list<$1127>) -> list<$1127>( xsxs: list<$1127>, Nilstd/core/types/Nil: forall<a> list<a> ) // Efficiently reverse a list `xs` and append it to `tl`: // `reverse-append(xs,tl) == reverse(xs) ++ tl pub fip fun reverse-appendstd/core/list/reverse-append: forall<a> (xs : list<a>, tl : list<a>) -> list<a>( xsxs: list<$1106> : liststd/core/types/list: V -> V<aa: V>, tltl: list<$1106> : liststd/core/types/list: V -> V<aa: V> )result: -> total list<1122> : liststd/core/types/list: V -> V<aa: V> reverse-accstd/core/list/reverse-acc: (acc : list<$1106>, ys : list<$1106>) -> list<$1106>(tltl: list<$1106>,xsxs: list<$1106>) fip fun reverse-accstd/core/list/reverse-acc: forall<a> (acc : list<a>, ys : list<a>) -> list<a>(accacc: list<$1069> : liststd/core/types/list: V -> V<aa: V>, ysys: list<$1069> : liststd/core/types/list: V -> V<aa: V> )result: -> total list<1101> : liststd/core/types/list: V -> V<aa: V> match ysys: list<$1069> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1069,xxxx: list<$1069>) -> reverse-accstd/core/list/reverse-acc: (acc : list<$1069>, ys : list<$1069>) -> list<$1069>(Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1069,accacc: list<$1069>),xxxx: list<$1069>) _ -> accacc: list<$1069> // Append two lists. pub fip fun (++)std/core/list/(++): forall<a> (xs : list<a>, ys : list<a>) -> list<a>(xsxs: list<$1190> : liststd/core/types/list: V -> V<aa: V>, ysys: list<$1190> : liststd/core/types/list: V -> V<aa: V> )result: -> total list<1206> : liststd/core/types/list: V -> V<aa: V> appendstd/core/list/append: (xs : list<$1190>, ys : list<$1190>) -> list<$1190>(xsxs: list<$1190>,ysys: list<$1190>) // Append two lists. pub fip fun appendstd/core/list/append: forall<a> (xs : list<a>, ys : list<a>) -> list<a>(xsxs: list<$1150> : liststd/core/types/list: V -> V<aa: V>, ysys: list<$1150> : liststd/core/types/list: V -> V<aa: V> )result: -> total list<1185> : liststd/core/types/list: V -> V<aa: V> match xsxs: list<$1150> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1150,xxxx: list<$1150>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1150,appendstd/core/list/append: (xs : list<$1150>, ys : list<$1150>) -> list<$1150>(xxxx: list<$1150>,ysys: list<$1150>)) Nilstd/core/types/Nil: forall<a> list<a> -> ysys: list<$1150> // Fold a list from the right, i.e. `foldr([1,2],0,(+)) == 1+(2+0)` // Note, `foldr` is less efficient than `foldl` as it reverses the list first. pub fun foldrstd/core/list/foldr: forall<a,b,e> (xs : list<a>, z : b, f : (a, b) -> e b) -> e b(xsxs: list<$1267> : liststd/core/types/list: V -> V<aa: V>, zz: $1268 : bb: V, ff: ($1267, $1268) -> $1269 $1268 : (aa: V, bb: V) -> ee: E bb: V)result: -> 1310 1309 : ee: E bb: V xsxs: list<$1267>.reversestd/core/list/reverse: (xs : list<$1267>) -> $1269 list<$1267>.foldlstd/core/list/foldl: (xs : list<$1267>, z : $1268, f : ($1268, $1267) -> $1269 $1268) -> $1269 $1268(zz: $1268) fnfn: (x : $1268, y : $1267) -> $1269 $1268(xx: $1268,yy: $1267) ff: ($1267, $1268) -> $1269 $1268(yy: $1267,xx: $1268) // Fold a list from the left, i.e. `foldl([1,2],0,(+)) == (0+1)+2` // Since `foldl` is tail recursive, it is preferred over `foldr` when using an associative function `f` pub fun foldlstd/core/list/foldl: forall<a,b,e> (xs : list<a>, z : b, f : (b, a) -> e b) -> e b(xsxs: list<$1211> : liststd/core/types/list: V -> V<aa: V>, zz: $1212 : bb: V, ff: ($1212, $1211) -> $1213 $1212 : (bb: V, aa: V) -> ee: E bb: V)result: -> 1257 1256 : ee: E bb: V match xsxs: list<$1211> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1211,xxxx: list<$1211>) -> foldlstd/core/list/foldl: (xs : list<$1211>, z : $1212, f : ($1212, $1211) -> $1213 $1212) -> $1213 $1212(xxxx: list<$1211>,ff: ($1212, $1211) -> $1213 $1212(zz: $1212,xx: $1211),ff: ($1212, $1211) -> $1213 $1212) Nilstd/core/types/Nil: forall<a> list<a> -> zz: $1212 pub fun foldl1std/core/list/foldl1: forall<a,e> (xs : list<a>, f : (a, a) -> <exn|e> a) -> <exn|e> a(xsxs: list<$1320> : liststd/core/types/list: V -> V<aa: V>, ff: ($1320, $1320) -> <exn|$1321> $1320 : (aa: V,aa: V) -> <exnstd/core/exn/exn: (E, V) -> V|std/core/types/effect-extend: (X, E) -> Eee: E> aa: V)result: -> <exn|1367> 1366 : <exnstd/core/exn/exn: (E, V) -> V|std/core/types/effect-extend: (X, E) -> Eee: E> aa: V match xsxs: list<$1320> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1320,xxxx: list<$1320>) -> xxxx: list<$1320>.foldlstd/core/list/foldl: (xs : list<$1320>, z : $1320, f : ($1320, $1320) -> <exn|$1321> $1320) -> <exn|$1321> $1320(xx: $1320,ff: ($1320, $1320) -> <exn|$1321> $1320) Nilstd/core/types/Nil: forall<a> list<a> -> throwstd/core/exn/throw: (message : string, info : ? exception-info) -> <exn|$1321> $1320("unexpected Nil in std/core/foldl1"literal: string
count= 33
) pub fun foldr1std/core/list/foldr1: forall<a,e> (xs : list<a>, f : (a, a) -> <exn|e> a) -> <exn|e> a(xsxs: list<$1374> : liststd/core/types/list: V -> V<aa: V>, ff: ($1374, $1374) -> <exn|$1375> $1374 : (aa: V,aa: V) -> <exnstd/core/exn/exn: (E, V) -> V|std/core/types/effect-extend: (X, E) -> Eee: E> aa: V)result: -> <exn|1403> 1402 : <exnstd/core/exn/exn: (E, V) -> V|std/core/types/effect-extend: (X, E) -> Eee: E> aa: V xsxs: list<$1374>.reversestd/core/list/reverse: (xs : list<$1374>) -> <exn|$1375> list<$1374>.foldl1std/core/list/foldl1: (xs : list<$1374>, f : ($1374, $1374) -> <exn|$1375> $1374) -> <exn|$1375> $1374(ff: ($1374, $1374) -> <exn|$1375> $1374) // Create a list of `n` repeated elements `x` pub fun replicatestd/core/list/replicate: forall<a> (x : a, n : int) -> list<a>( xx: $2866 : aa: V, nn: int : intstd/core/types/int: V )result: -> total list<2914> : liststd/core/types/list: V -> V<aa: V> if nn: int >std/core/int/(>): (x : int, y : int) -> bool 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
then Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $2866, replicatestd/core/list/replicate: (x : $2866, n : int) -> list<$2866>(xx: $2866,pretend-decreasingstd/core/undiv/pretend-decreasing: (x : int) -> int(nn: int.decstd/core/int/dec: (i : int) -> int))) else Nilstd/core/types/Nil: forall<a> list<a>
// split a list at position `n` pub fun splitstd/core/list/split: forall<a> (xs : list<a>, n : int) -> (list<a>, list<a>)( xsxs: list<$1410> : liststd/core/types/list: V -> V<aa: V>, nn: int : intstd/core/types/int: V )result: -> total (list<1445>, list<1445>) : (std/core/types/tuple2: (V, V) -> Vliststd/core/types/list: V -> V<aa: V>, liststd/core/types/list: V -> V<aa: V>) (std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)xsxs: list<$1410>.takestd/core/list/take: (xs : list<$1410>, n : int) -> list<$1410>(nn: int), xsxs: list<$1410>.dropstd/core/list/drop: (xs : list<$1410>, n : int) -> list<$1410>(nn: int))std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b) pub fun spanstd/core/list/span: forall<a,e> (xs : list<a>, predicate : (a) -> e bool) -> e (list<a>, list<a>)( xsxs: list<$5461> : liststd/core/types/list: V -> V<aa: V>, predicatepredicate: ($5461) -> $5462 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 5604 (list<5603>, list<5603>) : ee: E (std/core/types/tuple2: (V, V) -> Vliststd/core/types/list: V -> V<aa: V>,liststd/core/types/list: V -> V<aa: V>) fun span-accspan-acc: forall<a> (ys : list<$5461>, acc : cctx<a,list<$5461>>) -> $5462 (a, list<$5461>)( ysys: list<$5461>, accacc: cctx<_5517,list<$5461>> )result: -> $5462 (_5517, list<$5461>) match ysys: list<$5461> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $5461,yyyy: list<$5461>) -> if yy: $5461.predicatepredicate: ($5461) -> $5462 bool then yyyy: list<$5461>.span-accspan-acc: (ys : list<$5461>, acc : cctx<_5517,list<$5461>>) -> $5462 (_5517, list<$5461>)(accacc: cctx<_5517,list<$5461>> ++std/core/types/cctx/(++): (c1 : cctx<_5517,list<$5461>>, c2 : cctx<list<$5461>,list<$5461>>) -> $5462 cctx<_5517,list<$5461>> ctxctx: cctx<list<$5461>,list<$5461>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $5461, holehole: list<$5461>)) else (std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)accacc: cctx<_5517,list<$5461>> ++.std/core/types/cctx/(++.): (c : cctx<_5517,list<$5461>>, x : list<$5461>) -> $5462 _5517 [std/core/types/Nil: forall<a> list<a>]std/core/types/Nil: forall<a> list<a>,ysys: list<$5461>)std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b) _ -> (std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)accacc: cctx<_5517,list<$5461>> ++.std/core/types/cctx/(++.): (c : cctx<_5517,list<$5461>>, x : list<$5461>) -> $5462 _5517 [std/core/types/Nil: forall<a> list<a>]std/core/types/Nil: forall<a> list<a>, ysys: list<$5461>)std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b) xsxs: list<$5461>.span-accspan-acc: (ys : list<$5461>, acc : cctx<list<$5461>,list<$5461>>) -> $5462 (list<$5461>, list<$5461>)( ctxctx: ctx<list<$5461>> holehole: list<$5461> ) // Keep only those initial elements that satisfy `predicate` pub fun take-whilestd/core/list/take-while: forall<a,e> (xs : list<a>, predicate : (a) -> e bool) -> e list<a>( xsxs: list<$5611> : liststd/core/types/list: V -> V<aa: V>, predicatepredicate: ($5611) -> $5612 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 5663 list<5662> : ee: E liststd/core/types/list: V -> V<aa: V> match xsxs: list<$5611> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $5611,xxxx: list<$5611>) -> if xx: $5611.predicatepredicate: ($5611) -> $5612 bool then Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $5611, xxxx: list<$5611>.take-whilestd/core/list/take-while: (xs : list<$5611>, predicate : ($5611) -> $5612 bool) -> $5612 list<$5611>(predicatepredicate: ($5611) -> $5612 bool) ) else Nilstd/core/types/Nil: forall<a> list<a> Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> // Drop all initial elements that satisfy `predicate` pub fun drop-whilestd/core/list/drop-while: forall<a,e> (xs : list<a>, predicate : (a) -> e bool) -> e list<a>( xsxs: list<$1450> : liststd/core/types/list: V -> V<aa: V>, predicatepredicate: ($1450) -> $1451 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 1492 list<1491> : ee: E liststd/core/types/list: V -> V<aa: V> match xsxs: list<$1450> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1450,xxxx: list<$1450>) -> if xx: $1450.predicatepredicate: ($1450) -> $1451 bool then xxxx: list<$1450>.drop-whilestd/core/list/drop-while: (xs : list<$1450>, predicate : ($1450) -> $1451 bool) -> $1451 list<$1450>(predicatepredicate: ($1450) -> $1451 bool) else xsxs: list<$1450> Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> // Retain only those elements of a list that satisfy the given predicate `pred`. // For example: `filter([1,2,3],odd?) == [1,3]` pub fun filterstd/core/list/filter: forall<a,e> (xs : list<a>, pred : (a) -> e bool) -> e list<a>( xsxs: list<$1499> : liststd/core/types/list: V -> V<aa: V>, predpred: ($1499) -> $1500 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 1558 list<1557> : ee: E liststd/core/types/list: V -> V<aa: V> match xsxs: list<$1499> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1499,xxxx: list<$1499>) -> if predpred: ($1499) -> $1500 bool(xx: $1499) then Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1499,xxxx: list<$1499>.filterstd/core/list/filter: (xs : list<$1499>, pred : ($1499) -> $1500 bool) -> $1500 list<$1499>(predpred: ($1499) -> $1500 bool)) else xxxx: list<$1499>.filterstd/core/list/filter: (xs : list<$1499>, pred : ($1499) -> $1500 bool) -> $1500 list<$1499>(predpred: ($1499) -> $1500 bool) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> // Remove those elements of a list that satisfy the given predicate `pred`. // For example: `remove([1,2,3],odd?) == [2]` pub fun removestd/core/list/remove: forall<a,e> (xs : list<a>, pred : (a) -> e bool) -> e list<a>( xsxs: list<$2919> : liststd/core/types/list: V -> V<aa: V>, predpred: ($2919) -> $2920 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 2955 list<2954> : ee: E liststd/core/types/list: V -> V<aa: V> xsxs: list<$2919>.filterstd/core/list/filter: (xs : list<$2919>, pred : ($2919) -> $2920 bool) -> $2920 list<$2919>( fnfn: (x : $2919) -> $2920 bool(xx: $2919) !std/core/types/bool/(!): (b : bool) -> $2920 boolpredpred: ($2919) -> $2920 bool(xx: $2919) ) // Partition a list in two lists where the first list contains // those elements that satisfy the given predicate `pred`. // For example: `partition([1,2,3],odd?) == ([1,3],[2])` pub fun partitionstd/core/list/partition: forall<a,e> (xs : list<a>, pred : (a) -> e bool) -> e (list<a>, list<a>)( xsxs: list<$3125> : liststd/core/types/list: V -> V<aa: V>, ^predpred: ($3125) -> $3126 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 3165 (list<3164>, list<3164>) : ee: E (std/core/types/tuple2: (V, V) -> Vliststd/core/types/list: V -> V<aa: V>,liststd/core/types/list: V -> V<aa: V>) partition-accstd/core/list/partition-acc: (xs : list<$3125>, pred : ($3125) -> $3126 bool, acc1 : ctx<list<$3125>>, acc2 : ctx<list<$3125>>) -> $3126 (list<$3125>, list<$3125>)(xsxs: list<$3125>, predpred: ($3125) -> $3126 bool, ctxctx: ctx<list<$3125>> holehole: list<$3125>, ctxctx: ctx<list<$3125>> holehole: list<$3125>) fun partition-accstd/core/list/partition-acc: forall<a,e> (xs : list<a>, pred : (a) -> e bool, acc1 : ctx<list<a>>, acc2 : ctx<list<a>>) -> e (list<a>, list<a>)(xsxs: list<$2962> : liststd/core/types/list: V -> V<aa: V>, ^predpred: ($2962) -> $2963 bool : aa: V -> ee: E boolstd/core/types/bool: V, acc1acc1: ctx<list<$2962>> : ctxstd/core/types/ctx: V -> V<liststd/core/types/list: V -> V<aa: V>>, acc2acc2: ctx<list<$2962>> : ctxstd/core/types/ctx: V -> V<liststd/core/types/list: V -> V<aa: V>>)result: -> 3118 (list<3117>, list<3117>): ee: E (std/core/types/tuple2: (V, V) -> Vliststd/core/types/list: V -> V<aa: V>, liststd/core/types/list: V -> V<aa: V>) match xsxs: list<$2962> Nilstd/core/types/Nil: forall<a> list<a> -> (std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)acc1acc1: ctx<list<$2962>> ++.std/core/types/cctx/(++.): (c : cctx<list<$2962>,list<$2962>>, x : list<$2962>) -> $2963 list<$2962> Nilstd/core/types/Nil: forall<a> list<a>, acc2acc2: ctx<list<$2962>> ++.std/core/types/cctx/(++.): (c : cctx<list<$2962>,list<$2962>>, x : list<$2962>) -> $2963 list<$2962> Nilstd/core/types/Nil: forall<a> list<a>)std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b) Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $2962,xxxx: list<$2962>) -> if predpred: ($2962) -> $2963 bool(xx: $2962) then partition-accstd/core/list/partition-acc: (xs : list<$2962>, pred : ($2962) -> $2963 bool, acc1 : ctx<list<$2962>>, acc2 : ctx<list<$2962>>) -> $2963 (list<$2962>, list<$2962>)(xxxx: list<$2962>,predpred: ($2962) -> $2963 bool,acc1acc1: ctx<list<$2962>> ++std/core/types/cctx/(++): (c1 : cctx<list<$2962>,list<$2962>>, c2 : cctx<list<$2962>,list<$2962>>) -> $2963 cctx<list<$2962>,list<$2962>> ctxctx: cctx<list<$2962>,list<$2962>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $2962,holehole: list<$2962>),acc2acc2: ctx<list<$2962>>) else partition-accstd/core/list/partition-acc: (xs : list<$2962>, pred : ($2962) -> $2963 bool, acc1 : ctx<list<$2962>>, acc2 : ctx<list<$2962>>) -> $2963 (list<$2962>, list<$2962>)(xxxx: list<$2962>,predpred: ($2962) -> $2963 bool,acc1acc1: ctx<list<$2962>>,acc2acc2: ctx<list<$2962>> ++std/core/types/cctx/(++): (c1 : cctx<list<$2962>,list<$2962>>, c2 : cctx<list<$2962>,list<$2962>>) -> $2963 cctx<list<$2962>,list<$2962>> ctxctx: cctx<list<$2962>,list<$2962>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $2962,holehole: list<$2962>)) // Partition a list in two lists where the first list contains // those elements that satisfy the given predicate `pred`. // For example: `partition([1,2,3],fn(i) if i.is-odd then Left(i.show) else Right(-i)) == (["1","3"],[-2])` pub fun partition-mapstd/core/list/partition-map: forall<a,b,c,e> (xs : list<a>, pred : (a) -> e either<b,c>) -> e (list<b>, list<c>)( xsxs: list<$3375> : liststd/core/types/list: V -> V<aa: V>, ^predpred: ($3375) -> $3378 either<$3376,$3377> : aa: V -> ee: E eitherstd/core/types/either: (V, V) -> V<bb: V,cc: V> )result: -> 3433 (list<3431>, list<3432>) : ee: E (std/core/types/tuple2: (V, V) -> Vliststd/core/types/list: V -> V<bb: V>,liststd/core/types/list: V -> V<cc: V>) partition-map-accstd/core/list/partition-map-acc: (xs : list<$3375>, pred : ($3375) -> $3378 either<$3376,$3377>, acc1 : ctx<list<$3376>>, acc2 : ctx<list<$3377>>) -> $3378 (list<$3376>, list<$3377>)(xsxs: list<$3375>, predpred: ($3375) -> $3378 either<$3376,$3377>, ctxctx: ctx<list<$3376>> holehole: list<$3376>, ctxctx: ctx<list<$3377>> holehole: list<$3377>) fun partition-map-accstd/core/list/partition-map-acc: forall<a,b,c,e> (xs : list<a>, pred : (a) -> e either<b,c>, acc1 : ctx<list<b>>, acc2 : ctx<list<c>>) -> e (list<b>, list<c>)(xsxs: list<$3172> : liststd/core/types/list: V -> V<aa: V>, ^predpred: ($3172) -> $3175 either<$3173,$3174> : aa: V -> ee: E eitherstd/core/types/either: (V, V) -> V<bb: V,cc: V>, acc1acc1: ctx<list<$3173>> : ctxstd/core/types/ctx: V -> V<liststd/core/types/list: V -> V<bb: V>>, acc2acc2: ctx<list<$3174>> : ctxstd/core/types/ctx: V -> V<liststd/core/types/list: V -> V<cc: V>>)result: -> 3362 (list<3360>, list<3361>): ee: E (std/core/types/tuple2: (V, V) -> Vliststd/core/types/list: V -> V<bb: V>, liststd/core/types/list: V -> V<cc: V>) match xsxs: list<$3172> Nilstd/core/types/Nil: forall<a> list<a> -> (std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)acc1acc1: ctx<list<$3173>> ++.std/core/types/cctx/(++.): (c : cctx<list<$3173>,list<$3173>>, x : list<$3173>) -> $3175 list<$3173> Nilstd/core/types/Nil: forall<a> list<a>, acc2acc2: ctx<list<$3174>> ++.std/core/types/cctx/(++.): (c : cctx<list<$3174>,list<$3174>>, x : list<$3174>) -> $3175 list<$3174> Nilstd/core/types/Nil: forall<a> list<a>)std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b) Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $3172,xxxx: list<$3172>) -> match predpred: ($3172) -> $3175 either<$3173,$3174>(xx: $3172) Leftstd/core/types/Left: forall<a,b> (left : a) -> either<a,b>(yy: $3173) -> partition-map-accstd/core/list/partition-map-acc: (xs : list<$3172>, pred : ($3172) -> $3175 either<$3173,$3174>, acc1 : ctx<list<$3173>>, acc2 : ctx<list<$3174>>) -> $3175 (list<$3173>, list<$3174>)(xxxx: list<$3172>,predpred: ($3172) -> $3175 either<$3173,$3174>,acc1acc1: ctx<list<$3173>> ++std/core/types/cctx/(++): (c1 : cctx<list<$3173>,list<$3173>>, c2 : cctx<list<$3173>,list<$3173>>) -> $3175 cctx<list<$3173>,list<$3173>> ctxctx: cctx<list<$3173>,list<$3173>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $3173,holehole: list<$3173>),acc2acc2: ctx<list<$3174>>) Rightstd/core/types/Right: forall<a,b> (right : b) -> either<a,b>(zz: $3174) -> partition-map-accstd/core/list/partition-map-acc: (xs : list<$3172>, pred : ($3172) -> $3175 either<$3173,$3174>, acc1 : ctx<list<$3173>>, acc2 : ctx<list<$3174>>) -> $3175 (list<$3173>, list<$3174>)(xxxx: list<$3172>,predpred: ($3172) -> $3175 either<$3173,$3174>,acc1acc1: ctx<list<$3173>>,acc2acc2: ctx<list<$3174>> ++std/core/types/cctx/(++): (c1 : cctx<list<$3174>,list<$3174>>, c2 : cctx<list<$3174>,list<$3174>>) -> $3175 cctx<list<$3174>,list<$3174>> ctxctx: cctx<list<$3174>,list<$3174>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(zz: $3174,holehole: list<$3174>)) // Retain only those elements of a list that satisfy the given predicate `pred`. // For example: `filterMap([1,2,3],fn(i) { if i.odd? then Nothing else Just(i*i) }) == [4]` pub fun filter-mapstd/core/list/filter-map: forall<a,b,e> (xs : list<a>, pred : (a) -> e maybe<b>) -> e list<b>( xsxs: list<$1565> : liststd/core/types/list: V -> V<aa: V>, predpred: ($1565) -> $1567 maybe<$1566> : aa: V -> ee: E maybestd/core/types/maybe: V -> V<bb: V> )result: -> 1642 list<1641> : ee: E liststd/core/types/list: V -> V<bb: V> match xsxs: list<$1565> Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1565,xxxx: list<$1565>) -> match predpred: ($1565) -> $1567 maybe<$1566>(xx: $1565) Nothingstd/core/types/Nothing: forall<a> maybe<a> -> xxxx: list<$1565>.filter-mapstd/core/list/filter-map: (xs : list<$1565>, pred : ($1565) -> $1567 maybe<$1566>) -> $1567 list<$1566>(predpred: ($1565) -> $1567 maybe<$1566>) Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(yy: $1566) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $1566,xxxx: list<$1565>.filter-mapstd/core/list/filter-map: (xs : list<$1565>, pred : ($1565) -> $1567 maybe<$1566>) -> $1567 list<$1566>(predpred: ($1565) -> $1567 maybe<$1566>)) // Find the first element satisfying some predicate pub fun findstd/core/list/find: forall<a,e> (xs : list<a>, pred : (a) -> e bool) -> e maybe<a>( xsxs: list<$1794> : liststd/core/types/list: V -> V<aa: V>, predpred: ($1794) -> $1795 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 1846 maybe<1845> : ee: E maybestd/core/types/maybe: V -> V<aa: V> xsxs: list<$1794>.foreach-whilestd/core/list/foreach-while: (xs : list<$1794>, action : ($1794) -> $1795 maybe<$1794>) -> $1795 maybe<$1794> fnfn: (x : $1794) -> $1795 maybe<$1794>(xx: $1794) if predpred: ($1794) -> $1795 bool(xx: $1794) then Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(xx: $1794) else Nothingstd/core/types/Nothing: forall<a> maybe<a> // Find the first element satisfying some predicate and return it. pub fun find-maybestd/core/list/find-maybe: forall<a,b,e> (xs : list<a>, pred : (a) -> e maybe<b>) -> e maybe<b>( xsxs: list<$1853> : liststd/core/types/list: V -> V<aa: V>, predpred: ($1853) -> $1855 maybe<$1854> : aa: V -> ee: E maybestd/core/types/maybe: V -> V<bb: V> )result: -> 1894 maybe<1893> : ee: E maybestd/core/types/maybe: V -> V<bb: V> xsxs: list<$1853>.foreach-whilestd/core/list/foreach-while: (xs : list<$1853>, action : ($1853) -> $1855 maybe<$1854>) -> $1855 maybe<$1854>(predpred: ($1853) -> $1855 maybe<$1854>) // Lookup the first element satisfying some predicate pub fun lookupstd/core/list/lookup: forall<a,b,e> (xs : list<(a, b)>, pred : (a) -> e bool) -> e maybe<b>( xsxs: list<($3446, $3447)> : liststd/core/types/list: V -> V<(std/core/types/tuple2: (V, V) -> Vaa: V,bb: V)>, predpred: ($3446) -> $3448 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 3576 maybe<3575> : ee: E maybestd/core/types/maybe: V -> V<bb: V> xsxs: list<($3446, $3447)>.foreach-whilestd/core/list/foreach-while: (xs : list<($3446, $3447)>, action : (($3446, $3447)) -> $3448 maybe<$3447>) -> $3448 maybe<$3447> fnfn: (kv : ($3446, $3447)) -> $3448 maybe<$3447>(kvkv: ($3446, $3447)) if predpred: ($3446) -> $3448 bool(kvkv: ($3446, $3447).fststd/core/types/tuple2/fst: (tuple2 : ($3446, $3447)) -> $3448 $3446) then Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(kvkv: ($3446, $3447).sndstd/core/types/tuple2/snd: (tuple2 : ($3446, $3447)) -> $3448 $3447) else Nothingstd/core/types/Nothing: forall<a> maybe<a> // Check if the list has a particular element `y` pub fun containsstd/core/list/contains: forall<a> (xs : list<a>, y : a, @implicit/(==) : (a, a) -> bool) -> bool( xsxs: list<$1652> : liststd/core/types/list: V -> V<aa: V>, yy: $1652 : aa: V, (@implicit/==)?(==): ($1652, $1652) -> bool : (aa: V,aa: V) -> boolstd/core/types/bool: V)result: -> total bool : boolstd/core/types/bool: V match xsxs: list<$1652> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1652,xxxx: list<$1652>) -> if xx: $1652==?(==): ($1652, $1652) -> boolyy: $1652 then Truestd/core/types/True: bool else xxxx: list<$1652>.containsstd/core/list/contains: (xs : list<$1652>, y : $1652, @implicit/(==) : ($1652, $1652) -> bool) -> bool
?(==)=?(==)
(yy: $1652) Nilstd/core/types/Nil: forall<a> list<a> -> Falsestd/core/types/False: bool
// Convert a `:maybe` type to a list type. pub fun maybe/liststd/core/list/maybe/list: forall<a> (m : maybe<a>) -> list<a>( mm: maybe<$1904> : maybestd/core/types/maybe: V -> V<aa: V> )result: -> total list<1935> : liststd/core/types/list: V -> V<aa: V> match mm: maybe<$1904> Nothingstd/core/types/Nothing: forall<a> maybe<a> -> Nilstd/core/types/Nil: forall<a> list<a> Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(xx: $1904) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1904,Nilstd/core/types/Nil: forall<a> list<a>) fun index-of-accstd/core/list/index-of-acc: forall<a,e> (xs : list<a>, pred : (a) -> e bool, idx : int) -> e int( xsxs: list<$3586> : liststd/core/types/list: V -> V<aa: V>, predpred: ($3586) -> $3587 bool : aa: V -> ee: E boolstd/core/types/bool: V, idxidx: int : intstd/core/types/int: V )result: -> 3632 int : ee: E intstd/core/types/int: V match xsxs: list<$3586> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $3586,xxxx: list<$3586>) -> if predpred: ($3586) -> $3587 bool(xx: $3586) then idxidx: int else index-of-accstd/core/list/index-of-acc: (xs : list<$3586>, pred : ($3586) -> $3587 bool, idx : int) -> $3587 int(xxxx: list<$3586>,predpred: ($3586) -> $3587 bool,idxidx: int+std/core/int/(+): (x : int, y : int) -> $3587 int1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001
) Nilstd/core/types/Nil: forall<a> list<a> -> -1literal: int
dec = -1
hex8 = 0xFF
bit8 = 0b11111111
// Returns the index of the first element where `pred` holds, or `-1` if no such element exists. pub fun index-ofstd/core/list/index-of: forall<a,e> (xs : list<a>, pred : (a) -> e bool) -> e int( xsxs: list<$3639> : liststd/core/types/list: V -> V<aa: V>, predpred: ($3639) -> $3640 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 3662 int : ee: E intstd/core/types/int: V index-of-accstd/core/list/index-of-acc: (xs : list<$3639>, pred : ($3639) -> $3640 bool, idx : int) -> $3640 int( xsxs: list<$3639>, predpred: ($3639) -> $3640 bool, 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
) // Invoke `action` for each element of a list pub fun foreachstd/core/list/foreach: forall<a,e> (xs : list<a>, action : (a) -> e ()) -> e ()( xsxs: list<$3669> : liststd/core/types/list: V -> V<aa: V>, actionaction: ($3669) -> $3670 () : (aa: V) -> ee: E (std/core/types/unit: V)std/core/types/unit: V )result: -> 3712 () : ee: E (std/core/types/unit: V)std/core/types/unit: V match xsxs: list<$3669> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $3669,xxxx: list<$3669>) -> { actionaction: ($3669) -> $3670 ()(xx: $3669); xxxx: list<$3669>.foreachstd/core/list/foreach: (xs : list<$3669>, action : ($3669) -> $3670 ()) -> $3670 ()(actionaction: ($3669) -> $3670 ()) } Nilstd/core/types/Nil: forall<a> list<a> -> (std/core/types/Unit: ())std/core/types/Unit: () // Invoke `action` for each element of a list while `action` return `Nothing` pub fun foreach-whilestd/core/list/foreach-while: forall<a,b,e> (xs : list<a>, action : (a) -> e maybe<b>) -> e maybe<b>( xsxs: list<$1714> : liststd/core/types/list: V -> V<aa: V>, actionaction: ($1714) -> $1716 maybe<$1715> : (aa: V) -> ee: E maybestd/core/types/maybe: V -> V<bb: V> )result: -> 1778 maybe<1777> : ee: E maybestd/core/types/maybe: V -> V<bb: V> match xsxs: list<$1714> Nilstd/core/types/Nil: forall<a> list<a> -> Nothingstd/core/types/Nothing: forall<a> maybe<a> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $1714,xxxx: list<$1714>) -> match actionaction: ($1714) -> $1716 maybe<$1715>(xx: $1714) Nothingstd/core/types/Nothing: forall<a> maybe<a> -> xxxx: list<$1714>.foreach-whilestd/core/list/foreach-while: (xs : list<$1714>, action : ($1714) -> $1716 maybe<$1715>) -> $1716 maybe<$1715>(actionaction: ($1714) -> $1716 maybe<$1715>) justjust: maybe<$1715> -> justjust: maybe<$1715> // Invoke `action` on each element of a list while `action` returns `Just` pub fun map-whilestd/core/list/map-while: forall<a,b,e> (xs : list<a>, action : (a) -> e maybe<b>) -> e list<b>( xsxs: list<$3723> : liststd/core/types/list: V -> V<aa: V>, actionaction: ($3723) -> $3725 maybe<$3724> : (aa: V) -> ee: E maybestd/core/types/maybe: V -> V<bb: V> )result: -> 3790 list<3789> : ee: E liststd/core/types/list: V -> V<bb: V> match xsxs: list<$3723> Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $3723,xxxx: list<$3723>) -> match actionaction: ($3723) -> $3725 maybe<$3724>(xx: $3723) Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(yy: $3724) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $3724,xxxx: list<$3723>.map-whilestd/core/list/map-while: (xs : list<$3723>, action : ($3723) -> $3725 maybe<$3724>) -> $3725 list<$3724>(actionaction: ($3723) -> $3725 maybe<$3724>)) Nothingstd/core/types/Nothing: forall<a> maybe<a> -> Nilstd/core/types/Nil: forall<a> list<a> // Invoke `action` for each element of a list, passing also the position of the element. pub fun foreach-indexedstd/core/list/foreach-indexed: forall<a,e> (xs : list<a>, action : (int, a) -> e ()) -> e ()( xsxs: list<$3800> : liststd/core/types/list: V -> V<aa: V>, actionaction: (int, $3800) -> $3801 () : (intstd/core/types/int: V,aa: V) -> ee: E (std/core/types/unit: V)std/core/types/unit: V )result: -> 3928 () : ee: E (std/core/types/unit: V)std/core/types/unit: V var ii: local-var<$3811,int> := 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
xsxs: list<$3800>.foreachstd/core/list/foreach: (xs : list<$3800>, action : ($3800) -> <local<$3811>|$3801> ()) -> <local<$3811>|$3801> () fnfn: (x : $3800) -> <local<$3811>|$3801> ()(xx: $3800) val jj: int = ii: int
?hdiv=iev@3846
// don't dereference `i` inside the inject actionaction: (int, $3800) -> $3801 ()(jj: int,xx: $3800) ii: local-var<$3811,int> :=std/core/types/local-set: (v : local-var<$3811,int>, assigned : int) -> <local<$3811>|$3801> () ii: int
?hdiv=iev@3898
+std/core/int/(+): (x : int, y : int) -> <local<$3811>|$3801> int
1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001
// Insert a separator `sep` between all elements of a list `xs` . pub fun interspersestd/core/list/intersperse: forall<a> (xs : list<a>, sep : a) -> list<a>( xsxs: list<$3935> : liststd/core/types/list: V -> V<aa: V>, sepsep: $3935 : aa: V )result: -> total list<4004> : liststd/core/types/list: V -> V<aa: V> fun beforebefore: (ys : list<$3935>) -> list<$3935>(ysys: list<$3935>)result: -> total list<$3935> match ysys: list<$3935> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $3935,yyyy: list<$3935>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(sepsep: $3935,Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $3935,beforebefore: (ys : list<$3935>) -> list<$3935>(yyyy: list<$3935>))) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> match xsxs: list<$3935> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $3935,xxxx: list<$3935>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $3935, xxxx: list<$3935>.beforebefore: (ys : list<$3935>) -> list<$3935>) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> // Concatenate all strings in a list fun joinsepstd/core/list/joinsep: (xs : list<string>, sep : string) -> string( xsxs: list<string> : liststd/core/types/list: V -> V<stringstd/core/types/string: V>, sepsep: string : stringstd/core/types/string: V )result: -> total string : stringstd/core/types/string: V match xsxs: list<string> Nilstd/core/types/Nil: forall<a> list<a> -> ""literal: string
count= 0
Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: string,Nilstd/core/types/Nil: forall<a> list<a>) -> xx: string Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: string,Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: string,Nilstd/core/types/Nil: forall<a> list<a>)) | sepsep: string.is-emptystd/core/string/is-empty: (s : string) -> bool -> xx: string ++std/core/types/(++): (x : string, y : string) -> string yy: string _ -> xsxs: list<string>.vectorstd/core/vector/list/vector: (xs : list<string>) -> vector<string>.joinstd/core/string/vectorsep/join: (v : vector<string>, sep : string) -> string(sepsep: string
) // Concatenate all strings in a list pub fun concat/joinstd/core/list/concat/join: (xs : list<string>) -> string( xsxs: list<string> : liststd/core/types/list: V -> V<stringstd/core/types/string: V> )result: -> total string : stringstd/core/types/string: V match xsxs: list<string> Nilstd/core/types/Nil: forall<a> list<a> -> ""literal: string
count= 0
Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: string,Nilstd/core/types/Nil: forall<a> list<a>) -> xx: string Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: string,Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: string,Nilstd/core/types/Nil: forall<a> list<a>)) -> xx: string ++std/core/types/(++): (x : string, y : string) -> string yy: string _ -> xsxs: list<string>.vectorstd/core/vector/list/vector: (xs : list<string>) -> vector<string>.joinstd/core/string/vector/join: (v : vector<string>) -> string(
) // Concatenate all strings in a list using a specific separator pub fun joinsep/joinstd/core/list/joinsep/join: (xs : list<string>, sep : string) -> string( xsxs: list<string> : liststd/core/types/list: V -> V<stringstd/core/types/string: V>, sepsep: string : stringstd/core/types/string: V )result: -> total string : stringstd/core/types/string: V xsxs: list<string>.joinsepstd/core/list/joinsep: (xs : list<string>, sep : string) -> string(sepsep: string) // Concatenate all strings in a list in reverse order pub fun reverse-joinstd/core/list/reverse-join: (xs : list<string>) -> string( xsxs: list<string> : liststd/core/types/list: V -> V<stringstd/core/types/string: V> )result: -> total string : stringstd/core/types/string: V xsxs: list<string>.reversestd/core/list/reverse: (xs : list<string>) -> list<string>.joinstd/core/list/concat/join: (xs : list<string>) -> string // Append `end` to each string in the list `xs` and join them all together.\ // `join-end([],end) === ""`\ // `join-end(["a","b"],"/") === "a/b/"` pub fun join-endstd/core/list/join-end: (xs : list<string>, end : string) -> string( xsxs: list<string> : liststd/core/types/list: V -> V<stringstd/core/types/string: V>, endend: string : stringstd/core/types/string: V)result: -> total string : stringstd/core/types/string: V match xsxs: list<string> Nilstd/core/types/Nil: forall<a> list<a> -> ""literal: string
count= 0
_ -> xsxs: list<string>.joinsepstd/core/list/joinsep: (xs : list<string>, sep : string) -> string(endend: string) ++std/core/types/(++): (x : string, y : string) -> string endend: string
// Concatenate all lists in a list (e.g. flatten the list). (tail-recursive) pub fun concatstd/core/list/concat: forall<a> (xss : list<list<a>>) -> list<a>( xssxss: list<list<$5711>> : liststd/core/types/list: V -> V<liststd/core/types/list: V -> V<aa: V>> )result: -> total list<5790> : liststd/core/types/list: V -> V<aa: V> fun concat-preconcat-pre: forall<a> (ys : list<a>, zss : list<list<a>>) -> list<a>( ysys: list<$5712> : liststd/core/types/list: V -> V<aa: V>, zsszss: list<list<$5712>> : liststd/core/types/list: V -> V<liststd/core/types/list: V -> V<aa: V>> )result: -> total list<5768> : liststd/core/types/list: V -> V<aa: V> match ysys: list<$5712> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $5712,yyyy: list<$5712>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $5712,concat-preconcat-pre: (ys : list<$5712>, zss : list<list<$5712>>) -> list<$5712>(yyyy: list<$5712>,zsszss: list<list<$5712>>)) Nilstd/core/types/Nil: forall<a> list<a> -> match zsszss: list<list<$5712>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(zszs: list<$5712>,zzszzs: list<list<$5712>>) -> concat-preconcat-pre: (ys : list<$5712>, zss : list<list<$5712>>) -> list<$5712>(zszs: list<$5712>,zzszzs: list<list<$5712>>) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> concat-preconcat-pre: (ys : list<$5711>, zss : list<list<$5711>>) -> list<$5711>([std/core/types/Nil: forall<a> list<a>]std/core/types/Nil: forall<a> list<a>,xssxss: list<list<$5711>>) // Concatenate the result lists from applying a function to all elements. pub fun flatmapstd/core/list/flatmap: forall<a,b,e> (xs : list<a>, f : (a) -> e list<b>) -> e list<b>( xsxs: list<$5795>: liststd/core/types/list: V -> V<aa: V>, ff: ($5795) -> $5797 list<$5796> : aa: V -> ee: E liststd/core/types/list: V -> V<bb: V> )result: -> 5865 list<5864> : ee: E liststd/core/types/list: V -> V<bb: V> fun flatmap-preflatmap-pre: (ys : list<$5796>, zs : list<$5795>) -> $5797 list<$5796>( ysys: list<$5796>, zszs: list<$5795> )result: -> $5797 list<$5796> match ysys: list<$5796> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $5796,yyyy: list<$5796>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $5796,flatmap-preflatmap-pre: (ys : list<$5796>, zs : list<$5795>) -> $5797 list<$5796>(yyyy: list<$5796>,zszs: list<$5795>)) Nilstd/core/types/Nil: forall<a> list<a> -> match zszs: list<$5795> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(zz: $5795,zzzz: list<$5795>) -> flatmap-preflatmap-pre: (ys : list<$5796>, zs : list<$5795>) -> $5797 list<$5796>(ff: ($5795) -> $5797 list<$5796>(zz: $5795),zzzz: list<$5795>) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> flatmap-preflatmap-pre: (ys : list<$5796>, zs : list<$5795>) -> $5797 list<$5796>([std/core/types/Nil: forall<a> list<a>]std/core/types/Nil: forall<a> list<a>,xsxs: list<$5795>) // Concatenate the `Just` result elements from applying a function to all elements. pub fun flatmap-maybestd/core/list/flatmap-maybe: forall<a,b,e> (xs : list<a>, f : (a) -> e maybe<b>) -> e list<b>( xsxs: list<$5875> : liststd/core/types/list: V -> V<aa: V>, ff: ($5875) -> $5877 maybe<$5876> : aa: V -> ee: E maybestd/core/types/maybe: V -> V<bb: V> )result: -> 5952 list<5951> : ee: E liststd/core/types/list: V -> V<bb: V> match xsxs: list<$5875> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $5875,xxxx: list<$5875>) -> match ff: ($5875) -> $5877 maybe<$5876>(xx: $5875) Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(yy: $5876) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $5876, xxxx: list<$5875>.flatmap-maybestd/core/list/flatmap-maybe: (xs : list<$5875>, f : ($5875) -> $5877 maybe<$5876>) -> $5877 list<$5876>(ff: ($5875) -> $5877 maybe<$5876>)) Nothingstd/core/types/Nothing: forall<a> maybe<a> -> xxxx: list<$5875>.flatmap-maybestd/core/list/flatmap-maybe: (xs : list<$5875>, f : ($5875) -> $5877 maybe<$5876>) -> $5877 list<$5876>(ff: ($5875) -> $5877 maybe<$5876>) Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> // Concatenate a list of `:maybe` values pub fun concat-maybestd/core/list/concat-maybe: forall<a> (xs : list<maybe<a>>) -> list<a>( xsxs: list<maybe<$5962>> : liststd/core/types/list: V -> V<maybestd/core/types/maybe: V -> V<aa: V>> )result: -> total list<6016> : liststd/core/types/list: V -> V<aa: V> match xsxs: list<maybe<$5962>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: maybe<$5962>,xxxx: list<maybe<$5962>>) -> match xx: maybe<$5962> Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(yy: $5962) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(yy: $5962, xxxx: list<maybe<$5962>>.concat-maybestd/core/list/concat-maybe: (xs : list<maybe<$5962>>) -> list<$5962>) Nothingstd/core/types/Nothing: forall<a> maybe<a> -> xxxx: list<maybe<$5962>>.concat-maybestd/core/list/concat-maybe: (xs : list<maybe<$5962>>) -> list<$5962> Nilstd/core/types/Nil: forall<a> list<a> -> Nilstd/core/types/Nil: forall<a> list<a> // Return the last element of a list (or `Nothing` for the empty list) pub fun laststd/core/list/last: forall<a> (xs : list<a>) -> maybe<a>( xsxs: list<$6021> : liststd/core/types/list: V -> V<aa: V> )result: -> total maybe<6064> : maybestd/core/types/maybe: V -> V<aa: V> match xsxs: list<$6021> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $6021,Nilstd/core/types/Nil: forall<a> list<a>) -> Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(xx: $6021) Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(_,xxxx: list<$6021>) -> laststd/core/list/last: (xs : list<$6021>) -> maybe<$6021>(xxxx: list<$6021>) Nilstd/core/types/Nil: forall<a> list<a> -> Nothingstd/core/types/Nothing: forall<a> maybe<a> // Return the list without its last element. // Return an empty list for an empty list. pub fun initstd/core/list/init: forall<a> (xs : list<a>) -> list<a>( xsxs: list<$6069> : liststd/core/types/list: V -> V<aa: V> )result: -> total list<6107> : liststd/core/types/list: V -> V<aa: V> match xsxs: list<$6069> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $6069, xxxx: list<$6069> as Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>) -> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $6069,initstd/core/list/init: (xs : list<$6069>) -> list<$6069>(xxxx: list<$6069>)) _ -> Nilstd/core/types/Nil: forall<a> list<a> // Return the prefix of list and its last element. pub fun split-laststd/core/list/split-last: forall<a> (xs : list<a>, acc : ? (ctx<list<a>>)) -> maybe2<list<a>,a>( xsxs: list<$6112> : liststd/core/types/list: V -> V<aa: V>, accacc: ? (ctx<list<$6112>>) : ctxstd/core/types/ctx: V -> V<liststd/core/types/list: V -> V<aa: V>> = ctxctx: ctx<list<$6112>> holehole: list<$6112> )result: -> total maybe2<list<6232>,6232> : maybe2std/core/types/maybe2: (V, V) -> V<liststd/core/types/list: V -> V<aa: V>,aa: V> match xsxs: list<$6112> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $6112, xxxx: list<$6112> as Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>) -> split-laststd/core/list/split-last: (xs : list<$6112>, acc : ? (ctx<list<$6112>>)) -> maybe2<list<$6112>,$6112>(xxxx: list<$6112>, accacc: ctx<list<$6112>> ++std/core/types/cctx/(++): (c1 : cctx<list<$6112>,list<$6112>>, c2 : cctx<list<$6112>,list<$6112>>) -> cctx<list<$6112>,list<$6112>> ctxctx: cctx<list<$6112>,list<$6112>> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $6112,holehole: list<$6112>) ) Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $6112,Nilstd/core/types/Nil: forall<a> list<a>) -> Just2std/core/types/Just2: forall<a,b> (fst : a, snd : b) -> maybe2<a,b>(accacc: ctx<list<$6112>> ++.std/core/types/cctx/(++.): (c : cctx<list<$6112>,list<$6112>>, x : list<$6112>) -> list<$6112> Nilstd/core/types/Nil: forall<a> list<a>, xx: $6112) Nilstd/core/types/Nil: forall<a> list<a> -> Nothing2std/core/types/Nothing2: forall<a,b> maybe2<a,b> // Get (zero-based) element `n` of a list. Return a `:maybe` type. pub fun @index( xsxs: list<$6237> : liststd/core/types/list: V -> V<aa: V>, nn: int : intstd/core/types/int: V )result: -> total maybe<6318> : maybestd/core/types/maybe: V -> V<aa: V> match xsxs: list<$6237> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $6237,xxxx: list<$6237>) -> if nn: int>std/core/int/(>): (x : int, y : int) -> bool0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
then xxxx: list<$6237>[nn: int -std/core/int/(-): (x : int, y : int) -> int 1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001
] // == @index(xx,n-1) elif nn: int==std/core/int/(==): (x : int, y : int) -> bool0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
then Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(xx: $6237) else Nothingstd/core/types/Nothing: forall<a> maybe<a> Nilstd/core/types/Nil: forall<a> list<a> -> Nothingstd/core/types/Nothing: forall<a> maybe<a> // Do all elements satisfy a predicate ? pub fun allstd/core/list/all: forall<a,e> (xs : list<a>, predicate : (a) -> e bool) -> e bool( xsxs: list<$6330> : liststd/core/types/list: V -> V<aa: V>, predicatepredicate: ($6330) -> $6331 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 6370 bool : ee: E boolstd/core/types/bool: V match xsxs: list<$6330> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $6330,xxxx: list<$6330>) -> if predicatepredicate: ($6330) -> $6331 bool(xx: $6330) then xxxx: list<$6330>.allstd/core/list/all: (xs : list<$6330>, predicate : ($6330) -> $6331 bool) -> $6331 bool(predicatepredicate: ($6330) -> $6331 bool) else Falsestd/core/types/False: bool Nilstd/core/types/Nil: forall<a> list<a> -> Truestd/core/types/True: bool // Are there any elements in a list that satisfy a predicate ? pub fun anystd/core/list/any: forall<a,e> (xs : list<a>, predicate : (a) -> e bool) -> e bool( xsxs: list<$6377> : liststd/core/types/list: V -> V<aa: V>, predicatepredicate: ($6377) -> $6378 bool : aa: V -> ee: E boolstd/core/types/bool: V )result: -> 6417 bool : ee: E boolstd/core/types/bool: V match xsxs: list<$6377> Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: $6377,xxxx: list<$6377>) -> if predicatepredicate: ($6377) -> $6378 bool(xx: $6377) then Truestd/core/types/True: bool else xxxx: list<$6377>.anystd/core/list/any: (xs : list<$6377>, predicate : ($6377) -> $6378 bool) -> $6378 bool(predicatepredicate: ($6377) -> $6378 bool) Nilstd/core/types/Nil: forall<a> list<a> -> Falsestd/core/types/False: bool // Return the sum of a list of integers pub fun sumstd/core/list/sum: (xs : list<int>) -> int( xsxs: list<int> : liststd/core/types/list: V -> V<intstd/core/types/int: V> )result: -> total int : intstd/core/types/int: V xsxs: list<int>.foldlstd/core/list/foldl: (xs : list<int>, z : int, f : (int, int) -> int) -> int( 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
, fnfn: (x : int, y : int) -> int(xx: int,yy: int) { xx: int +std/core/int/(+): (x : int, y : int) -> int yy: int }
) // Returns the smallest element of a list of integers (or `default` (=`0`) for the empty list) pub fun minimumstd/core/list/minimum: (xs : list<int>, default : ? int) -> int( xsxs: list<int> : liststd/core/types/list: V -> V<intstd/core/types/int: V>, defaultdefault: ? int : intstd/core/types/int: V = 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
)result: -> total int : intstd/core/types/int: V match xsxs: list<int> Nilstd/core/types/Nil: forall<a> list<a> -> defaultdefault: int Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: int,xxxx: list<int>) -> xxxx: list<int>.foldlstd/core/list/foldl: (xs : list<int>, z : int, f : (int, int) -> int) -> int( xx: int, minstd/core/int/min: (i : int, j : int) -> int
) // Returns the largest element of a list of integers (or `default` (=`0`) for the empty list) pub fun maximumstd/core/list/maximum: (xs : list<int>, default : ? int) -> int( xsxs: list<int> : liststd/core/types/list: V -> V<intstd/core/types/int: V>, defaultdefault: ? int : intstd/core/types/int: V = 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
)result: -> total int : intstd/core/types/int: V match xsxs: list<int> Nilstd/core/types/Nil: forall<a> list<a> -> defaultdefault: int Consstd/core/types/Cons: forall<a> (head : a, tail : list<a>) -> list<a>(xx: int,xxxx: list<int>) -> xxxx: list<int>.foldlstd/core/list/foldl: (xs : list<int>, z : int, f : (int, int) -> int) -> int( xx: int, maxstd/core/int/max: (i : int, j : int) -> int
) // Split a string into a list of lines pub fun linesstd/core/list/lines: (s : string) -> list<string>( ss: string : stringstd/core/types/string: V )result: -> total list<string> : liststd/core/types/list: V -> V<stringstd/core/types/string: V> ss: string.splitstd/core/string/sep/split: (s : string, sep : string) -> list<string>("\n"literal: string
count= 1
) // Join a list of strings with newlines pub fun unlinesstd/core/list/unlines: (xs : list<string>) -> string( xsxs: list<string> : liststd/core/types/list: V -> V<stringstd/core/types/string: V> )result: -> total string : stringstd/core/types/string: V xsxs: list<string>.joinstd/core/list/joinsep/join: (xs : list<string>, sep : string) -> string("\n"literal: string
count= 1
) // Apply a function `f` to each character in a string pub fun string/mapstd/core/list/string/map: forall<e> (s : string, f : (char) -> e char) -> e string( ss: string : stringstd/core/types/string: V, ff: (char) -> $2238 char : charstd/core/types/char: V -> ee: E charstd/core/types/char: V )result: -> 2295 string : ee: E stringstd/core/types/string: V ss: string.liststd/core/string/list: (s : string) -> $2238 list<char>.mapstd/core/list/map: (xs : list<char>, f : (char) -> $2238 char) -> $2238 list<char>(ff: (char) -> $2238 char).stringstd/core/string/listchar/string: (cs : list<char>) -> $2238 string // todo: optimize