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
  • Twitter
  • GitHub
  • Forum
JS Module
Overview
  • JS
Submodules
  • Array2
  • Array
  • Console
  • Date
  • Dict
  • Exn
  • Float
  • Global
  • Int
  • Json
  • List
    • t
    • cons
    • countBy
    • equal
    • filter
    • filterMap
    • flatten
    • foldLeft
    • foldRight
    • hd
    • init
    • isEmpty
    • iter
    • iteri
    • length
    • map
    • mapRev
    • nth
    • rev
    • revAppend
    • tl
    • toVector
  • Math
  • NullUndefined
  • Null
  • Nullable
  • Obj
  • Option
  • Promise
  • Re
  • Result
  • String2
  • String
  • TypedArrayArrayBuffer
  • TypedArrayDataView
  • TypedArrayFloat32Array
  • TypedArrayFloat64Array
  • TypedArrayInt8Array
  • TypedArrayInt16Array
  • TypedArrayInt32Array
  • TypedArrayTypeS
  • TypedArrayUint8Array
  • TypedArrayUint8ClampedArray
  • TypedArrayUint16Array
  • TypedArrayUint32Array
  • TypedArray2ArrayBuffer
  • TypedArray2DataView
  • TypedArray2Float32Array
  • TypedArray2Float64Array
  • TypedArray2Int8Array
  • TypedArray2Int16Array
  • TypedArray2Int32Array
  • TypedArray2Uint8Array
  • TypedArray2Uint8ClampedArray
  • TypedArray2Uint16Array
  • TypedArray2Uint32Array
  • TypedArray2
  • TypedArray
  • Types
  • Undefined
  • Vector
API / Js / List

You are currently looking at the v6.0 - v8.2 docs (Reason v3.6 syntax edition). You can find the latest API docs here.

(These docs cover all versions between v3 to v8 and are equivalent to the old BuckleScript docs before the rebrand)

List

Provide utilities for list.

t

RE
type t('a) = list('a);

length

RE
let length: t('a) => int;

cons

RE
let cons: ('a, t('a)) => t('a);

isEmpty

RE
let isEmpty: t('a) => bool;

hd

RE
let hd: t('a) => option('a);

tl

RE
let tl: t('a) => option(t('a));

nth

RE
let nth: (t('a), int) => option('a);

revAppend

RE
let revAppend: (t('a), t('a)) => t('a);

rev

RE
let rev: t('a) => t('a);

mapRev

RE
let mapRev: ((. 'a) => 'b, t('a)) => t('b);

map

RE
let map: ((. 'a) => 'b, t('a)) => t('b);

iter

RE
let iter: ((. 'a) => unit, t('a)) => unit;

iteri

RE
let iteri: ((. int, 'a) => unit, t('a)) => unit;

foldLeft

RE
let foldLeft: ((. 'a, 'b) => 'a, 'a, list('b)) => 'a;

Application order is left to right, tail-recurisve.

foldRight

RE
let foldRight: ((. 'a, 'b) => 'b, list('a), 'b) => 'b;

Application order is right to left, tail-recursive.

flatten

RE
let flatten: t(t('a)) => t('a);

filter

RE
let filter: ((. 'a) => bool, t('a)) => t('a);

filterMap

RE
let filterMap: ((. 'a) => option('b), t('a)) => t('b);

countBy

RE
let countBy: ((. 'a) => bool, list('a)) => int;

init

RE
let init: (int, (. int) => 'a) => t('a);

toVector

RE
let toVector: t('a) => Js_vector.t('a);

equal

RE
let equal: ((. 'a, 'a) => bool, list('a), list('a)) => bool;

© 2024 The ReScript Project

Software and assets distribution powered by KeyCDN.

About
  • Community
  • ReScript Association
Find us on