4 Policy authoring utilities
(require unlike-assets/policy) | |
package: unlike-assets-lib |
This module provides helper procedures for the available models.
4.1 Clarification
procedure
(clarify/multi compiler unclear-names) → (listof clear/c)
compiler : (instanceof/c (subclass?/c unlike-compiler%)) unclear-names : (listof unclear/c)
procedure
(local-asset-url? str) → boolean?
str : string?
Has no scheme or a "file" scheme
Has no host, or a host that points to the loopback interface.
Has no port, credentials, query, or fragment
Has a path
Use case: Distinguishing when URLs refer to a local filesystem.
procedure
(file-readable? path) → boolean?
path : path?
procedure
(build-complete-simple-path path [ relative-to]) → complete-path? path : (or/c string? path?) relative-to : (or/c path? boolean?) = #f
4.2 Asset Advancement and Regression
procedure
(chain proc args ...) → procedure?
proc : procedure? args : any/c
Use to transmit dynamically bound values across advance/c functions or to define simpler procedures that do not have to comply with the domain requirements of advance/c.
(define (step2 extra) extra) (define/contract (step1 clear compiler) advance/c (chain step2 'data))
4.3 Reactive Model Helpers
procedure
(make-key->live-build/sequence maybe-makers ...) → procedure? maybe-makers : (-> string? procedure? (or/c #f live-build?))
(λ (key recurse) (ormap (λ (p) (p key recurse)) maybe-makers))
Use this to sequence several procedures that map keys to live builds.
procedure
(make-key->live-build/unlike-compiler instance available? changed?) → procedure? instance : (instanceof/c (subclass?/c unlike-compiler%)) available? : (-> clear/c boolean?) changed? : (-> clear/c boolean?)
The live build produced by any application of P will always produce the latest result of compile!.