Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

 7 make chain clearer. edited Oct 20 '15 at 20:16 Zgarb 38.9k44 gold badges6464 silver badges236236 bronze badges ! (apply) pops a function f and a value x from the stack, and applies f to x. If f has arity 1, the list f(x) is added to the front of the stack. If it has arity n > 1, a new (n-1)-ary function g is pushed to the stack. It takes inputs x1,x2,...,xn-1 and returns f(x,x1,x2,...,xn-1). ? (blank) pushes a blank to the stack. + (clone) pushes to the stack a unary function that duplicates its input: any value x is mapped to [x,x]. > (shift) pushes to the stack a unary function that takes in an n-ary function f, and returns an (n+1)-ary function g that ignores its first argument x, calls f on the remaining ones, and tacks x in front of the result. For example, shift(clone) is a binary function that takes inputs a,b and returns [a,b,b]. / (fork) pushes to the stack a ternary function that takes three inputs a,b,c, and returns [b] if a is a blank, and [c] otherwise. $ (call) pushes to the stack a binary function that pops a function f and a value x, and applies f to x exactly as ! does. . (chain) pushes to the stack a binary function that pops two functions f and g, and returns their composition: a function h that has the same arity as f, and which takes its inputs normally, applies f to them, and then fully applies g to the result (calls it as many times as its arity dictates), with unused items from the output of gf remaining in the result of h. For example, suppose that f is a binary function that clones its second argument, and g is call. If the stack contains [f,g,a,b,c] and we do .!!, then it contains [chain(f,g),a,b,c]; if we do !! next, then f is first applied to a,b, producing [a,b,b], then g is applied to the first two elements of that since its arity is 2, producing [a(b),b], and the stack will finally be [a(b),b,c]. @ (say) pushes a unary function that simply returns its input, and prints 0 if it was a blank, and 1 if it was a function. ! (apply) pops a function f and a value x from the stack, and applies f to x. If f has arity 1, the list f(x) is added to the front of the stack. If it has arity n > 1, a new (n-1)-ary function g is pushed to the stack. It takes inputs x1,x2,...,xn-1 and returns f(x,x1,x2,...,xn-1). ? (blank) pushes a blank to the stack. + (clone) pushes to the stack a unary function that duplicates its input: any value x is mapped to [x,x]. > (shift) pushes to the stack a unary function that takes in an n-ary function f, and returns an (n+1)-ary function g that ignores its first argument x, calls f on the remaining ones, and tacks x in front of the result. For example, shift(clone) is a binary function that takes inputs a,b and returns [a,b,b]. / (fork) pushes to the stack a ternary function that takes three inputs a,b,c, and returns [b] if a is a blank, and [c] otherwise. $ (call) pushes to the stack a binary function that pops a function f and a value x, and applies f to x exactly as ! does. . (chain) pushes to the stack a binary function that pops two functions f and g, and returns their composition: a function h that has the same arity as f, and which takes its inputs normally, applies f to them, and then fully applies g to the result (calls it as many times as its arity dictates), with unused items from the output of g remaining in the result of h. For example, suppose that f is a binary function that clones its second argument, and g is call. If the stack contains [f,g,a,b,c] and we do .!!, then it contains [chain(f,g),a,b,c]; if we do !! next, then f is first applied to a,b, producing [a,b,b], then g is applied to the first two elements of that since its arity is 2, producing [a(b),b], and the stack will finally be [a(b),b,c]. @ (say) pushes a unary function that simply returns its input, and prints 0 if it was a blank, and 1 if it was a function. ! (apply) pops a function f and a value x from the stack, and applies f to x. If f has arity 1, the list f(x) is added to the front of the stack. If it has arity n > 1, a new (n-1)-ary function g is pushed to the stack. It takes inputs x1,x2,...,xn-1 and returns f(x,x1,x2,...,xn-1). ? (blank) pushes a blank to the stack. + (clone) pushes to the stack a unary function that duplicates its input: any value x is mapped to [x,x]. > (shift) pushes to the stack a unary function that takes in an n-ary function f, and returns an (n+1)-ary function g that ignores its first argument x, calls f on the remaining ones, and tacks x in front of the result. For example, shift(clone) is a binary function that takes inputs a,b and returns [a,b,b]. / (fork) pushes to the stack a ternary function that takes three inputs a,b,c, and returns [b] if a is a blank, and [c] otherwise. $ (call) pushes to the stack a binary function that pops a function f and a value x, and applies f to x exactly as ! does. . (chain) pushes to the stack a binary function that pops two functions f and g, and returns their composition: a function h that has the same arity as f, and which takes its inputs normally, applies f to them, and then fully applies g to the result (calls it as many times as its arity dictates), with unused items from the output of f remaining in the result of h. For example, suppose that f is a binary function that clones its second argument, and g is call. If the stack contains [f,g,a,b,c] and we do .!!, then it contains [chain(f,g),a,b,c]; if we do !! next, then f is first applied to a,b, producing [a,b,b], then g is applied to the first two elements of that since its arity is 2, producing [a(b),b], and the stack will finally be [a(b),b,c]. @ (say) pushes a unary function that simply returns its input, and prints 0 if it was a blank, and 1 if it was a function. 6 make chain clearer. edit approved Oct 20 '15 at 20:16 Paŭlo Ebermann 1,00888 silver badges1515 bronze badges ! (apply) pops a function f and a value x from the stack, and applies f to x. If f has arity 1, the list f(x) is added to the front of the stack. If it has arity n > 1, a new (n-1)-ary function g is pushed to the stack. It takes inputs x1,x2,...,xn-1 and returns f(x,x1,x2,...,xn-1). ? (blank) pushes a blank to the stack. + (clone) pushes to the stack a unary function that duplicates its input: any value x is mapped to [x,x]. > (shift) pushes to the stack a unary function that takes in an n-ary function f, and returns an (n+1)-ary function g that ignores its first argument x, calls f on the remaining ones, and tacks x in front of the result. For example, shift(clone) is a binary function that takes inputs a,b and returns [a,b,b]. / (fork) pushes to the stack a ternary function that takes three inputs a,b,c, and returns [b] if a is a blank, and [c] otherwise. $ (call) pushes to the stack a binary function that pops a function f and a value x, and applies f to x exactly as ! does. . (chain) pushes to the stack a binary function that pops two functions f and g, and returns their composition: a function h that has the same arity as f, and which takes its inputs normally, applies f to them, and then fully applies g to the result (calls it as many times as its arity dictates), with unused items from the output of g remaining in the result of h. For example, suppose that f is a binary function that clones its second argument, and g is call. If the stack contains [f,g,a,b,c] and we do .!!, then it contains [chain(f,g),a,b,c]; if we do !! next, then f is first applied to a,b, producing [a,b,b], then g is applied to the first two elements of that since its arity is 2, producing [a(b),b], and the stack will finally be [a(b),b,c]. @ (say) pushes a unary function that simply returns its input, and prints 0 if it was a blank, and 1 if it was a function. ! (apply) pops a function f and a value x from the stack, and applies f to x. If f has arity 1, the list f(x) is added to the front of the stack. If it has arity n > 1, a new (n-1)-ary function g is pushed to the stack. It takes inputs x1,x2,...,xn-1 and returns f(x,x1,x2,...,xn-1). ? (blank) pushes a blank to the stack. + (clone) pushes to the stack a unary function that duplicates its input: any value x is mapped to [x,x]. > (shift) pushes to the stack a unary function that takes in an n-ary function f, and returns an (n+1)-ary function g that ignores its first argument x, calls f on the remaining ones, and tacks x in front of the result. For example, shift(clone) is a binary function that takes inputs a,b and returns [a,b,b]. / (fork) pushes to the stack a ternary function that takes three inputs a,b,c, and returns [b] if a is a blank, and [c] otherwise. $ (call) pushes to the stack a binary function that pops a function f and a value x, and applies f to x exactly as ! does. . (chain) pushes to the stack a binary function that pops two functions f and g, and returns their composition: a function h that has the same arity as f, and which takes its inputs normally, applies f to them, and then fully applies g to the result (calls it as many times as its arity dictates). For example, suppose that f is a binary function that clones its second argument, and g is call. If the stack contains [f,g,a,b,c] and we do .!!, then it contains [chain(f,g),a,b,c]; if we do !! next, then f is first applied to a,b, producing [a,b,b], then g is applied to the first two elements of that since its arity is 2, producing [a(b),b], and the stack will finally be [a(b),b,c]. @ (say) pushes a unary function that simply returns its input, and prints 0 if it was a blank, and 1 if it was a function. ! (apply) pops a function f and a value x from the stack, and applies f to x. If f has arity 1, the list f(x) is added to the front of the stack. If it has arity n > 1, a new (n-1)-ary function g is pushed to the stack. It takes inputs x1,x2,...,xn-1 and returns f(x,x1,x2,...,xn-1). ? (blank) pushes a blank to the stack. + (clone) pushes to the stack a unary function that duplicates its input: any value x is mapped to [x,x]. > (shift) pushes to the stack a unary function that takes in an n-ary function f, and returns an (n+1)-ary function g that ignores its first argument x, calls f on the remaining ones, and tacks x in front of the result. For example, shift(clone) is a binary function that takes inputs a,b and returns [a,b,b]. / (fork) pushes to the stack a ternary function that takes three inputs a,b,c, and returns [b] if a is a blank, and [c] otherwise. $ (call) pushes to the stack a binary function that pops a function f and a value x, and applies f to x exactly as ! does. . (chain) pushes to the stack a binary function that pops two functions f and g, and returns their composition: a function h that has the same arity as f, and which takes its inputs normally, applies f to them, and then fully applies g to the result (calls it as many times as its arity dictates), with unused items from the output of g remaining in the result of h. For example, suppose that f is a binary function that clones its second argument, and g is call. If the stack contains [f,g,a,b,c] and we do .!!, then it contains [chain(f,g),a,b,c]; if we do !! next, then f is first applied to a,b, producing [a,b,b], then g is applied to the first two elements of that since its arity is 2, producing [a(b),b], and the stack will finally be [a(b),b,c]. @ (say) pushes a unary function that simply returns its input, and prints 0 if it was a blank, and 1 if it was a function. 5 edited tags | link edited Oct 18 '15 at 12:45 Martin Ender 184k6161 gold badges407407 silver badges890890 bronze badges 4 Fixed issue with chain. edited Apr 24 '15 at 10:52 Zgarb 38.9k44 gold badges6464 silver badges236236 bronze badges 3 added 10 characters in body edited Apr 21 '15 at 7:41 Zgarb 38.9k44 gold badges6464 silver badges236236 bronze badges 2 Corrected the examples, and added some new ones. edited Apr 21 '15 at 7:31 Zgarb 38.9k44 gold badges6464 silver badges236236 bronze badges Tweeted twitter.com/#!/StackCodeGolf/status/589170742035611648 occurred Apr 17 '15 at 20:57 1 asked Apr 17 '15 at 16:56 Zgarb 38.9k44 gold badges6464 silver badges236236 bronze badges