Skip to content

Commit

Permalink
moved # and #? methods out of typicalvalues
Browse files Browse the repository at this point in the history
  • Loading branch information
mahrud committed Aug 10, 2024
1 parent 515f72d commit fc9dd47
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 2 additions & 0 deletions M2/Macaulay2/d/actors.d
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,7 @@ lengthFun(rhs:Code):Expr := (
e := eval(rhs);
when e
is Error do e
-- # typical value: symbol #, Set, ZZ
-- # typical value: symbol #, HashTable, ZZ
is x:HashTable do (
if (x.Mutable) then lockRead(x.mutex);
Expand All @@ -1168,6 +1169,7 @@ lengthFun(rhs:Code):Expr := (
unlock(table.mutex);
res)
-- # typical value: symbol #, List, ZZ
-- # typical value: symbol #, BasicList, ZZ
is x:List do toExpr(length(x.v))
-- # typical value: symbol #, String, ZZ
is s:stringCell do toExpr(length(s.v))
Expand Down
3 changes: 3 additions & 0 deletions M2/Macaulay2/d/hashtables.dd
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,7 @@ export subvalue(left:Expr,right:Expr):Expr := (
else buildErrorPacket("encountered missing value"))
else buildErrorPacket("expected a string as key to database"))
-- # typical value: symbol #, List, ZZ, Thing
-- # typical value: symbol #, BasicList, ZZ, Thing
is x:List do (
when right is r:ZZcell do (
if isInt(r) then getvalue(x.v,toInt(r))
Expand Down Expand Up @@ -866,6 +867,7 @@ export subvalueQ(left:Expr,right:Expr):Expr := (
)
else False)
else False)
-- # typical value: symbol #?, Set, Thing, Boolean
-- # typical value: symbol #?, HashTable, Thing, Boolean
is x:HashTable do if lookup1Q(x,right) then True else False
-- # typical value: symbol #?, Dictionary, String, Boolean
Expand All @@ -880,6 +882,7 @@ export subvalueQ(left:Expr,right:Expr):Expr := (
is key:stringCell do dbmquery(x,key.v)
else buildErrorPacket("expected a string as key to database"))
-- # typical value: symbol #?, List, ZZ, Boolean
-- # typical value: symbol #?, BasicList, ZZ, Boolean
is x:List do (
when right is r:ZZcell do (
if isInt(r) then (
Expand Down
7 changes: 0 additions & 7 deletions M2/Macaulay2/m2/set.m2
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ Set.synonym = "set"
set VisibleList := Set => set
new Set from List := Set => (X,x) -> set x

-- compiled functions which will be documented
-- TODO: why doesn't this work?
-- # Set := Boolean => lookup(symbol #, HashTable)
-- Set #? Thing := Boolean => lookup(symbol #?, HashTable, Thing)
installMethod(symbol #, Set, Boolean => x -> x)
installMethod(symbol #?, Set, Thing, Boolean => x -> x)

-- set operations
elements Set := List => keys
installMethod(union, () -> set {})
Expand Down
4 changes: 0 additions & 4 deletions M2/Macaulay2/m2/typicalvalues.m2
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ typicalValues#(symbol symbol) = Symbol
typicalValues#(symbol ?) = Boolean

dummy := x -> error("dummy method function called")
-- TODO: where are these defined in the interpreter?
installMethod(symbol #?, BasicList, ZZ, Boolean => x -> (dummy x;))
installMethod(symbol #, BasicList, ZZ, Thing => x -> (dummy x;))
installMethod(symbol #, BasicList, ZZ => x -> (dummy x;))

append(BasicList,Thing) := BasicList => append
prepend(Thing,BasicList) := BasicList => prepend
Expand Down

0 comments on commit fc9dd47

Please sign in to comment.