Skip to content

Commit 4a9e2db

Browse files
committed
Updated map function to accept multiple iterators
Created transcrypt/transducers autotest module Moved existing map and filter autotests to transducers autotest module Added new autotests for map
1 parent 1116b62 commit 4a9e2db

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

transcrypt/development/automated_tests/transcrypt/autotest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

5757
import truthyness
5858
import tuple_assignment
59+
import transducers
5960

6061
autoTester = org.transcrypt.autotester.AutoTester ()
6162
autoTester.run (arguments, 'arguments')
@@ -113,5 +114,6 @@
113114

114115
autoTester.run (truthyness, 'truthyness')
115116
autoTester.run (tuple_assignment, 'tuple_assignment')
117+
autoTester.run (transducers, 'transducers')
116118

117119
autoTester.done ()

transcrypt/development/automated_tests/transcrypt/div_pulls/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ def run (autoTester):
4040
autoTester.check (s [2:])
4141
autoTester.check (s [::2])
4242

43-
autoTester.check ('Pull 59')
44-
autoTester.check (list (filter (lambda x: x % 2 == 0, range (10))))
45-
autoTester.check (list (map (lambda x: x*x, range (0, 31, 3))))
46-
4743
autoTester.check ('Pull 561')
4844
def brackets (word):
4945
autoTester.check ('sideeffect')
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
def run (autoTester):
3+
autoTester.check (list (filter (lambda x: x % 2 == 0, range (10))))
4+
5+
autoTester.check (list (map (lambda x: x* x, range(0, 31, 3))))
6+
autoTester.check (list (map (lambda x, y: x * y, range(0, 31, 3), [1, 2, 3])))
7+
autoTester.check (list (map (lambda x, y, z: x * y + z, range(0, 31, 3), [1, 2, 3, 4], (2, 4, 6))))

transcrypt/modules/math/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def radians (x):
5353
def copysign (x, y):
5454
return x if Math.sign(x) == Math.sign(y) else -x
5555

56-
__pragma__ ('kwargs')
56+
#__pragma__ ('kwargs')
5757
def isclose (a, b, rel_tol=1e-09, abs_tol=0.0):
5858
return Math.abs(a-b) <= Math.max(rel_tol * Math.max(Math.abs(a), Math.abs(b)), abs_tol)
59-
__pragma__ ('nokwargs')
59+
#__pragma__ ('nokwargs')
6060

6161
isnan = js_isNaN
6262

transcrypt/modules/org/transcrypt/__runtime__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ def sorted (iterable, key = None, reverse = False):
122122

123123
#__pragma__ ('nokwargs')
124124

125-
def map (func, iterable):
126-
return [func (item) for item in iterable]
127-
125+
def map (func, *iterables):
126+
# return [func (item) for item in iterable]
127+
return [func(*items) for items in zip(*iterables)]
128128

129129
def filter (func, iterable):
130130
if func == None:

0 commit comments

Comments
 (0)