Paste: .cut - print lines to avoid sidescrolling
Author: | rien |
Mode: | factor |
Date: | Tue, 11 Oct 2011 06:50:07 |
Plain Text |
: (.cut) ( vec str n -- vec str n )
2dup swap length <
[ [ cut ] keep
[ [| v x xs | x v push v xs ] call ] dip (.cut) ] [ ] if ;
: .cut ( str n -- )
0 <vector> -rot (.cut) drop swap [ push ] keep [ . ] each ;
"this is a very long string and it's highly annoying to read a long string by having to scroll sideways. " dup [ append ] curry 2 swap times 60 .cut
"this is a very long string and it's highly annoying to read "
"a long string by having to scroll sideways. this is a very l"
"ong string and it's highly annoying to read a long string by"
" having to scroll sideways. this is a very long string and i"
"t's highly annoying to read a long string by having to scrol"
"l sideways. "
New Annotation