MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/codegolf/comments/1pcgohf/advent_of_code_day_2/ns0tivi/?context=3
r/codegolf • u/dantose • Dec 02 '25
What do you guys have?
9 comments sorted by
View all comments
Show parent comment
2
Yep, you're right. |measure -su for it to be version-agnostic. -join'+'|iex also works instead.
|measure -su
-join'+'|iex
Down to 99:
(gc input.txt|% sp* `,|%{for([long]$i,$e=$_|% sp* -;$i-le$e){($i++)}})-match'^(.+)\1$'-join'+'|iex
I've been trying to remove the $i type-constraint. It doesn't have to be a [long] (unless it's being type-constrained); it just needs to be a numeric value before the first ++.
$i
[long]
++
Edit:
Also 99:
(gc input.txt|% sp* `,|%{for($i,$e=$_|% sp* -;$i-$e-1){$i-=0;($i++)}})-match'^(.+)\1$'-join'+'|iex
96:
(gc input.txt|% sp* `,|%{for($i,$e=$_|% sp* -;$i-$e-1){$i;$i-=-1}})-match'^(.+)\1$'-join'+'|iex
View all comments
Show parent comment
2
u/surfingoldelephant Dec 03 '25 edited Dec 03 '25
Yep, you're right.
|measure -sufor it to be version-agnostic.-join'+'|iexalso works instead.Down to 99:
I've been trying to remove the
$itype-constraint. It doesn't have to be a[long](unless it's being type-constrained); it just needs to be a numeric value before the first++.Edit:
Also 99:
96: