Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
37 votes

How many arguments were passed?

Java (JDK 10), 11 bytes a->a.length Try it online!
Olivier Grégoire's user avatar
33 votes

How many arguments were passed?

JavaScript, 15 bytes [].push.bind(0) The Array.prototype.push function takes any number of arguments, adds them to its array, ...
apsillers's user avatar
  • 3,802
26 votes

Church Booleans

Haskell, 50 - 6 = 44 bytes -1 byte thanks to Khuldraeseth na'Barya, and -1 byte thanks to Christian Sievers. ...
Nitrodon's user avatar
  • 10.8k
25 votes

Implement an Over function

Haskell, 12 bytes f?g=(.f).g.f Try it online! Haskell was made for this. Let's unpack it: ...
xnor's user avatar
  • 150k
20 votes

How many arguments were passed?

JavaScript (ES6), 16 bytes (...a)=>a.length ...
tsh's user avatar
  • 36.2k
17 votes

How many arguments were passed?

Python 3, 15 bytes lambda*a:len(a) Try it online!
Leaky Nun's user avatar
  • 50.6k
17 votes
Accepted

How many arguments were passed?

Amstrad CPC Z80 binary call from BASIC, 1 byte, hex encoded C9 : RET (Also 2 and 5 byte versions, see below) Upon entry to the call, the number of ...
CJ Dennis's user avatar
  • 4,296
14 votes
Accepted

Church Booleans

Binary Lambda Calculus, 13.875 12.875 bytes (103 bits) Binary Lambda Calculus Language (BLC) by John Tromp is basically an efficient serialization format for lambda calculus. It is a great fit for ...
Pavel Potoček's user avatar
14 votes

Implement a zipwith function

Haskell, 22 bytes (.zip).(.).map.uncurry Try it online! Not particularly interesting, just a reimplementation of zipWith ...
orthocresol's user avatar
13 votes

Make a long type signature

Haskell with extensions, \$\ggg A(A(A(A(220,0),0),0),0)\$ Z::Z#Z#Z#Z#Z#Z#Z#Z#Z?Z data a?b=Z|S(a?b) type family m#n where Z#n=S n;S m#Z=m#S m;S m#S n=m#(S m#n) Try ...
dfeuer's user avatar
  • 1,207
13 votes

Find a Fixed Point

APL (Dyalog), 2 bytes ⍣= Try it online! NB: I define O←⍣= in the the input section due to a bug in that derived monadic ...
H.PWiz's user avatar
  • 11.7k
12 votes

How many arguments were passed?

Zsh, 7 5 bytes <<<$# Try it online!
Pavel's user avatar
  • 9,457
12 votes

Make me some curry

JavaScript (ES6), 35 bytes f=g=>g.length<2?g:a=>f(g.bind(f,a))
Neil's user avatar
  • 184k
12 votes

Make me some curry

Idris, 204 bytes ...
lynn's user avatar
  • 69.7k
12 votes

Implement a zipwith function

Trivial builtin answers Edit your answer into this post if it consists of a builtin which does the entire task by itself HBL, 0.5 bytes 2 (Not implemented in the ...
12 votes

Implement an argwhere function

Python 3.8 (pre-release), 45 bytes lambda l,F:[i for i,e in enumerate(l)if F(e)] Try it online! Looks like it won't get much shorter than this. Explanation: keep ...
ophact's user avatar
  • 3,184
12 votes

Point-free JavaScript: write a function runner

Why I believe this is impossible (as stated) There aren't very many JS builtins that call a function, and even fewer that call one with arbitrary arguments. The ones that I've found are the string ...
emanresu A's user avatar
  • 46.2k
12 votes

Function with memories of its past life

JavaScript (V8), 21 bytes f=s=>x=>f(x,print(s)) Try it online!
Arnauld's user avatar
  • 206k
11 votes

Make a long type signature

Haskell, 9·2663552 − 3 (≈ 1.02·10199750) A small (“small”) improvement over xnor’s 5⋅2262144 + 5. This is 99 bytes. ...
Anders Kaseorg's user avatar
11 votes

Find a Fixed Point

Haskell, 17 bytes until=<<((==)=<<) Try it online!
nimi's user avatar
  • 36k
11 votes

Tuple addition in pointfree

44 bytes Got this from \x y -> (fst x + fst y, snd x + snd y) (<*>).((,).).(.fst).(+).fst<*>(.snd).(+).snd Try ...
H.PWiz's user avatar
  • 11.7k
11 votes

Implement an Over function

Factor, 16 bytes [ bi@ rot call ] Try it online! Explanation: It's a quotation (anonymous function) that takes a quotation with stack effect ...
chunes's user avatar
  • 27.8k
11 votes

Simplify K combinatory logic expression

Perl 5 -p, 28 27 bytes s/@(.K)(\1*K)\1*K/$2/&&redo Try it online! How it works Each term in the \$K\$ calculus ...
Anders Kaseorg's user avatar
11 votes

Curry tips for Haskell programmers

Use ++ in patterns In Haskell we are used to handling lists with : as our pattern. Curry1 can do this but it can also use ...
Wheat Wizard's user avatar
  • 103k
10 votes

Find a Fixed Point

MATLAB, 41 bytes function x=g(f,x);while f(x)-x;x=f(x);end There is also this beauty that does not need function files. Unfortunately it is a little bit longer: <...
flawr's user avatar
  • 44.1k
10 votes

Church Booleans

Python 2, (-3?)  101  95 bytes David Beazley eat your heart out! -6 thanks to Chas Brown (moved the repeated : into the join text >.<) ...
Jonathan Allan's user avatar
10 votes

Point-free JavaScript: write a function runner

JavaScript (Node.js), 74 65 bytes [].forEach.bind([{[Symbol.split]:(c=Map.call).bind(c)}],''.split) Attempt This Online!
TwiN's user avatar
  • 4,820
9 votes

Tuple addition in pointfree

44 bytes -8 bytes thanks to Ørjan Johansen. -3 bytes thanks to Bruce Forte. (.).flip(.)<*>(zipWith(+).)$mapM id[fst,snd] Try it online! Translates to: <...
totallyhuman's user avatar
  • 17.4k

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