Skip to content

Commit

Permalink
removed unicode keywords, added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pzinn committed Nov 30, 2024
1 parent 8df20ab commit f1f033c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
9 changes: 1 addition & 8 deletions M2/Macaulay2/d/binding.d
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,8 @@ bumpPrecedence();
export MinusS := makeKeyword(unarybinaryleft("-")); -- also binary
export PlusS := makeKeyword(unarybinaryleft("+")); -- also binary
export PlusPlusS := makeKeyword(binaryleft("++"));
bumpPrecedence();
export InterpunctS := makeKeyword(binaryleft("·"));
bumpPrecedence();
export StarStarS := makeKeyword(binaryleft("**"));
export BoxTimesS := makeKeyword(binaryleft(""));
export ShuffleProductS := makeKeyword(binaryleft(""));
bumpPrecedence();
precBracket := prec;
export leftbracket := parens("[","]",precBracket, precRightParen, precRightParen);
Expand Down Expand Up @@ -515,10 +511,7 @@ export opsWithBinaryMethod := array(SymbolClosure)(
PowerGreaterEqualS, UnderscoreGreaterEqualS,
PowerLessS, UnderscoreLessS,
PowerLessEqualS, UnderscoreLessEqualS,
PowerStarStarS,
InterpunctS,
BoxTimesS,
ShuffleProductS
PowerStarStarS
);
export opsWithUnaryMethod := array(SymbolClosure)(
StarS, MinusS, PlusS, LessLessS, QuestionQuestionS,
Expand Down
3 changes: 2 additions & 1 deletion M2/Macaulay2/tests/normal/symbols.m2
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ assert (i -> symbol i === symbol i)()
assert( (i -> symbol i)() =!= (i -> symbol i)() )
assert( symbolBody (i -> symbol i)() =!= symbolBody (i -> symbol i)() )
assert( f = i -> symbol i ; symbolBody f() === symbolBody f() )

assert( try getSymbol "" then false else true )
assert( try getSymbol "++" then false else true )
1 change: 1 addition & 0 deletions M2/Macaulay2/tests/normal/unicode.m2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ v = vector {1, 2}
w = vector {3, 4}
assert(v⊗w == vector {3, 4, 6, 8})

makeKeyword("·")
Vector·Vector := (v, w) -> ((transpose v#0) * w#0)_(0, 0)
assert(v·w == 11)

Expand Down

0 comments on commit f1f033c

Please sign in to comment.