Problems (John Earnest) Pascal’s Triangle A classic exercise demonstrating “for-scan”. (1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1) Dereplicated Map Map a function x over y without recomputing duplicate values. f[{`0:,"f of ",$x;x+2};3 10 9 3 5 10] f of 3 f of 10 f of 9 f of 5 5 12 11 5 7 12 2x2 Matrix Determinant A nice use of dot-apply. f (3 8;4 6) -14 Longest Cycle Count Iterating on a permutation vector, how many steps is the longest cycle? f 1 2 3 0 4 f 1 0 3 4 2 3 f 0 1 2 3 4 1 Rising Edge “Number go up! Number good.” -business man f 3 3 4 5 4 6 9 0 0 1 1 0 1 1 Sign Iverson’s convention. f 34 -99 0 1 -1 0 Find a Function’s Name An everyday convenience function. boop: {x+1} f {x+1} "boop" Is Inverleave? Can you interleave x and y (merge without altering element orders) to arrive at z? f["don";"dogo";"dodongo"] 1 f["don";"dogo";"gododon"] 0 Merge Dictionaries Turn a list of dictionaries into a dictionary of lists. f (.,(`a;1);.,(`b;2);.((`a;3);(`b;4))) .((`a 1 3) (`b 2 4)) Distinct Names Tag duplicates by order of appearance. f ("foo";"bar";"foo";"quux";"zami";"bar") ("foo0" "bar0" "foo1" "quux0" "zami0" "bar1") Limit Run Length Cap runs of char z in y to length x. f[2;"xxxxOOxOOxxxOOx";"x"] "xxOOxOOxxOOx"