filter-instances | | unit-instances pattern
&key
filter-before
filter-after
verbose
=> matching-unit-instances | [Function]
|
Purpose
Select matching unit instances from a list of
unit instances based on a retrieval pattern.
Package :gbbopen
Module :gbbopen-core
Arguments and values
Returns
A newly consed list of unit instances that satisfy
the specified pattern and predicate filters.
Detailed syntax
pattern ::=
| subpattern | t |
|
subpattern ::=
| pattern-element | |
| (not subpattern) | |
| (and subpattern*) | |
| (or subpattern*) |
|
pattern-element ::= | ( pattern-op dimension-names
pattern-values option*) | |
| ( boolean-dimension-unary-pattern-op dimension-names
option*) |
|
pattern-op ::= | ordered-dimension-pattern-op | |
| enumerated-dimension-pattern-op | |
| boolean-dimension-binary-pattern-op |
|
ordered-dimension-pattern-op ::=
| ordered-dimension-any-numeric-value-pattern-op | |
| ordered-dimension-explicit-type-pattern-op |
|
ordered-dimension-explicit-type-pattern-op ::=
| ordered-dimension-fixnum-pattern-op | |
| ordered-dimension-short-float-pattern-op | |
| ordered-dimension-single-float-pattern-op | |
| ordered-dimension-double-float-pattern-op | |
| ordered-dimension-long-float-pattern-op | |
| ordered-dimension-pseudo-probability-pattern-op |
|
ordered-dimension-any-numeric-value-pattern-op ::=
| < | <= |
>= | > |
= | /= | |
| within | covers |
overlaps | |
| abuts |
starts | ends |
|
ordered-dimension-fixnum-pattern-op ::=
| <& | <=& |
>=& | >& |
=& | /=& | |
| within& | covers& |
overlaps& | |
| abuts& |
starts& | ends& |
|
ordered-dimension-short-float-pattern-op ::=
| <$& | <=$& |
>=$& | >$& |
=$& | /=$& | |
| within$& | covers$& |
overlaps$& | |
| abuts$& |
starts$& | ends$& |
|
ordered-dimension-single-float-pattern-op ::=
| <$ | <=$ |
>=$ | >$ |
=$ | /=$ | |
| within$ | covers$ |
overlaps$ | |
| abuts$ |
starts$ | ends$ |
|
ordered-dimension-double-float-pattern-op ::=
| <$$ | <=$$ |
>=$$ | >$$
| =$$ | /=$$ | |
| within$$ | covers$$ |
overlaps$$ | |
| abuts$$ |
starts$$ | ends$$ |
|
ordered-dimension-long-float-pattern-op ::=
| <$$$ | <=$$$ |
>=$$$ | >$$$ |
=$$$ | /=$$$ | |
| within$$$ | covers$$$ |
overlaps$$$ | |
| abuts$$$ |
starts$$$ | ends$$$ |
|
ordered-dimension-pseudo-probability-pattern-op ::=
| <% | <=% |
>=% | >% |
=% | /=% | |
| within% | covers% |
overlaps% | |
| abuts% | starts% | ends% |
|
enumerated-dimension-pattern-op ::=
| is | enumerated-dimension-explicit-test-pattern-op |
|
enumerated-dimension-explicit-test-pattern-op ::=
| is-eq | is-eql | is-equal |
is-equalp |
|
boolean-dimension-binary-pattern-op ::=
| eqv |
|
boolean-dimension-unary-pattern-op ::=
| true | false |
|
dimension-names ::= | dimension-name |
( dimension-name+) |
|
pattern-values ::=
| pattern-value | |
| ( pattern-value+) | |
| ( pattern-value+ .
pattern-value) | |
| #( pattern-value+) |
|
pattern-value ::=
| point | interval |
element | set |
|
interval ::= | ( start end) |
( start . end) |
#( start end) |
|
Terms
point
| | A number, infinity , or -infinity |
start | | A number or -infinity |
end | | A number or infinity |
element | | An object |
|
Description
If a unit instance appears more than once in
unit-instances, it will be checked for selection—and potentially
included in the result—multiple times.
Declared numeric and pseudo
probability pattern operators are also supported, for example:
=&
, =$&
, =$
, =$$
, =$$$
, and
=%
and within&
, within$&
,
within$
, within$$
, within$$$
,
and within%
.
See also
*find-verbose*
*warn-about-unusual-requests*
find-all-instances-by-name
find-instance-by-name
find-instances
map-instances-on-space-instances
Declared numerics
Examples
> (filter-instances (supporting-hyps-of hyp) '(> belief .8))
(#<hyp 183 (1835 4791) 0.82 [0..35]>
#<hyp 233 (1835 4791) 0.89 [5..35]>
#<hyp 419 (1835 4791) 0.85 [5..35]>)
> (filter-instances (supporting-hyps-of hyp) `(within belief (.85 ,infinity)))
(#<hyp 233 (1835 4791) 0.89 [5..35]>
#<hyp 419 (1835 4791) 0.85 [5..35]>)
>
Note
Fixnum overlaps
comparisons can result in bignum computations if the
combined intervals of the pattern and a candidate unit instance
exceeds most-positive-fixnum
.
The GBBopen Project