// TODO: The relation -> operator (and => for functions) is defined using the language.…
- User
// TODO: The relation -> operator (and => for functions) is defined using the language. How?
// TODO: How to make infix possible (without adding new language features): @a => (("|" -> @b) -> ..)// Native
// SOLUTION?: // Define infix relations with ( "(" -> @a => "|" -> @b => ")" -> .. /* Natve */
(someSet | otherSet)
// PROBLEM: Parentheses were used to disambiguate // SOLUTION: Define catch-all defintion "(" -> @a => ")" -> a
// If there are multiple relations (or functions?) with the same input, and both have function as output that have // inputs, those function will become one in scope. // Above two relations become: // ERROR: One more step needed "(" -> { ...@a => "|" -> @b => ")" -> .. /* Natve */, ...@a => ")" -> a },
// If the function has overlapping inputs, and the function return a relation/function, the functions are combined:
"(" -> @a => { "|" -> @b => ")" -> .. /* Natve */, ")" -> a },
")" -> ")", "|" -> "|"
( 20 // With the current scope, either
)or|can be passed// Set builder {|@a : Int => a <= 10|}
// If function input have the exact same specificity,
// If there are 2 relations with the same input in scope, that's an error. "abc" -> 10 "abc" -> 12 abc // Result: ??
// Define relation syntax through the language itself: // It is defined, but not using the language's syntax. // Should be displayed in pseudo-syntax when hovering over
=>or->@a => "->" -> @b"(" -> @a => _tupleOf a
"_tupleOf" -> @a -> { ")" -> a "," -> @b => _tupleOf {{a}, {a, b}} }
"(" 10 // Result: _tupleValue 10 "(" 10 "," 20 // Result: _tupleValue 10 "," (_tupleValue {{10}, {10, 20}}) "(" 10 "," 20 "," // Result: _tupleValue 10 "," (_tupleValue {{10}, {10, 20}} ",") "(" 10 "," 20 "," 30 ")" // Or: (10, 20, 30)
- Assistant