Skip to content

Instantly share code, notes, and snippets.

@timhuff timhuff/explanation.pyth
Last active Sep 12, 2016

What would you like to do?
L?-b=dsm?.&.<1db3 4hlbydb@mXdH1mydSQ0
L create lambda function named y with param b
? ternary if
- minus used for expressing "if d != b"
b lambda param
= assign
d d =
s sum
m map
? if
.& bitwise and
.< bitshift
1 1 literal
d map lambda param
b input
3 3
4 4
hlb 2nd param of map - [0..log2(b)]
ternary then
yd return y(d)
ternary else
b return b
@ grab zeroth element from array
m map
X B[A] += C
d the map lambda param
H the default pyth H={}
1 increment by 1
m map
yd y(d)
SQ [1..input]
0 "zeroth element"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.