Skip to content

Commit

Permalink
test(testament): zip/map
Browse files Browse the repository at this point in the history
  • Loading branch information
litlighilit committed Feb 3, 2025
1 parent edac795 commit b41ae11
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/testaments/builtins/map_zip.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
discard """
output: '''
1 4
5
2 5
7
1
2
3
(1, 4, 'a')
(2, 5, 'b')
'''
"""
import pylib/builtins/iters

let
it1 = [1, 2, 3]
it2 = [4, 5]

func f(a, b: int): int =
debugEcho a, ' ', b
a+b

for i in map(f, it1, it2): echo i



func f(a: int): int = a
for i in map(f, it1): echo i

for i in zip(it1, it2, "abc"): echo i

0 comments on commit b41ae11

Please sign in to comment.