Array.fold()

From ZCubes Wiki
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