Array.fold()

From ZCubes Wiki
Revision as of 21:35, 20 March 2020 by Joseph (talk | contribs) (→‎See Also)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Array.fold(SomeAtFoldValue, SomeAtReverseFoldValue)

For the corresponding SomeAtFoldValue (and SomeAtReverseFoldValue), fold the array into subarrays if the value in the array element matches the given fold value. "a+[a+b]"

  .split("")
  .fold("[").print()

[a,+, [[,a,+,b,] ] ]

(Compare this to the original string "a+[a+b]")


See Also

pairmatch

pastefolds