Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2009-05-23

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:01 skids and a more overarching utilization of the word "constrain" comes to mind for that.
00:03 skids e.g a sub that wants a Num generally wont try to use something exclusive to Int on it.
00:03 jnthn Right.
00:05 sjohnson will anyone mind if i do a /version on the channel
00:10 jnthn OK, sleep time for me...night all.
00:11 wayland76 'night
00:11 wayland76 sjohnson: What does that do?
00:12 sjohnson just tells me what irc client people use
00:12 sjohnson and also hints at possible active perl users
00:13 sjohnson by that i mean ActivePerl / win32 perl
00:14 sjohnson for example, wayland76, i take it you use a KDE version for linux of some sort?
00:14 wayland76 Well, Kinda
00:15 wayland76 I'm using Fedora 10, and it has both gnome and KDE
00:15 wayland76 So I'm using Konversation, but I lean towards Gnome stuff as a general rule
00:16 sjohnson you can run K* programs in gnome without a hitch mostly?
00:16 * sjohnson didn't know this fact
00:17 sjohnson i was worried that their software only worked on KDE desktops
00:17 wayland76 I don't use either desktop
00:17 wayland76 I use Enlightenment :)
00:17 sjohnson i remember when that was pretty spectuclar about 10+ years ago
00:17 sjohnson and i can only imagine it still use back when i was playing with slackware linux
00:18 wayland76 Well, E17 is pretty cool :).  But it's still not claiming to be production-ready
00:18 wayland76 That said, I've had few problems with the version I'm using
00:18 wayland76 The main problem is that the maximise button doesn't work, and you have to right click on the title bar and choose maximise from the menu.  Other than that it's fine
00:19 sjohnson wayland76, do you have any bookmarked links handy for a good "perl 6" page that explains all the cool tricks you can do?
00:19 wayland76 Oh, but I have both desktops installed, so any libraries, etc, are there.  They're just not running (but the libraries are no doubt called upon by the relevant programs)
00:20 sjohnson i read the wiki page and learned some stuff, but i don't believe it was exhaustive
00:20 wayland76 sjohnson: Not sure that I do; have you checked out http://www.perl6-projects.org/ ?
00:21 sjohnson i think this is what i am looking for, ty
00:21 wayland76 That links to the specs, and the specs can be quite readable (ie. compared to W3C or IETF stuff)
00:22 wayland76 Also, if you're after more tutorial-format, readable stuff, we don't have any official stuff yet, but JDlugosz stuff is quite readable
00:23 wayland76 JDlugosz's stuff: http://www.dlugosz.com/Perl6/web/
00:23 sjohnson is the Perl 6 butterfly an official mascot? or just some guys cute drawing
00:24 skids s/some guy/larry/
00:24 wayland76 sjohnson: The disadvantage of not running KDE or gnome is that it makes your programs load slower
00:24 wayland76 yes, official mascot for the specs, the STD grammar, and the test suite, but not the implementations
00:25 sjohnson it is cute
00:25 wayland76 I'd be unsurprised, though, if implementation logos incorporated Camelia somehow (that's the name of the butterfly)
00:27 * skids thinks larry should "quietly" open a cafe press account :-)
00:28 * wayland76 googles cafe press
00:29 wayland76 idea++ :)
00:30 sjohnson looks like t-shirt custom design page
00:32 ElectricHeavyLan joined #perl6
00:38 * sjohnson rubs his hands together.. perl6!
00:40 lambdabot joined #perl6
00:42 sjohnson question:  will Perl 6 have mutator methods like ruby's exclamation mark methods?
00:42 sjohnson for example... @array_to_be_shuffled.pick!(*);
00:42 sjohnson or something
00:43 skids Not sure exactly what those do...
00:44 sjohnson they affect the object calling it
00:45 sjohnson in ruby:   a = [1, 2, 3].shuffle
00:45 sjohnson b = [1, 2, 3]
00:45 sjohnson b.shuffle!
00:45 sjohnson will be the same idea
00:45 sjohnson the exclamation mark will change the object calling it
00:46 sjohnson where as:   a[1,2,3].shuffle   #  will not shuffle a permenantly
00:46 sjohnson shuffle is a cute word, btw
00:48 sjohnson especially with it has a ! at the end of it
00:50 skids I don't think there will be a consistent syntax throughout for it, but methods can modify their invocant and any parameter (as long as they prototype it as "is rw")
00:50 skids And they can return an lvalue, too.
00:52 skids Also, there are attributes:
00:52 skids rakudo: class A { has $.a is rw }; my $a = A.new; $a.a = 4; $a.a.say
00:52 p6eval rakudo 23718a: OUTPUT«4␤»
00:52 wayland76 sjohnson: Basically, yes.  S12 (section 12 of the Perl 6 specifcation) has a Mutating Methods section
00:52 wayland76 And that seems to do what you want
00:53 wayland76 eg. @array .= sort;
00:56 H1N1 joined #perl6
00:56 skids Oh right, but it's not really a "mutating method" perse but an operator that invokes a normal method and assigns the return value.   Hrm, though could you MMD-specify that as a variant somehow for true in-place?
00:57 wayland76 Well, I'm sure the optimiser will do it in-place :)
00:57 skids Eh.  I never put much faith in optimizers, butam always willing to be impressed. :-)
00:57 lichtkind joined #perl6
00:58 wayland76 I never write anything big enough to worry about optimisation :)
00:58 wayland76 If it can't be written in a month, it won't happen :)
00:58 skids e.g. maybe S12 should specify it to search for ($self is rw:) first...
01:01 skids rakudo: my $b = 5; sub foo { $b }; foo() = 4; $b.say # shouldn't this require sub foo is rw?
01:02 p6eval rakudo 23718a: OUTPUT«4␤»
01:05 skids sjohnson: anyway, you were asking about %{@{%h{f}}} messiness... attributes pretty much mitigate the need for that.
01:08 H1N1[A] joined #perl6
01:08 JDlugosz I like the use of "constrain".
01:08 lambdabot JDlugosz: You have 1 new message. '/msg lambdabot @messages' to read it.
01:09 sjohnson skids, how pretty can it look?
01:11 skids Well, assuming what you were using them for was class-like storage: $a.b<foo>.c[4]
01:11 sjohnson hmm, ok here's another question
01:13 sjohnson anyway to pretty this up?
01:13 sjohnson sub foo {
01:13 sjohnson # accepts an array and an int
01:13 sjohnson my @array = @{shift(@_)};
01:13 sjohnson my $int = shift;
01:13 sjohnson }
01:16 skids rakudo: sub foo (@rray of Int is rw, $i of Int is rw) { $i = @rray.shift; }; my @a = <a b c>; my $stuff; foo(@a, $stuff); @a.perl.say; $stuff.perl.say
01:16 p6eval rakudo 23718a: OUTPUT«["b", "c"]␤"a"␤»
01:24 eternaleye joined #perl6
01:28 cotto joined #perl6
01:45 gabiruh joined #perl6
01:54 rewt joined #perl6
01:54 nbrown joined #perl6
01:59 Eevee joined #perl6
02:04 sjohnson joined #perl6
02:19 sjohnson perl6: say 'hi';
02:19 p6eval elf 26914, pugs, rakudo 23718a: OUTPUT«hi␤»
02:21 sjohnson rakudo:  print  5.^methods
02:21 p6eval rakudo 23718a: OUTPUT«ScalarabsabsACCEPTSperlpredsuccWHICH»
02:21 sjohnson rakudo:  print  5.times { "hi" }
02:21 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "{ \"hi\" }"␤in Main (src/gen_setting.pm:0)␤»
02:22 sjohnson rakudo:  print  5.times { "hi"; }
02:22 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "{ \"hi\"; }"␤in Main (src/gen_setting.pm:0)␤»
02:22 sjohnson rakudo:  print "moose".^methods
02:22 p6eval rakudo 23718a: OUTPUT«Null PMC access in inspect_str()␤in Main (src/gen_setting.pm:3166)␤»
02:22 eternaleye rakudo: say "'hi' x 5
02:22 p6eval rakudo 23718a: OUTPUT«say requires an argument at line 1, near " \"'hi' x 5"␤in Main (src/gen_setting.pm:2400)␤»
02:22 eternaleye erg
02:22 eternaleye rakudo: say 'hi' x 5
02:22 p6eval rakudo 23718a: OUTPUT«hihihihihi␤»
02:22 * skids grumbles something about "stop installing avahi-daemon on my system!"
02:23 sjohnson rakudo:  print "moose".uc
02:23 p6eval rakudo 23718a: OUTPUT«MOOSE»
02:24 eternaleye rakudo: say "\c[WHITE SMILING FACE]"
02:24 p6eval rakudo 23718a: OUTPUT«☺␤»
02:24 sjohnson rakudo: if (0) { print "no"; } else { print "yes";}
02:24 p6eval rakudo 23718a: OUTPUT«yes»
02:25 eternaleye sjohnson: In p6, the idiom has evolved into leaving out the parentheses on if, for, etc
02:25 skids rakudo: multi sub foo (Int $a) { "integer" }; multi sub foo (Num $a) { "number" }; my Int $a = 3; $a.foo; my Num $n = 5.4; $n.foo
02:25 p6eval rakudo 23718a: OUTPUT«Method 'foo' not found for invocant of class 'Int'␤»
02:25 eternaleye rakudo: if True { say "yes" } else { say "no" }
02:25 p6eval rakudo 23718a: OUTPUT«yes␤»
02:25 skids rakudo: multi sub foo (Int $a) { "integer" }; multi sub foo (Num $a) { "number" }; my Int $a = 3; $a.foo.say; my Num $n = 5.4; $n.foo.say;
02:25 p6eval rakudo 23718a: OUTPUT«Method 'foo' not found for invocant of class 'Int'␤»
02:26 sjohnson rakudo:  if (1) print "hi";
02:26 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "print \"hi\""␤in Main (src/gen_setting.pm:0)␤»
02:26 sjohnson i wish that would be implemented
02:26 eternaleye sjohnson: Curlies are mandatory now
02:26 sjohnson they always were
02:26 sjohnson but i can see why
02:26 eternaleye If you want to omit them, you need the modifier form
02:27 eternaleye rakudo: if 1 { say "hi" }
02:27 p6eval rakudo 23718a: OUTPUT«hi␤»
02:27 eternaleye rakudo: say "hi" if 1
02:27 p6eval rakudo 23718a: OUTPUT«hi␤»
02:27 skids rakudo: multi sub foo (Int $a) { "integer" }; multi sub foo (Num $a) { "number" }; my Int $a = 3; foo($a).say; my Num $n = 5.4; foo($n).say;
02:27 p6eval rakudo 23718a: OUTPUT«integer␤number␤»
02:27 sjohnson how can you get a list of all the STDLIB methods and such for Perl 6
02:28 sjohnson so i can see all the cool stuff it can do
02:28 sjohnson rakudo:  print < 1 2 undef 3>.collapse
02:28 p6eval rakudo 23718a: OUTPUT«Method 'collapse' not found for invocant of class 'List'␤»
02:28 sjohnson rakudo:  print < 1 2 undef 3>.methods
02:28 skids Well, a good amount of that is in flux, but it is Synopsis 32 (S32)
02:28 p6eval rakudo 23718a: OUTPUT«Method 'methods' not found for invocant of class 'List'␤»
02:28 sjohnson rakudo:  print < 1 2 undef 3>.^methods
02:28 p6eval rakudo 23718a: OUTPUT«invoke() not implemented in class 'ResizablePMCArray'␤in Main (src/gen_setting.pm:3166)␤»
02:29 skids What's collapse?
02:30 eternaleye say <1 2 undef 3>.grep: { $_ !~~ undef }
02:30 eternaleye rakudo: say <1 2 undef 3>.grep: { $_ !~~ undef }
02:30 p6eval rakudo 23718a: OUTPUT«12undef3␤»
02:30 skids simon says :-)
02:30 eternaleye rakudo: say <<1 2 { undef } 3>>.grep: { $_ !~~ undef }
02:30 p6eval rakudo 23718a: OUTPUT«Use of uninitialized value␤123␤»
02:30 sjohnson rakudo: say <1 2 undef 3>.grep { $_ !~~ undef }
02:30 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "{ $_ !~~ u"␤in Main (src/gen_setting.pm:0)␤»
02:31 eternaleye sjohnson: It doesn't work because it's the string "undef", not an undef value
02:31 eternaleye And the colon is necessary
02:31 sjohnson rakudo: say <1 2 undef 3>.grep (defined)
02:31 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "(defined)"␤in Main (src/gen_setting.pm:0)␤»
02:31 sjohnson it was worth a shot :)
02:31 eternaleye rakudo: say <1 2 undef 3>.grep: { $_ !~~ "undef" }
02:31 p6eval rakudo 23718a: OUTPUT«123␤»
02:31 sjohnson what does the second squiggle do?
02:32 skids say <<1 2 { undef } 3>>.grep { .defined }
02:32 skids rakudo: say <<1 2 { undef } 3>>.grep { .defined }
02:32 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "{ .defined"␤in Main (src/gen_setting.pm:0)␤»
02:32 eternaleye ~~ is smartmatch, ! negates it
02:32 eternaleye =~ does not exist in P6
02:32 skids rakudo: say <<1 2 { undef } 3>>.grep: { .defined }
02:32 eternaleye Nor !~
02:32 p6eval rakudo 23718a: OUTPUT«Use of uninitialized value␤123␤»
02:32 sjohnson oh i see
02:32 sjohnson does it work the same way?
02:32 sjohnson or is it totally different
02:32 eternaleye Yes, but more intelligent
02:33 skids arguably too dwimmy for its own good :-)
02:33 eternaleye so `my Dog $rover; say $rover ~~ Dog` checks ISA
02:33 eternaleye Or 'does' really
02:36 sjohnson rakudo:  say ("moose" =~ m/oo/);
02:36 p6eval rakudo 23718a: OUTPUT«Unable to set lvalue on PAST::Val node␤in Main (src/gen_setting.pm:3166)␤»
02:36 sjohnson rakudo:  say ("moose" ~~ m/oo/);
02:36 p6eval rakudo 23718a: OUTPUT«oo␤»
02:37 eternaleye std: say ("moose" =~ m/oo/);
02:37 p6eval std 26914: OUTPUT«##### PARSE FAILED #####␤Obsolete use of =~ to do pattern matching; in Perl 6 please use ~~ instead at /tmp/bOdZQh9SJR line 1:␤------> [32msay ("moose" =~[31m m/oo/);[0m␤FAILED 00:04 36m␤»
02:37 sjohnson rakudo:  say ("m00se" ~~ m/00/);
02:37 p6eval rakudo 23718a: OUTPUT«00␤»
02:37 sjohnson rakudo:  if ("m00se" ~~ m/00/) { say 1 } else { say 0 }
02:37 p6eval rakudo 23718a: OUTPUT«1␤»
02:38 sjohnson rakudo:  if ('00') { say 1 } else { say 0 }
02:38 eternaleye sjohnson: It returns a Match object, which stringifies to the matched text and boolifies to whether the match succeeded
02:38 p6eval rakudo 23718a: OUTPUT«1␤»
02:38 sjohnson rakudo:  if ('0') { say 1 } else { say 0 }
02:38 p6eval rakudo 23718a: OUTPUT«0␤»
02:38 sjohnson rakudo:  if ('000') { say 1 } else { say 0 }
02:38 p6eval rakudo 23718a: OUTPUT«1␤»
02:39 skids rakudo: if (?'00') { say 1 } else { say 0 }
02:39 sjohnson that's good to know
02:39 p6eval rakudo 23718a: OUTPUT«1␤»
02:39 eternaleye rakudo: say ("moose" ~~ m/oo/).WHAT
02:39 sjohnson what does the ?'00' do?
02:39 p6eval rakudo 23718a: OUTPUT«Match()␤»
02:39 skids rakudo: if (+'00') { say 1 } else { say 0 }
02:39 p6eval rakudo 23718a: OUTPUT«0␤»
02:39 eternaleye sjohnson: Coerces it to a boolean value
02:39 skids sjohnson: boolean context
02:39 sjohnson is this new to perl?
02:39 sjohnson i never came across that in 5 :(
02:39 eternaleye sjohnson: '+' is for numbers, '~' is for strings
02:39 * skids too tired to look up the str boolification spec.
02:40 eternaleye sjohnson: Yes, it's new
02:40 eternaleye Only in Perl 6!
02:41 eternaleye rakudo: say (?'00').WHAT, ' ', (+'00').WHAT, ' ', (~'00').WHAT
02:41 p6eval rakudo 23718a: OUTPUT«Bool() Num() Str()␤»
02:41 skids rakudo: say "0002" ~| "1234"; say "0002" +| "1234";
02:41 sjohnson is there anything Perl 6 can't do?
02:41 p6eval rakudo 23718a: OUTPUT«1236␤1234␤»
02:42 skids rakudo: say "0" ?| "1234";
02:42 p6eval rakudo 23718a: OUTPUT«1␤»
02:42 eternaleye sjohnson: Anything that isn't implemented yet can't be done currently; I'm not sure if there's anything (besides pimc, pifl, and pire) that the final result of the spec can't do
02:43 eternaleye http://c2.com/cgi/wiki?PimcPiflPire
02:43 eternaleye Well, it can't solve the Halting Problem, but nothing else ever will be able to either ;D
02:44 sjohnson rakudo:  exit();
02:44 p6eval rakudo 23718a:  ( no output )
02:45 sjohnson rakudo:  say "im still running!"
02:45 p6eval rakudo 23718a: OUTPUT«im still running!␤»
02:45 eternaleye sjohnson: p6eval writes the command to a temporary file, and run()'s that.
02:45 TimToady sjohnson: the answer to your earlier question is simply sub foo (%array, $int) {...}
02:46 TimToady you use signatures instead of all that fancy shifting
02:46 orafu joined #perl6
02:47 skids TimToady: up late? s/%/@/ :-)
02:47 TimToady it's always too late for me
02:47 TimToady except when it's too early
02:47 skids I feel EXACTLY the same way :-)
02:48 TimToady but then you can simply call it foo(@x, 42)
02:48 hercynium joined #perl6
02:48 TimToady no need for \@x anymore
02:49 TimToady rakudo: @a = 1..10; @a.=pick(*); say @a
02:49 p6eval rakudo 23718a: OUTPUT«Symbol '@a' not predeclared in <anonymous> (/tmp/9ZThr2qVSa:1)␤in Main (src/gen_setting.pm:3166)␤»
02:49 TimToady rakudo: my @a = 1..10; @a.=pick(*); say @a
02:49 p6eval rakudo 23718a: OUTPUT«29673541810␤»
02:49 TimToady there's your mutator
02:50 sjohnson TimToady:  was saying (%array, $int) a mistake?  is % == hash?
02:50 TimToady @array
02:50 lambdabot I'll crush ye barnacles!
02:50 eternaleye rakudo: sub foo( @bar, $baz --> Str) { return ([~] @bar) x $baz; }; my @arr = <qux corge grault>; say foo( @arr, 3 );
02:50 p6eval rakudo 23718a: OUTPUT«quxcorgegraultquxcorgegraultquxcorgegrault␤»
02:51 skids about that, can you MMD a variant on the method end somehow for in-place, or must you override .=?
02:51 sjohnson with all this new technology it looks like my Perl 5 book i got work to pay for will be used as a doorstop
02:51 sjohnson the one written by Larry Wall and friends
02:51 TimToady rakudo: sub foo (@array, $int) { say @array[$int] }; foo('a'..'z', 15)
02:51 p6eval rakudo 23718a: OUTPUT«p␤»
02:52 eternaleye sjohnson: Perl 6 isn't (quite) ready for replacing Perl 5 yet
02:53 sjohnson rakudo:  print ('a'..'c').WHAT
02:53 TimToady Perl 6 is trying to turn all the other books into doorstops; Perl 5 isn't special that way :)
02:53 p6eval rakudo 23718a: OUTPUT«Range()»
02:53 sjohnson rakudo:  print ('a'..'c')[1]
02:53 p6eval rakudo 23718a: OUTPUT«b»
02:53 skids Plus, you can embed p5 regexe syntax in P6, so you'll still need it to debug code where other people punted.
02:53 * sjohnson is frothing at the mouth for the new Perl 6
02:54 * sjohnson snarls loudly
02:54 sjohnson are block comments too much to ask for instead of pods in Perl 6 that work even if there it whitespace before them?
02:55 TimToady use #{.....}
02:55 TimToady or #(...) or #[....] etc
02:55 sjohnson do those work in Perl 5?
02:55 TimToady or #<<<...>>>
02:55 TimToady no
02:55 sjohnson heheh
02:56 sjohnson the camel book was a very entertaining and funny read
02:56 sjohnson i have never laughed so hard reading a manual in my life
02:56 sjohnson my brother doesnt seem to get the jokes tho
02:56 skids or #«
02:57 TimToady maybe your brother should program in Python
02:57 sjohnson he's a C programmer mostly
02:57 sjohnson i showed him this new Perl 6 stuff after he was whining about a lot of things in Perl he didn't like
02:57 sjohnson he seemed pretty impressed
02:58 sjohnson rukado:  say `uname -a`
02:59 TimToady rakudo: say qx/uname -a/
02:59 p6eval rakudo 23718a: OUTPUT«Linux timtowtdi 2.6.18-6-686 #1 SMP Mon Aug 18 08:42:39 UTC 2008 i686 GNU/Linux␤␤»
02:59 sjohnson back ticks a thing of the past?
02:59 TimToady yes, too unreadable
02:59 TimToady also, reserved for user-defined syntax
02:59 skids sjohnson: reserved for user-defined uses.
03:00 JDlugosz Hi Larry.  I saw your sub foo.
03:00 JDlugosz lambdabot is still not giving me my messages though.
03:00 TimToady case (in)sensitivity?
03:01 JDlugosz Even when I copy/paste from its instructions to me.
03:01 sjohnson TimToady:  a faster way to do:   @technology = split ('\n', qx/ps aux/);  ?
03:01 sjohnson err.."\n" i mean
03:02 skids Awww F'd didn't get into the spec yet? :-)
03:03 TimToady space not allowed before that (, by the way
03:03 sjohnson who are you referring to?
03:03 TimToady you
03:03 TimToady split( not split (
03:03 sjohnson that must be new, right?
03:03 cosimo joined #perl6
03:03 TimToady unless you want it parsed as a listop
03:04 TimToady solves the p5 problem with print (1+2)*3
03:04 skids One of those areas where parsing/unambiguity trumps convenience.
03:05 sjohnson Question:  Perl 6 have anything like basename() or pathname()?
03:06 TimToady IO specs still developing; ask wayland76
03:06 sjohnson rakudo:  say basename("/etc/passwd");
03:06 p6eval rakudo 23718a: OUTPUT«Could not find non-existent sub basename␤»
03:06 sjohnson rakudo:  say base("/etc/passwd");
03:06 p6eval rakudo 23718a: OUTPUT«Could not find non-existent sub base␤»
03:06 sjohnson *scratches head*
03:08 sjohnson rakudo:  my $x = if 1 { 10 } else { 15 } }; say $x
03:08 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "{ 10 } els"␤in Main (src/gen_setting.pm:0)␤»
03:08 sjohnson rakudo:  my $x = if 1 { 10 } else { 15 } ; say $x
03:08 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "{ 10 } els"␤in Main (src/gen_setting.pm:0)␤»
03:08 sjohnson rakudo:  my $x = (if 1 { 10 } else { 15 }) ; say $x
03:08 p6eval rakudo 23718a: OUTPUT«10␤»
03:09 sjohnson wow
03:09 sjohnson thats neat
03:09 * sjohnson cracks open a beer
03:09 JDlugosz TimToady I saw your example foo.
03:10 TimToady you keep saying that
03:10 sjohnson heh
03:10 JDlugosz Had me worried, with no examples of that in the current document.
03:10 sjohnson 'foo or foo()?
03:10 skids wait.  isn't if supposed to return the conditional?
03:10 TimToady that's p5
03:10 TimToady p6 doesn't, so you can write list comprehensions
03:11 JDlugosz So I'm on the right track, that actual arguments are taken one at a time to match with the positional parameters, but THEN it is taken as list context to bind it.
03:11 TimToady huh?
03:11 JDlugosz <http://www.dlugosz.com/Perl6/web/passing_examples.html>
03:12 TimToady it switches to pulling slurpy terms out of the positions when it's done binding mandatory and optional
03:12 JDlugosz Working it through, I ran into a problem with Nil and "item context".
03:12 JDlugosz I know, slurpy evaluates arg list in list context.
03:12 TimToady there is no list context until slurpy-binding starts
03:14 JDlugosz sub foo (@y) { ... }
03:14 JDlugosz foo(Nil);
03:14 JDlugosz We want @y to be bound to an empty list, not wonder how to bind to undef.  Nil gives up the empty list in list context, not item context.
03:14 sjohnson rakudo:  @a = <1 2 3>; print $a[0].WHAT, @a[0].WHAT;
03:14 p6eval rakudo 23718a: OUTPUT«Symbol '@a' not predeclared in <anonymous> (/tmp/lwUunSC1az:1)␤in Main (src/gen_setting.pm:3166)␤»
03:15 sjohnson rakudo:  use lenient;  @a = <1 2 3>; print $a[0].WHAT, @a[0].WHAT;
03:15 p6eval rakudo 23718a: OUTPUT«Can't find ./lenient in @INC␤in Main (src/gen_setting.pm:438)␤»
03:15 sjohnson rakudo:  my @a = <1 2 3>; print $a[0].WHAT, @a[0].WHAT;
03:15 p6eval rakudo 23718a: OUTPUT«Symbol '$a' not predeclared in <anonymous> (/tmp/tm9ZLfbDcQ:1)␤in Main (src/gen_setting.pm:3166)␤»
03:15 TimToady the meaning of Nil is not precisely driven by item/list, I think
03:15 sjohnson rakudo:  my @a = <1 2 3>; print $a[0].WHAT; @a[0].WHAT;
03:15 p6eval rakudo 23718a: OUTPUT«Symbol '$a' not predeclared in <anonymous> (/tmp/tlhbtjBVoP:1)␤in Main (src/gen_setting.pm:3166)␤»
03:15 sjohnson rakudo:  my @a = <1 2 3>; print @a[0].WHAT;
03:15 p6eval rakudo 23718a: OUTPUT«Str()»
03:16 TimToady binding Nil to @y should still bind ()
03:16 sjohnson rakudo:  my @a = 1, <2 3>; print @a.perl;
03:16 JDlugosz TimToady: it should be... that's the point of having it.  Nil as an object replaces "undef in item context, () in list context" exactly in the description of what some construct does.
03:16 p6eval rakudo 23718a: OUTPUT«[1, "2", "3"]»
03:16 sjohnson rakudo:  my @a = 1, (<2 3>); print @a.perl;
03:16 p6eval rakudo 23718a: OUTPUT«[1, "2", "3"]»
03:16 JDlugosz The machiery of contextualizer DOES THAT.  Now you ignore that and come up with another way.
03:17 TimToady Nil is really just (), and undef is only if forced to mean something non-arrayish
03:17 sjohnson rakudo:  say Nil.WHAT
03:17 p6eval rakudo 23718a: OUTPUT«Nil()␤»
03:18 sjohnson rakudo:  say undef.WHAT
03:18 p6eval rakudo 23718a: OUTPUT«Failure()␤»
03:18 sjohnson rakudo:  say (0 == 1).WHAT
03:18 JDlugosz It gets far worse with flattening Captures with extra levels of nesting.  The context thing works for that, as desgined.  It just needs to get invoked at the right moment.
03:18 p6eval rakudo 23718a: OUTPUT«Bool()␤»
03:19 sjohnson rakudo:  say qx/w/;
03:19 p6eval rakudo 23718a: OUTPUT« 03:19:10 up 262 days, 14:24,  0 users,  load average: 0.89, 0.32, 0.20␤USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT␤␤»
03:19 TimToady if it is at all possible to interpret Nil as as (), it does so
03:19 skids rakudo: (1,2,3,Failure,4).say
03:19 JDlugosz I've identified where the passing description needs to be updated to go along with the context/Capture stuff, and it's elegant enough.  You just can't mix up "non-slurpy" with "item context".  Contexualizers (now) tell delayed objects what they should be.
03:19 p6eval rakudo 23718a: OUTPUT«123Failure()4␤»
03:20 sjohnson TimToady:  is it true that pick(*) is the shuffle() function for Perl 6?
03:20 TimToady sjohnson: how many times do you need to be told before you believe it?
03:20 sjohnson i know it works, but i was wondering if there was... a TimToady way to shuffle as well planned
03:20 JDlugosz So, knowing that foo (@x, @y, $z) {...}  foo(@list1,@list2,$x);  is supposed to work, unless I'm missing something big here, I'd like to "run with that".
03:21 TimToady that is the TimToady way to shuffle
03:21 sjohnson i was just wondering if it was the only TimToady way tho
03:21 JDlugosz It is the contextualizer "step" that makes Nil become () as opposed to undef.
03:21 wayland76 rakudo: say qx/ls/
03:21 p6eval rakudo 23718a: OUTPUT«build␤Configure.pl␤CREDITS␤docs␤LICENSE␤Makefile␤parrot␤perl6␤perl6.c␤perl6.o␤perl6.pbc␤perl6.pir␤perl6_s1.pbc␤rakudo_revision␤README␤src␤t␤Test.pir␤Test.pm␤tools␤␤»
03:21 sjohnson other than writing your own function
03:22 skids rakudo:  for (1,2,3,Failure,4) { say $_ if $_; }
03:22 p6eval rakudo 23718a: OUTPUT«1␤2␤3␤4␤»
03:22 JDlugosz So even if it is wrong to say the arg is "in list context", it needs to call that same step to trigger that.
03:22 skids Oh, Failure is the class. duh.
03:23 sjohnson TimToady:  i will take your silence as a yes
03:23 TimToady more like "being used as a list/Positional" than list context, but yes
03:24 TimToady certainly a lot of the Any methods are in a similar state
03:24 TimToady you're using the invocant as a particular type, but this is implied by the method itself, as part of the langauge
03:24 JDlugosz Discusions with ruoso beat into me that the contextualizer is not the same as expressing the desired interface.
03:24 TimToady item/list context are not the only kinds of context
03:24 wayland76 sjohnson: The philosophy of Perl 6 is to get as many functions out of the core and into libraries as makes sense.  I suspect that basename et. al. will be some of those
03:25 sjohnson rakudo:  <b c a a b c c c a b a>.uniq.sort.say
03:25 p6eval rakudo 23718a: OUTPUT«abc␤»
03:25 wayland76 There will be multiple Perl6 "distros", one that packages Perl 6 with lots of modules for doing web stuff, one with modules for sysadmin, etc
03:25 TimToady but yes, basically, which is why a Positional interpretation of Nil should result in () even in "item" context
03:25 JDlugosz invocant as a particular type... I don't know what you're getting at.
03:25 wayland76 one of those distros will presumably include basename
03:25 sjohnson wayland76:  if you are in charge of the basename stuff, please name a basedir too *putty dog eyes*
03:26 * skids heads in for precious 4 hours sleep.  Gah.  Planned outage windows suuhuhuck.
03:26 TimToady rakudo: say "foo".join
03:26 p6eval rakudo 23718a: OUTPUT«foo␤»
03:26 TimToady join is not a method of Str
03:26 wayland76 sjohnson: I'm not really in charge.  I just write the specs, which are then ignored or rewritten by the implementors
03:26 TimToady nevertheless, we use it as a list
03:26 JDlugosz That's where I was a couple days ago... context same as choosing an interface role.
03:26 TimToady and it treats it as a list of 1 elem
03:26 sjohnson wayland76:  well thanks for reading my request / question seriously
03:27 wayland76 Basically, I'm completely unqualified to do anything to the Specs except rearrange them (which I did), but I provoke others into writing them by doing a really bad job of writing something :)
03:27 sjohnson rakudo: my @a = 1,2,3;  @a.pick(*); @a.say;
03:27 p6eval rakudo 23718a: OUTPUT«123␤»
03:27 TimToady you need .=
03:27 sjohnson rakudo: my @a = 1,2,3;  @a .= pick(*); @a.say;
03:27 p6eval rakudo 23718a: OUTPUT«231␤»
03:28 sjohnson just making sure :)
03:28 wayland76 is your suggested "basedir" the same as "dirname" in File::Basename (Perl 5)?
03:28 JDlugosz Hmm, wouldn't it have to be a method of some base class (Any is the ultimate base, right)?
03:28 JDlugosz So the body of that decides what to do with "self".
03:28 TimToady correct
03:28 sjohnson if FIle is a CPAN module you need to download, then yeah...  i hate having to do basic good wholesome things with CPAN
03:28 sjohnson cause i'm usually not a sudo user on many computers i dick around on
03:28 TimToady the Any version of join makes it a language feature, not just an OO feature :)
03:28 wayland76 Well, on my system, File::Basename comes with Perl 5
03:29 skids Some out of the box distros are lean on modules.
03:29 * sjohnson slaps himself
03:29 sjohnson wayland76, thanks tho
03:29 sjohnson it is likely what i was looking for
03:29 JDlugosz In terms of explaining what goes on under the hood, the Smalltalk model is simple.  Method call.  Simple dispatch.  "self" is easy. <G>
03:30 wayland76 skids: Yes, but File::Basename was first released with perl 5
03:30 wayland76 sjohnson: Just "use File::Basename" :)
03:30 wayland76 skids: In other words, it comes with Perl 5, and they'd have to remove it to get rid of it
03:30 TimToady yes, but it would be redundant to reinvent Smalltalk
03:31 sjohnson TimToady:  are you a vi(m) kind of guy?
03:31 TimToady I use vim, though I think its API beyond the vi bits are rather ad hoc
03:31 JDlugosz Are we agreed that in principle, as things are now with Contexts and Captures, that Nil is a fragile object that turns into undef (I guess Nill is an interesting instance of undef) or () when needed.  Right?
03:32 JDlugosz One way of triggering that is with the contextualizers, @(...) etc.
03:32 TimToady for some def or other
03:32 sjohnson vim stands for VI, a Man's editor
03:32 JDlugosz So parameter binding would draw upon the same behavior of the object.  Or any other object that has context-sensitive behavior.
03:32 wayland76 I want something like Emacs, but with Perl6 instead of Elisp
03:33 wayland76 (and of course, supporting VI keyboard interface as an option :) )
03:33 wayland76 Well, actually, $Parrot_based_language instead of Elisp :)
03:34 JDlugosz On the next computer over, my wife is talking to her folks in China on the webcam.  It's a connected world.  Where is everyone now on this channel?  I'm in Texas.
03:34 sjohnson Question:  in pick(*), what is the astrisk?  is that a high-level globbing?  or a special reserved keyword that means all elements or something
03:35 wayland76 JDlugosz: Australia
03:35 * sjohnson is in Canada and is 27 years old
03:36 nsh- joined #perl6
03:36 * TimToady is in San Diego this weekend
03:37 TimToady but usually in Mountain View, CA
03:37 wayland76 The "*" character as a standalone term captures the notion of "Whatever" (quoted from S02)
03:37 sjohnson say *.WHAT
03:37 sjohnson rakudo:  say *.WHAT
03:37 p6eval rakudo 23718a: OUTPUT«Whatever()␤»
03:37 sjohnson rakudo:  say *.WHAT.^methods
03:37 p6eval rakudo 23718a: OUTPUT«perlACCEPTSScalar␤»
03:37 TimToady * means the operator gets to pick a "globby" default answer
03:38 JDlugosz Hmm, I'm thinking, TimToady, that Nil is too simple of an example.  It =can= express a Positional role and be interesting undef all at the same time.  Ruoso's examples are more challanging.
03:38 wayland76 JDlugosz: You're not in the Dallas/Fort Worth area are you?
03:38 JDlugosz Yes I am.  Allen to be exact.  You?
03:38 JDlugosz (my neice is still scared of me.  Webcams have their downsides too)
03:39 wayland76 JDlugosz: Australia, as I said.  I was just thinking that there are already at least 3 other Perl6ers in the DFW area
03:39 JDlugosz I mean, you have a connection with D/FW?
03:40 JDlugosz I noticed notices on the mailing list today... didn't notice them before.
03:40 wayland76 No, other than that I hold US citizenship as well as Australian :)
03:41 wayland76 Btw, sjohnson, if you're really slavering with anticipation and unable to restrain yourself, you could redirect some of that unrestraint into one of the P6 implementations
03:41 TimToady sjohnson: many of the uses of * actually indicate an indefinite/infinite number of elements
03:41 wayland76 Rakudo or SMOP
03:42 orafu joined #perl6
03:42 TimToady so 1..* is an infinite range
03:42 TimToady and "yes" xx * is an infinite number of "yes" list elements
03:44 TimToady but to other operations it can mean "all the elements" or "the number of elements"
03:47 JDlugosz Oh, question on the svn and synopses.
03:47 JDlugosz Is incrementing the Version and Last Modified automated?
03:48 TimToady no
03:49 TimToady I answered policy on that somewhere...
03:49 TimToady okay to incr for typos but not necessary
03:58 sjohnson wayland76:  how can i help?  the only way i can think of helping is suggesting quick and easy things that might not be obvious, but would bring substantial peace of mind to Perl programmers
03:59 JDlugosz You can read my essays and tell me if anything needs improving re tutorials.
04:00 eternaleye JDlugosz: phenny is an option that isn't lambdabot.
04:00 eternaleye phenny: tell JDlugosz phenny is helpful
04:00 phenny eternaleye: I'll pass that on when JDlugosz is around.
04:00 JDlugosz I'm not the one leaving messages for me.
04:00 phenny JDlugosz: 04:00Z <eternaleye> tell JDlugosz phenny is helpful
04:00 eternaleye JDlugosz: No @clear'ing :D
04:01 sjohnson p6 makes p5 look like stone-age technology.  i am really glad i came here!
04:02 sjohnson and i mean that without trying to offend anyone, but i cant wait till a solid working Perl 6 implementation comes out
04:03 sjohnson so i will do look over your things JDlugosz
04:04 sjohnson well, here's a suggestion.  could $string.trim! be an alias for $string .= trim?
04:04 sjohnson ala Ruby
04:04 wayland76 sjohnson: What are your skills?  Documentation?  C Programming?  Any Programming necessary (ie. willing to learn new language to help)?  Packaging?
04:05 wayland76 sjohnson: That's a question for TimToady, but even if he says no, you can define a slang that lets you do that if you want
04:06 sjohnson by the ! mark i mean that p6 would recognize the ! as a .= of that method invocation, so you don't to define 100 more methods with the same name, except a ! after it
04:07 JDlugosz sjohnson: consider that a challenge.  Write a macro for postfix:<!> that does that.  Learn enough to take a stab at it.
04:07 JDlugosz (See my APL and Perl 6 essay to get ideas)
04:08 sjohnson let's say I figured it out, someone stick it on the p6-bot so i could test it out?
04:08 sjohnson s/someone/could someone/
04:09 eternaleye rakudo: sub postcircumfix:<. !>( $var, &method ) { $var = $var.&method.() }; my $str = "   foo   "; say $str.trim!
04:09 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "!"␤in Main (src/gen_setting.pm:0)␤»
04:09 eternaleye pugs: sub postcircumfix:<. !>( $var, &method ) { $var = $var.&method.() }; my $str = "   foo   "; say $str.trim!
04:09 JDlugosz I think tht would be a bit much for any existing implementation to handle.  And not a one-liner.
04:09 p6eval pugs: OUTPUT«*** ␤    Unexpected "!"␤    expecting term postfix, operator, ":" or ","␤    at /tmp/exv7I77nol line 1, column 106␤»
04:09 sjohnson looks like eternaleye might be close to figuring it out
04:10 eternaleye sjohnson: But postcircumfix custom operators are NYI.
04:11 sjohnson wayland76: skills
04:11 sjohnson 1.  Documentation / explaining difficult in a very informal yet informative way.
04:11 sjohnson 2.  Programming in high-level languages.  Perl 5 and PHP (I hate PHP but don't mind that it has many functions out of the box).
04:11 sjohnson 3.  Anally-retentive / perfectionist.
04:11 wayland76 sjohnson: You can download your own copy of Rakudo if you want
04:11 wayland76 sjohnson: Sounds like you need to help with documentation and maybe spec then
04:12 sjohnson oh and 4.  Finding easier ways of doing the same old thing that everyone else has been doing for 15 years.
04:13 sjohnson though it seems that  a lot of my ideas are already included in Perl 6
04:13 wayland76 sjohnson: U4X might be a good place.  http://svn.pugscode.org/pugs/docs/u4x/ and http://use.perl.org/~masak/journal/38279
04:14 wayland76 U4X = Userdocs for Christmas
04:14 wayland76 When people ask "When is Perl 6 coming out", we say "Christmas", but we don't say which year.
04:14 wayland76 Hence the tradition of referring to Perl 6.0.0 as "Christmas"
04:15 wayland76 masak (Carl Masak) is in charge of U4X
04:15 wayland76 and we expect some of JDlugosz's stuff to go in there too
04:15 literal rakudo: say "hi"
04:15 p6eval rakudo 23718a: OUTPUT«hi␤»
04:16 wayland76 (I think he said he was cool with the idea, anyway)
04:16 JDlugosz Yes, I'm cool.  I want generations of newbes to ponder how to say my name.
04:17 sjohnson J. D. Lugozi
04:17 sjohnson is my guess
04:17 sjohnson sounds like Bela Lugosi
04:17 TimToady I have a pretty good notion how it sounds, if you pronounce it the olde way :)
04:19 TimToady the initial consonant cluster will, of course, stump most native English speakers
04:19 JDlugosz No sjohnson, The L is actually a Ł, but that's hard to type.
04:19 eternaleye sjohnson: No, he's John M Dlugosz
04:19 JDlugosz It's not a consonant at all.
04:19 TimToady well, laterals are always a liitle of both
04:20 JDlugosz <http://www.dlugosz.com/Me/index.html>
04:20 DoGuess this would help others out :)
04:21 JDlugosz I like to eat (and make) pierogi, but I can't properly pronounce any of the consonants in it.
04:21 sjohnson TimToady:  do you have any thoughts on the ! ruby exclamation mark self-invocation idea?
04:23 TimToady I prefer to unify with the other mutating assignment operators
04:23 TimToady and reserve ! for factorial :)
04:23 mikehh joined #perl6
04:23 JDlugosz Hmm, I need a favicon for my web pages.
04:23 TimToady rakudo: sub postfix:<!> ($n) { [*] 1..$n }; say 5!
04:23 sjohnson $string .= trim;  =>  $string.trim!
04:24 p6eval rakudo 23718a: OUTPUT«120␤»
04:24 TimToady so I think the Ruby notation is a dead end
04:25 sjohnson wow you sure write really short code
04:25 * sjohnson looks at the line with a stern eye
04:25 wayland76 sjohnson: That's what happens when you have the specs in your head
04:26 wayland76 The [] puts the * operator between all of the 1..$n
04:26 eternaleye wayland76: He no need can haz spec, he iz spec!
04:26 wayland76 (in this case)
04:26 nbrown_ joined #perl6
04:26 sjohnson is that like a eval(join type thing?
04:26 wayland76 eternaleye: Well, that's true, but I was trying to indicate to sjohnson that he might be able to achieve short code too :)
04:26 eternaleye sjohnson: It's the reduction operator, like foldr in haskell IIRC
04:27 wayland76 sjohnson: Well, kind of, if you want to think of it in Perl 5 terms
04:27 TimToady it's supposed to work the same as eval join but without the eval or the join
04:27 eternaleye [op] list, for any op, means to apply 'op' infixed between all items of the list
04:28 sjohnson rakudo:  say <a b c>.[uc()]
04:28 p6eval rakudo 23718a: OUTPUT«No applicable candidates found to dispatch to for 'uc'␤in Main (/tmp/0LyEso4V08:1)␤»
04:28 eternaleye so if [<] @list checks if @list is in strict ascending order
04:28 sjohnson im probably going to break the compiler one of these days with bad syntax
04:28 wayland76 sjohnson: [] only works on operators.  There's a function called "reduce" that does the same thing on functions
04:29 wayland76 say <a b c>.reduce(uc())
04:29 wayland76 rakudo say <a b c>.reduce(uc())
04:29 eternaleye rakudo: say <a b c>.map( *.uc )
04:29 p6eval rakudo 23718a: OUTPUT«ABC␤»
04:29 wayland76 thanks
04:29 wayland76 rakudo: say <a b c>.reduce(uc())
04:29 p6eval rakudo 23718a: OUTPUT«No applicable candidates found to dispatch to for 'uc'␤in Main (/tmp/dAcq78kugB:1)␤»
04:29 wayland76 rakudo: say <a b c>.reduce(*.uc)
04:29 p6eval rakudo 23718a: OUTPUT«Cannot reduce() using a unary or nullary function.␤␤»
04:30 sjohnson rakudo:  say <a b c>.reduce(uc)
04:30 p6eval rakudo 23718a: OUTPUT«No applicable candidates found to dispatch to for 'uc'␤in Main (/tmp/Z9RFmyDxgp:1)␤»
04:30 eternaleye rakudo: say <a b c>.reduce( cmp )
04:30 p6eval rakudo 23718a: OUTPUT«Could not find non-existent sub cmp␤»
04:30 eternaleye rakudo: say <a b c>.reduce( <=> )
04:30 p6eval rakudo 23718a: OUTPUT«Parameter type check failed; expected something matching Code() but got something of type Str() for $expression in call to reduce␤in method Any::reduce (src/gen_setting.pm:93)␤called from Main (src/gen_setting.pm:3166)␤»
04:30 eternaleye rakudo: say <a b c>.reduce( &infix:<cmp> )
04:30 wayland76 rakudo: say <a b c>.[cmp]
04:30 TimToady you can' t hang bare operators out there as terms
04:30 p6eval rakudo 23718a: OUTPUT«Null PMC access in find_method()␤in Main (src/gen_setting.pm:3166)␤»
04:30 p6eval rakudo 23718a: OUTPUT«Could not find non-existent sub cmp␤»
04:31 TimToady cmp is non associative
04:31 eternaleye rakudo: say <a b c>.reduce( &infix:<lt> )
04:31 p6eval rakudo 23718a: OUTPUT«Null PMC access in find_method()␤in Main (src/gen_setting.pm:3166)␤»
04:31 TimToady that would be a bug
04:32 TimToady say <a b c>».uc
04:32 TimToady rakudo: say <a b c>».uc
04:32 p6eval rakudo 23718a: OUTPUT«ABC␤»
04:32 sjohnson shit my utf-8 isnt working
04:32 sjohnson i cant see what he did
04:32 Infinoid sjohnson: >>
04:33 sjohnson (<A B C>) >>.uc
04:33 TimToady utf-8 is pretty much a necessity on this channel
04:33 sjohnson rakudo: say (<A B C>) >>.uc
04:33 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near ">>.uc"␤in Main (src/gen_setting.pm:0)␤»
04:33 TimToady can't have a space before a postfix!!!
04:33 sjohnson rakudo: say (<A B C>)>>.uc
04:33 p6eval rakudo 23718a: OUTPUT«ABC␤»
04:33 TimToady rakudo: say <a b c>>>.uc
04:33 p6eval rakudo 23718a: OUTPUT«ABC␤»
04:33 Infinoid nice.
04:33 sjohnson oops
04:33 sjohnson i forgot to make the letters small
04:34 sjohnson this perl 6 stuff is something else
04:35 eternaleye rakudo: sub infix:<ö>( $l, $r ) { say "$l »ö« $r"; }; <Camelia Rose> »ö« <butterfly bumblebee>
04:35 p6eval rakudo 23718a: OUTPUT«Camelia »ö« butterfly␤Rose »ö« bumblebee␤»
04:35 TimToady rakudo: my $x = "uc"; say <a b c>>>."$x"
04:35 p6eval rakudo 23718a: OUTPUT«ABC␤»
04:35 eternaleye Wait, when did unicode hypers start working? :D
04:35 TimToady rakudo: my $x = "uc"; my @x = <a b c>; @a>>.="$x"; say @a
04:36 p6eval rakudo 23718a: OUTPUT«Symbol '@a' not predeclared in <anonymous> (/tmp/d8cGXp9I4z:1)␤in Main (src/gen_setting.pm:3166)␤»
04:36 TimToady rakudo: my $x = "uc"; my @a = <a b c>; @a>>.="$x"; say @a
04:36 p6eval rakudo 23718a: OUTPUT«ABC␤»
04:36 TimToady there's one reason to use .= instead of !
04:36 TimToady the ! would get lost after the quote
04:38 sjohnson i think i can agree with you there
04:39 sjohnson hmm
04:39 sjohnson what if you knew you wanted to mutate it with a !, wouldn't you just make "uc!" string, and call it with a period still/
04:39 sjohnson ?
04:40 TimToady that changes the types
04:40 eternaleye buubot: spack Junction
04:40 buubot eternaleye: S02-bits.pod:5 S03-operators.pod:3 S06-routines.pod:1 S09-data.pod:4 S29-functions.pod:13
04:41 TimToady you really shouldn't be calling a method with such different semantics invisibly
04:41 sjohnson i think i will be just as happy with .= anyway
04:41 TimToady it is much more extensible
04:42 TimToady most of the places where Ruby has "cute" syntax tend to interfere badly with extensibility
04:43 TimToady the spots where Perl 6 looks slightly klunkier are that way for a good reason, in general
04:44 justatheory joined #perl6
04:44 sjohnson thank godness perl is free
04:44 sjohnson as i use it a lot for day to day things
04:45 sjohnson and it's on every unixy system i go to
04:45 sri_kraih joined #perl6
04:47 sjohnson anyone here like shooting pool?
04:47 wayland76 Was Hæl Larry!
04:47 TimToady nah, the bullets slow down too fast in water
04:47 wayland76 (I was thinking of dead fish)
04:48 sjohnson heh
04:48 wayland76 It kinda takes the sport out of the fishing, though :)
04:48 sjohnson or young kids with goggles
04:48 TimToady not nearly as much as dynamite
04:48 wayland76 sjohnson: Yes, but I only do it once every 5-10 years
04:49 wayland76 Hmm.  Have we just designed a new computer game? :)
04:49 TimToady my wife is sure that game exists already embedded in some other game
04:53 sjohnson alright guys thanks for chatting
04:53 sjohnson gonna go play a game of pool with my shotgun
04:53 sjohnson CYA!
05:01 cognominal joined #perl6
05:23 davidad joined #perl6
05:49 sjohnson joined #perl6
05:51 sjohnson pugs:  my $x = ( if (1) { 5 } else { 10 } );  print $x;
05:51 p6eval pugs: OUTPUT«*** ␤    Unexpected "$x"␤    expecting "=", expression, ")", context, ":" or "("␤    postfix op␤    at /tmp/4rBlMEvu0J line 1, column 4␤»
05:51 sjohnson whats the one with the r again
05:51 sjohnson should be in the topic maybe
05:51 sjohnson rutaku or something
05:54 wayland76 Rakudo?
05:54 wayland76 We had a really long topic, so we replaced it with http://perl6-projects.org/
05:54 sjohnson rakudo: my $x = ( if (1) { 5 } else { 10 } );  print $x;
05:54 p6eval rakudo 23718a: OUTPUT«5»
05:55 sjohnson i wonder why pugs cant do that line
05:55 ashizawa joined #perl6
05:59 sjohnson rakudo:  @list = 1,2,3;  print @list[1];
05:59 p6eval rakudo 23718a: OUTPUT«Symbol '@list' not predeclared in <anonymous> (/tmp/yeMfwAIWky:1)␤in Main (src/gen_setting.pm:3166)␤»
05:59 sjohnson rakudo:  my @list = 1,2,3;  print @list[1];
05:59 p6eval rakudo 23718a: OUTPUT«2»
06:02 sjohnson rakudo: say qx/whoami/;
06:03 p6eval rakudo 23718a: OUTPUT«evalenv␤␤»
06:04 lichtkind_ joined #perl6
06:07 sjohnson is TimToady in bed?
06:09 TimToady I'll never tell
06:11 TimToady pugs: my $x = do if 1 { 5 } else { 10 }; print $x
06:11 p6eval pugs: OUTPUT«5»
06:11 TimToady the () syntax is more recent
06:15 sjohnson TimToady: can you field this question for my brother who programs in C
06:16 sjohnson (11:04:36 PM) falzer@hotmail.com: make it so you dont have to have  { }
06:16 sjohnson (11:04:38 PM) falzer@hotmail.com: after an if
06:16 sjohnson (11:04:44 PM) falzer@hotmail.com: it really annoys me.
06:16 sjohnson (11:04:55 PM) falzer@hotmail.com: just wanna be able to say
06:16 sjohnson (11:05:08 PM) falzer@hotmail.com: if $x print $var;
06:16 sjohnson his response to just reversing it and putting the "if" after he knows, but says it's not what he wants
06:19 sjohnson if ($var) print "hi!";
06:24 wayland76 sjohnson: There are many other short ways to do this kind of thing in perl
06:25 wayland76 rakudo: 1 and print "hi";
06:25 p6eval rakudo 23718a: OUTPUT«hi»
06:25 wayland76 rakudo: 0 and print "hi";
06:25 p6eval rakudo 23718a:  ( no output )
06:28 sjohnson i take it Larry knows about this and probably has his own opinion as to why that wont work without the { }
06:29 sjohnson thanks wayland76 tho, i didnt know about that trick
06:29 wayland76 You can also do ...
06:29 wayland76 rakudo: 0 or print "hi"
06:29 p6eval rakudo 23718a: OUTPUT«hi»
06:29 wayland76 rakudo: 1 or print "hi"
06:29 p6eval rakudo 23718a:  ( no output )
06:30 sjohnson rakudo:  1 && print "hi"
06:30 p6eval rakudo 23718a: OUTPUT«hi»
06:30 wayland76 I learned it from open(FILE, "filename") or die "message";
06:30 sjohnson wayland76: are && and "and" the same?  or do they have some other differences
06:30 wayland76 different predence level
06:30 wayland76 "and" is very low, "&&" is the same as C
06:31 wayland76 I just always use "and", these days, because it's usually what I mean anyway
06:31 sjohnson if i use ($var) && "print hi";
06:31 sjohnson for simple things like that, it's okay?
06:32 sjohnson cause i will likely forget if i should use && or and
06:32 wayland76 Well, if in doubt, you can always put parentheses in
06:32 sjohnson i usually always do
06:32 wayland76 Yeah, && works well most of the time
06:32 sjohnson i can never remember the order of operations
06:33 wayland76 About the only time it would make a difference is if you did something like $b = $a && $c = 1
06:33 wayland76 and yes, those are assignments there
06:34 sjohnson you can do that in perl 6?
06:34 wayland76 I just think "and" is more readable, and more likely to be what I want, so I always use that
06:34 sjohnson assign two vals in one statement?
06:34 wayland76 Well, that's Perl 5
06:34 wayland76 I don't know if you can in Perl6
06:34 sjohnson oh
06:34 sjohnson i see what you are doing
06:34 wayland76 It's probably a bad way to program
06:35 sjohnson you are essentially doing if ($b = a$a) { $c = 1 }
06:35 wayland76 but it's an example of where there'd be a difference
06:35 sjohnson err, $b = $a
06:35 sjohnson something like that
06:35 wayland76 Well, the example I gave would be $b = ($a && $c = 1)
06:36 wayland76 Whereas you might want ($b = $a) and ($c = 1)
06:36 wayland76 The whole thing would be in an if statement or something
06:36 wayland76 (those two commands I wrote on the previous lines are the same with and without ()
06:37 wayland76 That first should maybe have been $b = ($a && $c) = 1
06:37 sjohnson hopefully i will never have to be that expressive when i program myself
06:37 wayland76 which would be really confusing.
06:37 wayland76 That first should maybe have been $b = (($a && $c) = 1 )
06:37 wayland76 Well, it's probably a bad idea all around, but we needed an example :)
06:38 frew|work joined #perl6
06:38 wayland76 might also make a difference in if($a, $b and $c, $d) {...}
06:38 wayland76 Oh, wait, I think I remember who it's bad
06:39 wayland76 or good
06:39 wayland76 $a = $b && $c # does what you want here
06:39 wayland76 $a = $b and $c; # always sets $a to $b
06:39 wayland76 I think, anyway
06:40 wayland76 So it doesn't always do what you want :)
06:43 sjohnson in that case
06:43 sjohnson ill use english words "and" and "or" to do the die() stuff
06:43 Psyche^ joined #perl6
06:48 sjohnson thanks for the answers wayland76
06:49 sjohnson you seem to be interested in perl 6 as much or more than i am
06:52 ElectricHeavyLan left #perl6
06:58 sjohnson i wish i could do something to help, but i will probably just keep asking q's until i find something good that isn't in perl 5
07:00 azawawi joined #perl6
07:00 wayland76 sjohnson: Well, if you're not so keen on the Userdocs 4 Christmas approach...
07:01 azawawi good localtime()
07:01 wayland76 You could write some actual working code, and submit any bugs you find back to the coding team
07:01 wayland76 Of course, you'd need to install one of the versions of Perl 6 for that :)
07:02 DemoFreak joined #perl6
07:02 wayland76 azawawi: hi :)
07:02 sjohnson what is the best one that is executable ? pugs?
07:02 wayland76 depends what you mean by "executeable"
07:02 wayland76 But if I was going to try one, it would be Rakudo
07:02 sjohnson ... closest to bytecode
07:02 wayland76 sjohnson: remind me; what OS?
07:03 sjohnson probably linux since thats what i do most of my perl in
07:03 wayland76 Anyway, I'd avoid Pugs, and go with either SMOP or Rakudo
07:04 wayland76 Rakudo is on the Parrot Virtual Machine (and is the one I lean towards), and SMOP is, IIRC, in native C
07:05 wayland76 Which Linux?
07:05 wayland76 Fedora?  Ubuntu?  Gentoo?  etc
07:06 sjohnson old ass ubuntu
07:06 sjohnson mostly run these on work computers
07:06 sjohnson as i mostly use perl at work
07:06 wayland76 Oh, ok
07:07 wayland76 I don't know what the Debian/Ubuntu packaging status is for any of these projects
07:07 sjohnson oh
07:07 sjohnson i would just compile it if possible
07:07 sjohnson it's so old that not even the packages work anymore
07:07 sjohnson i have to compile most things from src
07:07 sjohnson thankfully, most of these things work with a ./configure && make
07:08 wayland76 :)
07:08 wayland76 Rakudo has a built-in build script that will download and install Parrot for you.  I don't use it myself, though (I'm slowly working on making an RPM of it)
07:09 sjohnson does it look like SMOP might end up being the fastest one?
07:11 sjohnson in Perl 6, what was the better way again for writing this?  ${%hash{symbol}}
07:11 sjohnson %hash.symbol ?
07:11 TimToady do you mean symbol to be a string?
07:12 TimToady %hash<symbol> if so
07:12 TimToady %hash{symbol} would always call the symbol function
07:12 sjohnson yeah like if it was a key
07:12 sjohnson ${%hash{key}} is what i should have said
07:13 TimToady there's no ${} anymore
07:13 sjohnson thank god
07:13 TimToady or @{} %{}
07:13 sjohnson though i realize that was a bad example
07:13 sjohnson $hash{key} would get you the stuff in p5
07:13 sjohnson now my brother will be happy with perl
07:14 sjohnson and myself too
07:14 sjohnson well, i always am happy with it
07:14 TimToady since the .<> subscript is based on qw, it automatically gives you slices
07:14 sjohnson but im excited that he will be excited
07:14 TimToady %hash<foo bar> is %hash{'foo','bar'}
07:14 sjohnson %hash.foo won't work for foo only?
07:15 TimToady that only works if there's a foo method
07:15 sjohnson hmm... since <> is like qw
07:15 sjohnson is there a different way to do it (out of curiosity only)?
07:15 TimToady to do which?
07:15 sjohnson just reference what's in the foo key in that %hash
07:16 wayland76 Yes.  Is it %hash{foo}{bar}
07:16 wayland76 or do I need a . in there somewhere?
07:16 TimToady no, you never need the dot except on alphanumeric methods
07:17 TimToady on all other postfixes it's optional
07:17 sjohnson wayland76: but i dont want the bar thing
07:17 TimToady %hash<foo><bar> if they're strings
07:17 sjohnson just %hash{foo} and $hash<foo>   are the only ways to get this method?
07:17 TimToady what method?
07:17 sjohnson s/method/var
07:17 sjohnson sorry too many beers tonight
07:18 TimToady {'foo'} has to be quoted to be equivalent
07:18 sjohnson unlike p5, correct?
07:18 TimToady yes
07:18 iblechbot joined #perl6
07:19 sjohnson ... and that's it?  just {} and <>?  no other special trick?
07:19 TimToady well, everything else is longer
07:19 sjohnson and it's not considered overkill to use a <> type thing on only one key ?
07:19 sjohnson i think the answer is "yes"
07:20 TimToady %hash.postcircumfix:<{ }>('foo') or some such also works
07:20 sjohnson ok i am happy with that
07:20 sjohnson thanks larry
07:20 TimToady why would that be overkill?
07:20 sjohnson just cause i normally use qw() in perl 5 to do more than 1 item in a list
07:20 TimToady it makes the autoquoting very visible
07:21 sjohnson please note that i also understand why it's perfectly fine
07:21 sjohnson because it is syntatically perfect
07:21 TimToady well, a real <foo> as a qw would generally not be distinguishable from a 'foo'
07:21 TimToady so there's no point, unlike with subscripts
07:21 TimToady but you can't say %hash'foo'
07:21 sjohnson is <foo> not an array though?
07:21 sjohnson or does it not even matter in 99% of the cases
07:22 sjohnson likely because the Hash object can take in that array etc
07:22 TimToady the qw form is defined as equivalent to ('foo')
07:22 sjohnson is my guess
07:22 TimToady the subscript form is defined as equivalent to {'foo'}
07:22 sjohnson rukado:  say ('foo').WHAT
07:22 sjohnson damn i can never remember the name of this bot
07:23 TimToady all you have to remember is that rakuda is "camel" in Japanese
07:23 sjohnson rakudo:  say ('foo').WHAT
07:23 p6eval rakudo 23718a: OUTPUT«Str()␤»
07:23 sjohnson rakudo:  say <foo>.WHAT
07:23 p6eval rakudo 23718a: OUTPUT«Str()␤»
07:23 sjohnson rakudo:  say <foo bar>.WHAT
07:23 p6eval rakudo 23718a: OUTPUT«List()␤»
07:23 sjohnson i see.. the TRUTH now
07:24 ssm joined #perl6
07:24 sjohnson i think camel is "rakuda"
07:24 sjohnson in japanese
07:24 TimToady that's what I said
07:25 sjohnson hahah
07:25 sjohnson you are funny
07:25 sjohnson heheheh
07:25 sjohnson i can see why i liked the camel book so much
07:27 sjohnson hmmm...
07:28 sjohnson i cant think of another way to improve perl 5
07:28 sjohnson i had a giant list of things too
07:28 sjohnson well there is one thing:
07:28 sjohnson string manipulation without regex.  things like  $food = 'cake';
07:28 sjohnson $food[0] = 'C';
07:29 TimToady we might be able to support something like that someday
07:29 sjohnson it's as old as the hills... and it sure beats splitting it into a @food_chars list
07:30 TimToady it kinda depends on whether we can make this thing called NFG work out
07:30 sjohnson i found it particularily helpful i was programming in the wee hours a perl project to do that oxford hype thing
07:30 sjohnson i shall show you
07:30 sjohnson Lrray Wlal!  Tkhans for wrintig Prel 5 and sonupitprg and enicoranugg and diisscnsug the frtuue of Prel 6, its soscucser.
07:31 TimToady My eyes!  I should go to be for real
07:32 TimToady *bed
07:32 wayland76 'night :)
07:32 TimToady gotta get up in 6 hrs...
07:32 TimToady zzz &
07:32 sjohnson thanks hope to see you again soon
07:32 wayland76 sjohnson: You know this is all permanently recorded, and available on the 'Net? :)
07:33 wayland76 Oh, I don't think you could keep him away from here :)
07:33 sjohnson so far i haven't said anything bad, have i?
07:33 sjohnson or that i'm a super nerd
07:33 wayland76 Well, no, but that was some fairly beery typing :)
07:33 sjohnson lol
07:34 sjohnson it's called... obfuscated English
07:34 araujo be careful, they might think perl6 is being developed by beery people
07:34 wayland76 ...and Beeri, as everyone knows, was a Hittite
07:34 wayland76 (which is probably the Old Testament equivalent of a Klingon or something)
07:35 wayland76 (Beeri was the father of one of Esau's wives in the Old Testament)
07:35 sjohnson is it possible to read the Perl 6 test that must be passed to be considered a Perl 6 official-approved implementation?
07:35 wayland76 Yes
07:36 wayland76 But I forget where it is.  They refer to them as spectests, I think
07:37 wayland76 Tip: the link labelled "The official test suite" on perl6-projects links to the SVN for the spectests
07:37 wayland76 But be warned that they're incomplete
07:38 sjohnson time to write an ASM Perl 6 interpretor
07:38 wayland76 There is one.  If you call Parrot's Assembly langugage an ASM :)
07:38 revdiablo joined #perl6
07:38 dukeleto joined #perl6
07:38 diakopter joined #perl6
07:40 sjohnson hmm
07:40 sjohnson rakudo: for (1..10) { print "hi!"; }
07:40 p6eval rakudo 23718a: OUTPUT«hi!hi!hi!hi!hi!hi!hi!hi!hi!hi!»
07:42 sjohnson rakudo: print qx/date/;  for (1..1000)   if (0 == 1) { print "buy a new computer"; }  print qx/date/;
07:42 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "{ print \"b"␤in Main (src/gen_setting.pm:0)␤»
07:42 sjohnson rakudo: print qx/date/;  for (1..1000) { if (0 == 1) { print "buy a new computer"; } }  print qx/date/;
07:42 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "print qx/d"␤in Main (src/gen_setting.pm:0)␤»
07:42 sjohnson rakudo: print qx/date/;  for (1..1000) { if (0 == 1) { print "buy a new computer"; } } ; print qx/date/;
07:42 p6eval rakudo 23718a: OUTPUT«Sat May 23 07:42:47 UTC 2009␤»
07:43 * sjohnson is waiting...
07:44 kate21de joined #perl6
07:47 sjohnson rakudo: print qx/date/.chomp;  for (1..1000) { if (0 == 1) { print "buy a new computer"; } } ; print qx/date/;
07:47 p6eval rakudo 23718a: OUTPUT«Sat May 23 07:47:25 UTC 2009»
07:51 sjohnson does the pugs creator hang around here too?
08:01 wayland76 sjohnson: Not any more, I think.
08:01 wayland76 Unless I just don't know their handle
08:04 wayland76 Audrey Tang was the name
08:05 nbrown_ joined #perl6
08:06 sjohnson it is impressive that is a girl around my age that is doing Pugs
08:06 sjohnson not something you see everyday
08:11 abra joined #perl6
08:32 davidad joined #perl6
08:55 kst joined #perl6
09:25 phenny joined #perl6
09:32 tulcod joined #perl6
09:45 M_o_C joined #perl6
10:10 |MoC| joined #perl6
10:13 cognominal joined #perl6
10:17 cognominal joined #perl6
10:22 skids joined #perl6
10:32 Whiteknight joined #perl6
11:09 nsh joined #perl6
11:19 fridim_ joined #perl6
11:21 meppl joined #perl6
11:26 nsh- joined #perl6
11:56 nsh_ joined #perl6
12:06 justatheory joined #perl6
12:06 nsh- joined #perl6
12:06 nsh_ joined #perl6
12:20 CMA joined #perl6
12:37 ZuLuuuuuu joined #perl6
12:44 mizioumt joined #perl6
12:55 pmurias joined #perl6
12:55 pmurias ruoso: hi
12:58 pugs_svn r26915 | pmurias++ | [re-mildew] added -x m0ld option to accept m0ld code
12:58 pugs_svn r26916 | pmurias++ | [re-smop] added .perl to idconst
12:58 pugs_svn r26917 | pmurias++ | [re-smop] added Hash.keys
12:58 pugs_svn r26918 | pmurias++ | [re-smop] added a extremely crude way of listing leaks
12:58 pugs_svn r26919 | pmurias++ | [re-smop] added a non-spec $OUT.describe for debugging purposes
13:23 ilbot2 joined #perl6
13:23 Topic for #perl6is now »ö« | http://perl6-projects.org/ | nopaste: http://sial.org/pbot/perl6 | evalbot: 'perl6: say 3;' | irclog: http://irc.pugscode.org/ | UTF-8 is your friend!
13:33 justatheory joined #perl6
13:44 abra joined #perl6
13:45 icwiener joined #perl6
13:55 bacek joined #perl6
13:55 bacek hi there
13:56 bacek rakudo: say log10(1i)
13:56 p6eval rakudo 23718a: OUTPUT«0␤»
13:56 bacek rakudo: say (2*log(10)
13:56 p6eval rakudo 23718a: OUTPUT«say requires an argument at line 1, near " (2*log(10"␤in Main (src/gen_setting.pm:2400)␤»
13:56 bacek rakudo: say (2*log(10))
13:56 p6eval rakudo 23718a: OUTPUT«4.60517018598809␤»
13:57 bacek rakudo: say 1i * pi
13:57 p6eval rakudo 23718a: OUTPUT«0+3.14159i␤»
13:57 bacek rakudo: say 1i * pi / (2*log(10)
13:57 p6eval rakudo 23718a: OUTPUT«Statement not terminated properly at line 1, near "/ (2*log(1"␤in Main (src/gen_setting.pm:0)␤»
13:57 bacek rakudo: say 1i * pi / (2*log(10))
13:57 p6eval rakudo 23718a: OUTPUT«0+0.682188i␤»
13:58 bacek rakudo: say abs(1i * pi / (2*log(10)))
13:58 p6eval rakudo 23718a: OUTPUT«0.682188176920921␤»
13:58 bacek rakudo: say abs(log10(i1) - (1i * pi / (2*log(10))))
13:58 p6eval rakudo 23718a: OUTPUT«Could not find non-existent sub i1␤»
13:58 bacek rakudo: say abs(log10(1i) - (1i * pi / (2*log(10))))
13:59 p6eval rakudo 23718a: OUTPUT«0.682188176920921␤»
14:04 bacek rakudo: say log10(1i) - (1i * pi / (2*log(10)))
14:04 p6eval rakudo 23718a: OUTPUT«0-0.682188i␤»
14:05 bacek rakudo: say abs(log10(1i) - (1i * pi / (2*log(10))))
14:05 p6eval rakudo 23718a: OUTPUT«0.682188176920921␤»
14:07 bacek moritz_: ping?
14:09 pugs_svn r26920 | pmurias++ | [re-mildew] fix test count
14:09 pugs_svn r26921 | pmurias++ | [re-mildew] started working on RoleHOW
14:10 amoc joined #perl6
14:12 bacek msg moritz_ Can you check S32/log.t why "is_approx(log10(1i), 1i * pi / (2*log(10)), 'got the log10 of i');" is passing? Because it shouldn't...

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo