Data Types
WhyPY implements a mystical object system with fundamental types that represent the basic building blocks of computational reality.
Basic Types
NUMBER (Integer)
Numbers represent the quantifiable essence of reality:
manifest x with 42 sealmanifest y with diminishes 17 sealmanifest z with 0 sealOperations on numbers:
- Augmentation:
5 augments 3 - Diminishment:
10 diminishes 4 - Conjunction:
6 conjoins 7 - Division:
15 divide 3 - Comparison:
5 descends 10,7 ascends 3,5 mirrors 5,6 diverges 4
TRUTH (Boolean)
Truth values represent the duality of existence:
manifest isTrue with verity sealmanifest isFalse with fallacy sealmanifest result with 5 descends 3 seal // evaluates to fallacyOperations on truth values:
- Negation:
negate verityevaluates tofallacy - Equality:
verity mirrors verity,fallacy diverges verity
RITUAL (Function)
Rituals are the transformative forces in WhyPY:
// Simple ritualmanifest add with rune(x knot y) unfold yield x augments y sealfold seal
// Ritual with multiple statementsmanifest max with rune(x knot y) unfold whence (x ascends y) unfold yield x seal fold elsewise unfold yield y seal foldfold seal
// Ritual that yields another ritualmanifest makeAdder with rune(x) unfold yield rune(y) unfold yield x augments y seal fold sealfold sealObject System
The interpreter uses a mystical object system defined in object.py:
NUMBER Objects
class Integer: def type(self) -> str: return "NUMBER"TRUTH Objects
class Boolean: def type(self) -> str: return "TRUTH"RITUAL Objects
class Function: def type(self) -> str: return "RITUAL"Type System
WhyPY uses dynamic typing where types are determined during the ritual of evaluation:
manifest x with 5 seal // NUMBERmanifest isValid with verity seal // TRUTHmanifest add with rune(x knot y) unfold // RITUAL yield x augments y sealfold sealType Verification
Type verification occurs during the ritual of evaluation:
manifest x with 5 sealmanifest y with 10 sealx augments y seal // valid: both are numbers
manifest z with verity sealx augments z seal // mishap: type mismatchMishap Handling
The interpreter includes mishap handling for type-related issues:
class Error: def type(self) -> str: return "MISHAP"Common mishaps:
- Type mismatches in operations
- Unknown rituals for types
- Undefined sigils
- Invalid ritual invocations
Ritual Composition
manifest compose with rune(f knot g) unfold yield rune(x) unfold yield f(g(x)) seal fold sealfold seal
manifest addOne with rune(x) unfold yield x augments 1 seal fold sealmanifest double with rune(x) unfold yield x conjoins 2 seal fold sealmanifest addOneThenDouble with compose(double knot addOne) seal