Hot answers tagged

11 votes

Tips for golfing in APL

Use to combine multiplication with addition (a×b)+C -> a⊥b,C (C)+a×b -> a⊥b,C (a×b)-C -> a⊥b,-C Assumptions: ...
ngn's user avatar
  • 15.2k
10 votes

Tips for golfing in APL

Complex numbers Often overlooked, they present wonderful opportunities to shorten expressions dealing with grids, mazes, fractals, or geometry. ...
ngn's user avatar
  • 15.2k
10 votes

Tips for golfing in APL

Tricks for dealing with / and in trains When using trains you may want to use reductions f/...
Adám's user avatar
  • 29.9k
10 votes

What valence does this APL train have?

Haskell, 61 bytes f t=[and$zipWith(/=)t$[2|even$length t]++cycle[x,0]|x<-[2,0]] Try it online! Takes a list of: 0 for monad,...
Lynn's user avatar
  • 68.1k
10 votes

Floor of complex number

BQN, 14 bytesSBCS ⌊+·(⍋×1<+´)1⊸| Try it here. ...
frasiyav's user avatar
  • 779
9 votes

Official Dyalog APL 2016 Year Game

Hexagony, 888 bytes Okay, first some ground rules for Hexagony, in case anyone wants to beat this: I'm interpreting "snippet" as a linear piece of code that can be dumped into any sufficiently large ...
Martin Ender's user avatar
9 votes

Take that frown and turn it around

Python 3, 105 bytes lambda s:":⊢⍡⊣:▷⍢◁:⋆⍣⋆:∘⍤∘:○⍥○:≀⍨≀:∧⍩∨:".split(s)[1][:3-len(s)] Try it online!
xnor's user avatar
  • 144k
9 votes

Take that frown and turn it around

JavaScript (ES6), 108 107 bytes s=>(S="⊢▷⋆∘○≀∧⍡⍢⍣⍤⍥⍨⍩⊣◁⋆∘○≀∨")[S.search(s[1]||s)+7]+(s[1]?'':':') Demo ...
Arnauld's user avatar
  • 188k
9 votes

What have we got?

JavaScript (ES6),  145 ... 138  136 bytes Returns \$0\$ for dyadic dops, \$1\$ for monadic dops, \$2\$ for dfns and \$3\$ for other. ...
Arnauld's user avatar
  • 188k
9 votes

Ken Iverson’s Favourite APL Expression?

APL (Dyalog Unicode), 7 bytes +∘⌽⍨0,⊢ Try it online! Prepend a zero, and add the mirrored array: ...
Bubbler's user avatar
  • 73.8k
9 votes

Ken Iverson’s Favourite APL Expression?

Python 2, 34 bytes lambda l:map(sum,zip(l+[0],[0]+l)) Try it online! 37 bytes lambda l:map(int.__add__,l+[0],[0]+l) Try it ...
xnor's user avatar
  • 144k
8 votes
Accepted

Official Dyalog APL 2016 Year Game

Jelly, 686 bytes ...
Lynn's user avatar
  • 68.1k
8 votes

Official Dyalog APL 2016 Year Game

J, 1041 ... 838 bytes 981 961 952 860 859 I got a little lazy to the end, but it should be more fixed than less. I don't think I'll ever overtake Hexagony, but you never know! beating hexagony! ...
Conor O'Brien's user avatar
8 votes

Clearly parenthesize APL trains

APL (Dyalog Classic), 71 68 65 63 bytes 0{⍵≡⍕⍵:⍵⋄⍬≡⍵:'⍬'⋄1=≢⍵:⍺∇⊃⍵⋄3≥≢⍵:⍺⌽')(',⍣⍺∊1∇¨⍵⋄⍺∇¯3(↓,∘⊂1∇↑)⍵}⍎ Try it online! The characters I chose for I/O are ...
ngn's user avatar
  • 15.2k
8 votes

Implement 1-dimensional version of Multi-Take

APL (Dyalog Unicode), 58 50 bytes {{2⊃{⍵[⍒⍴¨⍵]}(⍺,⍵)A⍺(⍵,⍺↓⍨≢A)}/((⌈/,⌊/)0,⍵)↑¨⊂A←⎕} Try it online! What better way to implement this than in APL itself? That ...
fireflame241's user avatar
  • 16.2k
8 votes

What valence does this APL train have?

APL (Dyalog Unicode), 59 bytes (SBCS) Anonymous tacit prefix function. Returns [] if invalid, [[]] if dyadic, ...
Adám's user avatar
  • 29.9k
8 votes

Ken Iverson’s Favourite APL Expression?

Jelly, 2 bytes Ż+ A monadic Link accepting a list of integers which yields a list of integers. Try it online! How? Pretty simple in Jelly to go with the method ...
Jonathan Allan's user avatar
8 votes

Floor of complex number

J, 32 31 26 bytes j.&<.+((1<:+)*0j1^<)&(1|]) Try it online! -5 thanks to Razetime for pointing out I could take real and imag parts as left and ...
Jonah's user avatar
  • 33k
8 votes

Evaluation order of an APL n-train

J, 14 bytes [:\:0 _2#:i.@- Try it online! Alternative solution that makes use of divmod with negative divisor. How it works Example using ...
Bubbler's user avatar
  • 73.8k
7 votes

Tips for golfing in APL

Indexing modulo vector length ⊃i⌽a is often shorter than the naive ⊃a[(≢a)|i] or a⊃⍨i|⍨≢a (...
ngn's user avatar
  • 15.2k
7 votes

Tips for golfing in APL

Generate A001057, A130472, and many variations A001057 is a simple sequence of alternating integers, starting with 0, 1, -1, 2, -2, 3, -3, .... A130472 is its ...
Bubbler's user avatar
  • 73.8k
7 votes

Official Dyalog APL 2016 Year Game

Dyalog APL (This is a joke, please don't submit), 25,957 bytes. 2016⊢≢⍬ 2016⊢(⊢+≢)≢⍬ 2016⊢(⊢+≢)(⊢+≢)≢⍬ ... Yeah, this is a joke entry, we need an APL solution, ...
Adalynn's user avatar
  • 6,092
7 votes

Official Dyalog APL 2016 Year Game

JavaScript (ES7), 836 bytes Everything should work in any browser except 81, 88, and 97, which use the new ** operator. Mostly everything here was done by hand. I'...
ETHproductions's user avatar
7 votes

Official Dyalog APL 2016 Year Game

JavaScript, 1021 bytes Fixed and saved two bytes thanks to Charlie Wynn and ETHProductions. ...
ASCII-only's user avatar
  • 5,119
7 votes

Ken Iverson’s Favourite APL Expression?

05AB1E, 5 4 bytes 0šÂ+ Try it online or verify all test cases. Or alternatively: 0š+Ć -1 byte thanks to @ovs. Try it online or ...
Kevin Cruijssen's user avatar
7 votes

Ken Iverson’s Favourite APL Expression?

Factor, 27 bytes [ 0 suffix dup reverse v+ ] Try it online!
Galen Ivanov's user avatar
7 votes

Floor of complex number

R, 55 bytes function(x,y=x%%1)(x+(sum(y)>1)*c(z<-diff(y)<0,!z))%/%1 Try it online! Straightforward implementation of McDonnell's function. R, 71 bytes <...
Dominic van Essen's user avatar
6 votes

What have we got?

Jelly,  50 48 46  45 bytes Ỵµṣ”'m2Kṣ”#Ḣ)KµċⱮƤØ{IF©<-oµ⁾waż¤ẇ€‘Ḅ«5×®¬Ḅ⁼1¤ A monadic Link accepting a list of characters which yields: ...
Jonathan Allan's user avatar
6 votes

Implement 1-dimensional version of Multi-Take

JavaScript (ES6),  103 97  96 bytes Expects (A)(N). ...
Arnauld's user avatar
  • 188k
6 votes

Ken Iverson’s Favourite APL Expression?

Haskell, 26 25 bytes o l=zipWith(+)(0:l)l++[1] Try it online! Saved 1 thanks to @ovs New approach, it essentially do this: 0[1,2,1] + [1,2,1] = [1,3,3] + 1 ...
AZTECCO's user avatar
  • 10.6k

Only top scored, non community-wiki answers of a minimum length are eligible