Raku / raku.org

Source code for https://raku.org/
https://raku.org/
Artistic License 2.0
70 stars 50 forks source link

perl6.org should have source code on the front page #19

Closed bartgrantham closed 9 years ago

bartgrantham commented 9 years ago

Here I am, a lapsed Perl programmer curious about Perl 6, and I'd like to see how the language is shaping up. Have you tried starting from the home page and seeing the minimal number of clicks you need to see actual code? I counted 4 (home page -> getting started -> examples -> category -> pl file)

Having code on the home page and above the fold, even if it's a trivial example, is an expectation that most developers would have of a programming language website in 2015.

FROGGS commented 9 years ago

:+1:

jonathanstowe commented 9 years ago

:+1:

stmuk commented 9 years ago

And ideally that code should be executable (and modifiable) within the browser

On 17 July 2015 at 09:22, Jonathan Stowe notifications@github.com wrote:

[image: :+1:]

— Reply to this email directly or view it on GitHub https://github.com/perl6/perl6.org/issues/19#issuecomment-122213620.

4096R/EA75174B Steve Mynott steve.mynott@gmail.com

paultcochrane commented 9 years ago

Any suggestions for a good example? We accept pull requests :-)

mkrull commented 9 years ago

Maybe a simple JAPH?

labster commented 9 years ago

http://rosettacode.org/wiki/Fibonacci_sequence#Perl_6 The multi sub form, and perhaps the infinite list form.

Feel free to link to examples.perl6.org too.

perlpilot commented 9 years ago

ruby-lang.org and go-lang.org have some simple code, rust-lang.org has a small calculator implementation, python.org starts out with fibonacci, but you can cycle through multiple code samples that illustrate python features. All of them except python have an interactive way to try the language.

I think we should do something like python.org if we can, but with an interactive box to try the language. If someone can come up with a shortish, complete example of idiomatic Perl 6 code that illustrates several features at once, that might be a good alternative to multiple code samples.

ajs commented 9 years ago

I would suggest three snippets: one very Perl 5 like bit, one very Perl 6 specific bit, and one poetic JAPH.

Give them the old, the new and the culture...

On Fri, Jul 17, 2015, 10:45 AM Jonathan Scott Duff notifications@github.com wrote:

ruby-lang.org and go-lang.org have some simple code, rust-lang.org has a small calculator implementation, python.org starts out with fibonacci, but you can cycle through multiple code samples that illustrate python features. All of them except python have an interactive way to try the language.

I think we should do something like python.org if we can, but with an interactive box to try the language. If someone can come up with a shortish, complete example of idiomatic Perl 6 code that illustrates several features at once, that might be a good alternative to multiple code samples.

— Reply to this email directly or view it on GitHub https://github.com/perl6/perl6.org/issues/19#issuecomment-122297942.

Util commented 9 years ago

Or, actual Perl 5, barely converted Perl 6, and native idiomatic Perl 6.

Adapted from http://rosettacode.org/wiki/Averages/Mode

Perl 5: | # Perl 6: | # Perl 6:

use 5.010; | use v6; | use v6; use List::Util qw(max); | | sub mode { | sub mode ( @a ) { | sub mode ( @a ) { my %count; | my %count; | my %count = @a.classify({$}).map: foreach my $e ( @ ) { | for @a -> $e { | { .key => .value.elems }; $count{$e}++; | %count{$e}++; | my $max = [max] %count.values; } | } | return %count.map: my $best = max(values %count); | my $best = max(values %count); | { .key if .value == $max }; return grep { $count{$} == $best } | return grep {; %count{$} == $best }, | } keys %count; | keys %count; | } | } | say mode( 1, 3, 3, 3, 5, 7, 7, 7 ); | say mode( 1, 3, 3, 3, 5, 7, 7, 7 ); | say mode( 1, 3, 3, 3, 5, 7, 7, 7 );

On Jul 17, 2015, at 10:01 AM, Aaron Sherman notifications@github.com wrote:

I would suggest three snippets: one very Perl 5 like bit, one very Perl 6 specific bit, and one poetic JAPH.

Give them the old, the new and the culture...

On Fri, Jul 17, 2015, 10:45 AM Jonathan Scott Duff notifications@github.com wrote:

ruby-lang.org and go-lang.org have some simple code, rust-lang.org has a small calculator implementation, python.org starts out with fibonacci, but you can cycle through multiple code samples that illustrate python features. All of them except python have an interactive way to try the language.

I think we should do something like python.org if we can, but with an interactive box to try the language. If someone can come up with a shortish, complete example of idiomatic Perl 6 code that illustrates several features at once, that might be a good alternative to multiple code samples.

— Reply to this email directly or view it on GitHub https://github.com/perl6/perl6.org/issues/19#issuecomment-122297942.

— Reply to this email directly or view it on GitHub.

uvtc commented 9 years ago

I think one of the reasons this wasn't done previously was due to lack of Perl 6 html syntax highlighting.

paultcochrane commented 9 years ago

On 17 July 2015 5:30:18 pm GMT+02:00, John Gabriele notifications@github.com wrote:

I think one of the reasons this wasn't done previously was due to lack of Perl 6 html syntax highlighting.


Reply to this email directly or view it on GitHub: https://github.com/perl6/perl6.org/issues/19#issuecomment-122313019

we now have either the highlighting from pygments (http://pygments.org) or Text::VimColour (https://github.com/stmuk/p6-Text-VimColour), so highlighting shouldn't be problem.

vendethiel commented 9 years ago

I'd like to avoid showing perl5, it makes it harder to market it from outside of the perl community.

I really like racket-lang.org's code samples

timo commented 9 years ago

@paultcochrane don't forget we also have acceptable lexers in the TextMate format and for CodeMirror or something like that

smls commented 9 years ago

Did you guys see the mockup I did a while ago (and unfortunately haven't found the time to continue working on yet)? http://i.imgur.com/jBXkUgW.png

It prominently features a code example, which I think is suitable for this purpose: screenshot of code snippet

I actually took some notes back then, listing the requirements I set myself when trying to come up with that snippet. Here they are:


Requirements:

Should feature:

Should additionally feature at least two of the following:


I still think they are good guidelines, and should be followed if you want a different code snippet than the one I came up with.

Remember that the target audience should include Perl 5 programmers, and programmers coming from other language, and complete programming newbies.

Also, please don't fall for the temptation to try and squeeze too much interesting stuff into it at once, and sacrifice the "Must be very short" and "Must be easy and obvious" rules in the process. Instead, give people an easy way to reach further examples. In my mockup, that was meant to be handled by this clickable feature list: http://i.imgur.com/QFtj4TQ.png

uvtc commented 9 years ago

:+1: on having multiple examples that can be manually cycled through.

Personally, I don't think it's important if the examples are interactive, just that they look good. I've never used those in-browser demos --- If I like it well enough to want to try it, I'll just install it.

As for the content of the samples, I'd like to see bread-and-butter basics included. The advent calendars and RC have plenty of fancier examples.

perlpilot commented 9 years ago

@smls No I hadn't seen that mockup, but the first thing that occurs to me when I look at it is that it's too busy. The "simple elegance" of the existing perl6.org is lost IMHO.

But your guidelines for the code snippet are excellent! Anyone who makes a mockup that includes code on the main page should review them.

zoffixznet commented 9 years ago

@smls my purely subjective two cents on the mockup is the main top background feels too heavy and the logo blends into it instead of popping. I think making it lighter would alleviate the busyness perlpilot mentioned above. Other than that, I think it looks fantastic and offers a modern look and the code snippet being interactive is a great idea too. Great job.

zoffixznet commented 9 years ago

It does now :) Cheers!