consider add "for_each" function
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 280
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 4
Description
Hello, will toolz consider add "for_each" function?
In scala,
Scala> Array(“hbase”,”hive”,”spark”,”hadoop “).foreach(a => print(a + ’ ‘))
"for_each" function can perform a process on each element immediately.
Consider this case:
@curry
def for_each(proc, eles):
for ele in eles:
proc(ele)
.......
with open(out_path, "w", encoding='utf8') as fout, open(src_path, 'r', encoding='utf8') as fin:
pipe(fin,
map(lambda e: e.strip().split('\t')),
filter(lambda e: len(e) == 3),
for_each(lambda e: fout.write(e[1]+'\n'))
)
Will toolz consider it? or do we have better method?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed for_each(proc, eles) behavior and the pipe usage shown in the issue. Review toolz's existing collection and pipeline APIs, then determine whether this function belongs in the library or whether an existing method is preferred; done means a decided API direction with appropriate implementation and tests if accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100