-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow modifiers such as (),[] and . on any variable access
- Loading branch information
1 parent
cc3e2da
commit eb728de
Showing
2 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
############################################################################# | ||
## | ||
#W modifiers.tst GAP Library | ||
## | ||
## | ||
gap> START_TEST("modifiers.tst"); | ||
gap> x := rec(); | ||
rec( ) | ||
gap> x.2 := 3; | ||
3 | ||
gap> x; | ||
rec( 2 := 3 ) | ||
gap> x.2 := rec(); | ||
rec( ) | ||
gap> x.2.3 := 5; | ||
5 | ||
gap> x; | ||
rec( 2 := rec( 3 := 5 ) ) | ||
gap> x.f := -> rec(); | ||
function( ) ... end | ||
gap> x; | ||
rec( 2 := rec( 3 := 5 ), f := function( ) ... end ) | ||
gap> x.f().q := 6; | ||
6 | ||
gap> y := []; | ||
[ ] | ||
gap> x := rec( a := 3 ); | ||
rec( a := 3 ) | ||
gap> 1 + x.a; | ||
4 | ||
gap> x.f := -> [4]; | ||
function( ) ... end | ||
gap> 4 + x.f()[1]; | ||
8 | ||
gap> x.f()[1]; | ||
4 | ||
gap> l := [[1,2,3],[4,5,6],[7,8,9]];; | ||
gap> Print(l{[2..3]}{[2..3]},"\n"); | ||
[ [ 5, 6 ], [ 8, 9 ] ] | ||
gap> STOP_TEST( "modifiers.tst", 1); |