On this page:
4.1 Clarification
clarify/  multi
local-asset-url?
file-url?
file-readable?
build-complete-simple-path
4.2 Asset Advancement and Regression
chain
block
rebuild
4.3 Reactive Model Helpers
make-key->live-build/  sequence
make-key->live-build/  unlike-compiler
7.7

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)
Maps unclear names to clear names using a compiler.

procedure

(local-asset-url? str)  boolean?

  str : string?
Returns #t if str is a URL that meets ALL of the below criteria:

Use case: Distinguishing when URLs refer to a local filesystem.

procedure

(file-url? url-inst)  boolean?

  url-inst : url?
Returns #t if url-inst has no scheme or a "file" scheme.

procedure

(file-readable? path)  boolean?

  path : path?
Returns #t if path refers to an existing file and read permissions are set for the process.

procedure

(build-complete-simple-path path    
  [relative-to])  complete-path?
  path : (or/c string? path?)
  relative-to : (or/c path? boolean?) = #f
If relative-to is a path, and path is not complete, returns (simplify-path (build-path relative-to path)). Otherwise returns (simplify-path path).

4.2 Asset Advancement and Regression

procedure

(chain proc args ...)  procedure?

  proc : procedure?
  args : any/c
Returns an advance/c procedure that returns the value of (apply proc args).

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))

value

block : ripple/c

A ripple procedure that unconditionally prevents change from propogating.

value

rebuild : ripple/c

A ripple procedure that unconditionally forces an asset to rebuild.

4.3 Reactive Model Helpers

procedure

(make-key->live-build/sequence maybe-makers    
  ...)  procedure?
  maybe-makers : (-> string? procedure? (or/c #f live-build?))
Returns a procedure equivalent to the following:

(λ (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?)
Returns a procedure P suitable for use in make-u/a-build-system, where P acts as an adapter between the reactive model and the imperative model. (P key recurse) assumes that key is an unclear name. Once clarified using (send instance clarify key), the clear name is checked against available? and changed?. From there, P will call compile! on the provided instance as a side-effect with appropriate arguments.

The live build produced by any application of P will always produce the latest result of compile!.