diff options
Diffstat (limited to 'src/algebra')
-rw-r--r-- | src/algebra/symbol.spad.pamphlet | 7 | ||||
-rw-r--r-- | src/algebra/syntax.spad.pamphlet | 14 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/algebra/symbol.spad.pamphlet b/src/algebra/symbol.spad.pamphlet index 7f80ecdb..e701270e 100644 --- a/src/algebra/symbol.spad.pamphlet +++ b/src/algebra/symbol.spad.pamphlet @@ -23,7 +23,8 @@ Symbol(): Exports == Implementation where Scripts ==> Record(sub:L,sup:L,presup:L,presub:L,args:L) Exports ==> Join(OrderedSet, ConvertibleTo InputForm, - ConvertibleTo Symbol,CoercibleFrom String, + ConvertibleTo Symbol,CoercibleFrom String, + RetractableTo Identifier, ConvertibleTo Pattern Integer, ConvertibleTo Pattern Float, PatternMatchable Integer, PatternMatchable Float) with new: () -> % @@ -276,6 +277,10 @@ Symbol(): Exports == Implementation where sy pretend List(%) sample() == 'aSymbol + coerce(x: Identifier): % == x : % + retractIfCan(x): Union(Identifier,"failed") == + scripted? x => x : Identifier + "failed" @ diff --git a/src/algebra/syntax.spad.pamphlet b/src/algebra/syntax.spad.pamphlet index 2ab38358..783459b1 100644 --- a/src/algebra/syntax.spad.pamphlet +++ b/src/algebra/syntax.spad.pamphlet @@ -579,27 +579,23 @@ Literal(T: SetCategory): Public == Private where <<domain IDENT Identifier>>= ++ Author: Gabriel Dos Reis ++ Date Created: July 5, 2008 -++ Date Last Modified: April 20, 2009 +++ Date Last Modified: September 7, 2011 ++ Description: -++ This domain represents identifer AST. -++ This domain differs from Symbol in that it does not support -++ any form of scripting. -++ A value of this domain is a plain old identifier. +++ This domain provides representation for plain identifiers. +++ It differs from Symbol in that it does not support any form +++ of scripting. It is a plain basic data structure. ++ )abbrev domain IDENT Identifier Identifier(): Public == Private where - Public == Join(SetCategory, CoercibleTo Symbol, CoercibleTo String) with + Public == SetCategory with gensym: () -> % ++ \spad{gensym()} returns a new identifier, different from ++ any other identifier in the running system Private == add import %peq: (%,%) -> Boolean from Foreign Builtin import %gensym: () -> % from Foreign Builtin - import %sname: % -> String from Foreign Builtin gensym() == %gensym() x = y == %peq(x,y) - coerce(x: %): Symbol == x : Symbol - coerce(x: %): String == %sname x coerce(x: %): OutputForm == x : OutputForm @ |