further cleanup
This commit is contained in:
parent
ed1870640c
commit
00c29ca217
17
day1.retro
17
day1.retro
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue