Array.pairmatch()

From ZCubes Wiki
Jump to navigation Jump to search


Array.pairmatch(SomeAtFoldValue, SomeAtReverseFoldValue, SomeStartFrom)

Array.fold folds the array for the corresponding SomeAtFoldValue (and SomeAtReverseFoldValue), into subarrays if the value in the array element matches the given fold value. Array.pairmatch finds the matching pair of SomeAtFoldValue and returns the index. Used for internal advanced uses of parsing.

"a+[a+b]"

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

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

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


See Also

fold