Vyxapedia

Element - - Chunk Wrap

Characters:


Description

Wrap a list in chunks of a certain length / apply a function to every second item of a list


Overloads

  • any-num - a wrapped in chunks of length b
  • num-any - b wrapped in chunks of length a
  • any-lst - wrap a into chunks with lengths given in b, repeating if necessary
  • lst-any - wrap b into chunks with lengths given in a, repeating if necessary
  • any-fun - apply b to every second item of a ([a[0], b(a[1]), a[2], ...])
  • fun-any - apply a to every second item of b ([b[0], a(b[1]), b[2], ...])
  • str-str - split a on first occurrence of b

Examples

  • `abcdef` 2 ẇ = ⟨`ab`|`cd`|`ef`⟩
  • ⟨1|2|3|4|5|6⟩ 3 ẇ = ⟨⟨1|2|3⟩|⟨4|5|6⟩⟩
  • `abcdefghi` ⟨2|3|4⟩ ẇ = ⟨`ab`|`cde`|`fghi`⟩
  • ⟨1|2|3|4|5⟩ ⟨2|3⟩ ẇ = ⟨⟨1|2⟩|⟨3|4|5⟩⟩
  • ⟨1|2|3|4|5⟩ ⟨2|3|4⟩ ẇ = ⟨⟨1|2⟩|⟨3|4|5⟩⟩
  • ⟨1|2|3|4|5|6|7|8|9|10⟩ ⟨2|3⟩ ẇ = ⟨⟨1|2⟩|⟨3|4|5⟩|⟨6|7⟩|⟨8|9|10⟩⟩
  • ⟨`abc`|`def`|`ghi`|`jkl`⟩ 2 ẇ = ⟨⟨`abc`|`def`⟩|⟨`ghi`|`jkl`⟩⟩
  • ⟨`abc`|`def`|`ghi`|`jkl`⟩ ⟨2|3⟩ ẇ = ⟨⟨`abc`|`def`⟩|⟨`ghi`|`jkl`⟩⟩
  • `abcdefg` 2 ẇ = ⟨`ab`|`cd`|`ef`|`g`⟩
  • `abca` `a` ẇ = ⟨``|`bca`⟩
  • `defg` `g` ẇ = ⟨`def`|``⟩
  • `defg` `x` ẇ = ⟨`defg`⟩
  • ⟨1|2|3|4|5|6⟩ ⟨0|0|1|2|3⟩ ẇ = ⟨⟨⟩|⟨⟩|⟨1⟩|⟨2|3⟩|⟨4|5|6⟩⟩