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
Belt Stdlib
Overview
  • Introduction
Basics
  • Array
  • List
  • Float
  • Int
  • Range
  • Id
  • Option
  • Result
Set
  • HashSet
  • HashSetInt
  • HashSetString
  • Set
  • SetDict
  • SetInt
  • SetString
Map
  • HashMap
  • HashMapInt
  • HashMapString
  • Map
  • MapDict
  • MapInt
  • MapString
Mutable Collections
  • MutableMap
  • MutableMapInt
  • MutableMapString
  • MutableQueue
  • MutableSet
  • MutableSetInt
  • MutableSetString
  • MutableStack
    • t
    • clear
    • copy
    • dynamicPopIter
    • dynamicPopIterU
    • forEach
    • forEachU
    • isEmpty
    • make
    • pop
    • popUndefined
    • push
    • size
    • top
    • topUndefined
Sort Collections
  • SortArray
  • SortArrayInt
  • SortArrayString
Utilities
  • Debug
API / Belt / MutableStack

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)

MutableStack

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

t

type t('a);

make

let make: unit => t('a);

Returns a new stack, initially empty.

clear

let clear: t('a) => unit;

Discard all elements from the stack.

copy

let copy: t('a) => t('a);

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

push

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

popUndefined

let popUndefined: t('a) => Js.undefined('a);

pop

let pop: t('a) => option('a);

topUndefined

let topUndefined: t('a) => Js.undefined('a);

top

let top: t('a) => option('a);

isEmpty

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

size

let size: t('a) => int;

forEachU

let forEachU: (t('a), [@bs] ('a => unit)) => unit;

forEach

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

dynamicPopIterU

let dynamicPopIterU: (t('a), [@bs] ('a => unit)) => unit;

dynamicPopIter

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.

© 2024 The ReScript Project

Software and assets distribution powered by KeyCDN.

About
  • Community
  • ReScript Association
Find us on