Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Substring/Factor/substring.factor
Normal file
20
Task/Substring/Factor/substring.factor
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
USING: math sequences kernel ;
|
||||
|
||||
! starting from n characters in and of m length
|
||||
: subseq* ( from length seq -- newseq ) [ over + ] dip subseq ;
|
||||
|
||||
! starting from n characters in, up to the end of the string
|
||||
: dummy ( seq n -- tailseq ) tail ;
|
||||
|
||||
! whole string minus last character
|
||||
: dummy1 ( seq -- headseq ) but-last ;
|
||||
|
||||
USING: fry sequences kernel ;
|
||||
! helper word
|
||||
: subseq-from-* ( subseq len seq quot -- seq ) [ nip ] prepose 2keep subseq* ; inline
|
||||
|
||||
! starting from a known character within the string and of m length;
|
||||
: subseq-from-char ( char len seq -- seq ) [ index ] subseq-from-* ;
|
||||
|
||||
! starting from a known substring within the string and of m length.
|
||||
: subseq-from-seq ( subseq len seq -- seq ) [ start ] subseq-from-* ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue