(require unlike-assets) (define dependencies '(complexity only maddens people ingesting lengthy elusive documentation)) (define/contract (build-message clear compiler) advance/c (string-upcase (apply string (map (λ (unclear) (send compiler lookup unclear)) dependencies)))) (define/contract (resolve-dependency clear compiler) advance/c (string-ref clear 0)) (define/contract (main clear compiler) advance/c (define clear-names (map (λ (unclear) (send compiler clarify unclear)) dependencies)) (for ([dependency clear-names]) (send compiler add! dependency clear)) build-message) (define compiler (new (class* unlike-compiler% () (super-new) (define/override (clarify unclear) (symbol->string unclear)) (define/override (delegate clear) (if (string=? clear "start") main resolve-dependency))))) (send compiler add! "start") (hash-ref (send compiler compile!) "start")
The compiler is informed of a new asset by an unclear name: 'start.
clarify maps the unclear name to "start".
delegate associates "start" to main.
main runs, adding dependencies as a side-effect. build-message is returned as the designated next step to fulfill "start". It will not be called yet.
build-message runs, joining the first letter of each dependency in the declared order. The output is "COMPILED"