This is the latest docs version
Quick Links
  • -Overview
  • -Language Features
  • -JS Interop
  • -Build System
Documentation
Language Manual
Reference for all language features
ReScript & React
First class bindings for ReactJS
GenType
Seamless TypeScript integration
Reanalyze
Dead Code & Termination analysis
Exploration
Packages
Explore third party libraries and bindings
Syntax Lookup
Discover all syntax constructs
APIPlaygroundBlogCommunity
  • Playground
  • Blog
  • X
  • Bluesky
  • GitHub
  • Forum
Js Module
Overview
Js
submodules
  • Array
  • Array2
  • BigInt
  • Blob
  • Console
  • Date
  • Dict
  • Exn
  • File
  • Float
  • Global
  • Int
  • Json
    • Kind
  • List
    • t
      t
    • v
      length
    • v
      cons
    • v
      isEmpty
    • v
      hd
    • v
      tl
    • v
      nth
    • v
      revAppend
    • v
      rev
    • v
      mapRev
    • v
      map
    • v
      iter
    • v
      iteri
    • v
      foldLeft
    • v
      foldRight
    • v
      flatten
    • v
      filter
    • v
      filterMap
    • v
      countBy
    • v
      init
    • v
      toVector
    • v
      equal
  • Map
  • Math
  • Null
  • Null_undefined
  • Nullable
  • Obj
  • Option
  • Promise
  • Promise2
  • Re
  • Result
  • Set
  • String
  • String2
  • TypedArray2
    • DataView
    • Float64Array
    • Float32Array
    • Uint32Array
    • Int32Array
    • Uint16Array
    • Int16Array
    • Uint8ClampedArray
    • Uint8Array
    • Int8Array
    • ArrayBuffer
    Typed_array
    • DataView
    • Float64_array
    • Float64Array
    • Float32_array
    • Float32Array
    • Uint32Array
    • Int32_array
    • Int32Array
    • Uint16Array
    • Int16Array
    • Uint8ClampedArray
    • Uint8Array
    • Int8Array
    • S
    • ArrayBuffer
    • Type
  • Types
  • Undefined
  • Vector
  • WeakMap
  • WeakSet
  • API / Js / List

    List

    Provide utilities for list

    t

    RESCRIPT
    type t<'a> = list<'a>

    length

    RESCRIPT
    let length: t<'a> => int

    cons

    RESCRIPT
    let cons: ('a, t<'a>) => t<'a>

    isEmpty

    RESCRIPT
    let isEmpty: t<'a> => bool

    hd

    RESCRIPT
    let hd: t<'a> => option<'a>

    tl

    RESCRIPT
    let tl: t<'a> => option<t<'a>>

    nth

    RESCRIPT
    let nth: (t<'a>, int) => option<'a>

    revAppend

    RESCRIPT
    let revAppend: (t<'a>, t<'a>) => t<'a>

    rev

    RESCRIPT
    let rev: t<'a> => t<'a>

    mapRev

    RESCRIPT
    let mapRev: ('a => 'b, t<'a>) => t<'b>

    map

    RESCRIPT
    let map: ('a => 'b, t<'a>) => t<'b>

    iter

    RESCRIPT
    let iter: ('a => unit, t<'a>) => unit

    iteri

    RESCRIPT
    let iteri: ((int, 'a) => unit, t<'a>) => unit

    foldLeft

    RESCRIPT
    let foldLeft: (('a, 'b) => 'a, 'a, list<'b>) => 'a

    Application order is left to right, tail recurisve

    foldRight

    RESCRIPT
    let foldRight: (('a, 'b) => 'b, list<'a>, 'b) => 'b

    Application order is right to left tail-recursive.

    flatten

    RESCRIPT
    let flatten: t<t<'a>> => t<'a>

    filter

    RESCRIPT
    let filter: ('a => bool, t<'a>) => t<'a>

    filterMap

    RESCRIPT
    let filterMap: ('a => option<'b>, t<'a>) => t<'b>

    countBy

    RESCRIPT
    let countBy: ('a => bool, list<'a>) => int

    init

    RESCRIPT
    let init: (int, int => 'a) => t<'a>

    toVector

    RESCRIPT
    let toVector: t<'a> => array<'a>

    equal

    RESCRIPT
    let equal: (('a, 'a) => bool, list<'a>, list<'a>) => bool
    Types and values
    • t
      t
    • v
      length
    • v
      cons
    • v
      isEmpty
    • v
      hd
    • v
      tl
    • v
      nth
    • v
      revAppend
    • v
      rev
    • v
      mapRev
    • v
      map
    • v
      iter
    • v
      iteri
    • v
      foldLeft
    • v
      foldRight
    • v
      flatten
    • v
      filter
    • v
      filterMap
    • v
      countBy
    • v
      init
    • v
      toVector
    • v
      equal

    © 2024 The ReScript Project

    Software and assets distribution powered by KeyCDN.

    About
    • Community
    • ReScript Association
    Find us on