sequences.extras: adding change-last and change-last-unsafe.

db4
John Benediktsson 2013-10-12 16:40:51 -07:00
parent 8321aa1e6a
commit f6bd67ab46
2 changed files with 8 additions and 4 deletions

View File

@ -4,7 +4,8 @@
USING: accessors assocs calendar combinators environment fonts
formatting fry io io.streams.string kernel literals locals make
math math.order math.ranges pdf.canvas pdf.values pdf.wrap
sequences sorting splitting ui.text xml.entities ;
sequences sequences.extras sorting splitting ui.text
xml.entities ;
FROM: assocs => change-at ;
FROM: sequences => change-nth ;
FROM: pdf.canvas => draw-text ;
@ -245,9 +246,6 @@ M: table-row pdf-render
] [ 0 ] if*
] map nip ;
: change-last ( seq quot -- )
[ drop length 1 - ] [ change-nth ] 2bi ; inline
:: max-col-widths ( canvas rows -- widths )
H{ } clone :> widths
rows [

View File

@ -521,3 +521,9 @@ PRIVATE>
: reject! ( ... seq quot: ( ... elt -- ... ? ) -- ... subseq )
[ not ] compose filter! ; inline
: change-last ( seq quot -- )
[ drop length 1 - ] [ change-nth ] 2bi ; inline
: change-last-unsafe ( seq quot -- )
[ drop length 1 - ] [ change-nth-unsafe ] 2bi ; inline