home.social

#apljk — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #apljk, aggregated by home.social.

  1. CW: Advent of Code 2025, day 8 in K

    init:1+!n:#:d:`I$","\'0:"08.in"
    ds:1_'ds@<ds:{(+/t*t:d[x]-d[y]),x,y}.'p@&</'p:+!n,n
    conn:{(x*~f)+x[y[0]]*f:x=x[y[1]]}
    steps:1000#
    :one:*/t 3#>t:.#'=init conn/steps ds
    :two:*/*+d {:[&/g=*g:conn[x;*y];*y;o[g;1_y]]}[init;ds]

    Part 2 takes a metric eternity to converge. There must be a better solution, but this will have to do for now.

    #AdventOfCode #AoC2025 #APLJK #ArrayProgramming

  2. CW: Advent of Code 2025, day 8 in K

    init:1+!n:#:d:`I$","\'0:"08.in"
    ds:1_'ds@<ds:{(+/t*t:d[x]-d[y]),x,y}.'p@&</'p:+!n,n
    conn:{(x*~f)+x[y[0]]*f:x=x[y[1]]}
    steps:1000#
    :one:*/t 3#>t:.#'=init conn/steps ds
    :two:*/*+d {:[&/g=*g:conn[x;*y];*y;o[g;1_y]]}[init;ds]

    Part 2 takes a metric eternity to converge. There must be a better solution, but this will have to do for now.

    #AdventOfCode #AoC2025 #APLJK #ArrayProgramming

  3. CW: Advent of Code 2025, day 8 in K

    init:1+!n:#:d:`I$","\'0:"08.in"
    ds:1_'ds@<ds:{(+/t*t:d[x]-d[y]),x,y}.'p@&</'p:+!n,n
    conn:{(x*~f)+x[y[0]]*f:x=x[y[1]]}
    steps:1000#
    :one:*/t 3#>t:.#'=init conn/steps ds
    :two:*/*+d {:[&/g=*g:conn[x;*y];*y;o[g;1_y]]}[init;ds]

    Part 2 takes a metric eternity to converge. There must be a better solution, but this will have to do for now.

    #AdventOfCode #AoC2025 #APLJK #ArrayProgramming

  4. CW: Advent of Code 2025, day 8 in K

    init:1+!n:#:d:`I$","\'0:"08.in"
    ds:1_'ds@<ds:{(+/t*t:d[x]-d[y]),x,y}.'p@&</'p:+!n,n
    conn:{(x*~f)+x[y[0]]*f:x=x[y[1]]}
    steps:1000#
    :one:*/t 3#>t:.#'=init conn/steps ds
    :two:*/*+d {:[&/g=*g:conn[x;*y];*y;o[g;1_y]]}[init;ds]

    Part 2 takes a metric eternity to converge. There must be a better solution, but this will have to do for now.

    #AdventOfCode #AoC2025 #APLJK #ArrayProgramming

  5. CW: Advent of Code 2025, day 8 in K

    init:1+!n:#:d:`I$","\'0:"08.in"
    ds:1_'ds@<ds:{(+/t*t:d[x]-d[y]),x,y}.'p@&</'p:+!n,n
    conn:{(x*~f)+x[y[0]]*f:x=x[y[1]]}
    steps:1000#
    :one:*/t 3#>t:.#'=init conn/steps ds
    :two:*/*+d {:[&/g=*g:conn[x;*y];*y;o[g;1_y]]}[init;ds]

    Part 2 takes a metric eternity to converge. There must be a better solution, but this will have to do for now.

    #AdventOfCode #AoC2025 #APLJK #ArrayProgramming

  6. CW: Advent of Code 2025, day 7 in K

    rng:!#*data:0:"07.in"
    spls:l@&0<#'l:&'"^"=1_data
    msks:(+/rng=/:(-1;1)+)@/:/:spls
    f:{spl:+/(n@&0<n)*msks[y]@&0<n:|/+t:(1_x)*/:rng=/:spls[y]
    str:(1_x)*~|/t
    ((+/0<n)+*x),str+spl}
    :(one;two):(*:;+/1_)@\:(0,"S"=*data) f/!# spls

    It was a pleasant surprise that a single fold could solve both parts.

    #AdventOfCode #AoC2025 #ArrayProgramming #APLJK

  7. CW: Advent of Code 2025, day 7 in K

    rng:!#*data:0:"07.in"
    spls:l@&0<#'l:&'"^"=1_data
    msks:(+/rng=/:(-1;1)+)@/:/:spls
    f:{spl:+/(n@&0<n)*msks[y]@&0<n:|/+t:(1_x)*/:rng=/:spls[y]
    str:(1_x)*~|/t
    ((+/0<n)+*x),str+spl}
    :(one;two):(*:;+/1_)@\:(0,"S"=*data) f/!# spls

    It was a pleasant surprise that a single fold could solve both parts.

    #AdventOfCode #AoC2025 #ArrayProgramming #APLJK

  8. CW: Advent of Code 2025, day 7 in K

    rng:!#*data:0:"07.in"
    spls:l@&0<#'l:&'"^"=1_data
    msks:(+/rng=/:(-1;1)+)@/:/:spls
    f:{spl:+/(n@&0<n)*msks[y]@&0<n:|/+t:(1_x)*/:rng=/:spls[y]
    str:(1_x)*~|/t
    ((+/0<n)+*x),str+spl}
    :(one;two):(*:;+/1_)@\:(0,"S"=*data) f/!# spls

    It was a pleasant surprise that a single fold could solve both parts.

    #AdventOfCode #AoC2025 #ArrayProgramming #APLJK

  9. CW: Advent of Code 2025, day 7 in K

    rng:!#*data:0:"07.in"
    spls:l@&0<#'l:&'"^"=1_data
    msks:(+/rng=/:(-1;1)+)@/:/:spls
    f:{spl:+/(n@&0<n)*msks[y]@&0<n:|/+t:(1_x)*/:rng=/:spls[y]
    str:(1_x)*~|/t
    ((+/0<n)+*x),str+spl}
    :(one;two):(*:;+/1_)@\:(0,"S"=*data) f/!# spls

    It was a pleasant surprise that a single fold could solve both parts.

    #AdventOfCode #AoC2025 #ArrayProgramming #APLJK

  10. CW: Advent of Code 2025, day 7 in K

    rng:!#*data:0:"07.in"
    spls:l@&0<#'l:&'"^"=1_data
    msks:(+/rng=/:(-1;1)+)@/:/:spls
    f:{spl:+/(n@&0<n)*msks[y]@&0<n:|/+t:(1_x)*/:rng=/:spls[y]
    str:(1_x)*~|/t
    ((+/0<n)+*x),str+spl}
    :(one;two):(*:;+/1_)@\:(0,"S"=*data) f/!# spls

    It was a pleasant surprise that a single fold could solve both parts.

    #AdventOfCode #AoC2025 #ArrayProgramming #APLJK

  11. CW: Advent of Code 2025, day 6 in K

    d:0:"06.in"
    op:(+/;*/)@"*"=op@&~" "=op:*|d
    :one:+/op@'+.'1_|d
    :two:+/op@'n 1_'.=+\~n:0,.'+|1_|d

    The fact that the input file was nearly valid K was helpful.

    #AdventOfCode #APLJK #AoC2025 #ArrayProgramming

  12. CW: Advent of Code 2025, day 6 in K

    d:0:"06.in"
    op:(+/;*/)@"*"=op@&~" "=op:*|d
    :one:+/op@'+.'1_|d
    :two:+/op@'n 1_'.=+\~n:0,.'+|1_|d

    The fact that the input file was nearly valid K was helpful.

    #AdventOfCode #APLJK #AoC2025 #ArrayProgramming

  13. CW: Advent of Code 2025, day 6 in K

    d:0:"06.in"
    op:(+/;*/)@"*"=op@&~" "=op:*|d
    :one:+/op@'+.'1_|d
    :two:+/op@'n 1_'.=+\~n:0,.'+|1_|d

    The fact that the input file was nearly valid K was helpful.

    #AdventOfCode #APLJK #AoC2025 #ArrayProgramming

  14. CW: Advent of Code 2025, day 6 in K

    d:0:"06.in"
    op:(+/;*/)@"*"=op@&~" "=op:*|d
    :one:+/op@'+.'1_|d
    :two:+/op@'n 1_'.=+\~n:0,.'+|1_|d

    The fact that the input file was nearly valid K was helpful.

    #AdventOfCode #APLJK #AoC2025 #ArrayProgramming

  15. CW: Advent of Code 2025, day 6 in K

    d:0:"06.in"
    op:(+/;*/)@"*"=op@&~" "=op:*|d
    :one:+/op@'+.'1_|d
    :two:+/op@'n 1_'.=+\~n:0,.'+|1_|d

    The fact that the input file was nearly valid K was helpful.

    #AdventOfCode #APLJK #AoC2025 #ArrayProgramming

  16. I just noticed the "Best Seller" sticker on my second hand copy of Alan Holt's Network Performance Analysis Using the J programming language. 😂 I love it but somehow I doubt the sticker #apljk #jlang

  17. CW: Advent of Code Day 25 - APL

    d←{⌊5÷⍨⍵+⍺}
    g←{⍵=0:''⋄r←5|⍵⋄r=3:'=',∇2d⍵⋄r=4:'-',∇1d⍵⋄(⍕r),∇0d⍵}
    ⌽1↓g+/∊{((⊂'210-='⍳⌽⍵)⌷3-⍳5)×5*⍳⍴⍵}¨⊃⎕NGET'input'1

    It's over. It's done. Whew!

    Not exactly elegant but it works. I might revisit it at a later time!

    #AdventOfCode #apljk #apl #AdventOfCode2022

  18. Well, I think it's time to re-watch Tracy Harms' J Programming Language talk again:
    youtu.be/RWYkx6-L04Q
    #jlang #apljk #array