-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
Suggestion
Modify superpose and collapse to assume an actual tuple constructed with ,. So instead of writing
!(superpose (A B C))we would write
!(superpose (, A B C))Likewise, collapse would output a tuple constructed with ,. So for instance
(= (foo) A)
(= (foo) B)
(= (foo) C)
!(collapse (foo))would output
[(, A B C)]Why?
- Avoid having
collapsetrigger an unintended reduction. For instancemay output(= (f $x $y) (+ $x $y)) (= (foo) f) (= (foo) 1) (= (foo) 2) !(collapse (foo))
I know it currently outputs[3]
but a slight change in the definition of collapse may make it output[(f 1 2)]
3in the future, it is too brittle in my opinion. - By using
,when wanting to represent a tuple the user makes it clear what is the intent. Think of the difference betweenwhich may evoke the idea of superposing the result of!(superpose (f 1 2))
(f 1 2)instead ofwhich clearly evokes the idea of superposing!(superpose (, f 1 2))
f,1and2. - We can introduce an actual
Tupletype (maybe a subtype ofExpression?) and refine the type signature ofsuperposeand certainly other functions.
Why not?
It breaks backward compatibility. But MeTTa is alpha, so...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels