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

Docs on Whatever curry could be clearer / don't cover everything #2017

Open
zoffixznet opened this issue May 9, 2018 · 3 comments
Open

Docs on Whatever curry could be clearer / don't cover everything #2017

zoffixznet opened this issue May 9, 2018 · 3 comments
Labels
big Issue consisting of many subissues docs Documentation issue (primary issue type) RFE Request for enhancement. Try to use alternative wording that explain the concept more clearly

Comments

@zoffixznet
Copy link
Contributor

zoffixznet commented May 9, 2018

Glancing at the intro section on https://docs.perl6.org/type/Whatever I notice a couple of problems.

  1. Roughly the second half of the section is probably not clear enough for the average reader. The section even introduces the term "stored *" only to backtrack on it and try to explain that curry already happened before it.
  2. The information doesn't give all the details when curry happens. Especially when it comes to chained Whatever stars, such as * ≥ * ≥ *, *.uc ~~ *, *.uc xx *.abs etc. In code form (and should already be fairly covered by spec) the list of what decisions are made is encoded here. I think this full information can replace the current second portion of the description.
  3. The section should probably mention that HyperWhatever exists, considering how close the two constructs are.

Update with a couple more comments on the subject: http://colabti.org/irclogger/irclogger_log/perl6?date=2018-09-26


00:54 | Zoffix | vrurg: it's a hardcoded list of things: https://github.com/rakudo/rakudo/blob/da646aa2ee6e3064bdef905f5c0b54b4bd0b2797/src/Perl6/Actions.nqp#L9634-L9665 there's a yet-to-be-fixed docs Issues on the topic D#2017
00:54 | synopsebot | D#2017 [open] : https://github.com/perl6/doc/issues/2017 [docs] Docs on Whatever curry could be clearer / don't cover everything
00:58 | Zoffix | `*` is "Whatever" in those comments, and an already-closurised thing is a "WhateverCode". So, for example in `*.uc.lc` => `*` Whatever => the `.uc` is a `callmethod` op, and so we make a WhateverCode => we now get to `.lc`, since `callmethod` op is level `3` in that list, we continue closing over it and make `{.uc.lc}`-equivalent closure (without the new scope). But `&infix:<~~>` is level 1, so with `*.all ~~
00:58 | Zoffix | Blah` => `.all` is callmethod op, we curry it => we get to `~~` op with WhateverCode in hands, and since `~~` is level 1, we don't curry anymore. But with `* ~~ Blah` we have a Whatever, not WhateverCode, on LHS, so we do curry the level 1 `~~` op

@zoffixznet zoffixznet added the docs Documentation issue (primary issue type) label May 9, 2018
@JJ JJ changed the title Docs on Whatever curry are muddy / don't cover everything Docs on Whatever curry could be clearer / don't cover everything May 9, 2018
@JJ JJ added RFE Request for enhancement. Try to use alternative wording that explain the concept more clearly big Issue consisting of many subissues labels Jan 27, 2019
JJ added a commit that referenced this issue Jan 28, 2019
@JJ
Copy link
Contributor

JJ commented Jan 28, 2019

I'm trying to solve this issue, and the main problem I'm finding is that I'm not sure currying is used properly here. In general, it translates the evaluation of a function with multiple arguments to the evaluation of a sequence of functions with single arguments. That's the general idea.
In this case, I can't even see where are the placeholders for "functions" and "arguments". Whatever is a class, it it's used as a term it might make the whole construct a WhateverCode; WhateverCode is actually a functor. Functors are effectively curried when they receive arguments.
So I guess we're talking about two different processes here: when and how Whatever (or HyperWhatever) are functorized (not curried, they are not functions) and when WhateverCode is curried. Am I too far off mark?

@Scimon
Copy link
Contributor

Scimon commented Jan 28, 2019

If they were currying I'd expect this to work : my &f = * + *;my &g = &f(2);say &g(2)

@JJ
Copy link
Contributor

JJ commented Jan 28, 2019

That's the other part of the issue, the "stored whatever". But that's right, it's not clear where the concept of currying fits here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
big Issue consisting of many subissues docs Documentation issue (primary issue type) RFE Request for enhancement. Try to use alternative wording that explain the concept more clearly
Projects
None yet
Development

No branches or pull requests

3 participants