diff options
author | Eduardo Julian | 2021-01-26 19:11:14 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-01-26 19:11:14 -0400 |
commit | 43d28326ad59c74439b96343cc8f619ed7d90231 (patch) | |
tree | 3f410d48bfca7d8141e2e7fda0f8d978934dd5c2 /stdlib/source/lux/data/collection/array.lux | |
parent | ae56acf791c2ed9bd5865f85fffa00b025d310fe (diff) |
Made the Python being generated more compatible with both P2.7 and P3.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/collection/array.lux | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux index 470640bcf..e407f4877 100644 --- a/stdlib/source/lux/data/collection/array.lux +++ b/stdlib/source/lux/data/collection/array.lux @@ -46,7 +46,10 @@ :assume) @.js - ("js array new" size)})) + ("js array new" size) + + @.python + ("python array new" size)})) (def: #export (size array) (All [a] (-> (Array a) Nat)) @@ -63,7 +66,10 @@ (:coerce Nat)) @.js - ("js array length" array)})) + ("js array length" array) + + @.python + ("python array length" array)})) (def: #export (read index array) (All [a] @@ -87,6 +93,12 @@ (let [output ("js array read" index array)] (if ("js object undefined?" output) #.None + (#.Some output))) + + @.python + (let [output ("python array read" index array)] + (if ("python object none?" output) + #.None (#.Some output)))}) #.None)) @@ -103,7 +115,10 @@ :assume) @.js - ("js array write" index value array)})) + ("js array write" index value array) + + @.python + ("python array write" index value array)})) (def: #export (delete! index array) (All [a] @@ -116,7 +131,10 @@ (write! index (:assume (: <elem_type> ("jvm object null"))) array) @.js - ("js array delete" index array)}) + ("js array delete" index array) + + @.python + ("python array delete" index array)}) array)) ) |