left-associative iterator for strings
right-associative iterator for strings
LeftFold( p, id, s )
RightFold( p, id, s )
anything; typically, a Maple procedure to iterate over string s
anything; initial value
The LeftFold( p, id, s ) function iterates procedure p over string s, composing the successive results from the left with the initial value id.
If s is the string argument abcde, then the value of the expression LeftFold( F, id, s ) is F⁡e,F⁡d,F⁡c,F⁡b,F⁡a,id.
Except for a more efficient implementation, this procedure is equivalent to the composition foldl⁡p,id,seq⁡t,t=s.
The RightFold( p, id, s ) function iterates procedure p over string s, composing the successive results from the right with the initial value id.
Except for a more efficient implementation, this procedure is equivalent to the composition foldr⁡p,id,seq⁡t,t=s.
These functions are part of the StringTools package, and so they can be used in the form LeftFold(..) only after executing the command with(StringTools). However, they can always be accessed through the long form of the command by using the form StringTools[LeftFold](..).
All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.
Download Help Document