package owl-base

  1. Overview
  2. Docs
OCaml Scientific and Engineering Computing - Base

Install

Dune Dependency

Authors

Maintainers

Sources

owl-1.0.0.tbz
sha256=d91ba09488edd602dad845f68db1f980a601bdbb55d9516e3b59681eca20debe
sha512=9b31c3474a94c3b11d1dedba00639e770737e61f2e724a1288066ed976e4d0f8afe891a430e17ecf525fbca92e433d71d1b66d3ba17d4e299a4f8fdc3b902461

doc/owl-base/Owl_utils_stack/index.html

Module Owl_utils_stack

Type definition
type 'a t

Type of a stack.

Basic functions
val make : unit -> 'a t

``make ()`` creates an empty stack.

val push : 'a t -> 'a -> unit

``push stack x`` pushes ``x`` into ``stack``.

val pop : 'a t -> 'a option

``pop stack`` pops the top element in ``stack``. It returns ``None`` if the ``stack`` is empty.

val peek : 'a t -> 'a option

``peek stack`` returns the value of top element in ``stack`` but it does not remove the element from the stack. ``None`` is returned if the stack is empty.

val is_empty : 'a t -> bool

Returns ``true`` if the stack is empty, otherwise ``false``.

val mem : 'a t -> 'a -> bool

``mem stack x`` checks whether ``x`` exist in ``stack``. The complexity is ``O(n)`` where ``n`` is the size of the ``stack``.

val memq : 'a t -> 'a -> bool

Similar to ``mem`` but physical equality is used for comparing values.

val to_array : 'a t -> 'a array

``to_array stack`` converts the elements in ``stack`` into an array.

OCaml

Innovation. Community. Security.