Class LAcond
Object
|
+--Lens
|
+--LAcond
- class
LAcond
- extends Lens
Applies one of two lenses based on predicates on the concrete and abstract
trees. LAcond behaves like LCcond, only a separate predicate pa
determines which lens to use during putback, making this lens (slightly)
more oblivious.
The lens is not oblivious because different lenses may be used for get
and putback; if this is the case, then the undefined is given instead of c.
LAcond is typically used to dispatch subtypes to appropriate lenses. For
an example, see LRenameIfPresent, which is essentially:
acond (function (c) { return has_prop(c, from); },
function (a) { return has_prop(a, to); },
new LRename(from, to),
new LId())
For simply dispatching, LCcond may be sufficient.
See:Defined in lens.js
|
Field Summary |
Object |
name
|
name
Object name
LAcond
LAcond(<Predicate> pc, <Predicate> pa, <Predicate> pass_lens, <Predicate> fail_lens)
Parameters:
pc - A predicate on the concrete tree
pa - A predicate on the abstract tree
pass_lens - Used for get when pc matches the concrete tree; used for putback when pa matches a
fail_lens - Used for get when pc does not match the concrete tree; used for putback when a does not match pa
get
Object get(c)
putback
Object putback(a, c)
Documentation generated by
JSDoc on Wed Feb 14 15:36:01 2007