Handbook
Glossary
wrap-split-line ( string width -- elements )
Vocabulary
wrap
.
strings
.
private
Inputs
string
an
object
width
an
object
Outputs
elements
an
object
Definition
USING:
grouping
kernel
math
namespaces
sequences
splitting
wrap
wrap.strings
;
IN:
wrap.strings.private
:
wrap-split-line
( string width -- elements )
[
dup
[
" \t"
member?
not
]
find
drop
0
or
[
f
swap
]
[
cut
]
if-zero
" \t"
split
harvest
break-long-words?
get
]
dip
[
group
[
dup
length
1
<element>
]
map
]
curry
[
map
concat
]
curry
[
[
dup
length
1
<element>
]
map
]
if
swap
[
0
over
length
<element>
prefix
]
when*
;