[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 MELT pattern macros

There are 6 documented pattern-macros.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.1 AND

Pattern macro defined at file ‘warmelt-macro.melt’, line 4262.

pattern macro description: The lispy AND conjonction syntax is a short-circuit "and then" conjonction. Expression syntax is (AND <conjunct-subexpression>...) and can evaluate to a :value or a thing such as a :long or a :gimple which is null/zero iff any conjunct is null or zero. Pattern syntax is ?(AND <conjunct-subpattern>...) and matches if all conjunct-subpattern-s match. See also COND OR and IF.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.2 INSTANCE

Pattern macro defined at file ‘warmelt-macro.melt’, line 3467.

pattern macro description: The INSTANCE pattern macro matches an instance when used as a pattern, or creates an instance when used as an expression. Pattern syntax is ?(INSTANCE class-name :field1 pattern1 :field2 pattern2...) - there can be zero, one or more distinct fields. A value matches such a pattern if the value is an instance of class-name or a sub-class and if each specified field matches its [sub-]pattern. Expression syntax is (INSTANCE class-name :field1 value1 :field2 value2...). All the fields should be acceptable for the specified class-name. In expressions, missing fields are initialized to nil. In patterns missing fields are not matched. The given class-name is a fixed class (not a variable) possessing all the specified fields.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.3 LIST

Pattern macro defined at file ‘warmelt-macro.melt’, line 4419.

pattern macro description: The LIST syntax is for making or matching lists made of pairs. Expression syntax is (LIST <component-subexpression>...) to make a list of DISCR_LIST with the given components going into the head of pairs of DISCR_PAIR. Pattern syntax is ?(LIST <component-subpattern>...) to match a list of given length with each component matching its corresponding <component-subpattern>. LIST expressions are constructive, so can appear in LETREC bindings.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.4 OBJECT

Pattern macro defined at file ‘warmelt-macro.melt’, line 3572.

pattern macro description: The OBJECT pattern macro matches an instance when used as a pattern. Pattern syntax is ?(OBJECT class-name :field1 pattern1 :field2 pattern2...) - there can be zero, one or more distinct fields. A value matches such a pattern if the value is an instance of exactly class-name (not a sub-class) and if each specified field matches its [sub-]pattern. The OBJECT pattern macro should not be used in expression context. See also INSTANCE and DEFCLASS.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.5 OR

Pattern macro defined at file ‘warmelt-macro.melt’, line 4325.

pattern macro description: The lispy OR disjunctive syntax is a short-circuit "or else" disjonction. Expression syntax is (OR <disjunct-subexpression>...) and can evaluate to a :value or a thing such as a :gimple or a :long etc. which is null/zero iff every disjunct is null/zero. Pattern-syntax is ?(OR <disjunct-subpattern>...) and matches if one of the disjunct-subpattern matches. See also COND AND and IF.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.6 TUPLE

Pattern macro defined at file ‘warmelt-macro.melt’, line 4372.

pattern macro description: The TUPLE syntax is for making or matching tuples. Expression syntax is (TUPLE <component-subexpression>...) to make a tuple of DISCR_MULTIPLE with the given components. Pattern syntax is ?(TUPLE <component-subpattern>...) to match a tuple of given length with each component matching its corresponding <component-subpattern>. TUPLE expressions are constructive, so can appear in LETREC bindings.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated on June 22, 2011 using texi2html 1.82.