further cleanup

This commit is contained in:
Nico 2021-12-01 19:52:13 +00:00
parent ed1870640c
commit 00c29ca217
1 changed files with 9 additions and 8 deletions

View File

@ -17,9 +17,9 @@ then loop through the file counting up. Retro has a nice word, for-each-line, th
~~~
'input1 [ s:to-number dup
@prev gt? [ &count v:inc ] if
!prev
&lines v:inc ] file:for-each-line
@prev gt? [ &count v:inc ] if
!prev
&lines v:inc ] file:for-each-line
@count n:put ASCII:LF c:put
~~~
@ -41,11 +41,12 @@ I'm not happy with this solution, but it works. Retro users, help me get better!
'seek-to var
@lines #2 - [
@f file:read-line dup s:length #1 + &seek-to v:inc-by s:to-number
#02 [ @f file:read-line s:to-number ] times
+ +
dup @prev gt? [ &count v:inc ] if !prev
@seek-to @f file:seek ] times
@f file:read-line dup s:length #1 + &seek-to v:inc-by s:to-number
#02 [ @f file:read-line s:to-number ] times
+ +
dup @prev gt? [ &count v:inc ] if
!prev
@seek-to @f file:seek ] times
@count n:put ASCII:LF c:put
@f file:close