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. CW: Advent of Code 2025, day 5 in K

    nr:*&~#'d:0:"05.in"
    rng@:<rng:`I$"-"\'nr# d
    ids:`I$(nr+1)_d
    merge:{:[~#:y
    ,x
    x[1]<y[0;0]-1
    (,x),o[*y;1_y]
    o[x[0],(x[1]|y[0;1])
    1_y]]}
    :one:+/|/+({~(z<x)|z>y}.'rng)@\:/:ids
    :two:+/1+--/'merge[*rng;1_rng]

    #AdventOfCode #AoC2025 #APLJK

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

    nr:*&~#'d:0:"05.in"
    rng@:<rng:`I$"-"\'nr# d
    ids:`I$(nr+1)_d
    merge:{:[~#:y
    ,x
    x[1]<y[0;0]-1
    (,x),o[*y;1_y]
    o[x[0],(x[1]|y[0;1])
    1_y]]}
    :one:+/|/+({~(z<x)|z>y}.'rng)@\:/:ids
    :two:+/1+--/'merge[*rng;1_rng]

    #AdventOfCode #AoC2025 #APLJK

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

    nr:*&~#'d:0:"05.in"
    rng@:<rng:`I$"-"\'nr# d
    ids:`I$(nr+1)_d
    merge:{:[~#:y
    ,x
    x[1]<y[0;0]-1
    (,x),o[*y;1_y]
    o[x[0],(x[1]|y[0;1])
    1_y]]}
    :one:+/|/+({~(z<x)|z>y}.'rng)@\:/:ids
    :two:+/1+--/'merge[*rng;1_rng]

    #AdventOfCode #AoC2025 #APLJK

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

    nr:*&~#'d:0:"05.in"
    rng@:<rng:`I$"-"\'nr# d
    ids:`I$(nr+1)_d
    merge:{:[~#:y
    ,x
    x[1]<y[0;0]-1
    (,x),o[*y;1_y]
    o[x[0],(x[1]|y[0;1])
    1_y]]}
    :one:+/|/+({~(z<x)|z>y}.'rng)@\:/:ids
    :two:+/1+--/'merge[*rng;1_rng]

    #AdventOfCode #AoC2025 #APLJK

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

    nr:*&~#'d:0:"05.in"
    rng@:<rng:`I$"-"\'nr# d
    ids:`I$(nr+1)_d
    merge:{:[~#:y
    ,x
    x[1]<y[0;0]-1
    (,x),o[*y;1_y]
    o[x[0],(x[1]|y[0;1])
    1_y]]}
    :one:+/|/+({~(z<x)|z>y}.'rng)@\:/:ids
    :two:+/1+--/'merge[*rng;1_rng]

    #AdventOfCode #AoC2025 #APLJK

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

    pad:+z'+(z:0,|0,|:)'
    d:pad"@"=0:"04.in"
    sh:{y w!x+!w:#:y}
    eight:(n w@;n e@;s w@;s e@
    e:+s@+:
    w:+n@+:
    n:sh[1;]
    s:sh[-1;])
    acc:{x*4>+/eight@\:x}
    :one:+//acc d
    :two:+//d-{x*~acc x}/d

    array problems 🤝 array programming languages

    #AdventOfCode #AoC2025 #APLJK

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

    pad:+z'+(z:0,|0,|:)'
    d:pad"@"=0:"04.in"
    sh:{y w!x+!w:#:y}
    eight:(n w@;n e@;s w@;s e@
    e:+s@+:
    w:+n@+:
    n:sh[1;]
    s:sh[-1;])
    acc:{x*4>+/eight@\:x}
    :one:+//acc d
    :two:+//d-{x*~acc x}/d

    array problems 🤝 array programming languages

    #AdventOfCode #AoC2025 #APLJK

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

    pad:+z'+(z:0,|0,|:)'
    d:pad"@"=0:"04.in"
    sh:{y w!x+!w:#:y}
    eight:(n w@;n e@;s w@;s e@
    e:+s@+:
    w:+n@+:
    n:sh[1;]
    s:sh[-1;])
    acc:{x*4>+/eight@\:x}
    :one:+//acc d
    :two:+//d-{x*~acc x}/d

    array problems 🤝 array programming languages

    #AdventOfCode #AoC2025 #APLJK

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

    pad:+z'+(z:0,|0,|:)'
    d:pad"@"=0:"04.in"
    sh:{y w!x+!w:#:y}
    eight:(n w@;n e@;s w@;s e@
    e:+s@+:
    w:+n@+:
    n:sh[1;]
    s:sh[-1;])
    acc:{x*4>+/eight@\:x}
    :one:+//acc d
    :two:+//d-{x*~acc x}/d

    array problems 🤝 array programming languages

    #AdventOfCode #AoC2025 #APLJK

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

    pad:+z'+(z:0,|0,|:)'
    d:pad"@"=0:"04.in"
    sh:{y w!x+!w:#:y}
    eight:(n w@;n e@;s w@;s e@
    e:+s@+:
    w:+n@+:
    n:sh[1;]
    s:sh[-1;])
    acc:{x*4>+/eight@\:x}
    :one:+//acc d
    :two:+//d-{x*~acc x}/d

    array problems 🤝 array programming languages

    #AdventOfCode #AoC2025 #APLJK

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

    w:#*data:`I$''0:"03.in"
    step:{(acc;len;row):x
    :[len=# acc
    x
    (acc,row i
    len
    row*~(!w)<1+i:*>((# acc)+1+w-len)# row)]}
    solve:{+/{`I$,/$*step/(();x;y)}[x;]'data}
    :(one;two):solve'2 12

    Great fun today.

    #AdventOfCode #APLJK

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

    w:#*data:`I$''0:"03.in"
    step:{(acc;len;row):x
    :[len=# acc
    x
    (acc,row i
    len
    row*~(!w)<1+i:*>((# acc)+1+w-len)# row)]}
    solve:{+/{`I$,/$*step/(();x;y)}[x;]'data}
    :(one;two):solve'2 12

    Great fun today.

    #AdventOfCode #APLJK

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

    w:#*data:`I$''0:"03.in"
    step:{(acc;len;row):x
    :[len=# acc
    x
    (acc,row i
    len
    row*~(!w)<1+i:*>((# acc)+1+w-len)# row)]}
    solve:{+/{`I$,/$*step/(();x;y)}[x;]'data}
    :(one;two):solve'2 12

    Great fun today.

    #AdventOfCode #APLJK

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

    w:#*data:`I$''0:"03.in"
    step:{(acc;len;row):x
    :[len=# acc
    x
    (acc,row i
    len
    row*~(!w)<1+i:*>((# acc)+1+w-len)# row)]}
    solve:{+/{`I$,/$*step/(();x;y)}[x;]'data}
    :(one;two):solve'2 12

    Great fun today.

    #AdventOfCode #APLJK

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

    w:#*data:`I$''0:"03.in"
    step:{(acc;len;row):x
    :[len=# acc
    x
    (acc,row i
    len
    row*~(!w)<1+i:*>((# acc)+1+w-len)# row)]}
    solve:{+/{`I$,/$*step/(();x;y)}[x;]'data}
    :(one;two):solve'2 12

    Great fun today.

    #AdventOfCode #APLJK

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

    data:0:"01.in"
    sign:+/(-1;1)*"LR"=\:data[;0]
    count:+/0=100!
    :one:count pos:+\50,sign*rot:`I$1_'data
    base:1_{y&-1+x}':pos
    :two: +/base {count x+1+!y}' rot

    This should be executable using codeberg.org/ngn/k

    #AdventOfCode #APLJK

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

    data:0:"01.in"
    sign:+/(-1;1)*"LR"=\:data[;0]
    count:+/0=100!
    :one:count pos:+\50,sign*rot:`I$1_'data
    base:1_{y&-1+x}':pos
    :two: +/base {count x+1+!y}' rot

    This should be executable using codeberg.org/ngn/k

    #AdventOfCode #APLJK

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

    data:0:"01.in"
    sign:+/(-1;1)*"LR"=\:data[;0]
    count:+/0=100!
    :one:count pos:+\50,sign*rot:`I$1_'data
    base:1_{y&-1+x}':pos
    :two: +/base {count x+1+!y}' rot

    This should be executable using codeberg.org/ngn/k

    #AdventOfCode #APLJK

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

    data:0:"01.in"
    sign:+/(-1;1)*"LR"=\:data[;0]
    count:+/0=100!
    :one:count pos:+\50,sign*rot:`I$1_'data
    base:1_{y&-1+x}':pos
    :two: +/base {count x+1+!y}' rot

    This should be executable using codeberg.org/ngn/k

    #AdventOfCode #APLJK

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

    data:0:"01.in"
    sign:+/(-1;1)*"LR"=\:data[;0]
    count:+/0=100!
    :one:count pos:+\50,sign*rot:`I$1_'data
    base:1_{y&-1+x}':pos
    :two: +/base {count x+1+!y}' rot

    This should be executable using codeberg.org/ngn/k

    #AdventOfCode #APLJK

  36. I will be in Toronto in the week of April 15th. I’d love to meet you and chat. Get in touch, let’s grab a lunch. A rough list of interests and potential conversation starters → #SoftwareArchitecture #DataDrivenProgramming #FunctionalProgramming #ProgrammingLanguages #Clojure #Erlang #APLJK #SmallWeb #DarkSouls #Coffee #StayAtHomeDad #Kettlebells #Toronto

  37. Just merged support for user defined functions (lambdas) in my #k interpreter written in #rust: #rok.
    Next up, conditionals: $[expr,expr,expr]
    #apljk #apl

    github.com/AshyIsMe/rok/blob/m

  38. Just merged support for user defined functions (lambdas) in my #k interpreter written in #rust: #rok.
    Next up, conditionals: $[expr,expr,expr]
    #apljk #apl

    github.com/AshyIsMe/rok/blob/m

  39. Just merged support for user defined functions (lambdas) in my #k interpreter written in #rust: #rok.
    Next up, conditionals: $[expr,expr,expr]
    #apljk #apl

    github.com/AshyIsMe/rok/blob/m

  40. CW: AoC Day 10 Part 1 in Uiua

    Map ← ⍥(⍉≡(⊂⊂⊙:.@.))2 ⊜∘≠@\n.&fras"10.in"
    Inf ← 9999 # applied infinity
    F ← +×Inf=0./+⊞=:Map
    D ← F"|LJ"
    U ← F"|7F"
    R ← F"-J7"
    L ← F"-FL"
    M ← ↧+1×
    TD ← M D ↻¯1.
    TU ← M U ↻ 1.
    TR ← M R≡↻¯1.
    TL ← M L≡↻ 1.
    T ← TU TL TD TR
    -1/↥/↥×≠Inf⍢(T.⊙;)(¬≍)⊃∘(×0) F"S"

    #AdventOfCode #Uiua #ArrayProgramming #APLJK

  41. CW: AoC Day 10 Part 1 in Uiua

    Map ← ⍥(⍉≡(⊂⊂⊙:.@.))2 ⊜∘≠@\n.&fras"10.in"
    Inf ← 9999 # applied infinity
    F ← +×Inf=0./+⊞=:Map
    D ← F"|LJ"
    U ← F"|7F"
    R ← F"-J7"
    L ← F"-FL"
    M ← ↧+1×
    TD ← M D ↻¯1.
    TU ← M U ↻ 1.
    TR ← M R≡↻¯1.
    TL ← M L≡↻ 1.
    T ← TU TL TD TR
    -1/↥/↥×≠Inf⍢(T.⊙;)(¬≍)⊃∘(×0) F"S"

    #AdventOfCode #Uiua #ArrayProgramming #APLJK

  42. CW: AoC Day 10 Part 1 in Uiua

    Map ← ⍥(⍉≡(⊂⊂⊙:.@.))2 ⊜∘≠@\n.&fras"10.in"
    Inf ← 9999 # applied infinity
    F ← +×Inf=0./+⊞=:Map
    D ← F"|LJ"
    U ← F"|7F"
    R ← F"-J7"
    L ← F"-FL"
    M ← ↧+1×
    TD ← M D ↻¯1.
    TU ← M U ↻ 1.
    TR ← M R≡↻¯1.
    TL ← M L≡↻ 1.
    T ← TU TL TD TR
    -1/↥/↥×≠Inf⍢(T.⊙;)(¬≍)⊃∘(×0) F"S"

    #AdventOfCode #Uiua #ArrayProgramming #APLJK