From f04f6bff2bb92b851b5aef56c6846fd01b493d7d Mon Sep 17 00:00:00 2001 From: dos-reis Date: Wed, 18 Feb 2009 15:37:25 +0000 Subject: * interp/parse.boot (parseHas): Constants are not attributes. * interp/compiler.boot (compHasFormat): Handle signature for constants too. * interp/info.boot (actOnInfo): Likewise. * algebra/data.spad.pamphlet (sample$Byte): Make a constant. (SystemInteger): Export constant 'sample'. (SystemNonNegativeInteger): Likewise. * algebra/aggcat2.spad.pamphlet (FiniteLinearAggregateFunctions2): Use 'sample' or 'random' elements when allocating new aggregates. --- src/interp/compiler.boot | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/interp/compiler.boot') diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index aa09ea1f..b5faa805 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -1101,6 +1101,7 @@ compElt(form,m,E) == E:= addDomain(aDomain,E) mmList:= getModemapListFromDomain(anOp,0,aDomain,E) modemap:= + -- FIXME: do this only for constants. n:=#mmList 1=n => mmList.(0) 0=n => @@ -1112,7 +1113,6 @@ compElt(form,m,E) == mmList.(0) [sig,[pred,val]]:= modemap #sig^=2 and ^val is ["elt",:.] => nil --what does the second clause do ???? ---+ val := genDeltaEntry [opOf anOp,:modemap] convert([["call",val],first rest sig,E], m) --implies fn calls used to access constants compForm(form,m,E) @@ -1121,9 +1121,7 @@ compElt(form,m,E) == compHas: (%Form,%Mode,%Env) -> %Maybe %Triple compHas(pred is ["has",a,b],m,$e) == - --b is (":",:.) => (.,.,E):= comp(b,$EmptyMode,E) $e:= chaseInferences(pred,$e) - --pred':= ("has",a',b') := formatHas(pred) predCode:= compHasFormat pred coerce([predCode,$Boolean,$e],m) @@ -1136,7 +1134,7 @@ compHasFormat (pred is ["has",olda,b]) == [a,:.] := comp(a,$EmptyMode,$e) or return nil a := SUBLISLIS(formals,argl,a) b is ["ATTRIBUTE",c] => ["HasAttribute",a,["QUOTE",c]] - b is ["SIGNATURE",op,sig] => + b is ["SIGNATURE",op,sig,:.] => ["HasSignature",a, mkList [MKQ op,mkList [mkTypeForm type for type in sig]]] isCategoryForm(b,$e) => ["HasCategory",a,mkTypeForm b] -- cgit v1.2.3