Permalink
Browse files

First source commit from Damian's YAPC::NA tarball (June 2010).

  • Loading branch information...
pmichaud committed Jul 19, 2010
1 parent a7fdf31 commit b7bd96107b35154facbfe39ac2ed89bcea55a27d
View
@@ -0,0 +1,11 @@
+#! /Users/damian/bin/rakudo'
+use v6;
+
+use IO::Prompter;
+
+while prompt('Args:', :args) -> $input {
+ say "Got [$input]";
+ say @*ARGS.perl;
+}
+
+
@@ -0,0 +1,38 @@
+#! /Users/damian/bin/rakudo'
+use v6;
+
+use IO::Prompter;
+
+loop {
+ my $name = prompt("Name:") // last;
+ my $age = prompt("Age:", :integer, :must({'be positive'=>*>0}) )
+ // last;
+ my $married = prompt("Married?", :yesno) // last;
+
+ report($name, $age, $married);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+sub report ($name, $age, $married) {
+ say " $name (aged $age) is{$married ?? '' !! "n\'t"} married";
+}
+
View
@@ -0,0 +1,12 @@
+#! /Users/damian/bin/rakudo'
+use v6;
+
+use IO::Prompter;
+
+while prompt("Weight:", :number, :default(42),
+ :must({'be greater than 0'=> *>0 })
+) -> $input {
+ say "Got [$input]";
+}
+
+
@@ -0,0 +1,35 @@
+#! /Users/damian/bin/rakudo'
+use v6;
+
+use IO::Prompter;
+
+prompt -> $name, Int $age, Bool $married {
+
+ report($name, $age, $married);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+sub report ($name, $age, $married) {
+ say " $name (aged $age) is{$married ?? '' !! "n\'t"} married";
+}
+
+
@@ -0,0 +1,34 @@
+#! /Users/damian/bin/rakudo'
+use v6;
+
+use IO::Prompter;
+
+prompt -> $what's_your_name, Int $age, Bool :wed($married) {
+
+ report($what's_your_name, $age, $married);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+sub report ($name, $age, $married) {
+ say " $name (aged $age) is{$married ?? '' !! "n\'t"} married";
+}
+
@@ -0,0 +1,14 @@
+#! /Users/damian/bin/rakudo'
+use v6;
+
+use IO::Prompter;
+
+my @input = prompt -> $what's_your_name, Int $age, Bool :wed($married) {
+
+ take [$what's_your_name.uc, $age~'ish', $married ?? 'M' !! 'm'];
+}
+
+say "\n----------------";
+.perl.say for @input;
+
+
@@ -0,0 +1,14 @@
+#! /Users/damian/bin/rakudo'
+use v6;
+
+use IO::Prompter;
+
+subset Coefficient of Num where 0..1;
+
+prompt -> Num $amount, Coefficient $rate, Int $term, Str $desc where /\S/ {
+
+ say "After $term year(s), $amount will be worth ",
+ $amount * (1+$rate)**$term;
+
+ say $desc;
+}
Oops, something went wrong.

0 comments on commit b7bd961

Please sign in to comment.