FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [View Raw Code]   [Original HTTPS Page]

daScript/doc/source/stdlib/algorithm.rst at master · Shekn/daScript · GitHub

Latest commit

 

History

History
512 lines (354 loc) · 21.2 KB

File metadata and controls

512 lines (354 loc) · 21.2 KB

Miscelanious algorithms

The ALGORITHM module exposes collection of miscellaneous array manipulation algorithms.

All functions and symbols are in "algorithm" module, use require to get access to it.

require daslib/algorithm

Search

.. das:function:: lower_bound(a: array<auto(TT)> const; f: int const; l: int const; val: TT const)

lower_bound returns auto

argument argument type
a array<auto(TT)> const
f int const
l int const
val TT const

Returns an iterator pointing to the first element in the range [first, last) that is not less than (i.e. greater or equal to) value, or last if no such element is found.

.. das:function:: lower_bound(a: array<auto(TT)> const; val: TT const)

lower_bound returns auto

argument argument type
a array<auto(TT)> const
val TT const

Returns an iterator pointing to the first element in the range [first, last) that is not less than (i.e. greater or equal to) value, or last if no such element is found.

.. das:function:: lower_bound(a: array<auto(TT)> const; f: int const; l: int const; value: TT const; less: block<(a:TT const -&;b:TT const -&):bool> const)

lower_bound returns auto

argument argument type
a array<auto(TT)> const
f int const
l int const
value TT const
less block<(a:TT const;b:TT const):bool> const

Returns an iterator pointing to the first element in the range [first, last) that is not less than (i.e. greater or equal to) value, or last if no such element is found.

.. das:function:: lower_bound(a: array<auto(TT)> const; value: TT const; less: block<(a:TT const -&;b:TT const -&):bool> const)

lower_bound returns auto

argument argument type
a array<auto(TT)> const
value TT const
less block<(a:TT const;b:TT const):bool> const

Returns an iterator pointing to the first element in the range [first, last) that is not less than (i.e. greater or equal to) value, or last if no such element is found.

.. das:function:: binary_search(a: array<auto(TT)> const; val: TT const)

binary_search returns auto

argument argument type
a array<auto(TT)> const
val TT const

Returns true if an val appears within the range [f, last). Array a must be sorted.

.. das:function:: binary_search(a: array<auto(TT)> const; f: int const; last: int const; val: TT const)

binary_search returns auto

argument argument type
a array<auto(TT)> const
f int const
last int const
val TT const

Returns true if an val appears within the range [f, last). Array a must be sorted.

.. das:function:: binary_search(a: array<auto(TT)> const; val: TT const; less: block<(a:TT const -&;b:TT const -&):bool> const)

binary_search returns auto

argument argument type
a array<auto(TT)> const
val TT const
less block<(a:TT const;b:TT const):bool> const

Returns true if an val appears within the range [f, last). Array a must be sorted.

.. das:function:: binary_search(a: array<auto(TT)> const; f: int const; last: int const; val: TT const; less: block<(a:TT const -&;b:TT const -&):bool> const)

binary_search returns auto

argument argument type
a array<auto(TT)> const
f int const
last int const
val TT const
less block<(a:TT const;b:TT const):bool> const

Returns true if an val appears within the range [f, last). Array a must be sorted.

.. das:function:: lower_bound(a: auto const; f: int const; l: int const; val: auto const)

lower_bound returns auto

argument argument type
a auto const
f int const
l int const
val auto const

Returns an iterator pointing to the first element in the range [first, last) that is not less than (i.e. greater or equal to) value, or last if no such element is found.

.. das:function:: lower_bound(a: auto const; val: auto const)

lower_bound returns auto

argument argument type
a auto const
val auto const

Returns an iterator pointing to the first element in the range [first, last) that is not less than (i.e. greater or equal to) value, or last if no such element is found.

.. das:function:: lower_bound(a: auto const; f: int const; l: int const; val: auto(TT) const; less: block<(a:TT const -&;b:TT const -&):bool> const)

lower_bound returns auto

argument argument type
a auto const
f int const
l int const
val auto(TT) const
less block<(a:TT const;b:TT const):bool> const

Returns an iterator pointing to the first element in the range [first, last) that is not less than (i.e. greater or equal to) value, or last if no such element is found.

.. das:function:: lower_bound(a: auto const; val: auto(TT) const; less: block<(a:TT const -&;b:TT const -&):bool> const)

lower_bound returns auto

argument argument type
a auto const
val auto(TT) const
less block<(a:TT const;b:TT const):bool> const

Returns an iterator pointing to the first element in the range [first, last) that is not less than (i.e. greater or equal to) value, or last if no such element is found.

.. das:function:: binary_search(a: auto const; val: auto const)

binary_search returns auto

argument argument type
a auto const
val auto const

Returns true if an val appears within the range [f, last). Array a must be sorted.

.. das:function:: binary_search(a: auto const; f: int const; last: int const; val: auto const)

binary_search returns auto

argument argument type
a auto const
f int const
last int const
val auto const

Returns true if an val appears within the range [f, last). Array a must be sorted.

.. das:function:: binary_search(a: auto const; val: auto(TT) const; less: block<(a:TT const -&;b:TT const -&):bool> const)

binary_search returns auto

argument argument type
a auto const
val auto(TT) const
less block<(a:TT const;b:TT const):bool> const

Returns true if an val appears within the range [f, last). Array a must be sorted.

.. das:function:: binary_search(a: auto const; f: int const; last: int const; val: auto(TT) const; less: block<(a:TT const -&;b:TT const -&):bool> const)

binary_search returns auto

argument argument type
a auto const
f int const
last int const
val auto(TT) const
less block<(a:TT const;b:TT const):bool> const

Returns true if an val appears within the range [f, last). Array a must be sorted.

Array manipulation

.. das:function:: unique(a: array<auto(TT)>)

unique returns auto

argument argument type
a array<auto(TT)>

Returns array of the elements of a with duplicates removed.

.. das:function:: sort_unique(a: array<auto(TT)>)

sort_unique returns auto

argument argument type
a array<auto(TT)>

Returns array of the elements of a, sorted and with duplicates removed. The elements of a are sorted in ascending order. The resulted array has only unqiue elements.

.. das:function:: reverse(a: array<auto>)

reverse returns auto

argument argument type
a array<auto>

Returns array of the elements of a in reverse order.

.. das:function:: combine(a: array<auto(TT)> const; b: array<auto(TT)> const)

combine returns auto

argument argument type
a array<auto(TT)> const
b array<auto(TT)> const

Returns array of the elements of a and then b.

.. das:function:: reverse(a: auto)

reverse returns auto

argument argument type
a auto

Returns array of the elements of a in reverse order.

.. das:function:: combine(a: auto const; b: auto const)

combine returns auto

argument argument type
a auto const
b auto const

Returns array of the elements of a and then b.

Uncategorized

.. das:function:: erase_all(arr: auto; value: auto const)

erase_all returns auto

argument argument type
arr auto
value auto const

Erase all elements equal to value from arr

.. das:function:: topological_sort(nodes: array<auto(Node)> const)

topological_sort returns auto

argument argument type
nodes array<auto(Node)> const

Topological sort of a graph. Each node has an id, and set (table with no values) of dependencies. Dependency before represents a link from a node, which should appear in the sorted list before the node. Returns a sorted list of nodes.


Back | FazBrowse Home | New Git URL