points by Avshalom 5 years ago

okay so it's not really smaller because it uses UTF8 also it relies on order of operations to get rid of the parens around ⍵≡'*' but

us←{('_'@(1+⍸2{(⍺≡⊃K)∧⍵≡'*'}/⍵))⍵}

is one(1) character shorter.

rak1507 5 years ago

⍵≡'*' should be ⍵≡,'*' like in the original k

us←⊃,⍥⊆2{(⍺≡⊃K)∧⍵≡,'*':,'_'⋄⍵}/⊢ is shorter anyway

  • geocar 5 years ago
        us←{'_'@{¯1⌽⍵⍷⍨(⊂⊃K),'*'}⍵}
    • rak1507 5 years ago

      Ah, ⍷, clever, don't even need the outer {...⍵},

        us←'_'@{¯1⌽⍵⍷⍨(⊂⊃K),'*'}
      • geocar 5 years ago

        Yes!

        You could also do: ⌽'*',⊂⊃K to save another character. I don't know if that's "better" though.

        • rak1507 5 years ago

          Or alternatively '*',⍨⊂⊃K which I think I prefer over ⌽, but neither seem that 'better' in my mind anyway.

wanderer2323 5 years ago

Is this the same language or a different one?

  • rak1507 5 years ago

    This is APL, k is a descendant of APL.