»ö« | perl6-projects.org/ | nopaste: paste.lisp.org/new/perl6 | evalbot usage: 'perl6: say 3;' | irclog: irc.pugscode.org/ | UTF-8 is our friend!
Set by moritz_ on 30 July 2009.
dalek kudo: e95ae57 | pmichaud++ | src/classes/Signature.pir:
Remove unused all_types PMC creation.
00:21
kudo: 186e36d | pmichaud++ | src/ (2 files):
We don't need to store an Undef for cons_type; PMCNULL suffices.
tann rakudo: package P { }; my $x = P.new; 00:26
p6eval rakudo c57fbd: ( no output )
KyleHa On my box, this crashes (segmentation fault) SOMETIMES: gist.github.com/160262 00:27
KyleHa I can't seem to get it any smaller, and the result-in-death isn't consistent. 00:28
pmichaud I suspect it's due to errors in the vals
*evals
one or more of the evals is failing, and you're getting the segmentation fault because we never exit the inferior runloop 00:29
KyleHa Yes, they definitely fail.
pmichaud in particular: eval 'role RT64688_r1' isn't valid as written (at least not according to Rakudo's grammar) 00:30
std: role RT64688_r1
p6eval std 27857: ( no output )
pmichaud hmmm
std: role RT64688_r1;
p6eval std 27857: OUTPUT«ok 00:02 36m␤»
pmichaud std: role RT64688_r1
p6eval std 27857: OUTPUT«ok 00:02 36m␤»
KyleHa S10-packages/basic.t is wall to wall failing evals. New code in there is kind of a crap shoot. 00:31
pmichaud well, that one is just giving segfaults on exit, yes? 00:32
frettled pmichaud: what on earth are you doing up so late? (oh, wait, that goes for me, too ...) 00:32
KyleHa I got it to segfault midstream. That's why I was trying to track this down.
pmichaud ah, I see.
anyway, I'm fairly sure it's an inferior runloop problem.
KyleHa I had to stick my tests somewhere else to get them to behave. 8-) 00:33
pmichaud Right now in any Parrot program, more than one failing eval() is likely to cause segfaults. 00:33
KyleHa OK, well, can you think of a way to trigger this reliably so I can test it?
pmichaud depends... what exactly are you wanting to test? 00:34
KyleHa I want to test the segfault thing...
pmichaud segfaults by their nature are somewhat unreliable. 00:35
KyleHa Yeah, that's true.
eval random_noise() for 1 .. 1000; 00:36
KyleHa lives_ok { eval random_noise() for 1 .. 1000 }, 'nyuck nyuck nyuck'; 00:36
frettled But with a little patience, a debugger, some more patience, and a bit of patience, you can get there. 00:37
KyleHa OK, well, I have to go take care of others. Thanks for your insight.
frettled Did I mention patience?
KyleHa: good luck, hope you manage to track down a bug or two and enjoy your night.
KyleHa Thanks, frettled. 00:41
tann rakudo: module X { class Y { }; }; X::Y.new; 00:42
p6eval rakudo c57fbd: ( no output )
pmichaud rakudo: say 3|4 00:50
p6eval rakudo 186e36: OUTPUT«34␤»
pmichaud (wrong!)
(fixing) 00:51
tann rakudo: say $?PACKAGE, $?MODULE, $?CLASS; 01:02
p6eval rakudo 186e36: OUTPUT«Symbol '$?PACKAGE' not predeclared in <anonymous> (/tmp/OVFnRyWpIK:2)␤in Main (src/gen_setting.pm:3363)␤»
pmichaud rakudo doesn't know those yet, I don't think. 01:03
at least, it doesn't know some of them.
cxreg rakudo: sub foo{};multi foo{} 01:31
p6eval rakudo 186e36: OUTPUT«Redefinition of routine foo␤»
cxreg that's segfaulting on me :)
colomon Huh. I've got a weird one I don't think can be duplicated with the rakudobot here. 01:38
my $out = open "02.pl", :w or die "Unable to open 02.pl: $!\n";
Works if an 02.pl file exists, fails with "Unable to open filehandle from path '02.pl' " if it doesn't. 01:39
cxreg wfm
maybe you dont have directory write permission? 01:40
colomon I do, directory is drwxr-xr-x. 01:41
KyleHa rakudo: my $foo = { "Yay" }; say $foo(foo => 'bar'); 01:42
p6eval rakudo 186e36: OUTPUT«FixedIntegerArray: index out of bounds!␤in Main (/tmp/h7KKjEEyKv:1)␤»
pmichaud (sigh) Parrot bug again. 01:43
KyleHa pmichaud: Which? Mine or colomon?
pmichaud KyleHa:
KyleHa: yours.
it's putting the named parameter into $_
and then likely getting confused about it. 01:44
rakudo: my $foo = { $^a; "Yay" }; say $foo(foo => 'bar')
p6eval rakudo 186e36: OUTPUT«too many named arguments - 'foo' not expected␤in Main (/tmp/X1rdAj15yv:1)␤»
pmichaud hmmm
KyleHa OK, well, at least it's reliably testable this time.
pmichaud colomon: are you sure you have write permission? I get the same error if I turn off write permission to my directory 01:46
colomon Actually, just realized I'm completely on the wrong track here. One sec.
pmichaud although now I'm getting a strange version of it as well. 01:47
oh.
colomon got it -- was executing the wrong script, so that I was executing the script that didn't exist, or was a 0 byte long file. thus the two different results. 01:48
pmichaud Yes, I was guessing it was something like that. 01:49
colomon not the most intuitive error message for "your script doesn't exist", but I'd have known instantly if I hadn't been trying to write a script with another script. :)
pmichaud yes, we should fix that error message. 01:50
pmichaud files rakudobug 01:51
(filed) 01:53
colomon pmichaud++; cxreg++; 01:59
blackdog is pugs still a going concern? if so, is it possible to drop out into haskell from within pugs? 02:16
dalek kudo: d51bca3 | pmichaud++ | src/classes/Signature.pir:
Slurpy params should default to Object instead of Any.
02:18
kudo: 91408af | pmichaud++ | src/ (2 files):
Move print() and say() functions to the setting.
pugs_svn r27858 | pmichaud++ | [t/spec]: Add some tests for slurpy params and autothreading (RT #68142). 02:24
pugs_svn r27859 | kyle++ | [t/spec] Adjust RT #64818 test 02:45
r27860 | kyle++ | [t/spec] Tests for RT #64828
r27861 | kyle++ | [t/spec] Tests for RT #64844
KyleHa rakudo: sub foo { say "bar" }; my $x = 'foo'; ::$x() 02:59
p6eval rakudo 91408a: OUTPUT«ResizablePMCArray: Can't pop from an empty array!␤in Main (src/gen_setting.pm:2240)␤»
meppl good night 03:00
eternaleye What's currently blocking heredocs? 03:59
wayland76 They're there instead of here :) 04:41
(no idea really :) )
dalek kudo: 18598de | tene++ | src/setting/IO/Socket/INET.pm:
Fix Socket::INET to re-use the appropriate attribute from its parent class.
05:06
cbk off to DC for 10 days. (will work on perl 6 programs, but no IRC 4 me) c-ya all when I get back :-) 05:15
wayland76 o/ 05:20
wayland76 lambdabot: @seen jnthn 05:45
lambdabot jnthn is in #perl6. I last heard jnthn speak 18h 3m 24s ago.
azawawi std: sub sub($foo) { say "OH HAI" }; sub(1) 06:21
p6eval std 27861: ( no output )
moritz_ std: 1 08:01
p6eval std 27861: OUTPUT«ok 00:02 36m␤»
moritz_ std: sub sub($foo) { say "OH HAI" }; sub(1)
p6eval std 27861: ( no output )
moritz_ cxreg: you'll never see a segmentation fault from p6eval, it will print these only to the administration log, not to the channel (not sure why, though) 08:18
tann rakudo: my @cities = <Berlin Paris London>; my @visited = <Paris London>; say "I want to see ", @cities - @visited; 08:19
p6eval rakudo 18598d: OUTPUT«I want to see 1␤»
tann rakudo: my @cities = <Berlin Paris London>; my @visited = <Paris London>; say "I want to see ", @cities >>-<< @visited;
p6eval rakudo 18598d: OUTPUT«Non-dwimmy hyperoperator cannot be used on arrays of different sizes or dimensions.␤in Main (/tmp/WMxtfM7LZ4:2)␤»
moritz_ rakudo: my @cities = <Berlin Paris London>; my @visited = <Paris London>; my %v; %v{@visited} = @visited; say "I want to see ", @cities.grep({!%v{$_}}) 08:21
p6eval rakudo 18598d: OUTPUT«I want to see Berlin␤»
moritz_ rakudo: my @cities = <Berlin Paris London>; my @visited = <Paris Berlin>; my %v; %v{@visited} = @visited; say "I want to see ", @cities.grep({!%v{$_}}) # adapted to my experience :-)
p6eval rakudo 18598d: OUTPUT«I want to see London␤»
tann i kinda like ruby's way..very convenient and concise :) 08:24
not sure how it's implemented in ruby though
moritz_ Perl 6 has sets, they just aren't implemented yet, and aren't specced very well either
tann dont see 'em on perlcabal 08:27
moritz, which s#?
moritz_ ack -w Set docs/Perl6/Spec/
S32:Containers, S02 and S03 mention it 08:28
tann thanks 08:29
wayland76 I'm keen to see more Sets too :) 09:34
wayland76 rakudo: say "Sets" x 20 09:35
p6eval rakudo 18598d: OUTPUT«SetsSetsSetsSetsSetsSetsSetsSetsSetsSetsSetsSetsSetsSetsSetsSetsSetsSetsSetsSets␤»
wayland76 Does Perl6 support relational algebra? 09:49
moritz_ what is "relational algebra"? 09:49
eldragon2 it's the algebra of the cartesian product in many relational databases 09:50
wayland76 Well, the join operator, for example :)
moritz_ I don't think it does 09:51
wayland76 en.wikipedia.org/wiki/Relational_algebra 09:52
Have we considered it?
Matt-W Not that I'm aware of 09:53
But you could write a module for it...
moritz_ I think dduncan tries to do something like that with Muldis-D or Rosetta or whatever it's called these days
wayland76 Yeah, I figured
Matt-W would it need core language support when you can define custom operators and types and munge the grammar?
wayland76 Matt-W: The old saying that "FORTRAN programmers can write FORTRAN in any language" is truer of Perl than any language before 09:54
Matt-W yes
use FORTRAN;
wayland76 (basically, nothing almost nothing needs core support :) )
Matt-W indeed
it's not so much about adding to the core language at this point, as writing cool modules to be shipped with the compiler 09:55
wayland76 The only thing is, I was confused earlier, and thought that we were getting Relational Algebra along with Sets
but I've just realised this isn't the case. I must admit, I'm disappointed, but I don't expect RA to find its way into the core 09:56
I'm having trouble with my ws token in a grammar 09:58
Is the default <ws> token just \s
?
moritz_ no 10:00
it's <ww> \s+ || \s*
erm, <.ww>
or something similar
wayland76 I'm trying to make it eliminate // style comments 10:01
Tried \s | '//' .*?\n
But it didn't seem to like that wonderfully well :) 10:02
What's ww?
moritz_ it's the "within word" assertioin
a single \s is almost certainly wrong
wayland76 Ok 10:03
moritz_ and so is .*?\n, because it might backtrack
try '//' \N*\n instead
lunch&
wayland76 Ok, will do 10:04
moritz_ <.ww> \s+ || <!ww> \s* [ '//' \N* \n]? 10:05
wayland76 Rakudo seems to be using: <!ww> [ | <.unsp> | \v+ | <.unv> ]*
(I removed some PIR code that I didn't understand :) )
Got this error: Unable to find regex 'ww' 10:11
I got rid of both ww and it worked, though. Thanks ;) 10:14
Maybe there should be an easier way to do this, though; maybe <ws> should call <comment> which does nothing by default, but can be set by the user 10:15
wayland76 Quiet tonight :) 12:04
moritz_ YAPC::EU absorbs all the bright minds :-) 12:05
wayland76 Ah, that would explain it :) 12:05
Although that doesn't explain what you're doing here :) 12:06
moritz_ well, it does :/
wayland76 Well, since you're one of the most knowledgeable about P6, that leads to two possibilities 12:08
wayland76 1) Knowledge of P6 != brightness, or 2) you're at YAPC::EU 12:08
moritz_ the first one applies 12:09
I'd love the second better :-)
wayland76 I think I've found a Rakudobug 12:10
In an actionclass, I'm going: $currkey = $match<ident> 12:12
And I get: Null PMC access in getprop()
Does anyone know whether that's a known bug? 12:13
Oh, wait, I didn't mention, this is in the middle of a rule :)
moritz_ I don't recognize it 12:14
so please submit
wayland76 Will do 12:15
Just trying to generate a minimal whatever at the moment
Doesn't matter if it's in the middle of a rule or not 12:18
(submitted btw) 12:20
Su-Shee good.. well day. :) 12:40
Matt-W good afternoon
pugs_svn r27862 | azawawi++ | [STD] ignore STD.pm5
r27863 | azawawi++ | [STD] Fix strict ref warning 12:42
wayland76 good localtime() 12:45
Nearly bedtime for me :)
Su-Shee wayland76: perfect solution. :)
wayland76 Well, I have to admit, it's not original to me :) 12:45
Su-Shee aren't you all in lisboa?
wayland76 No, I'm still in country-town Australia :) 12:46
Su-Shee is amazed every day by open source and irc and internationalism.
wayland76 :) 12:47
We've got pretty good coverage here now
EU and US, of course, and bacek and I are in AU
moritz_ ruoso is in south america, afaict 12:48
wayland76 azawawi is in the middle east somewhere
moritz_ that leaves afrika, the far east and the south pole :-)
Su-Shee didn't we have two mainland china developers also?
wayland76 I think you're right about ruoso. I'm thinking of timezone coverage, though, rather than geographical
moritz_ maybe xinming or xiaoyafeng?
Su-Shee I recollect JimmyZ mention it, but I maybe wrong. 12:49
Matt-W This is probably the most internationalised project I've been so involved in 12:52
wayland76 Definitely for me 12:53
I suspect it has a little to do with the Unicode stuff in P6.
Su-Shee interesting question. what attracts more internationl developers? 12:54
azawawi wayland76: jordan... 12:55
wayland76 I'm afraid it's my bedtime, though. I think my brain just went to bed, so I'll send my body to join it. Goodnight all
moritz_ Su-Shee: Unicode, general openness, being not hostile to talk in other languages 12:55
Matt-W Su-Shee: sheer coolness, I think, and because you can be in a different time zone and yet not really feel like you're missing out
Matt-W Some projects are so US-focussed that if you're not in at the right time you never get to talk about anything at all 12:56
wayland76 Also, I suspect once you get critical mass in less-popular timezones, things even out
Su-Shee Matt-W: Example?
I have to admit I really don't know any US-centric project. 12:57
moritz_ Su-Shee: another thing is that in Perl you can write "baby talk", which is pretty good when you're learning a language - especially if your natural language far away from english, linguistically
Su-Shee moritz_: isn't english on the other hand what today everybody has accepted as tech-language?
Matt-W wayland76: absolutely
Su-Shee moritz_: mr shee and me realized today that we don't know certain subjects in german anymore. (electronics for example.) 12:58
Matt-W Plus we're also all quite nice people, and patient with people coming in whose english isn't great (even if it does sometimes turn into an english lesson)
moritz_ Su-Shee: I know that feeling :-)
Matt-W used to be that physicists had to know english and german
Su-Shee Matt-W: the linguistic roots of perl. :)
Matt-W Su-Shee: well larry is a native American speaker... 12:59
Su-Shee Matt-W: that much I know. :)
Matt-W Perl's a great deal more sensible than any form of English though
Su-Shee on the other hand, I don't know how the php/ruby/python community looks like. 13:00
moritz_ I think TIMTOWTDI is great in a language 13:01
because if there's only one way to do something, as a beginner it's often very hard to find that one way
Su-Shee moritz_: MEIN REDEN. ;) I really don't know why everybody's insisting on perl being difficult for beginners.. 13:02
moritz_ it can certainly be hard to read all these different ways 13:04
but when you learn a programming language, the examples are explained, and the you write yourself
Su-Shee well I had mostly the problem how to get from "perl the language" with obyeing syntax to actual "this is good code"
moritz_ typically you don't immediately start to read completely foreign code 13:05
Su-Shee yeah, but today you _use_ foreign code very much as you're encouraged to use modules. 13:05
moritz_ yes, but as a start it's enough to read their docs
Matt-W Perl looks very strange when you first see it on the screen 13:06
I think that's got a lot to do with its reputation
people see the $ and the @ and the % and they think 'huh?'
a lot of people who bash Perl to me never got any further than that... 13:07
or they see the golfing stuff and think that's what all Perl is like
Su-Shee Matt-W: that's not what you care for when you start programming.
Matt-W: I accepted sigils plainly as "that's what perl is". never questioned it.
Matt-W I just thought okay, let's find out what this all means 13:08
and I read Programming Perl
and this lightbulb came on inside my head :)
moritz_ Su-Shee: you assume the first contact is under the assumption "I want to learn it" - that's not always true
pugs_svn r27864 | azawawi++ | [STD] Removed another warning when using DEBUG.pmc 13:09
Matt-W moritz_: this is true, I was interested because I wanted to know why Perl is so popular, and I wanted a CGI language that was nicer than PHP
Su-Shee moritz_: that's true. I realized that painfully when I gave lectures. ;) 13:10
moritz_ actually I looked at python, and thought "WTF? they don't have strict?"
Su-Shee I read about cool hackers and wanted to become one. ;) 13:11
moritz_ :-)
Su-Shee but then open source was more interesting and suitable for my mind set. ;) 13:12
Matt-W moritz_: I looked at Python, liked the syntax, but really felt that it tends to become quite hard to follow somehow
it looks nice and clean, but then it ends up *too* clean 13:13
not that I have a problem with block identing, it's just the total effect of how Python works
Su-Shee During my perl crisis I did some python, but I never really _liked_ it. it left me somehow indifferently.
Matt-W I think they've got some good ideas, but I don't really like the 'pick the best way and make it the only way' approach 13:16
because how do you know for sure it's the best?
Su-Shee well I like to have at least the opportunity to have a different opinion. ;) 13:17
Matt-W maybe that's what draws us all together 13:18
we're all terribly argumentative
moritz_ Matt-W: no, we're not! :-)
Su-Shee well perl has a certain kind of sexiness I plainly like. and it evolves very nicely.
Matt-W moritz_: yes we are! 13:19
Su-Shee: Perl 6, to me, is a refinement of Perl, a statement of what Perl really is and what it really means 13:20
and it turns out that what it means is 'awesome programming language'
it makes C++ look like a baby toy
araujo likes perl ...to a certain extent :) .... bu he can understand why it is not usually chose as a learning language 13:23
Su-Shee Well, I have the announcement to drop by at my editor's already half finished when rakudo gets released. ;)
azawawi TimToady: Hi. I am getting substr errors in redspans, please see gist.github.com/160552 13:32
TimToady: it happened while i tried to upgrade S:H:P6 to the latest STD.pm
Matt-W araujo: I'm not sure I'd recommend it as a first language at all 13:34
Matt-W araujo: although I'm not sure *what* I'd recommend as a first language 13:34
no decent language is nice for newbies
moritz_ well, you could start with haskell 13:35
or with pascal
Su-Shee moritz_: _why_ would _anyone_ want to start with those languages? 13:37
araujo Matt-W, Scheme
I would recommend that one
Matt-W haskell's not bad for teaching basic programming
moritz_ Su-Shee: haskell has a very clean design 13:38
Matt-W but then I'm not sure how you'd suddenly throw mutable variables at people
and advanced haskell is VERY VERY SCARY
Scheme might be a good choice
araujo would go with Scheme all the way through
Matt-W although the syntax tends to turn people off, as with all lisp variants
Java I wouldn't recommend for anything at all
Su-Shee moritz_: I as a newbie I would care for that why? I want cool games/nice web stuff/hacking/do open source.
moritz_ Su-Shee: it's hard for us to learn when your brain is wired like ours is, but I don't think it's that much harder than other languages to learn for a total newbie
araujo and i think, that once a person grasp the basic of programming with it, could easily take other language as second language
Su-Shee that's very school like thinking. 13:39
moritz_ yes, I went to school for 13 years :-)
Matt-W yes, where programming should be taught
moritz_ and then a few years university
I guess that leaves traces, no? 13:40
Su-Shee well I had to do pascal at school with all this outstandingly boring tower of hanoi stuff and I didn't bother even take another term computer science. ;)
Matt-W that's not pascal's fault
araujo school fault
Matt-W tower of hanoi is, I always thought, a horrendous example
NOBODY CARES 13:41
araujo haha
mdxi those monks in hanoi, who will one day end the world, care
Su-Shee Matt-W: no, but imagine you're 13 today, with internet and open source grown up already - would you _really_ even touch pascal? no. you would go for C, C++, PHP or something like this.
moritz_ Matt-W: actually I think it's a very good example, because it's one of the few where recursion really makes things easier, as compared to iterative solutions
araujo that's other thing I find perl isn't too much in the academic world ... academy usually don't go too much into the pragmatic thinking ... and perl is highly pragmatic
Su-Shee araujo: that was in 1986/87, I was "lucky" even having computers at school.
moritz_ Matt-W: what would you use as an example for teaching recursion? 13:42
araujo recursion isn't too hard of a concept to grasp
Su-Shee a real world example actually used on some project? ;)
Matt-W I'd just use it
araujo throw at the fibonnaci or factorial
Matt-W but that might be my Haskell tuition coming out
I don't think of recursion as anything special 13:43
moritz_ araujo: both are actually a good example where you should not use recursion
araujo moritz_, why? .. how it is pretty much done in languages like haskell
Matt-W moritz_: but in a pure functional language you *have* to use recursion for that :)
moritz_ yes, but in all other languages you don't
Su-Shee wasn't there this nice memoizing example for exactly fibonacci in HOP? ;)
araujo we are talking about recursion
as a concept 13:44
moritz_ in perl a naiive recursive fibonacci takes O(2**n)
Matt-W I think it's probably a good idea to initially teach programming using quite a pure language
araujo once you grasp at it, you can use it in other languages
Matt-W don't throw people straight into the deep end of C++ or something else multi-paradigm
araujo Matt-W, I think so too
Matt-W then you step into another paradigm and teach a pure form of that
do two or three like that
Su-Shee Matt-W: why not? it's what is actually really used in real world programming.
Matt-W then you introduce a heavyweight
moritz_ araujo: I'd like to teach concepts with examples that make sense, and not only in a very special branch of programming languages 13:45
Matt-W Su-Shee: because you want people to understand the concepts 13:45
moritz_ I always hated those "I'll show you how to do it, but don't do it in this particular case, because it's a bad idea"
araujo moritz_, recursion is a concept .. it isn't tied to any language
Su-Shee Matt-W: and who are you going to convince first learn two other languages because actually starting with the project you really want to do? :)
araujo what it matters is that the student grasp at it
Matt-W Su-Shee: a hobbyist or somebody wanting to do a specific project is going to start completely differently
araujo you don't need a complex example for it
Matt-W and probably end up writing total shit 13:46
moritz_ araujo: I understand that. But I don't want to explain to a newbie why the recursive fibonacci takes exponentatial time in anything but haskell
Matt-W (obviously there are exceptions)
Su-Shee Matt-W: but that's half of all techies nowadays.
Matt-W Su-Shee: that's why so much code is shit
moritz_ araujo: which is why fibonacci is a bad example for teaching, IMHO
araujo moritz_, you won't need to do it.. he is a newbie .. still learning
Su-Shee Matt-W: and there's plenty literature how to write good <insertyourfavoritelanghere> out there.
Matt-W moritz_: it's dreadful, nobody's interested in generating fibonacci numbers either
Su-Shee: which they don't read
araujo moritz_, plus you are teaching him recursion , not time complexity
Su-Shee Matt-W: they don't learn the two "pure" languages either. ;) 13:47
Matt-W Su-Shee: indeed they don't
I refer you back to my comment about how much bad code there is out there
moritz_ araujo: yes. Which is why I'd like to teach him something where I don't have to explain why it takes 2 years to calc fib(100)
Matt-W We had a senior developer in a meeting this morning say 'but it's only a small race condition'
moritz_ so I take an example that's well behaved instead
araujo moritz_, you are taking other way, seriously, i am taking here about recursion as a concept .. you can even teach it using a pseudo language if you want 13:48
Su-Shee Matt-W: maybe so. but that's how people learn and that will even grow because everyone being 12 years old today has internet, web, games, linux, robots, arduino, cell phones at his/her fingertips.
moritz_ araujo: I know that you are talking about a concept
araujo moritz_, plus recursive fib doesn't take that long
Matt-W Su-Shee: but it's okay, because they all just sit on MySpace saying 'lol' to each other
moritz_ araujo: but when teaching concepts, you often need examples
araujo functional languages get all these algorithms recursively 13:49
moritz_ araujo: and it makes sense to take examples that are well-behaved
Su-Shee Matt-W: you wish. ;)
araujo moritz_, i don't see how a recursive fib is bad behaved
Matt-W And I don't really care how they start out
moritz_ O(2**n)
araujo it is how it is done in functional languages, and it works good
Matt-W As long as they get caught at some point and taught things properly
Or develop the wits to figure it out themselves
Su-Shee Matt-W: you want them to write good code.
Matt-W I do
moritz_ yes, but it works *only* well where the values are automatically memoized
Matt-W I see so much bad code
moritz_ so it applies only to a small seet of programming languages 13:50
s/seet/set/
araujo I still think that doesn't matter for teaching recursion really
moritz_ I think it does, if they want to try it out
araujo the student can worry further about time complexity
and this discussion reminds me the Djikstra(sp?) quote about optimization 13:51
Matt-W araujo: you have to teach about the performance implications in certain language classes
araujo this seems to me like an 'early' optimization in the process of learning
moritz_ chosing a good example is not an early optimization 13:51
araujo fib is a good example to explain recursion 13:52
you care about time complexity of the language
araujo that's pretty much an optimization 13:52
moritz_ heck, I care about time complexity of stuff that I show on the blackboard
araujo and I think it doesn't matter when you are explaining what recursion is 13:52
moritz_ I don't want a student to say "could you please show an example with fib(10)?" 13:53
moritz_ and I'll stend the rest of the lecture writing it to the blackboard 13:53
for me that's a no-go
araujo you know that won't happen :)
moritz_ depends on how smart the students are
araujo the students are paying attention to what recursion is , not taking the time you spend writing in the blackboard
moritz_ I don't want to optimize for dumb students
Su-Shee (and me idiot always thought there's books to actually read up on recursion.. ;) 13:54
Matt-W if the students don't get it after an example for, say, fib(3), writing out fib(10) ain't going to help
araujo i bet he would get more confused :P 13:55
moritz_ anyway, to me these things matter, which is why I like neither fibs or factorials as an example of "good" recursion
araujo early optimization are evil
:P
moritz_ only if you expose them 13:56
Matt-W I was always taught fib in Haskell as 'this is how we do it in Haskell'
with no particular implication that it would be a good way to do it in any other language
moritz_ I mean I wouldn't tell the students "now I'm not going to use $this example, because it sucks"
*that* would be premature
araujo Matt-W, because recursion is a concept .. not a language feature
Matt-W araujo: no, because I knew it was a shit way to do it in any language without good recursion optimisations and lazy evaluation
but then, brain 13:57
not a feature of many of my fellow students
araujo still, see .. recursion is not a language feature .... just a concept, you can have your compiler or interpreters optimized for it, but i think this goes beyond the recursion concept 13:58
Matt-W the concept is important, yes
but at some point you have to tie it concretely
araujo I am pretty much talking about learning the concept here
Matt-W you then have to learn how to apply it
moritz_ araujo: sure. But there's no good reason to use an example which *requires* optimization to not run abyssimally slow
Matt-W and when it's appropriate to apply it
araujo i doubt you will be able to concrete it if you barely understand the concept, so, first learn it well, then you can worry about time complexity and all that stuff 13:59
Matt-W personally I think I'd rather use something like tree processing to show optimisation because it's a lovely way to program
err
to show recursion
Matt-W bangs his head on the desk
moritz_ right, that's a good one 14:00
mikehh does that hurt the poor desk :-}
araujo moritz_, still, it doesn't matter to teach recursion
seriously, this stuff doesn't matter to teach recursion
moritz_ araujo: unless your students want to try it out
araujo this is early learning process optimization
moritz_ there are some who learn by analyzing, and others learn by trying out, and observing
araujo what?, it will take 2 years? :)
moritz_ I don't see why I should make it harder for the second group 14:01
araujo you are not making it harder to anyone
moritz_ right, because I'm not using it :-) 14:01
araujo i bet that worrying about early time complexity stuff would make it far harder for all the group
Matt-W har
araujo heck
moritz_ anyway, this discussion doesn't make sense
araujo I even bet all you want here
moritz_ araujo: only if share these worries
Matt-W all I want is a decent programming language 14:02
araujo i can teach faster to a set of new students about recursion with my examples
Matt-W cracks his whip
go write rakudo patches!
araujo than you can with all that time complexity theory
I bet all man :)
moritz_ Matt-W: there is no decent programming language (yet)
Matt-W moritz_: that's why you have to go and write rakudo patches, Perl 6 is the closest we've got
mikehh Christmas
Matt-W presumably the Rakudo release for Perl 6.0.0 will be codenamed "Christmas" 14:03
I can see it now
"Rakudo release #5,774 "Christmas" now available"
mikehh hah - far too pesimistic - it will be before #5773 14:04
Su-Shee #2412 to be precise. ;) 14:05
mikehh precision will be 128 bits
or even 256?
moritz_ 2412 fits in 12 bits 14:06
mikehh but you need 24 for all of unicode specification 14:07
mikehh whatever - I better run my tests again - last time was 12 hours ago 14:11
PerlJam moritz_: feel free to make any commits to perl6-docs without waiting for approval. 15:22
moritz_ PerlJam: ok
PerlJam If I disagree with a commit, I can change it myself and we can have a nice discussion about it here :)
(or via email)
oh, and be sure to add your name in there as author. 15:23
moritz_ I will, in the next commit 15:24
ruoso HellO! 15:28
ruoso with no time to backlog!
moritz_ PerlJam: there, pushed 15:49
moritz_ PerlJam: funnily we both had a commit that moved <ws> out of the char classes section 15:51
PerlJam moritz_++ 15:54
mikehh rakudo (18598d0) builds on parrot r 40392 - make test PASS / make spectest (up to r27864) FAIL - two tests same as before - Kubuntu 9.04 amd64 16:09
mikehh eame two tests FAIL on i386 but also two others pass tests then exit 16:10
pmichaud good afternoon, #perl6 16:40
Tene Hi, pm! 16:41
moritz_ oh hai pmichaud
pmichaud finally got wireless at the conference :-| 16:58
tann that'll definitely help rakudo sprint to xmas sooner :) 16:59
colomon Hello? 17:21
moritz_ hello.
colomon I
I've nothing useful to say, just upgraded my IRC client and was startled by the utter quiet. :) 17:22
Tene Hi!
Su-Shee *hihi* no, nothing broken. ;)
tann pugs: multi sub qsort() { () }; multi sub qsort(*$p, *@l) { (qsort(grep { $_ < $p }, @l), $p, qsort(grep {$_ >= $p }, @l)) }; say qsort(5, 3, 4, 2, 1); 17:25
p6eval pugs: ( no output )
moritz_ pugs: say 1
p6eval pugs: OUTPUT«1␤»
tann rakudo: multi sub qsort() { () }; multi sub qsort(*$p, *@l) { (qsort(grep { $_ < $p }, @l), $p, qsort(grep {$_ >= $p }, @l)) }; say qsort(5, 3, 4, 2, 1);
p6eval rakudo 18598d: ( no output )
tann ^^^...i got a recursion error with the latest rakudo/parrot on my local box 17:27
moritz_ I could well imagine that *$p is not (properly) implement 17:29
tann moritz: looks like it 17:29
moritz_ does it need to be slurpy at all? 17:30
tann the first call $p is assigned the correct value
when 2nd invocation (from the recursion), it gets assigned the value of the rest of the list
which is wrong or that i didn't do it right
moritz_ it seems to recurse on the empty list 17:31
tann yes
b/c *$p slurps it up on the 2nd call
moritz_ rakudo: mult a (*@b) { 1 }; multi a() { 2 }; say a()
p6eval rakudo 18598d: OUTPUT«Statement not terminated properly at line 2, near "@b) { 1 };"␤in Main (src/gen_setting.pm:3363)␤» 17:32
moritz_ rakudo: multi a (*@b) { 1 }; multi a() { 2 }; say a()
p6eval rakudo 18598d: OUTPUT«Ambiguous dispatch to multi 'a'. Ambiguous candidates had signatures:␤:(Object *@b)␤:()␤in Main (/tmp/ib3fNWf9c7:2)␤»
moritz_ rakudo: multi a (*$p, *@b) { 1 }; multi a() { 2 }; say a()
p6eval rakudo 18598d: OUTPUT«2␤»
moritz_ rakudo: multi a (*$p, *@b) { 1 }; multi a() { 2 }; my @c = (); say a(|@c) 17:33
p6eval rakudo 18598d: OUTPUT«2␤»
moritz_ rakudo: multi a ( *@b) { 1 }; multi a() { 2 }; my @c = (); say a(|@c)
p6eval rakudo 18598d: OUTPUT«Ambiguous dispatch to multi 'a'. Ambiguous candidates had signatures:␤:(Object *@b)␤:()␤in Main (/tmp/8WLZhb7D89:2)␤»
lisppaste3 moritz_ pasted "This works in Rakudo right now (quicksort)" at paste.lisp.org/display/84678 17:34
colomon Wouldn't it be simpler and more efficient to just use "pick" to get a pivot element? 17:37
moritz_ colomon: feel free to try it 17:38
colomon Fair enough!
PerlJam efficient? 17:39
moritz_ I don't think it'll be more efficient; I'tt just amek it harder to come up with degenerate examples that run in O(n²) 17:39
and I think the point of this qsort ist to demonstrate the power of signatures in Perl 6 17:40
not a fast sort algorithm
colomon Randomizing the pivot is certainly not a cure-all, but it's generally better than just taking the first element as pivot, no? 17:41
beside, I'm still besotted with the pick command. :)
PerlJam yes. To avoid the degenerate behavior.
colomon moritz_: I think the power of signatures is what I'm missing from your example -- I don't quite understand what it is doing. 17:42
PerlJam colomon: but once you factor in the time to run pick, you may find that your quick sort isn't as quick as you would like
colomon Is the $p parameter needed because slurpy (*@l) cannot be distinguished from ()? 17:44
PerlJam colomon: but it can! 17:45
colomon Ambiguous dispatch to multi 'qsort'. Ambiguous candidates had signatures: 17:46
:()
:(Any *@l)
PerlJam (or should be able to :)
colomon Certainly feel better if that is a bug/NYI rather than a design limitation!
lisppaste3 colomon pasted "qsort with pick" at paste.lisp.org/display/84679 17:50
PerlJam colomon: where are the timings at?!? ;) 17:52
colomon nowhere, since it gives the error I pasted above. :) 17:53
sorry, I meant to say something like "Does this code look correct?" after I pasted that.
moritz_ no 17:54
you should not pass the pivot element on to the recursive calls
if you do, there might be calls which don't reduce the number of items passed to the next recursive call 17:55
colomon I see, the second grep is off.
moritz_ just test your script with the list (4, 4, 4) and see what happens
no
colomon I meant correct in terms of Perl syntax, as Rakudo barfs on it now. 17:56
PerlJam rakudo can tell you if the syntax is right. It's the semantics you're having difficulty with.
moritz_ if you change it from >= to > then duplicate elements will be filtered out 17:57
not nice for a sort routine
colomon moritz_: yes, I see that is an advantage of taking the first argument as pivot in your code, and thereby removing it from the list. 17:59
moritz_ (not my code, I merely adapted it) 18:00
colomon But at the moment, I'm more worried about the fact I got an error when I tried this code rather than an infinite loop.
lisppaste3 colomon pasted "qsort with shift instead of pick" at paste.lisp.org/display/84680 18:15
colomon There, I've used shift instead of pick in an effort to clean up errors in the algorithm. This still fails with the "Ambiguous dispatch" error. Should it work? 18:16
PerlJam colomon: btw, if you want to do a value-based constraint, you need to use a where clause. Otherwise you never will call your no-arg qsort. (that's why you have to use |() to get it to work even)
colomon PerlJam: ???? Where am I trying to do a value-based constraint? 18:19
moritz_ rakudo sees () and (*@a) as conflicting when doing dispatch on an empty list
you could use (*@a where { @a.elems > 0 }) to disambiguate 18:20
colomon Is that a rakudo limitation or a Perl 6 limitation? 18:23
moritz_ I'm not sure
jnthn is our dispatch expert
PerlJam IMHO, qsort(@some_thing_that_may_be_empty), should *never* dispatch to multi qsort() { ... } 18:24
moritz_ rakudo: multi a ($x) { 1 }; multi a (*@x) { 2 }; say a(3) 18:25
p6eval rakudo 18598d: OUTPUT«1␤»
moritz_ PerlJam: sounds right (unless you put a | in front)
PerlJam right
colomon rakudo: multi a () { 1 }; multi a (*@x) { 2 }; say a(); 18:33
p6eval rakudo 18598d: OUTPUT«Ambiguous dispatch to multi 'a'. Ambiguous candidates had signatures:␤:()␤:(Object *@x)␤in Main (/tmp/8uPi9JrI7p:2)␤»
PerlJam colomon: how about you rakudobug that? :) 18:36
colomon I'm happy too, if you guys are reasonably confident it is a bug!
colomon s/too/to/ 18:39
Su-Shee ok, coding perl 5 and perl 6 is really nasty with the sigil-hash/array change. 18:40
moritz_ Su-Shee: welcome to the club ;-) 18:41
PerlJam colomon: I think it's a bug, but what do I know? If it *isn't* a bug though, a bug report is likely to get some sort of ruling on that :)
Su-Shee moritz_: I stared 10 minutes on the code. hilighted. I plainly don't see it anymore. 18:42
colomon Su-Shee: That's why I'm doing my best to only work in Perl 6 these days. :)
Su-Shee yeah, having also sql, css, javascript and html in the mix isn't helping very much... 18:44
<-- is glad having learned "web" the old way.. this is insane nowadays...
tann Su-Shee: that's itneresting...the hash/array change just comes natural to me..in fact, i had a hard time to understand why you have to switch to $ when dealing with hash/array elements when i first picked up perl..i thought that was *stupid* :)) blame my old mind 18:49
Su-Shee tann: it really does come naturally - that's because I make the mistake in perl 5. 18:52
in perl 6 I'm fine. :)
"because of that" that way around :)
colomon PerlJam: seems this case is somewhat explicitly NOT tested.... 18:55
lisppaste3 colomon pasted "from S06-multi/type-based.t" at paste.lisp.org/display/84683 18:56
eternaleye colomon: Couldn't you disambiguate as multi qsort( *@l where { @l.elems > 0 } ) {...} ? 20:48
colomon eternaleye: Yes, but this isn't a showstopper for a program I was trying to write -- it's something that I stumbled across when playing around. And it certainly seems like it would be much more elegant if it did work... 20:50
frettled Are all these people connecting and disconnecting at the Radisson in Lisbon? :D 21:16
Su-Shee filter it. :) 21:17
tann rakudo: my @a = (1..100).pick(10); my @sorted_aliases := @a.sort; say "min: @sorted_aliases[0]"; say @a.perl; @sorted_aliases[0]++; say @a.perl; 21:19
p6eval rakudo 18598d: OUTPUT«min: @sorted_aliases[0]␤[29, 76, 64, 4, 50, 82, 66, 31, 7, 47]␤[29, 76, 64, 5, 50, 82, 66, 31, 7, 47]␤»
tann perl6++ 21:20
PerlJam aside from the rakudo interpolation fail there, rakudo++ too 21:24
frettled Su-Shee: oh, it's merely an observation regarding the quality (or lack thereof) of the wireless network at the hotel; they have multiple access points with the same SSID and roaming enabled, combined with lousy signal from all of them. 21:34
Su-Shee frettled: I have to admit that all the joining and leaving and ping time-outing is that annoying that I filter it in irssi. 21:39
frettled: so to me it all looks very quiet :)
frettled Su-Shee: aha :) 21:41
moritz_ same here
frettled I don't, in case I end up speaking into thin air
ruoso hello! 22:15
masak olà, #perl6. 22:16
phenny masak: 02 Aug 21:25Z <eternaleye> tell masak The Astaire docs have an error: the useragent example has :agent => /regex/ - the colons don't belong IIUC
payload this produces a big bad bug pastebin.com/m496b44f8
masak eternaleye: thank you.
from what I understand of named arguments, the colon has to be there, but it should be :agent(/regex/) -- fixed it that way. 22:18
cognominal ./perl6 -e 'class A { method a { 'b' } }; A.a' 22:34
Could not find non-existent sub b
I don't get it
masak colomon: looks like you're using apostrophes inside your apostrophe-delimited -e script. 22:35
sorry, cognominal, I mean.
cognominal: so it would be read as a subroutine call.
cognominal oops. I am so stooopide
masak cognominal: no, it's a natural mistake. :)
cognominal I should know, I make it so often :( 22:36
colomon masak: no worries, though it was a bit startling to learn I was screwing up my programming even when just reading Shadow Unit and contemplating what to cook for dinner.
masak colomon: sorry again. :)
colomon masak: I've done enough stupid things on this board in the last two weeks to make it a natural mistake. :) 22:37
masak :)
no now we have colomon/cognomial, pmichaud/pmurias, and moritz_/masak... 22:38
people should spread out more in the nick space. :P
cognominal there is cog, too, but not here 22:39
./perl6 -e 'grammar A { token a { a } }; say "a" ~~ A.a()'
Null PMC access in get_integer()
That would be nice to have grammar working. Or am I still making a mistake? 22:40
masak cognominal: yes.
cognominal ?? 22:41
masak rakudo: grammar A { token a { a } }; say "a" ~~ /<A::a>/
p6eval rakudo 18598d: OUTPUT«a␤»
cognominal cool
masak there you go.
grammars work quite well, actually.
cognominal need to brush up my skills
masak submits rakudobug
cognominal I wonder what I said is supposed to mean :) 22:42
masak rakudo: grammar A { token a { a } }; A.a()
p6eval rakudo 18598d: OUTPUT«Null PMC access in get_integer()␤in regex A::a (/tmp/rRW77eM8AK:2)␤called from Main (/tmp/rRW77eM8AK:2)␤» 22:43
masak rakudo: token a { a }; a()
p6eval rakudo 18598d: OUTPUT«too few arguments passed (0) - 2 params expected␤in regex a (/tmp/W3so9Hy1r0:1)␤called from Main (/tmp/W3so9Hy1r0:2)␤»
eternaleye masak: re colons, either :agent(/regex/) or agent => /regex/ is a named argument, while 'agent' => /regex is a positional Pair 23:20
masak eternaleye: ah. aye, that sounds familiar. 23:21
I still haven't internalized that.