charts.lines: make each2* output the last element

char-rename
Alexander Iljin 2017-01-19 00:24:13 +03:00 committed by John Benediktsson
parent 5a3ae9099d
commit f366f1f790
1 changed files with 6 additions and 3 deletions

View File

@ -162,9 +162,9 @@ ALIAS: y second
SYMBOL: elt
: each2* ( seq quot: ( prev next -- next' ) -- )
: each2* ( seq quot: ( prev next -- next' ) -- last )
[ unclip-slice elt ] dip '[
[ elt get swap @ elt set ] each
[ elt get swap @ elt set ] each elt get
] with-variable ; inline
:: (make-pair) ( prev next min max -- next' )
@ -190,7 +190,10 @@ SYMBOL: elt
]
}
[
drop [ chunks [ min max (make-pair) ] each2* ] { } make
drop [
chunks [ min max (make-pair) ] each2*
dup first y min max between? [ , ] [ drop ] if
] { } make
]
} case ;