sequences: adding second-, third-, and fourth- unsafe words.

db4
John Benediktsson 2012-09-19 10:07:03 -07:00
parent 2643ecc646
commit 3decf30626
1 changed files with 7 additions and 5 deletions

View File

@ -113,17 +113,19 @@ INSTANCE: iota immutable-sequence
<PRIVATE
: first-unsafe ( seq -- first )
0 swap nth-unsafe ; inline
: first-unsafe ( seq -- first ) 0 swap nth-unsafe ; inline
: second-unsafe ( seq -- second ) 1 swap nth-unsafe ; inline
: third-unsafe ( seq -- third ) 2 swap nth-unsafe ; inline
: fourth-unsafe ( seq -- fourth ) 3 swap nth-unsafe ; inline
: first2-unsafe ( seq -- first second )
[ first-unsafe ] [ 1 swap nth-unsafe ] bi ; inline
[ first-unsafe ] [ second-unsafe ] bi ; inline
: first3-unsafe ( seq -- first second third )
[ first2-unsafe ] [ 2 swap nth-unsafe ] bi ; inline
[ first2-unsafe ] [ third-unsafe ] bi ; inline
: first4-unsafe ( seq -- first second third fourth )
[ first3-unsafe ] [ 3 swap nth-unsafe ] bi ; inline
[ first3-unsafe ] [ fourth-unsafe ] bi ; inline
: exchange-unsafe ( m n seq -- )
[ [ nth-unsafe ] curry bi@ ]