On Sep 12, 2007, at 9:02 PM, Wacek Kusnierczyk wrote:
I found it convenient
to be able to ignore the wrapper (the label/features of a record) of a
message and get just the content (values; so the pattern _(_:V)
might be
useful, for example)
The syntactic sugar introduced by pattern matching does not support
this, as it wouldn't be as efficient (feature access is efficient
constant time access): _(_:V ...) would require traversing the whole
record.
However, with if and some record functions you can implement such a
check yourself easily (without any syntactic sugar..). Test whether a
given value is a record whose arity length is exactly one and whose
value at its single feature is V.
declare
R = test(foo:bar)
V = bar
{Browse
if {IsRecord R} andthen
local A = {Arity R} in
{Length A} == 1 andthen
R.(A.1) == V
end
then matches
end}
Best
Torsten
--
Torsten Anders
Interdisciplinary Centre for Computer Music Research
University of Plymouth
http://strasheela.sourceforge.net
http://www.torsten-anders.de
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users