Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reduce functionality and example #284

Merged
merged 12 commits into from
Apr 21, 2017
Merged

Add reduce functionality and example #284

merged 12 commits into from
Apr 21, 2017

Conversation

iandioch
Copy link
Member

Connects to #266.

This creates a @Dipla.reduce_distributable decorator. You can see its use in examples/reduce.py, which finds the word with the most vowels in the opening of the communist manifesto by a reduce function.

The decorator takes a parameter, n. This is the number of inputs to take in one go. A normal reduce takes 2 inputs, however it was suggested that this number could be raised to get better performance by reducing the number of requests sent across the wire. This is left up to the user.

It is a little over the 150 line limit, but that is probably caused by the inclusion of the example.

Let me know what you think xoxo

Copy link
Member

@CianLR CianLR left a comment

Choose a reason for hiding this comment

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

Top qual boii

self.task_item.instructions,
self.task_item.machine_type,
arguments,
signals=[x for x in self.task_item.signals])
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer list(self.task_item.signals) but it's a nitpick 🇱🇾

"Attempted to read input from an empty source")
arguments = []

for i in range(self.reduce_group_size):
Copy link
Member

Choose a reason for hiding this comment

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

Convention is for _ in qwertyuiop if you're not using the actual value 🇱🇾


input_data = [word.lower() for word in communist_manifesto.split() if len(word) > 0]

@Dipla.reduce_distributable(n = 6)
Copy link
Member

Choose a reason for hiding this comment

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

I know we don't PEP8 the examples... but qwerty(n=6)

@iandioch iandioch merged commit c4feaab into master Apr 21, 2017
@CianLR CianLR deleted the n/reduce#266 branch July 9, 2017 21:25
@CianLR CianLR restored the n/reduce#266 branch July 9, 2017 21:25
@iandioch iandioch deleted the n/reduce#266 branch May 29, 2018 22:00
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