irclog.perlgeek.de/perl6book/today | source: github.com/perl6/book/
Set by moderator on 24 November 2009.
00:26 eternaleye joined 03:36 moritz__ joined 03:47 TimToady joined 04:47 eternaleye joined 04:53 snarkyboojum joined
eternaleye Hey, I have a question. In the multis section, there's multi to-json($d where undef) - should I change that to match the spec? If so, 'where Mu' or 'where *.notdef' ? 05:42
08:21 japhb joined 10:13 japhb joined 10:19 masak joined 14:20 japhb joined 15:33 dalek joined, TimToady joined, japhb joined, moritz_ joined, hicx174 joined, pmichaud joined, carlin joined 15:34 snarkyboojum joined 15:37 TimToady joined 16:36 snearch joined 16:46 snearch_ joined 19:25 masak joined 19:52 eternaleye joined
eternaleye jnthn: Did you see my question about the multis section? 20:03
masak oh, oh! have we written anything about subtypes yet? 20:04
because I have some (loose) ideas. 20:05
jnthn back from teh noms 20:20
eternaleye: where *.notdef
masak: Let 'em loose!
eternaleye Cool
masak jnthn: well, I have one actual use case for subtypes: an upcoming refactor of Druid. 20:24
jnthn: istead of checking for move validity inside the routine that makes the move, I'll just define subtypes of valid moves, and then dispatch on those.
jnthn: I think it's a brilliant use case, but I somehow want to factor Druid out of it for the book. :) 20:25
jnthn masak: That is just the kinda thing subtypes were designed for, yeah. 20:26
masak jnthn: yeah. for some reason, the full power only struck me a few days ago. 20:27
jnthn masak: Challenge is just finding a way to use it in a much smaller example.
masak exactly.
jnthn I want to write up a first cut of my ideas for the roles thingy too.
masak maybe subtypes of poker hands could work...
jnthn I've been a bit take up today by being asked to jump in and do some urgent code review at $other-job though
ooh, yes. 20:28
If you understand poker enough.
Or somebody does.
jnthn totally doesn't.
masak there's always Wikipedia. :)
jnthn :-)
masak and knowledgeable people all around us.
jnthn Aye. 20:29
I don't know enough about poker to really know quite how well it'd work. :-)
But it's worth asking around, for sure. 20:30
.oO( use Perl 6 to aid your gambling! )
masak I'll try and write a poker hand analyzer and see what falls out of it. 20:33
jnthn Cool!
masak++
Let us know if you win any money with it. ;-)
masak one step at a time :) 20:34
jnthn bets on masak coming up with something cool 20:36
20:37 eternaleye joined
masak jnthn: if by 'something cool', you mean rakudobugs, then sure. :P 20:37
jnthn oh buggar
;-)
masak is there a method on enum types which says 'give me all the values'? 20:42
I don't mind it being a metaclass method, if that helps.
jnthn .pick(*)
maybe?
masak but that gives me the values out of order... 20:43
and it gives me the integer values, not the names.
hm, maybe I'll take this to #perl6...
jnthn I thought it gave you the enum values?
So you could .pick(*)>>.name?
masak cheks
oh, it does. 20:44
but it still botches the order.
jnthn Yeah
I don't know of an answer to that.
masak .pick(*, :nonrandom) # :) 20:45
jnthn lol
21:21 vamped joined
vamped In the November release of book, chapter 2, exercise 1 states: 21:23
my @sorted = B<%sets.keys>.sort({ %sets{$_} }).sort({ %games{$_} }).reverse;
I think something is not being translated correctly: the B<...> 21:24
anyone know what it should say?
jnthn I'm not sure the B<...> should appear in the output for one...
masak probably without the B<>
vamped if I remove it, I get errors 21:25
Multiple Dispatch: No suitable candidate found for 'cmp', with signature 'PP->I'
in Main (file <unknown>, line <unknown>)
%set.keys should turn into an array, to be sorted. I think it needs to be offset somehow from the .sort 21:26
jnthn Hmm...I suspect that may be a bug somewhere in Rakudo rather than a problem with the code. 21:29
vamped ... you were both right at first. just remove the B<> and it works. 21:33
masak that error shows up when the things being sorted are not all of the same kind.
vamped initial error message came from error in input file. my bad.
problem solved. and by the way -- thanks all for an awesome book -- those who are contributing. 21:34
masak vamped: which includes you, now! :) vamped++
21:44 hicx174 joined