Libraryless. Click here for Pure Java version (5927L/33K).
sclass TypeSystem<T> { // override if you have supertype (subtype) relations in your type system // you can assume neq(a, b) swappable bool isActualSupertypeOf(T a, T b) { false; } bool isSupertypeOf(T a, T b) { ret eq(a, b) || isActualSupertypeOf(a, b); } bool operatorCanTakeArguments(GOperator<T> op, T... types) { ret matchTwoLists(lambda2 isSupertypeOf, reallyLazyMap(op.arguments, a -> a.type()), types); } L<GOperator<T>> resolve(GPolymorphicOperator<T> polyOp, T... types) { ret filter(polyOp.definitions, op -> operatorCanTakeArguments(op, types)); } swappable S typeToString(T type) { ret str(type); } }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033960 |
Snippet name: | TypeSystem |
Eternal ID of this version: | #1033960/7 |
Text MD5: | 3cf7b0d7872e8b22c1fb28196d84929a |
Transpilation MD5: | 45541a1e26bb7a4266ee448fbac0dfcb |
Author: | stefan |
Category: | javax / scripting |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-15 02:32:05 |
Source code size: | 682 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 164 / 270 |
Version history: | 6 change(s) |
Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |