Skip to content

Instantly share code, notes, and snippets.

@timhuff
Last active September 12, 2016 11:03
Show Gist options
  • Save timhuff/1245a19fceb4f6e30511b1d4832b4b6e to your computer and use it in GitHub Desktop.
Save timhuff/1245a19fceb4f6e30511b1d4832b4b6e to your computer and use it in GitHub Desktop.
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
then
3 3
else
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