do cps (86/60/2) d9 $ midicmd "midiClock*48" # s "midi" hush d2 $ note ((scaleP scalePattern $ (rotR 3.5) -- $ inversion \n $ (+ slow 8 "x" <~> ((0.5 ~>) generateMelodicSeed)) -- $ slow 2 \n $ generateMelodicSeed ) - 12)#s "[pe-gtr:9,midi]" #gain 1.2 #orbit 1 #midichan 2 let melody = slow 6 $ "0 2 [4 8 .] [3 4 3] 8 4 9"

Closures

Closures are a way of treating a function as an object. Functional language generally let the programmer define anonymous functions that “enclose” data that is needed for their function. These functions can then be composed with others to form larger structure. For example, consider the following js function:

function saySomthing(something) {
	return ()=>"say" + " " + something;
}

The function saySomething “encloses” the value something and then returns a function that, when called returns the value of something concatenated with the string “say”.


Notes mentioning this note



Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.