コード例 #1
0
ファイル: __init__.py プロジェクト: hychen/harrow
 def test_choice(self):
     arr = Arrow()
     prog = arr.choice_apply(1,  _plus1)
     prog.post(list)
     self.assertEquals([0, 1, 1, 0], prog([0, 0, 1, 0]))
     arr = Arrow()
     prog = arr.choice_apply(1, _fn_with_args, 1, 2)
     prog.post(list)
     self.assertEquals([0, 3, 1, 0], prog([0, 0, 1, 0]))
コード例 #2
0
ファイル: __init__.py プロジェクト: hychen/harrow
 def test_parallel(self):
     """***"""
     prog =  Arrow().parallel(lambda n: n+1, lambda n: n+2)
     prog.post(list)
     self.assertEquals([2, 4], prog([1, 2]))
コード例 #3
0
ファイル: __init__.py プロジェクト: hychen/harrow
 def test_precomputation(self):
     arr = Arrow().map(lambda n: n+1)
     larger2arr = arr.filter(lambda n: n>2)
     self.assertEquals([3,4,5,6,7, 8], larger2arr([1,2,3,4,5,6,7]))
コード例 #4
0
ファイル: __init__.py プロジェクト: ya790206/harrow
 def test_choice(self):
     arr = Arrow()
     prog = arr.choice(_plus1, 1)
     self.assertEquals([0, 1, 0, 0], prog([0, 0, 0, 0]))