-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from polystat/forLoop
add a basic list support
- Loading branch information
Showing
7 changed files
with
102 additions
and
6 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,52 @@ | ||
+package org.eolang | ||
+alias cage org.eolang.gray.cage | ||
+alias goto org.eolang.gray.goto | ||
+junit | ||
|
||
[] > test-my-array | ||
[x] > mkCopy | ||
x' > copy | ||
copy.< > @ | ||
[result] > return | ||
[] > xclass | ||
3 > xid | ||
[] > xmyArray | ||
[initValue] > apply | ||
[stackUp] > @ | ||
cage > pResult | ||
[] > result | ||
cage > value | ||
|
||
[] > xlength | ||
[self] > apply | ||
[stackUp] > @ | ||
seq > @ | ||
stackUp.forward (return (self.value.length)) | ||
123 | ||
|
||
[] > xget | ||
[self i] > apply | ||
[stackUp] > @ | ||
seq > @ | ||
stackUp.forward (return (self.value.get i)) | ||
123 | ||
|
||
[] > xappend | ||
[self x] > apply | ||
[stackUp] > @ | ||
seq > @ | ||
mkCopy (self.value) > tmp | ||
self.value.write (tmp.copy.append x) | ||
stackUp.forward (return 0) | ||
|
||
seq > @ | ||
result.value.write initValue | ||
pResult.write result | ||
stackUp.forward (return pResult) | ||
|
||
(goto ((xmyArray.apply (*)).@)).result > a | ||
seq > @ | ||
(goto ((a.xappend.apply a 2).@)).result | ||
and. | ||
((goto ((a.xlength.apply a).@)).result.eq 1) | ||
(goto ((a.xget.apply a 0).@)).result.eq 2 |
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
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
3 changes: 2 additions & 1 deletion
3
transpiler/src/test/resources/org/polystat/py2eo/transpiler/simple-tests/list/list-1.yaml
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
enabled: False | ||
enabled: True | ||
python: | | ||
def test(): | ||
def len(list): return list.length() | ||
list = [1,2, 3] | ||
return len(list) == 3 |
e66b2b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to yegor256/0pdd:
Please, copy and paste this stack trace to GitHub: