case, patterns

Filip Konvička filip.konvicka at logis.cz
Thu Sep 13 10:37:36 CEST 2007


Waclaw Kusnierczyk (13.9.2007 9:14):
>>> In fact, there is a difference between l(f:V) and l(F:v) in that 
>>> there is no requirement on the uniqueness of values in a record, and 
>>> in this sense the pattern l(F:v ...) would be nondeterministic, 
>>> provided no requirement on sorting the features.  But I don't see 
>>> why the question 'does it contain the feature f?' would have to be, 
>>> in general, more interesting than 'does it contain a feature with 
>>> the value v?'
>> Features and values are not equal. Look at the RecordC constraints, 
>> and think of your proposals in terms of incremental record 
>> specification.
> ok.  as said before, i was not concerned with the implementation, but 
> rather with the interface.
I was not talking about implementation, either. I just don't see what 
behavior do you propose for the cases when the record arity is not fully 
determined yet. If you propose that the minimum feature is selected, 
then you'd have to wait until the arity is determined.

Which brings me to a more constructive comment:

local
   fun {InsideOut R}
      NR={Dictionary.new}
   in
      {Record.forAllInd R
       proc {$ F V} N in
          {Dictionary.condExchange NR V F N N}
       end
      }
      {Dictionary.toRecord {Label R} NR}
   end
in
   case {InsideOut a(b:c d:e)}
   of a(c:F ...) then
      {Show F}
   end
end

Cheers,
Filip



More information about the mozart-users mailing list