Skip to content

Conversation

@friendlymatthew
Copy link
Member

This PR implements the map() builtin function that applies a function to items from one or more iterables, returning a list of results.

Note: it stops at the shortest iterable when multiple are provided. Currently, it only supports builtin functions and the strict= parameter is not yet supported

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 23, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing map (bee7979) with main (7909646)

Summary

✅ 11 untouched benchmarks

@friendlymatthew friendlymatthew changed the title Add map() builtin function Implement map builtin function Jan 23, 2026
Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also needs tests for more error cases

Comment on lines +32 to +35
for (k, v) in kwargs {
k.drop_with_heap(heap);
v.drop_with_heap(heap);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (k, v) in kwargs {
k.drop_with_heap(heap);
v.drop_with_heap(heap);
}
kwargs.drop_with_heap(heap);

or something

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. we can do the same in zip, sorted, min_max, etc

Comment on lines +36 to +38
for v in positional {
v.drop_with_heap(heap);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for v in positional {
v.drop_with_heap(heap);
}
positional.drop_with_heap(heap);

also positional should probably be called args.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should help clean up how we drop items: #69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants