Comment by kragen
6 months ago
Witness the chaos you have unloosed upon the world; not even little Lua is safe:
> =dd-{"Todo","es","bueno"} /call("gsub", "[aeiou]", "i") /call("rep", 2) /call "lower"
{"tiditidi", "isis", "biinibiini"}
> ps={{x=5, y=7}, {x=5, y=4}, {x=3, y=4}}
> =dd-ps/get"x"
{5, 5, 3}
> =dd-ps/where {y=4}
{[2] = {y=4, x=5}, [3] = {y=4, x=3}}
> =dd-ps/group "x"
{[5] = {{x=5, y=7}, {x=5, y=4}}, [3] = {{x=3, y=4}}}
> =dd-ps/group "x"/get(1)
{[5] = {x=5, y=7}, [3] = {x=3, y=4}}
> =dd-ps/group "x"/map(get"y")
{[5] = {7, 4}, [3] = {4}
> =dd-ps/group "x"/map(get"y")/map(max)
{[5] = 7, [3] = 4}
> =dd-ps/group "x"/map(get"y")/map(max)/min
4
> =dd-ps/group "x"/map(get"y")/map(max)/sum
11
> =dd-ps/where(function(p) return 9 < p.x+p.y end)
{[2] = {y=6, x=8}}
> function bytes(s) return {s:byte(1,#s)} end
> =dd-{"hey", "you"}/map(bytes)
{{104, 101, 121}, {121, 111, 117}}
> =dd-{"hey", "you"}/map(bytes)/flat/freq
{[111] = 1, [101] = 1, [104] = 1, [121] = 2, [117] = 1}
No comments yet
Contribute on Hacker News ↗