Giter Club home page Giter Club logo

examples's People

Contributors

altai-man avatar andreoss avatar coke avatar dwarring avatar edpratomo avatar eric256 avatar felher avatar gerdr avatar grondilu avatar j1n3l0 avatar jani avatar jj avatar kamilaborowska avatar manwar avatar moritz avatar paultcochrane avatar perlpilot avatar philandstuff avatar polettix avatar raiph avatar scottp avatar shimmerfairy avatar shlomif avatar softmoth avatar stmuk avatar tbrowder avatar timo avatar unobe avatar virtualsue avatar zoffixznet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples's Issues

solution to project euler problem 99 does not compile

solution to project euler problem 99 does not compile

$ perl6 --version
This is perl6 version 2015.06 built on MoarVM version 2015.06

perl6 prob099-andreoss.pl
Dynamic variable $*PROGRAM-NAME not found
  in sub MAIN at prob099-andreoss.pl:45
  in block <unit> at prob099-andreoss.pl:45

Revise web generation

htmlify.p6 in documentation is deprecated, and theoretically Documentable should be able to work with all kind of directories with the correct configuration.
However, this program is totally different, although it's got the same name. So simply revise and maybe refactor.
Also find an infrastructure for it. I'm not sure where it is now, or who's in charge.

games/tictactoe.p6 broken

matthew@0xB1uE7:~/tmp/perl6-examples/categories/games$ perl6 -v
This is perl6 version 2015.09-383-gf0d4820 built on MoarVM version 2015.09-79-gee9fc2b

matthew@0xB1uE7:~/tmp/perl6-examples/categories/games$ perl6 tictactoe.p6
Index out of range. Is: 1, should be in 0..0
in block at tictactoe.p6:28

Actually thrown at:
in sub tictactoe-masak at tictactoe.p6:21
in block at tictactoe.p6:31

https

Fix https for examples.perl6.org
It works everywhere else.

Redefine / clarify purpose of examples

See also @Altai-man's comment: #57 (comment)

The examples directory requires attention. I am in the process of bringing file extensions (see also #72) and shebangs inline with current Raku conventions. But further attention is required to tidy up these examples, and repair publishing.

At a high level, my view is the Raku/examples directory should:

  • Make it easy for users to find (and execute) examples
  • have a "real world" nature wherever possible, including some explanatory text
  • Offer the community a place to contribute their valuable examples for others to benefit from
  • Have strong ties (bi-directional links to) official Raku documentation (IE, see example and follow link to reference docs, or see reference docs and follow link back to examples)

Commencing with the cookbook:

I propose further cookbook style recipes that offer typical programming activities and how they might be solved in Raku. Including multi paradigm examples, and alternative approaches to achieve the same result to ensure the TIMTOWTDI mindset can continue to prosper.

Currently, the Raku/examples/cookbook is a "tip of the hat" back to the excellent Perl Cookbook.

This is fantastic for Perl 5's posterity and certainly something we should continue maintain, however it fails to showcase Raku's capabilities that make it a more modern language. For one example, concurrency. One area among others that most certainly should have multiple cookbook recipes.

TODO:

Continue to maintain and enhance the existing cookbook examples:

  • Agree upon, and document Raku/examples/cookbook purpose, contribution guides and strategy
  • As suggested by @JJ include testing on the existing recipes (see also #63)
  • Fix the deployment, styling and hosting of cookbook recipes (see also #69 #46 )

`make html` fails

Running make html fails with:

[...]
Creating category index files                                                                                                                                                                               
Cannot resolve caller handle(Pod::To::HTML.new(de...: (Pod::Block::Table                                                                                                                                    
 ..., 0, None, :!defn); none of these signatures matches:                                                                                                                                                   
    (GenericPod: Nil, *%_)                                                                                                                                                                                  
    (GenericPod: Str $node, Int $in-level, Context $context, *%_ --> Str)                                                                                                                                   
    (GenericPod: Pod::Block::Code $node, Int $in-level, Context $context = Context::InPodCode, Bool :$defn = Bool::False, *%_ --> Str)                                                                      
    (GenericPod: Pod::Block::Comment $node, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                                        
    (GenericPod: Pod::Block::Declarator $node, Int $in-level, Context $context, Bool :$defn = Bool::False, *%_ --> Str)                                                                                     
    (GenericPod: Pod::Block::Named $node, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                                          
    (GenericPod: Pod::Block::Named $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                            
    (GenericPod: Pod::Block::Named $node where { ... }, Int $in-level, Context $context, Bool :$defn = Bool::False, *%_ --> Str)                                                                            
    (GenericPod: Pod::Block::Named $node where { ... }, Int $in-level, Context $context, Bool :$defn = Bool::False, *%_ --> Str)                                                                            
    (GenericPod: Pod::Block::Named $node where { ... }, Int $in-level, Context $context, Bool :$defn = Bool::False, *%_ --> Str)                                                                            
    (GenericPod: Pod::Block::Named $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                            
    (GenericPod: Pod::Block::Named $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                            
    (GenericPod: Pod::Block::Named $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                            
    (GenericPod: Pod::Block::Named $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                            
    (GenericPod: Pod::Block::Para $node, Int $in-level, Context $context where { ... }, Bool :$defn = Bool::False, *%_ --> Str)                                                                             
    (GenericPod: Pod::Block::Para $node, Int $in-level, Context $context, Bool :$defn = Bool::False, *%_ --> Str)                                                                                           
    (GenericPod: Pod::Block::Table $node, Int $in-level, Context $context, Bool :$defn = Bool::False, *%_ --> Str)                                                                                          
    (GenericPod: Pod::Defn $node, Int $in-level, Context $context, *%_ --> Str)                                                                                                                             
    (GenericPod: Pod::Heading $node, Int $in-level, Context $context, Bool :$defn = Bool::False, *%_ --> Str)                                                                                               
    (GenericPod: Pod::Item $node, Int $in-level is copy, Context $context, Bool :$defn = Bool::False, *%_ --> Str)                                                                                          
    (GenericPod: Pod::Raw $node, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                                                   
    (GenericPod: Pod::Config $node, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                                                
    (GenericPod: Pod::FormattingCode $node, Int $in-level, Context $context where { ... }, Bool :$defn = Bool::False, *%_ --> Str)                                                                          
    (GenericPod: Pod::FormattingCode $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                          
    (GenericPod: Pod::FormattingCode $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                          
    (GenericPod: Pod::FormattingCode $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                          
    (GenericPod: Pod::FormattingCode $node where { ... }, Int $in-level, $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                                  
    (GenericPod: Pod::FormattingCode $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                              (GenericPod: Pod::FormattingCode $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                          
    (GenericPod: Pod::FormattingCode $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                          
    (GenericPod: Pod::FormattingCode $node where { ... }, Int $in-level, Context $context = Context::None, Bool :$defn = Bool::False, *%_ --> Str)                                                          
  in code  at /home/examples.raku.org/.raku/sources/901F1025C42CF990CDCEED32B5126CF84EFB01D3 (ProcessedPod) line 689                                                                                        
  in method handle at /home/examples.raku.org/.raku/sources/901F1025C42CF990CDCEED32B5126CF84EFB01D3 (ProcessedPod) line 687                                                                                
  in code  at /home/examples.raku.org/.raku/sources/901F1025C42CF990CDCEED32B5126CF84EFB01D3 (ProcessedPod) line 331                                                                                        
  in method process-pod at /home/examples.raku.org/.raku/sources/901F1025C42CF990CDCEED32B5126CF84EFB01D3 (ProcessedPod) line 331                                                                           
  in method render-tree at /home/examples.raku.org/.raku/sources/901F1025C42CF990CDCEED32B5126CF84EFB01D3 (ProcessedPod) line 348                                                                           
  in sub pod2html at /home/examples.raku.org/.raku/sources/B724BB3B7903E7B04A25FE65B2CA6547625F99D8 (Pod::To::HTML) line 663                                                                                
  in method p2h at /home/examples.raku.org/examples/lib/Pod/Htmlify.pm6 (Pod::Htmlify) line 217                                                                                                             
  in method write-category-indices at /home/examples.raku.org/examples/lib/Pod/Htmlify.pm6 (Pod::Htmlify) line 136                                                                                          
  in method build at /home/examples.raku.org/examples/lib/Pod/Htmlify.pm6 (Pod::Htmlify) line 30                                                                                                            
  in sub MAIN at htmlify.pl line 79                                                                                                                                                                         
  in block <unit> at htmlify.pl line 5  

games/wizard.pl crash

matthew@0xB1uE7:~/tmp$ perl6 -v
This is perl6 version 2015.09-383-gf0d4820 built on MoarVM version 2015.09-79-gee9fc2b

matthew@0xB1uE7:~/tmp$ perl6 ./wizard.pl
What is your name: BT
Greetings, BT
BTiscurrently in theLobby

18
Army of frogs is attacking you! What will you do?
Use of uninitialized value $choice of type Any in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in method battle at ./wizard.pl:117
Type check failed in assignment to $!param; expected Str but got Weapon
in block at ./wizard.pl:120
in method battle at ./wizard.pl:117
in block at ./wizard.pl:217

Expected output

I'm just reading through https://examples.p6c.dev/categories/cookbook/01strings/01-00introduction.html and I notice some (most?) of the examples don't show the expected output. Is this something that can be done automagically, or does someone need to go through and add them manually?

Example with expected output:

say '~$scalar is ', (~$scalar).^name; # ~$scalar is Str

Example with no expected output:

say 'The quick brown fox\n\tjumps over the lazy dog\n';

review / refresh documentation links (and more?)

The examples left a strongly negative impression for at least one person expecting doc that's beyond the speculation stage. See http://www.perlmonks.org/?node_id=1163279 for the unfortunate impact of the first example in the first category. I've fixed that particular example but I'm filing this issue with the intent we review and refresh at least the documentation links in all examples (and perhaps review/refresh more as we go? please comment here if you've thought of something worth doing at the same time).

Repair bin/run-examples.pl

bin/run-examples.pl is currently broken.

Seems META6.json needs File::Find to be added.

Also, as file extensions are being changed to match Raku conventions this runner script will require ongoing updates

Incorrect Code for Computing Special Pythagorean Triplet

Examples prob009-gerdr.pl and gerdr-feeds.pl give an incorrect answer.

The object is to find three numbers, a < b < c, such that (1) a ** 2 + b ** 2 = c ** 2; and, (2) a + b + c = 1000. The correct answer is 200 375 and 425, but each of the above mentioned scripts gives 31875000 (which is 200 * 375 * 425).

The attached file (adapted from prob009-gerdr.pl) gives the correct answer (thus indicating that the problem stems from using gather ... take).
find_Pythagorean_Triplet.txt

Edit: Full code in the above link is :

#!/usr/bin/env raku

# raku ex_Pythagorean_Triplet_Say.raku

# -------------------------------------------------------------------
#  A Pythagorean triplet is a set of three integers, a < b < c, such
#  that a**2 + b**2 = c**2. Find a triplet where a + b + c = 1000.
# -------------------------------------------------------------------


sub triples($N) {
  for 1..Int((1 - sqrt(0.5)) * $N) -> $a {
    my $u = $N * ($N - 2 * $a);
    my $v = 2 * ($N - $a);

    # If b = u/v is an integer, report triple
    if $u %% $v {
      my $b = $u div $v;
      my $c = $N - $a - $b;
      say "$a $b $c";
    }
  }
}

triples(1000);

# 200 375 425

Rename file extensions

Content here is so old, everything is .pm .pl .p6 - Update to use latest extensions.

There is no need, IMO, to keep the old URLs working (in an ideal world we would, but having the site follow standard and be navigable is more important IMO)

Categories mismatch

The categories listed on the home page of examples.perl6.org don't match the category tabs across the topnav. There are some naming inconsistencies, but more importantly there are tabs with no associated description in the category list.

Only first 100 Project Euler problems should have solutions

The Project Euler solutions seem to clash with Project Euler's rules, as only solutions from the first 100 problems should be shown. From here:

I learned so much solving problem XXX, so is it okay to publish my solution elsewhere?

It appears that you have answered your own question. There is nothing quite like that "Aha!" moment when you finally beat a problem which you have been working on for some time. It is often through the best of intentions in wishing to share our insights so that others can enjoy that moment too. Sadly, that will rarely be the case for your readers. Real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery. Please do not deny others what you have so richly valued yourself.

However, the rule about sharing solutions outside of Project Euler does not apply to the first one-hundred problems, as long as any discussion clearly aims to instruct methods, not just provide answers, and does not directly threaten to undermine the enjoyment of solving later problems. Problems 1 to 100 provide a wealth of helpful introductory teaching material and if you are able to respect our requirements, then we give permission for those problems and their solutions to be discussed elsewhere.

That being said, this is a great resource, and thank you for your work!

games/blackjack.p6 broken

matthew@0xB1uE7:~/tmp/perl6-examples/categories/games$ perl6 -v
This is perl6 version 2015.09-383-gf0d4820 built on MoarVM version 2015.09-79-gee9fc2b

matthew@0xB1uE7:~/tmp/perl6-examples/categories/games$ perl6 blackjack.p6
DEALER:
0 of ten 10 hearts

PLAYER:
0 of nine 9 clubs
0 of six 6 clubs
Cannot call Numeric(Pair: ); none of these signatures match:
(Mu:U \v: *%_)
in block at blackjack.p6:63

site cert out of date

When I`m try to enter the site on https, firefox give me:

Websites prove their identity via certificates. Firefox does not trust this site because it uses a certificate that is not valid for examples.raku.org. The certificate is only valid for the following names: design.raku.org, design.rakulang.site
 
Error code: SSL_ERROR_BAD_CERT_DOMAIN

examples.perl6.org design

It would be nice if the examples have the same design as the main perl6.org website. For consistency.

[Question] Is a maintainer needed?

I think it is not a secret that this repo is outdated, not only that, it lacks a maintainer to take care of broken examples, blatantly old-style perl 6 code (it's ok when we demonstrate various approaches to users, but tooling is very this way too, and it is broken right now).

Anyone is against me working on reviving this project? Saving it for historical reasons or something like this? In case nobody argues against that in 7 days, I'll start tinker on things (in ways I see reasonable from my point of view, of course).

Renaming and moving this repository

This repository does not have that many dependencies (or attention, for that matter). If no one minds, I'll (or whoever is in charge by then) be changing everything to Raku and eventually move it to Raku/examples.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.