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
  • Twitter
  • GitHub
  • Forum
Belt Module
Overview
Belt
submodules
  • Array
  • Float
  • HashMap
    • String
    • Int
    HashSet
    • String
    • Int
    Id
    • MakeHashable
    • MakeHashableU
    • MakeComparable
    • MakeComparableU
  • Int
  • List
  • Map
    • Dict
    • String
    • Int
    MutableMap
    • String
    • Int
  • MutableQueue
  • MutableSet
    • String
    • Int
  • MutableStack
    • t
      t
    • v
      make
    • v
      clear
    • v
      copy
    • v
      push
    • v
      popUndefined
    • v
      pop
    • v
      topUndefined
    • v
      top
    • v
      isEmpty
    • v
      size
    • v
      forEachU
    • v
      forEach
    • v
      dynamicPopIterU
    • v
      dynamicPopIter
  • Option
  • Range
  • Result
  • Set
    • Dict
    • String
    • Int
    SortArray
    • String
    • Int
    API / Belt / Mutablestack

    MutableStack

    First in last out stack. This module implements stacks, with in-place modification.

    t

    RESCRIPT
    type t<'a>

    make

    RESCRIPT
    let make: unit => t<'a>

    Returns a new stack, initially empty.

    clear

    RESCRIPT
    let clear: t<'a> => unit

    Discard all elements from the stack.

    copy

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

    copy(x) O(1) operation, return a new stack.

    push

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

    popUndefined

    RESCRIPT
    let popUndefined: t<'a> => Js.undefined<'a>

    pop

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

    topUndefined

    RESCRIPT
    let topUndefined: t<'a> => Js.undefined<'a>

    top

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

    isEmpty

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

    size

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

    forEachU

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

    forEach

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

    dynamicPopIterU

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

    dynamicPopIter

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

    dynamicPopIter(s, f) apply f to each element of s. The item is poped before applying f, s will be empty after this opeartion. This function is useful for worklist algorithm.

    Types and values
    • t
      t
    • v
      make
    • v
      clear
    • v
      copy
    • v
      push
    • v
      popUndefined
    • v
      pop
    • v
      topUndefined
    • v
      top
    • v
      isEmpty
    • v
      size
    • v
      forEachU
    • v
      forEach
    • v
      dynamicPopIterU
    • v
      dynamicPopIter

    © 2024 The ReScript Project

    Software and assets distribution powered by KeyCDN.

    About
    • Community
    • ReScript Association
    Find us on