• fl42v@lemmy.ml
    link
    fedilink
    arrow-up
    22
    arrow-down
    1
    ·
    10 months ago

    Fuck programming then, I’ll go read ancient Egyptian or some not-yet-deciphered crap. On the other hand, I bet it’s not that different from APL

    APLSC_matrix-3547335466

    • drcobaltjedi@programming.dev
      link
      fedilink
      arrow-up
      11
      arrow-down
      1
      ·
      10 months ago

      My old man told me he took one programming language in college and it was APL. Having looked at APL since becoming a software dev myself, I can understand why he hated it.

      It’s just so gross and hard to read

    • funkless_eck@sh.itjust.works
      link
      fedilink
      arrow-up
      7
      ·
      10 months ago

      On the other hand, which do you prefer, this:

       life ← {⊃1 ⍵ ∨.∧ 3 4 = +/ +⌿ ¯1 0 1 ∘.⊖ ¯1 0 1 ⌽¨ ⊂⍵}
      

      or this:

       MODE UNIVERSE = [upb OF class universe, upb OF class universe]BOOL; STRUCT( INT upb, BOOL lifeless, alive, PROC(REF UNIVERSE)VOID init, PROC(REF UNIVERSE)STRING repr, PROC(REF UNIVERSE, INT, INT)VOID insert glider, PROC(REF UNIVERSE)VOID next ) class universe = ( # upb = # 50, # lifeless = # FALSE, # alive = # TRUE, # PROC init = # (REF UNIVERSE self)VOID: FOR row index FROM LWB self TO UPB self DO init row(self[row index, ]) OD, # PROC repr = # (REF UNIVERSE self)STRING:( FORMAT cell = $b("[]", " ")$, horizon = $"+"n(UPB self)("--")"+"l$; FILE outf; STRING out; associate(outf, out); putf(outf, (horizon, $"|"n(UPB self)(f(cell))"|"l$, self, horizon)); close(outf); out ), # PROC insert glider = # (REF UNIVERSE self, INT row, col)VOID:( self[row-2, col+1] := TRUE; self[row-1, col+2] := TRUE; self[row, col:col+2] := (TRUE, TRUE, TRUE ) ), # PROC next = # (REF UNIVERSE self)VOID:( [0:2, LWB self-1:UPB self+1]BOOL window;  # init row(window[LWB window, ]); window[LWB self, 2 LWB window] := window[LWB self, 2 UPB window] := window[UPB window, 2 LWB window] := window[UPB window, 2 UPB window] := lifeless OF class universe;  window[LWB self, LWB self:UPB self] := self[LWB self, ]; FOR row FROM LWB self TO UPB self DO REF []BOOL next row = window[(row+1) MOD 3, ]; IF row NE UPB self THEN next row[LWB self:UPB self] := self[row+1, ] ELSE init row(next row) FI; FOR col FROM LWB self TO UPB self DO INT live := 0;  FOR row FROM row-1 TO row+1 DO REF[]BOOL window row = window[row MOD 3, ]; FOR col FROM col-1 TO col+1 DO IF window row[col] THEN live +:= 1 FI OD OD; self[row, col] := IF window[row MOD 3, col] THEN live -:=  live = 3 FI OD OD ) );