pattern:keep
List of: Scheme Extensions
Subjects: Patterns
Contents: Kernel

Action: Creates a new pattern by applying a keep law to an existing pattern.

Filename: kern/kern_scm/pattern_scm.cxx

Syntax: (pattern:keep pat keep [merge=#t])

Arg Types: pat pattern

keep law

merge boolean

Returns: pattern

Description: Applies a keep law to an existing pattern, merging with any existing scaling or, optionally (with merge=#f), replacing it.


pat specifies an exisiting pattern.


keep specifies a law.


If merge is specified as #f, the existing pattern is replaced. The default value is #t.

Example: ; pattern:keep

; create a linear pattern in two dimensions

(define pat (pattern:linear


(gvector 10 0 0) 5 (gvector 0 8 4) 4))

;; pat

; create a keep law that keeps only elements

; for which x + y < 5

(define keep (law "X + Y < 5"))

;; keep

; attach the keep law to the pattern

(set! pat (pattern:keep pat keep))

;; #[pattern

;; trans-vec: "DOMAIN(X*VEC(10,0,0)+X2*VEC

;; (0,8,4),0,4,0,3)"

;; x-vec: "null_law"

;; y-vec: "null_law"

;; z-vec: "null_law"

;; scale: "null_law"

;; keep: "null_law"

;; no list]


PDF/KERN/14SCI.PDF
HTM/DATA/KERN/KERN/14SCI/0068.HTM