Simplify using iteration
parent
dd759b1e13
commit
ca781ea739
|
@ -28,16 +28,8 @@ IN: ctags.etags
|
||||||
: ctag-hash ( seq -- hash )
|
: ctag-hash ( seq -- hash )
|
||||||
H{ } clone swap [ swap ctag-add ] each ;
|
H{ } clone swap [ swap ctag-add ] each ;
|
||||||
|
|
||||||
: line>bytes ( n seq -- bytes )
|
: lines>bytes ( seq n -- bytes )
|
||||||
nth length 1+ ;
|
head 0 [ length 1+ + ] reduce ;
|
||||||
|
|
||||||
: lines>bytes ( n seq -- bytes )
|
|
||||||
over zero? [
|
|
||||||
line>bytes ] [
|
|
||||||
[
|
|
||||||
[ 1- ] dip lines>bytes
|
|
||||||
] 2keep line>bytes +
|
|
||||||
] if ;
|
|
||||||
|
|
||||||
: file>lines ( resource -- lines )
|
: file>lines ( resource -- lines )
|
||||||
ascii file-lines ;
|
ascii file-lines ;
|
||||||
|
@ -48,7 +40,7 @@ IN: ctags.etags
|
||||||
1 HEX: 7f <string> %
|
1 HEX: 7f <string> %
|
||||||
second dup number>string %
|
second dup number>string %
|
||||||
1 CHAR: , <string> %
|
1 CHAR: , <string> %
|
||||||
2 - swap lines>bytes number>string %
|
1- lines>bytes number>string %
|
||||||
] "" make ;
|
] "" make ;
|
||||||
|
|
||||||
: etag-entry ( alist -- alist array )
|
: etag-entry ( alist -- alist array )
|
||||||
|
|
Loading…
Reference in New Issue