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

Many methods in Any docs are wrong #1731

Closed
22 tasks done
zoffixznet opened this issue Jan 13, 2018 · 8 comments
Closed
22 tasks done

Many methods in Any docs are wrong #1731

zoffixznet opened this issue Jan 13, 2018 · 8 comments
Assignees
Labels
docs Documentation issue (primary issue type)

Comments

@zoffixznet
Copy link
Contributor

zoffixznet commented Jan 13, 2018

Many, if not most, methods in Any docs are either slightly wrong or are outright completely invalid.

Briefly scanning the docs I see these issues:

  • method produce - this one is just plain missing.
  • method reduce - missing.
  • method rotor - missing
  • "Treats the Any as a 1-item list" — many methods mention this, however the actual behaviour is the Any gets coerced to a list using .list method, which is a 1-item list if Any.list is used, but some types implement their own .list. For example ^10 .combinations would treat that Range as a list, but the docs suggest the Range would become a single item
  • "Coerce the invocant first to a List" — the actual coercion for many methods is to a "list" (lowercase), using .list method which can give any Positional
  • "Returns an empty List." / "Returns Any." / etc. — this is the "completely invalid" category. Some methods like .pairs, .antipairs, and .kv seem to document observed behaviour for an Any typeobject rather than what the methods actually do. Yes, Any.pairs returns an empty list, but the behaviour for Any:D is to coerce to .list and then call .pairs on the result.
  • method values.
  • say Any.flatmap
  • say Any.skip
  • say Any.first
  • say Any.unique
  • say Any.repeated
  • say Any.squish
  • say Any.categorize
  • say Any.classify
  • say Any.pairs
  • say Any.kv
  • say Any.tree
  • say Any.nl-out
  • say Any.invert
  • say Any.combinations
  • Any.map and sub map

There may be more issues and my suggestion would be to look through all the methods to ensure they contain valid information.

@zoffixznet zoffixznet added the docs Documentation issue (primary issue type) label Jan 13, 2018
@JJ
Copy link
Contributor

JJ commented Jan 23, 2018

If I can be of help, do assign me some issue. Are you working on this?

@zoffixznet
Copy link
Contributor Author

Are you working on this?

Not me, no.

@JJ JJ self-assigned this Jan 23, 2018
@JJ
Copy link
Contributor

JJ commented Jan 23, 2018

OK, I'll try to have a look at it then.

JJ added a commit that referenced this issue Jan 25, 2018
This addresses @zoffixznet first concern in #1731
@JJ
Copy link
Contributor

JJ commented Jan 25, 2018

However, there is still a problem, and that is my usual concern with examples, in that they do not reflect a real use case. Using a class name like Any in examples like say Any.roll, and correct me if I'm wrong, converts class Any to an object of type Any and then applies roll. Wouldn't it be more adequate to use, say, a list of objects with classes that descend from Any and apply one of these examples to them?
Besides, flatmap is discouraged in list. Shouldn't we mention this also here? Or at least make a reference to that?

JJ added a commit that referenced this issue Jan 25, 2018
Now that I've read item 2 of @zoffixznet's list, I see that what I've
said for the first item is wrong. Hope it's OK now. Refs #1731
JJ added a commit that referenced this issue Jan 25, 2018
There was a single instance. Refs #1731
fluca1978 added a commit that referenced this issue Jan 25, 2018
Removes the related TODO item.
Documentation comes from the source of Any shipped with
Rakudo version 2017.11 built on MoarVM version 2017.11

See issue #1731
fluca1978 added a commit that referenced this issue Jan 25, 2018
Documentation comes from the source of Any shipped with
Rakudo version 2017.11 built on MoarVM version 2017.11

See issue #1731
fluca1978 added a commit that referenced this issue Jan 25, 2018
Documentation comes from the source of Any shipped with
Rakudo version 2017.11 built on MoarVM version 2017.11

See issue #1731
fluca1978 added a commit that referenced this issue Jan 25, 2018
Documentation comes from the source of Any shipped with
Rakudo version 2017.11 built on MoarVM version 2017.11

See issue #1731
fluca1978 added a commit that referenced this issue Jan 25, 2018
Documentation comes from the source of Any shipped with
Rakudo version 2017.11 built on MoarVM version 2017.11

See issue #1731
fluca1978 added a commit that referenced this issue Jan 25, 2018
Apparently there is no method reduce in Any:

Any.reduce;
Cannot resolve caller reduce(Any: ); none of these signatures match:
    ($: &with, *%_)

This should not hurt, since reduce was marked as a TODO item.

Documentation comes from the source of Any shipped with
Rakudo version 2017.11 built on MoarVM version 2017.11

See issue #1731
fluca1978 added a commit that referenced this issue Jan 25, 2018
Apparently there's no any method produce:

> Any.produce
Cannot resolve caller produce(Any: ); none of these signatures match:
    ($: &with, *%_)

This should not hurt, since the method was marked as a TODO item.

Documentation comes from the source of Any shipped with
Rakudo version 2017.11 built on MoarVM version 2017.11

See issue #1731
@JJ
Copy link
Contributor

JJ commented Jan 26, 2018

Great work, @fluca1978

fluca1978 added a commit that referenced this issue Feb 5, 2018
As of moar source code 2017-12.
See issue #1731
fluca1978 added a commit that referenced this issue Feb 5, 2018
See issue #1731.
Documentation as of source moar-2017-.12.
fluca1978 added a commit that referenced this issue Feb 5, 2018
See issue #1731.
As of source code in moar-2017.12.
fluca1978 added a commit that referenced this issue Feb 5, 2018
See issue #1731.
As of source code from moar-2017.12.
@JJ JJ closed this as completed in a881041 Feb 25, 2018
@JJ JJ reopened this Sep 1, 2018
@JJ
Copy link
Contributor

JJ commented Sep 1, 2018

Reopening this, since many examples still document what happens if you call the method on Any, the class, instead of an object of any class in the Any hierarchy. Search for say Any. in the document and try to eliminate all of them.

@JJ
Copy link
Contributor

JJ commented Sep 1, 2018

In some cases, those methods are described again where they make sense (in List, for instance). Insert a reference to them in that case.

JJ added a commit that referenced this issue Sep 1, 2018
JJ added a commit that referenced this issue Nov 11, 2018
Eliminates the class example, and adds pointers. Refs #1731
JJ added a commit that referenced this issue Nov 12, 2018
Eliminates the class example, and adds pointers. Refs #1731
JJ added a commit that referenced this issue Nov 12, 2018
Eliminates the class example too; refs #1731
JJ added a commit that referenced this issue Feb 14, 2019
JJ added a commit that referenced this issue Feb 15, 2019
This is WIP. Works towards #1731
JJ added a commit that referenced this issue Feb 16, 2019
JJ added a commit that referenced this issue Feb 17, 2019
JJ added a commit that referenced this issue Feb 17, 2019
JJ added a commit that referenced this issue Feb 18, 2019
JJ added a commit that referenced this issue Feb 18, 2019
JJ added a commit that referenced this issue Feb 18, 2019
JJ added a commit that referenced this issue Feb 18, 2019
JJ added a commit to JJ/my-raku-examples that referenced this issue Feb 19, 2019
JJ added a commit that referenced this issue Feb 19, 2019
JJ added a commit that referenced this issue Feb 19, 2019
JJ added a commit that referenced this issue Feb 19, 2019
JJ added a commit that referenced this issue Feb 19, 2019
JJ added a commit that referenced this issue Feb 19, 2019
JJ added a commit that referenced this issue Feb 19, 2019
JJ added a commit that referenced this issue Feb 20, 2019
JJ added a commit that referenced this issue Feb 20, 2019
JJ added a commit that referenced this issue Feb 20, 2019
JJ added a commit that referenced this issue Feb 20, 2019
JJ added a commit that referenced this issue Feb 23, 2019
@JJ JJ closed this as completed in e96b81b Feb 23, 2019
@JJ
Copy link
Contributor

JJ commented Mar 27, 2019

Reopen to address #2675

@JJ JJ reopened this Mar 27, 2019
@JJ JJ closed this as completed in 99c20ef Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue (primary issue type)
Projects
None yet
Development

No branches or pull requests

2 participants