-
Notifications
You must be signed in to change notification settings - Fork 128
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
Use composition for multiagents #1089
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know about this either... But, If two people that develop such a complex library don't know something about Julia, what does this say for the average user...? I think the average user would have no clue what this piece of code even means. This seems a cool feature, but probably should be highlighted as an advanced illustration. My suggestion would be to keep the the tutorial as-is and add another sentence afterwards that says something "actually, julia even allows for composition. You can use this character (with unicode \name and tab) and then compose functions" and then show the new code. Or something like that?
yeah, I had the same feeling, let's go with suggesting it after the constructor calls |
I've improved the tutorial a bit. @Tortar I noticed that the two approaches aren't interchangeable per se:
I assume this doens't have any impact on performance? To finish this do you want to replace the syntax in the docstring of |
Both return a function so they are interchangeable for our scopes and the composition shouldn't change any perf characteristics. Replaced the composition in multiagent, I also changed a bit the constructor stuff in the tutorial, let me know what do you think. In general to construct single agents we have three options:
I mean, in a sense, now that I know about the ∘ operator I would completely drop constructor(Multi, Agent)(...) and I would explain the logic more than anything else, e.g. if we woudn't have the composition operator we would need a closure to build the Multi(Agent(...)) syntax |
I didn't know about this feature but it is sweet in this case I think :-)