Comparisons between ayr
and a few other languages
Language | Program | Notes |
---|---|---|
ayr | , |
Works for arbitrary depth |
APL | (⊃,/)⍣≡ |
Works for arbitrary depth. Without ⍣≡ , it doesn't |
J | ; |
Doesn't work for arbitrary depth |
Haskell | concat |
Doesn't work for arbitrary depth |
Language | Program | Notes |
---|---|---|
ayr | */+/ |
|
APL | ×/+/ |
|
J | */+/"1 |
J's reduce operates on the data as a whole, instead of rank 1 by default |
Haskell | foldr (*) 1 . map (foldr (+) 0) |
Language | Program | Notes |
---|---|---|
ayr | ((=/+/)^.(</>&~."))'()'=\ |
:((|+/)^.1=>)(+/1 _1*)"'()'=\: |
APL | ((=/+/)∧(</⊃⍤⍸⍤1))'()'∘.=⊢ |
{((=/+/)∧'('=1⌷⍵/⍨∨⌿)'()'∘.=⍵} |
Language | Program | Notes |
---|---|---|
ayr | !\`~ |
:;1,1,"!&:~"~ |
APL | ⍉(∘.!⍨⍳) |
Language | Program | Notes |
---|---|---|
ayr | ,.\= |
+/&*\= |
APL | +.× |
∘.(+/⍤×)⍥↓∘⍉ |
K | +/'*\: |
|
J | +/ .* |
+/@:*"$ |
Language | Program | Notes |
---|---|---|
ayr | gol.ayr | |
Dyalog Extended | gol.apl |