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
|
'input1 [ s:to-number dup
|
||||||
@prev gt? [ &count v:inc ] if
|
@prev gt? [ &count v:inc ] if
|
||||||
!prev
|
!prev
|
||||||
&lines v:inc ] file:for-each-line
|
&lines v:inc ] file:for-each-line
|
||||||
|
|
||||||
@count n:put ASCII:LF c:put
|
@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
|
'seek-to var
|
||||||
|
|
||||||
@lines #2 - [
|
@lines #2 - [
|
||||||
@f file:read-line dup s:length #1 + &seek-to v:inc-by s:to-number
|
@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
|
#02 [ @f file:read-line s:to-number ] times
|
||||||
+ +
|
+ +
|
||||||
dup @prev gt? [ &count v:inc ] if !prev
|
dup @prev gt? [ &count v:inc ] if
|
||||||
@seek-to @f file:seek ] times
|
!prev
|
||||||
|
@seek-to @f file:seek ] times
|
||||||
|
|
||||||
@count n:put ASCII:LF c:put
|
@count n:put ASCII:LF c:put
|
||||||
@f file:close
|
@f file:close
|
||||||
|
|
Loading…
Reference in New Issue