r/EncapsulatedLanguage • u/AceGravity12 Committee Member • Sep 08 '20
Arithmetic Proposal Maths bracketing proposals
Proposal 1:
Whenever an operation is not followed by a set of parenthis it is assumed to take it's default number of arguments. Otherwise it is a Lisp-style operation and the arguments are all of the listed values in the parenthesis
Examples:
2 + 2 = + 2 2
1 + 2 + 3 = + + 1 2 3 or +( 1 2 3 )
4 × 3 + 2 + 1 = + + × 4 3 2 1 or +( × 4 3 2 1)
Proposal 2:
When a closing parenthis is at the end of an expression that's not followed by another expression it may be dropped.
Examples:
+( 1 2 3 ) is the same as +( 1 2 3
+( 3 4 × ( 6 7 7)) is the same as +( 3 4 ×( 6 7 7
1
u/AceGravity12 Committee Member Sep 09 '20
I was reminded that I completely forgot to put a reason in this post, sorry about that.
The point of these two proposals is to minimize the length of expressions for when they are being encapsulated, and for these minimizations to be optional so that when someone wants matching pairs of dislikes fixed arity, they can just not do it.
Math in this language needs to have the option to be very very dense for encapsaltion, and based on my experiments, this is the densest way I've found.
1
u/xigoi Sep 08 '20
I like the first idea, but the second one looks ugly and will break bracket matching.
1
u/[deleted] Sep 08 '20
The first proposal will make lists longer than necessary because of the brackets. Also, it would make more sense to drop the opening bracket than the closing bracket because the operator sort of acts like an opening bracket.
1
u/gxabbo Sep 09 '20 edited Sep 10 '20
As I also commented on the other proposal:
For reasons of both aesthetics and consistency, I'm very much against non-matching brackets. If a closing one is there, there should an opening one, too. And vice versa.
I'll also vote against anything were two or more operators follow each other without brackets. It makes the whole expression more difficult to parse.
So
1 + 2 + 3should be+ 1 2 3,+ ( 1 2 3)or(+ 1 2 3)and4 × 3 + 2 + 1should be+ (x 4 3) 2 1or(+ (x 4 3) 2 1).I'm fine with making brackets optional in simple expressions that can't be misunderstood. But otherwise, brackets are there for grouping symbols. So let's use them for that.
1
u/nadelis_ju Committee Member Sep 11 '20
Goodbye!