raku.org icon indicating copy to clipboard operation
raku.org copied to clipboard

Simpler example is needed

Open AlexDaniel opened this issue 6 years ago • 2 comments

This ticket was motivated by this issue: https://github.com/perl6/marketing/issues/9#issuecomment-375389577

Go to https://perl6.org/ and you will be welcomed with this example:



grammar Parser {
    rule  TOP  { I <love> <lang> }
    token love { '♥' | love }
    token lang { < Perl Rust Go Python Ruby > }
}

say Parser.parse: 'I ♥ Perl';
# OUTPUT: 「I ♥ Perl」 love => 「♥」 lang => 「Perl」

say Parser.parse: 'I love Rust';
# OUTPUT: 「I love Rust」 love => 「love」 lang => 「Rust」

It's not too complicated, I agree. But don't we want to show something simpler first? For example, this is the third example:

# No floating point noise:
say 0.1 + 0.2 == 0.3;        # OUTPUT: True
say (1/13 + 3/7 + 3/8).perl; # OUTPUT:  <641/728>

And IMO it is much more straightforward.

Maybe we can just rearrange them to get the desired effect, but IMO we should show some real basics first (variables, for loop, etc.).

AlexDaniel avatar Mar 22 '18 17:03 AlexDaniel

(variables, for loop, etc.).

In other words, stuff that all languages have and no one cares about?

The homepage examples should show off our flagship features: I'd definitely put Grammars & Unicode support on first place and Ease of Async/Concurrency/Parallelism on second, and I see the examples are currently arranged to show just that.

And IMO it is much more straightforward.

It's also a lot more boring, shows a feature that's available in all languages—either by default or via libraries—and requires non-trivial CS knowledge about floating point math and its issues to fully appreciate its significance.


I think this proposal conflates teaching the language with showing off cool features of the language. The reader isn't meant to understand all of the code—just the input, resultant output, and the approximate amount and structure of the code involved to produce the behaviour.

zoffixznet avatar Mar 26 '18 01:03 zoffixznet

Maybe you're right.

AlexDaniel avatar Mar 26 '18 01:03 AlexDaniel

I think @zoffixznet is right, closing ticket.

coke avatar Oct 05 '23 03:10 coke