- first-class function
- when you can store a function in a variable
- anonymous function
- a function without a name
- closures and pure functions
- closure - function with at least one free variable (variable defined elsewhere)
- pure function - a function where the variables are bound to the function's scope
- also, a function that always returns the same output for some input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public static class Colors | |
{ | |
public static readonly Color AbsoluteZero = new Color32( 0, 72, 186, 255 ); | |
public static readonly Color Acajou = new Color32( 76, 47, 39, 255 ); | |
public static readonly Color AcidGreen = new Color32( 176, 191, 26, 255 ); | |
public static readonly Color Aero = new Color32( 124, 185, 232, 255 ); | |
public static readonly Color AeroBlue = new Color32( 201, 255, 229, 255 ); | |
public static readonly Color AfricanViolet = new Color32( 178, 132, 190, 255 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Since a key-value store is a finite, discrete function, and functions | |
# can be composed, then Hashes can be composed. | |
# | |
# The syntactic sugar for calling lambdas, accessing array values, and | |
# other objects which have a #[] method allow composition of Hashes | |
# with all sorts of objects and contexts with the same implementation. | |
# | |
# Play with it at https://eval.in/388458 | |
# | |
class Hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
S : \x y z -> x z (y z) | |
*/ | |
// S :: (z -> (a -> b)) -> (z -> a) -> z -> b | |
function S(x, y, z) { | |
return x(z)(y(z)); | |
} | |
// example: | |
// add :: a -> a -> a |