#lang transd MainModule: { // Make a short alias for a function type that takes a string and // returns a string. Call it 'Shader'. Shader: typealias(Lambda), // 'composer' function takes two Shaders, combines them into // a single Shader, which is a capturing closure, аnd returns // this closure to the caller. // [[f1,f2]] is a list of captured variables composer: (λ f1 Shader() f2 Shader() (ret Shader(λ[[f1,f2]] s String() (exec f1 (exec f2 s))))), _start: (λ // create a combined shader as a local variable 'render' locals: render (composer Shader(λ s String() (ret (toupper s))) Shader(λ s String() (ret (+ s "!")))) // call this combined shader as a usual shader with passing // a string to it, аnd receiving from it the combined result of // its two captured shaders (textout (exec render "hello"))) }