Webel IT Australia promotes the amazing Mathematica tool and the powerful Wolfram Language and offers professional Mathematica services for computational computing and data analysis. Our Mathematica
tips, issue tracking, and wishlist is offered here most constructively to help improve the tool and language and support the Mathematica user community.
DISCLAIMER: Wolfram Research does not officially endorse analysis by Webel IT Australia.
This universal base
ADT
pseudo class is also called "the ADT All" (compare with the Webel MAll extension for MTools). Example:
adt$def$ADT[
class_Symbol,
$usage_String,
pattern_,
isAllSuper:(True|False):False
] := Module[{ ...},
...
class /: get[pattern] := $$;
class /: head[pattern] := Head[$$];
...
pattern
];
Every ADT sub-class 'definer' MUST directly or indirectly call the special
adt$def$ADT
definer function, passing its pseudo ADT class
name Symbol, a $usage
description String, its unique signature pattern
, and whether it isSuperAll
(has ADT as direct super class)Its definer can be used on-the-fly to create new ADT sub-classes:
pattern = adt$def$ADT[MY$ADT$String,
"An ADT that carries a String",
MY$ADT$String[$$_String],
True
];
MY$ADT$String /: stringLength[pattern] := StringLength[$$];
my$adt$s = MY$ADT$String["string1"];
stringLength[my$adt$s]
7