    @sputter(t:tab, p:float, n:numeric)

is an impure function returning a new tab of length `n`. This tab is filled as follows:

- The process starts with a current value initialized with the first element in `t`.

- Successively, for each element \(e\) in the result, a random number \(p'\) between 0 and 1 is compared with `p`:

  - if \(p'\) it is lower than `p`, then \(c\) becomes the value of \(e\) and the element next \(e\) is processed.

  - If \(p'\) it is greater than `p`, then \(c\) takes the value of the next element in `t`, this new value becomes the value of \(e\) and the element next \(e\) is processed.

Not that this function is impure as it returns a different result for each invocation. For example:

           @sputter([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 0.5, 16)

can return

            → [ 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6, 6, 7, 8, 8, 9 ]
            → [ 1, 2, 3, 3, 4, 5, 6, 7, 8, 8, 9, 9, 9, 9, 10 ]
            → [ 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 5, 5, 5 ]

See also tab related functions: @car, @cdr, @clear, @concat, @cons, @copy, @count, @dim, @domain, @drop, @empty, @explode, @find, @flatten, @gnuplot, @insert, @iota, @is_list, @is_prefix, @is_subsequence, @is_suffix, @lace, @last, @listify, @map, @max_val, @median, @member, @normalize, @occurs, @permute, @push_back, @push_front, @range, @reduce, @remove, @remove_duplicate, @replace, @resize, @reverse, @rotate, @scan, @scramble, @size, @slice, @sort, @sputter, @stutter, @tab_history, @tab_history_date, @tab_history_rdate, @take

#### Search

From here you can search these documents. Enter your search terms below.