The topic for #perl6 is: pugscode.org/ planetsix.perl.org/ | nopaste: sial.org/pbot/perl6 | pugs: [~] <m oo se> (or rakudo:, kp6:, elf: etc.) (or perl6: for all) | irclog: irc.pugscode.org/
Set by TimToady on 25 November 2008.
00:09 maerzhase left
slavik junction is when it takes an element from setA and combines it with every element from setB? 00:20
00:21 pmurias left
slavik ad, ae, af, bd, be ... etc? 00:21
pmichaud: rakudo can has libgtk bindings? ^^ 00:26
01:00 meppl left
rakudo_svn r34841 | pmichaud++ | [rakudo]: Autothread junctions over concatenation (infix:<~>). 01:00
pmichaud rakudo: say (any(<a b c>) ~ any(<d e f>)).perl; 01:02
p6eval rakudo 34840: OUTPUT«"Junction<0xb5f6c828>Junction<0xb5f6024c>"␤»
pmichaud (hasn't updated yet.)
Limbic_Region rakudo: my @foo = <a b c> X~X <d e f>; @foo.perl 01:03
p6eval rakudo 34840: RESULT«"[\"ad\", \"ae\", \"af\", \"bd\", \"be\", \"bf\", \"cd\", \"ce\", \"cf\"]"»
Limbic_Region slavik - no, what you described is a cross product operator
slavik - a junction is a bit harder to describe
pmichaud: I am not sure I understand what any<a b c> ~ any<d e f> should produce? 01:06
pmichaud rakudo: say (any(<a b c>) ~ any(<d e f>)).perl;
p6eval rakudo 34840: OUTPUT«"Junction<0xb5f29860>Junction<0xb5f1d380>"␤»
pmichaud arggh. just a sec.
> say (any(<a b c>) ~ any(<d e f>)).perl;
any(any("ad", "ae", "af"), any("bd", "be", "bf"), any("cd", "ce", "cf"))
lambdabot <no location info>: parse error on input `)'
Whiteknight rakudo: say "w00t" 01:09
p6eval rakudo 34840: OUTPUT«w00t␤»
Whiteknight rakudo: say "w00t";
Limbic_Region pmichaud: my question is more fundemental
p6eval rakudo 34840: OUTPUT«w00t␤»
Limbic_Region when you have a junction and you ask it to stringify
should it stringify to its eigenstates in a list
pmichaud yes.
I think that's where we ended up.
just haven't implemented that yet. 01:10
Limbic_Region so some questions I asked back on the list a long time ago which I was told 'no' then, are now 'yes'
time has a funny way of doing that
pmichaud I honestly don't recall the answer -- there's probably an rt ticket for it somewhere, or else I'll have to re-check the logs.
or maybe the tests cover it.
Limbic_Region well, it had to do with being able to get the actual matches out of something like all(1..5) == any(0,2,3,7) 01:11
to get the intersection
pmichaud oh, I don't know that we do that. 01:12
(from a language perspective)
rakudo: say (all(1..5) == any(0,2,3,7)).perl;
p6eval rakudo 34840: OUTPUT«all(any(Bool::False), any(Bool::False, Bool::True), any(Bool::False, Bool::True), any(Bool::False), any(Bool::False))␤»
Limbic_Region well, that should return a junction
as it does
the problem is it doesn't return the values 01:13
pmichaud correct.
(as it shouldn't, I suspect)
Limbic_Region but using stringification and other tricks, the same thing can be accomplished
though, it would be pretty silly to do since perl 6 has sets 01:15
and set operations
so getting the intersection of a list should be more straight forward 01:16
pmichaud @a.grep( { $_ == any(@b) } ) 01:17
lambdabot Unknown command, try @list
pmichaud maybe
Limbic_Region tries to find the correct thread 01:18
slavik rakudo: say any(<a b c>); 01:19
p6eval rakudo 34841: OUTPUT«Junction<0xb5f59278>␤»
slavik rakudo: say ~any(<a b c>);
p6eval rakudo 34841: OUTPUT«Junction<0xb5f78ba8>␤»
slavik err ... ?
pmichaud 01:10 <pmichaud> just haven't implemented that yet. 01:20
Limbic_Region pmichaud: groups.google.com/group/perl.perl6....305af2ab31
slavik what should it return?
rakudo: for all(1..6) -> $a { say $a }
p6eval rakudo 34841: OUTPUT«Junction<0xb68aa990>␤»
pmichaud slavik: note that all(1..6) is a single scalar value 01:21
so it only iterates ones.
*once.
slavik err, shouldn't that be parallel?
pmichaud oh, maybe. I don't know if that's still in the spec.
Limbic_Region pmichaud - or do you need to explicitly call .values 01:23
pmichaud it's not in S03, at any rate.
Limbic_Region that's one of the questions I asked back in that thread I pointed to
pmichaud L_R: so far we're against .values. Rakudo implements .eigenstates
Limbic_Region back then - the spec seemed to be contradictory about how you could use junctions
pmichaud any(@a, @b).values # does this return (@a, @b), or does it autothread .values over (@a|@b) ?
Limbic_Region pmichaud - the method name makes no difference (to me) for the question
slavik pmichaud: IMO, it should retturn one of the two arrays 01:24
Limbic_Region S3 used to state that you could iterate over an all(1..5) junction just as slavik described
pmichaud l_r: yes, and I think it was decided that wouldn't really work
Limbic_Region but elsewhere indicated if you wanted to get at its eigenstates, you needed to call .values
ah
good
consistency++
pmichaud which is why I think it's no longer in S03 01:25
slavik pmichaud: since args aren't passed in @_ unless they are slurped, and all() shouldn't slurp IMO
Limbic_Region I was just pulling up the latest
pmichaud in order to hyperize the loop, I think we explicitly require a 'hyper' keyword now.
Limbic_Region slavik - you really need to understand what a junction is
pmichaud slavik: a junction is not a list.
slavik Limbic_Region: then explain it :)
Limbic_Region a junction is a more usuable name then quantum superposition 01:26
but that's what it used to be called
basically, it is the state of an operation where many different possible states can exist at once
as a single entity
slavik quantum ... you lost me :(
Limbic_Region until you ask for a value
where is a link to Damian's talk on Quantum::Superpositions anyway
Limbic_Region goes to ask google 01:27
slavik Limbic_Region: all(<a b c>); what is the result of that?
01:27 DemoPhreak left
Limbic_Region slavik - it returns a junction 01:27
pmichaud slavik: it's a Junction
Limbic_Region a single scalar
you can do lots of neat things with it though
pmichaud it's a Junction of type 'all' that has three states: 'a', 'b', and 'c'
Limbic_Region you can ask it to pick a value at random from its possible eigenstates 01:28
slavik eigenstates?
Limbic_Region quantum superpositions again
all possible states
let me find the link
pmichaud (pick a value at random) -- I think that's no .eigenstates.pick
s/no/now/
slavik so, if I ask it for a value, what will it return?
pmichaud slavik: depends on what kind of value you ask it for
01:28 sri_kraih left
slavik err 01:28
slavik is lost and confused 01:29
pmichaud we tend to not say "ask for a value", we say "ask for a string" or "ask for a number" or ...
if I have: any(<a b c>) ~ 'd'
TimToady junctions are mostly for doing comparisons in boolean context
pmichaud then the result is any('ad', 'bd', 'cd')
slavik pmichaud: if I want a single result, what will it give me then? like if I do: say any(<a b c>) ~ d; 01:30
TimToady so any(<a b c>) ~ 'd' eq 'db' is True
Limbic_Region TimToady - I have to agree that there should be a succinct but clear explanation of junctions in one of the synopses
pmichaud slavik: a junction "is" a single result. :-)
slavik I see
Limbic_Region I can't seem to find the link I was looking for
slavik pmichaud: is this something like MMX type of thing? 01:31
pmichaud I don't know "MMX"
slavik pmichaud: pentium mmx?
pmichaud okay, now I recall the acronym, but I'm a software guy. :-
Limbic_Region pmichaud - I thought any was defined to randomly find any true value, not all possible true values?
slavik single instruction multiple data ... that type of thing?
Limbic_Region and for all true values, you used all()
?
pmichaud l_r: any in a boolean context returns true if any of its eigenstates is true
slavik pmichaud: does the above make sense? 01:32
pmichaud l_r: all() in a boolean context returns true if all of its eigenstates are true
?(any(<1 2 3>) == 2) # true
lambdabot Unknown command, try @list
slavik also, all(<a b c>, <d e f>) will that be ad, ae, af, bd ... etc?
Limbic_Region pmichaud - nevermind
pmichaud ?(all(<1 2 3>) == 2) # false 01:33
lambdabot Unknown command, try @list
TimToady slavik: we do use such ideas all the time in English: "If the value is 1 or 2 or 3"
pmichaud slavik: all(<a b c>, <d e f>) is all('a', 'b', 'c', 'd', 'e', 'f')
(<a b c>, <d e f>) is just a list.
slavik ok
so all slurps all arguments
pmichaud "slurps" is an odd word there. 01:34
slavik I take it there won't be automatic parallelization?
pmichaud it evaluates its arguments in list context.
(I guess that's "slurps")
slavik: there can be automatic parallelization, yes, in contexts where it's appropriate.
TimToady there is no guarantee of serial processing. the computer can try to decide the fastest way to falsify it 01:35
slavik pmichaud: the apocalypse stated that for all(@list) would automatically evaluate every element in the list in parallel
pmichaud slavik: perhaps, but that's no longer the case.
slavik pmichaud: hence my confusion :P 01:36
TimToady but it's specifically for logical parallelism where you plan to throw away most of the results
pmichaud slavik: junctions aren't meant to be parallelism operators -- that's not their purpose.
as TimToady says, they're for parallelism in logical contexts.
but not generic parallelism.
slavik such as?
pmichaud if all(<a b c d e f>) lt 'd' { ... } 01:37
TimToady if you say all(@list) == 42 it's allowed to stop processing @list as soon as it sees something that is not 42
slavik I see
pmichaud TimToady: wouldn't one also have to be in boolean context?
TimToady yes, I'm assuming that
pmichaud okay.
TimToady I personally thing that junctions are only for that 01:38
*think
pmichaud that works for me.
TimToady if you want other forms of parallelism, we try to provide those too
so attempts to make junctions do that are a bit misguided 01:39
which is why we don't provide a lot of user-visible methods on juncitons
pmichaud it'd probably be helpful to move the "parallelism" description of junctions out of S03 and move it to wherever we discuss parallelism in more detail.
TimToady we don't want people trying to do set theory with them, for instance, except in boolean contexts 01:40
pmichaud since S03 is really the first place "parallel" gets mentioned, I think lots of people latch onto that as being "oh, here's where I get automatic threading and concurrency"
Limbic_Region does the hyper keyword give the ok to parallelize anything it wants to? 01:41
TimToady the hyper keyword says you don't care what order the following list is calculated in
Limbic_Region so hyper only applies to a list, not to a block acting on a list? 01:42
TimToady it also asserts that you likely interested in all the values
in the sense of eager()
01:42 mgs joined
TimToady hyper is a form of list context 01:42
as is eager
slice context is another modification of list context, but orthogonal to hyper/eager/lazy 01:43
Limbic_Region let me ask a question a different way 01:44
future proofing the language - cause parallelism is all the rage
mgs could someone point me to where i can find a good example of how to use libraries in perl? i have never used perl but i have a lot of experience in other languages .. just not sure where to begin :)
Limbic_Region is there a way to say
for (@foo) { ... } and let that block be parallelized
?
mgs but i found an awesome graphviz extension that is a perl library and would love to use it 01:45
Limbic_Region mgs - try #perl
TimToady hyper for does that
Limbic_Region this channel is specifically for perl 6
TimToady but that's becuase for knows it's in list context
Limbic_Region TimToady - and hyper map and hyper grep play along too?
TimToady hyper for is identical to hyper map, except for argument order
yes
pmichaud need a break... afk for a while. 01:46
TimToady note, hyper says you don't care what order evaluation happens, but the list is still serialized
Limbic_Region ok, so now we can call ourselves Erlang improved
Limbic_Region ducks
TimToady well, Erlangy things will tend rather to be done with ==> and <==
mgs Limbic_Region: i'm sorry, i found out about #perl6 by the #perl topic ;) 01:47
TimToady an object pipe with signature matching on the end is very Erlangy
01:48 mgs is now known as mgs`
Limbic_Region TimToady - true. I just wanted to ensure perl 6 was being future proofed for the parallelistic future 01:48
punting S17 to "it's an implementation detail" kinda scares me 01:49
TimToady my job is just to make sure it's clear which constructs promise which parallel semantics, but there is no real guarantee of parallelism anywhere within any traditional von neumann computer, so that's about all we can do 01:50
01:51 hercynium joined
TimToady as long as the implementors know which constructs promise them how much leeway, then I think we'll be okay in the world of ∥ 01:52
for instance, ==> basically promises a clean thread fork 01:53
Limbic_Region listens
TimToady where the definition of "clean" is still under negotiation
it's very analogous to | in a shell
Limbic_Region only got one of the books on the list for Xmas which he read in a day and will now have to go buy the rest himself :-( 01:54
*shrug* - ok, ok, trying to pin you down on anything is like <any number of things - I would say something but then it would be wrong because there is no one way to pin you down>
did you have the shoulder surgery yet? 01:56
TimToady not yet
had to wait for holidays to pass, and still have to be cleared by my gp 01:57
and that may depend on what my GI guy tells me about my capsule endo
very strange to swallow a pill with a xenon flash bulb going off twice a second... 01:58
Limbic_Region speaking of GI, I found a home remedy for an unpleasant GI problem that wasn't solved after 4 days using Immodium nor Pepto Bismol
2 tbsp of apple cider vinegar diluted in about 6 oz of water
TimToady - very strange indeed, but given the alternatives ;-) 01:59
02:00 Whiteknight left
slavik you're going to shit a light bulb? 02:00
sorry, had to be said
Limbic_Region if he's lucky 02:01
slavik heh
02:20 ilogger2 joined
slavik yes 02:21
02:25 hercynium joined
s1n wow, 7612 passing tests 02:39
02:54 brunoV joined 02:59 [bjoern] joined
drbean_ sln: Read Jonathan Worthington's blogs on use.perl. I found this one explained MMD to me. use.perl.org/~JonathanWorthington/journal/36298 03:00
[bjoern] Is there anything ontopic that would today help me determine how two structurally simple but very long perl5 regular expressions with lots of unicode code points are different, if at all? 03:02
(in what they match) 03:03
03:14 [bjoern] left
avar lambdabot: tell [bjoern] perl -Mre=debug and compare the output 03:24
03:29 alc joined 03:51 kisu joined
pugs_svn r24742 | azawawi++ | [S:H:P6] hilitep6 was doing --clean-html all the time. Release 0.02963 to CPAN 04:00
04:02 elmex_ joined 04:17 xinming_ joined, elmex_ is now known as elmex
s1n drbean_: that's a one, not an "el" 04:21
05:52 hercynium left 05:56 justatheory joined 06:30 kisu_ joined 06:31 justatheory left 06:34 kisu left 06:49 ejs joined 06:51 kisu_ is now known as kisu 07:15 DemoFreak joined 07:18 DemoFreak left 07:20 DemoFreak joined 07:23 mberends joined 07:31 ejs left 07:37 DemoFreak left 07:54 Amsuna[Busy] joined 07:59 Amsuna[Busy] left 08:51 iblechbot joined 08:57 brunoV left 08:58 DemoFreak joined 09:53 pmurias joined 10:12 kisu_ joined 10:16 kisu left 10:31 maerzhase joined 10:46 maerzhase left 10:53 ayrnieu joined 11:01 vixey joined 11:10 [particle]1 joined, barney joined 11:12 kisu joined 11:14 kst joined, Aisling joined, alester joined, smtms joined, [particle] joined, Jedai joined 11:18 kisu_ left 11:29 [particle] left 11:36 masak joined
masak wow, I'm really happy with the diversity of rakudobug reporters lately. 11:47
perl6: say undef === undef 11:51
p6eval pugs: OUTPUT«1␤»
..rakudo 34869: OUTPUT«0␤»
..elf 24742: OUTPUT«Undefined subroutine &GLOBAL::prefix__61 called at (eval 149) line 3.␤ at ./elf_f line 3861␤»
masak "yes", "no", "don't ask me" :)
any reason undef _shouldn't_ triple-equal itself? 11:52
is it like NaN, perhaps? NaN always returns false in equality comparisons, even with itself. 11:53
Gothmog_ Nah. 12:01
masak I agree.
just trying on different hats here. :)
Gothmog_ There is a good reason for the NaN behaviour, but that doesn't apply for undef. 12:02
masak right. 12:03
12:04 DemoFreak left 12:06 maerzhase joined
Gothmog_ Plus, it would be very counter-intuitive. NaN is not meant to be compared explicitly with a float, but undef is. 12:09
That would be a real trap.
masak aye 12:10
12:24 pdcawley joined 12:38 laye joined 12:41 xinming joined 12:42 pdcawley left 12:47 xinming_ left 12:50 xinming_ joined 13:02 araujo joined 13:09 fridim_ joined, xinming left 13:12 masak left 13:13 laye left, laye joined 13:14 laye left, laye joined, laye left, laye joined, kisu_ joined 13:19 kisu left 13:31 xinming joined 13:32 xinming left 13:36 xinming joined 13:37 xinming_ left 13:42 laye left 14:00 meppl joined 14:11 nomas joined 14:14 nomas left
rakudo_svn r34876 | pmichaud++ | [rakudo]: spectest-progress.csv update: 264 files, 5911 passing, 0 failing 14:20
14:31 xinming_ joined 14:50 xinming left 15:01 vixey left 15:06 vixey joined
pmurias perl6: say NaN === NaN 15:07
p6eval elf 24742: OUTPUT«Can't call method "Str" on an undefined value at ./elf_f line 649.␤ at ./elf_f line 3861␤»
..rakudo 34878: OUTPUT«0␤»
..pugs: OUTPUT«␤»
pmurias how can one check for NaN? 15:08
szabgab pugs: unpack("A2", "hello").say 15:35
p6eval pugs: OUTPUT«*** No such subroutine: "&unpack"␤ at /tmp/yd6ul5G3Bb line 1, column 1 - line 2, column 1␤»
szabgab rakudo: unpack("A2", "hello").say
p6eval rakudo 34883: OUTPUT«Could not find non-existent sub unpack␤current instr.: '_block14' pc 62 (EVAL_13:40)␤»
szabgab but AFAIK unpack is in perl 6, so what shall I do now? 15:36
15:45 masak joined 15:47 fridim_ left 15:58 xinming joined
masak buubot: spack unpack 16:03
buubot masak: S03-operators.pod:1 S06-routines.pod:1 S09-data.pod:3 S29-functions.pod:1
szabgab masak: so what does this mean ? that unpack is mentione in those places? 16:04
masak szabgab: aye.
szabgab: 'spack' is 'speck-ack', i.e. ack/grep through the Specs.
szabgab cute :-) 16:05
masak it is. it was added by buu++ yesterday.
only the S29 change seems relevant.
...and it's empty. :/ 16:06
hence "insufficently specced"
szabgab: but if you want 'pack'/'unpack', I'm wiling to work with you on that.
szabgab I have started to go through the Perl 5 Cookbook and reimplement it 16:07
masak szabgab: cool!
szabgab the first example used unpack()
masak do you commit your work somewhere public? 16:08
szabgab yes and it is on CPAN Per6::Cookbook
masak szabgab: URL to the first example?
szabgab Perl6::Cookbook
szabgab.com/blog/2009/01/1230804190.html
masak thanks
szabgab oh, it does not have the one with unpack yet 16:09
here is the cpan version: search.cpan.org/dist/Perl6-Cookbook/
masak aye, already tracked that one down.
szabgab and this is the svn: svn1.hostlocal.com/szabgab/trunk/Pe...1_Strings/ 16:10
where you have the unpack example already
masak szabgab: you could help by filling in S29, or by reviewing the tests in the Pugs repo for unpack
szabgab but it is a very basic version of unpack, onlu using A and x
masak szabgab: I think I can get that working today. 16:11
szabgab s/reviewing/writing/
16:11 xinming_ left
szabgab as there is no test yet 16:11
masak szabgab: possibly.
szabgab where shall I pu the tests
masak somewhere in t/ in the Pugs repo. 16:12
preferably t/spec/S29-*
szabgab pugs/t/spec/S29-str/
masak sounds reasonable.
szabgab++
szabgab grabs a sandwitch and goes to write perl 6 tests again 16:13
masak tests++
I should add that I'm not really here right now, but I will be in increasing degrees as the day progresses. 16:14
it's been a while since I made a significant contribution to Rakudo, but this one I'll be happy to help with. 16:15
16:17 meppl left
szabgab masak++ 16:20
masak as in, it's about at the level of PIR that I'm comfortable with :) 16:21
16:21 azawawi_ joined
pugs_svn r24743 | szabgab++ | basic unpack() test 16:27
masak szabgab: looks good. I'll look at it in a couple of hours. 16:28
@ask TimToady is there any reason to assume that C<pack>/C<unpack> will not be identical in Perl 6 as in Perl 5? 16:29
lambdabot Consider it noted.
masak s/as /to those / 16:30
pmichaud @ask TimToady class Dog { is Mammal; does Pet; ... } (from S12) parses 'is' as a listop -- is this correct? 16:36
lambdabot Consider it noted.
16:38 eric256 joined
masak eric256: greetings. 16:39
eric256 morning 16:40
moritz_ perl6: say NaN ~~ NaN
p6eval elf 24743: OUTPUT«Can't call method "Str" on an undefined value at ./elf_f line 649.␤ at ./elf_f line 3861␤»
..pugs: OUTPUT«1␤»
..rakudo 34888: OUTPUT«0␤»
moritz_ hi there
masak moritz_: hi!
moritz_ masak: want to report as a bug?
masak moritz_: no.
moritz_: I think Rakudo is right.
moritz_ masak: care to elaborate? 16:41
masak moritz_: well,
moritz_ perl6: say NaN == NaN
p6eval rakudo 34888: OUTPUT«0␤»
..elf 24743, pugs: OUTPUT«␤»
masak two NaN's can very well be different. there is not but one NaN.
that's part of the theory behind them.
moritz_ masak: ~~ doesn't test equality
eric256 then how do you do $num ~~ NaN? 16:42
say (NaN === NaN)
masak moritz_: seems to me it does test equality in increasing amounts lately.
eric256 rakudo: NaN === NaN
16:42 rindolf joined
p6eval rakudo 34888: RESULT«Bool::False» 16:42
masak moritz_: but you have a point.
moritz_ I think that $thing ~~ NaN should answer the questions "is $thing a NaN`?"...
masak reports rakudobug
moritz_ just like $thing ~~ undef really desugars to !$thing.defined
eric256 rakudo: my $nan = NaN; say $nan ~~ NaN; 16:43
p6eval rakudo 34888: OUTPUT«0␤»
azawawi_ moritz_: hi there
moritz_ masak: I also put .perl in my local S29 copy, will commit on Thursday 8th, when I have good internet access again
azawawi_: hi
have to go now again (but will backlog, if you have more comments or questions)
cheers
masak moritz_: goodie. in the meantime, I will map what needs be done with S29. see my latest blog post. 16:44
16:44 GitHub96 joined
GitHub96 perl6-examples: 3Eric Hodges 07master0 SHA1-367ec9d 16:44
Adding WSG Advanced category
is.gd/eu3a
16:44 GitHub96 left
eric256 i'm gitting used to this git thing. starting to wish rakudo used it. would be easy to fork and patch etc...thought thats probably easy in SVN ifyou know what you are doing too hehe 16:44
vixey I really hate that github bot
masak moritz_: use.perl.org/~masak/journal/38212
vixey: /ignore it then. 16:45
eric256 vixey: its not my favorite either. i would prefer a single line, but till i can make a bot in perl6 it will have to do
vixey yeah I would have to hack my client to allow me to ignore join/parts of one class of user
eric256 masak: you think i should store the problems from WSG? in case M$ decides to take them down?
masak eric256: find out what licence they are under. 16:46
in general, one is not allowed to copy text indiscriminately.
16:47 alc left
eric256 rakudo: say (1..3) X (1..3) X (1..3) 16:47
p6eval rakudo 34889: OUTPUT«111112113121122123131132133211212213221222223231232233311312313321322323331332333␤»
masak pretty. 16:48
eric256 lol
as my licensing csar could you check? i'll do the copying if you could make sure i'm not going to jail lmao www.microsoft.com/technet/scriptcen...vent1.mspx
i don't see any licenses
masak in the case of no license, I think you'd better write and ask. 16:49
eric256: www.microsoft.com/info/cpyright.mspx#E1E 16:50
eric256 perl6++ rakudo++ :)
rakudo: (<a b c> X~X <d e f>).perl
p6eval rakudo 34889: RESULT«"[\"ad\", \"ae\", \"af\", \"bd\", \"be\", \"bf\", \"cd\", \"ce\", \"cf\"]"»
eric256 rakudo: (<> X~X <d e f>).perl 16:52
p6eval rakudo 34889: RESULT«"[]"»
eric256 i was afraid of that ;)
rakudo: ((' ') X~X <d e f>).perl
p6eval rakudo 34889: RESULT«"[\" d\", \" e\", \" f\"]"»
masak eric256: write to them and ask nicely. they might surprise you with a lenient policy. 16:53
eric256 okay
can't hurt
masak exactly.
eric256 rakudo: my %test = (1 => <a b c>); my @word = <e f g>; (%test{1} X~X @word).perl.say 16:57
p6eval rakudo 34889: OUTPUT«["a b ce", "a b cf", "a b cg"]␤»
eric256 it appears to be stringifying <a b c> before crossing it..any idea what i did wrong?
rakudo: my %test = (1 => <a b c>); my @word = <e f g>; %test{1}.perl.say 16:58
p6eval rakudo 34889: OUTPUT«["a", "b", "c"]␤»
masak rakudo: my %test = (1 => <a b c>); %test{1}.WHAT.say 17:03
p6eval rakudo 34889: OUTPUT«Array␤»
masak rakudo: my %test = (1 => <a b c>); (%test{1} X~X <e f g>).perl.say
p6eval rakudo 34889: OUTPUT«./parrot: error while loading shared libraries: libparrot.so.0.8.2: cannot open shared object file: No such file or directory␤»
masak lots of kudos to the first person who makes Rakudo build _in the background_. 17:04
can't be that hard to save the executable from destruction...
eric256 couldn't you just copy the executable to a new location, run from there. then rebuild in the original location andocpy when done?
masak eric256: I think so, yes. 17:05
but I haven't tried to solve the problem myself, so I don't know.
I'm just miffed when it occurs.
rakudo: my %test = (1 => <a b c>); (%test{1} X~X <e f g>).perl.say 17:07
p6eval rakudo 34889: OUTPUT«["a b ce", "a b cf", "a b cg"]␤»
masak eric256: I'd say that's a bug. care to submit to rakudobug?
masak has begun to try to delegate of late 17:08
rakudo: use Test; ok(1)
p6eval rakudo 34889: OUTPUT«Can't find ./Test in @INC␤current instr.: 'die' pc 14812 (src/builtins/control.pir:204)␤»
masak seems Rakudo is not run from its built location anyway... so I don't see a problem with copying it. 17:09
eric256 does the bot live in the pugs repo?
is it self updating?
masak I think moritz_ is the right person to ask such questions. 17:10
eric256: it is "self updating", yes.
at least Rakudo is.
eric256 i meant if i update the bots source in the repo will the bot update its files and restart ;) 17:11
masak eric256: oh. no, I don't think so.
eric256 hehe i just sent several thousands items into an any statement....hmmm possibly not a good idea at current ;(
masak what Rakudo needs are people who push its limits. 17:14
eric256 switched to a double for loop....still comparing to many options i think ;) one list of 3^7 comparing agianst another that is over 30k 17:18
rakudo: say 3^7;
p6eval rakudo 34893: OUTPUT«Junction<0xb6046250>␤»
eric256 rakudo: say 3^^7;
p6eval rakudo 34893: OUTPUT«␤»
eric256 rakudo: say 3**7;
masak rakudo: say 3 ** 7
p6eval rakudo 34893: OUTPUT«2187␤»
eric256 i was getting there ;)
masak seemingly :) 17:19
szabgab masak: ping me if you hear a response from TimToady regarding the unpack() so I can add more tests if its the same as in p5
masak szabgab: a'ight.
masak has a vague recollection he's seen pack/unpack documentation for Perl 6 somewhere
but perhaps that was just a dream.
szabgab what was dream? 17:20
masak the vision of pack/unpack documentation for Perl 6.
(maybe)
eric256 yea paired the comparisons down to 2187 XeqX 3805 17:22
still probably too many
masak eric256: are you sure XeqX is what you want?
17:22 jferrero joined
szabgab well we don't need documentation now if it is the same as in perl 5 17:23
eric256 nah thats just pseudo code, its realy nested loops with eq in ther cause i need the value not just the true/false
17:23 kidd joined
masak szabgab: no, just tests. 17:23
eric256 maybe i'll try loading the dictionary into a hash... my %dictionary = ( @words X 1 ); ?? i wonder if that would work 17:26
rakudo: my @words = <a b c>; my %dictionary = (@words X 1); %dictionary.perl.say;
p6eval rakudo 34893: OUTPUT«{"a" => 1, "b" => 1, "c" => 1}␤»
eric256 perl6++ ;)
masak eric256: sorry, did you submit the rakudobug about the %hash{1} X~X @array thing? 17:28
eric256 masak: nope. i leave professional bug submission to you 17:30
masak eric256: ok, then I'm glad I checked. :)
masak submits rakudobug
17:36 GitHub191 joined
GitHub191 perl6-examples: 3Eric Hodges 07master0 SHA1-e1d07db 17:36
Adding answer to WSG Advanced 2008
is.gd/euhi
17:36 GitHub191 left
eric256 's daughter just inhaled all of his breakfast ;) 17:41
17:49 aindilis` joined 18:08 ruoso joined
eric256 masak: is there a way to sort a hash? i want to get the key with the highest score? array of hashes maybe or array of pairs? 18:09
masak rakudo: my %h = 1 => 'a', 2 => 'c'; say %h.keys.sort({ $^b <=> $^a }).first 18:10
p6eval rakudo 34894: OUTPUT«No applicable methods.␤␤current instr.: '_block14' pc 159 (EVAL_13:58)␤»
masak hrm.
rakudo: my %h = 1 => 'a', 2 => 'c'; say %h.keys;
p6eval rakudo 34894: OUTPUT«12␤»
masak rakudo: my %h = 1 => 'a', 2 => 'c'; say %h.keys.sort;
p6eval rakudo 34894: OUTPUT«12␤»
szabgab masak: I have another project for you: 4 parameter substr()
masak rakudo: my %h = 1 => 'a', 2 => 'c'; say %h.keys.sort.reverse;
p6eval rakudo 34894: OUTPUT«21␤»
szabgab it has spec tests but not implemented in rakudo yet
masak rakudo: my %h = 1 => 'a', 2 => 'c'; say %h.keys.sort.reverse[0]; 18:11
p6eval rakudo 34894: OUTPUT«2␤»
masak eric256: there you go.
szabgab: oh? sounds a bit un-Perl6-like.
eric256 masak: ??????
lol
masak szabgab: we usually do .= nowadays.
eric256: ¿¿¿¿¿¿ 18:12
szabgab whatever, I'll keep an eye on it
masak szabgab: is there proof that 4-args substr() is still in Perl 6? spec or tests?
eric256 rakudo: my %test = ( 'eric' => 5, 'masak' => 2); %test.values.sort.reverse[0].say; 18:13
p6eval rakudo 34894: OUTPUT«5␤»
masak szabgab: meantime, why don't you implement your own multi in your code which does just that? it should be possible.
eric256 got the high score...but i need the key with the highest score
masak eric256: ah.
szabgab masak: I don't have code :-) I am just typing in these stupid examples 18:14
masak rakudo: my %test = 'eric' => 5, 'masak' => 2; say %test.pairs.sort( { $^b.value <=> $^a.value } )[0]
p6eval rakudo 34894: OUTPUT«eric 5␤»
eric256 magic pairs++ 18:15
thanks
masak szabgab: but you know you don't _need_ four-args substr. it's just a convenience, even in Perl 5.
eric256: glad to be of assistance. :)
eric256 whats 4-args substr do?
szabgab eric256: replace the selected part by the 4th arg
masak eric256: see `perldoc -f substr`
pmurias ruoso: what would be a good demo of the p5 integration? 18:16
eric256 use CGI;
masak pmurias: DBI, CGI.
18:20 Psyche^ joined 18:21 dwhipp joined 18:23 aindilis` left, GitHub199 joined
GitHub199 perl6-examples: 3Eric Hodges 07master0 SHA1-3c65243 18:23
[WSG] Adding challenge 2
is.gd/eupi
18:23 GitHub199 left
eric256 perl6 rocks! lol. figuring out skaters scores, sorting and printing all takes very very little space 18:25
amazing
masak aye.
18:28 Psyche^ is now known as Patterner 18:30 DemoFreak joined 18:31 jferrero left
eric256 crap i added a .swp file to the repo by accident. lmao 18:32
masak eric256: locally?
or did you push it to github?
ruoso pmurias, hi... btw the SDL thing is just awesome 18:33
have you seen how std parses
std: use p5:DBI;
p6eval std 24743: OUTPUT«00:05 71m␤»
ruoso if it parses it somewhat in an easy way... 18:35
you could alias the used package to the lexical scope as a type
and just make
18:35 ejs joined
ruoso use p5:DBI; my $dbh = DBI.connect($dsn); 18:36
eric256 pushed it to github
masak eric256: ok. just 'git rm' it I guess. 18:37
ruoso eric256, if you remove the file and re-push it fix it... no big deal
masak 'xactly. 18:38
eric256 oddly i don't see it localy, just on github and a git pull doesn't git it...
masak eric256: it was probably generated by your editor, and removed when you exited it. 18:39
eric256: also, you probably shouldn't 'git add' files the way you did when you added the .swp file. :)
eric256 masak: yea i was adding the folder 18:40
and i guess it added all the files in it
pugs_svn r24744 | pmurias++ | [smop] SMOP__Objects are represented as tied scalars in p5 land so they FETCH and STORE when necessary
eric256 github.com/eric256/perl6-examples/t...eric256.pl thats pretty sweet. and actualy i think i could shorten it by a couple lines ;) 18:41
dwhipp promised Patrick a writeup: dave.whipp.name/sw/perl6 (lots of code for the scripting games; plus Connect4 game) 18:42
masak eric256: yes, it adds all files, recursively.
dwhipp++
pmurias ruoso: hi
masak dwhipp: I looked at the Connect4 game earlier today; looks great. 18:43
eric256: indentation looks strange on lines 7 and 8-10. 18:44
pmurias ruoso: shouldn't it be use DBI:from<perl5>?
masak eric256: other than that, cool code.
TimToady yes, just because STD parses something doesn't mean it would interpret the bits like you would, if it did interpret the bits, which it mostl doesn't :) 18:45
masak eric256: may I suggest you use .fmt for the last three lines?
eric256 wow dwhipp thats a heck of a write up!
masak: yea or you could submit your own ;) lol
masak eric256: sure. 18:46
but it would be a very similar variant of yours.
eric256 ohh the editor ate some indents...odd
TimToady masak: we could probably use a p5-identical pack/unpack, but long term we'll probably be de-emphasizing the template language as something that a user would deal with directly 18:47
eric256 off to play some rockband2 with the wife ;)
dwhipp 18:48
dwhipp++
TimToady rather, we'd use compact classes to represent layout, and ask the class for the template that will unpack it
or something like that
masak TimToady: ok.
szabgab: ping
TimToady but an identical pack/unpack will at least be useful for p5 migration
and precompiled templates can dispatch via a different type than Str 18:49
masak I'll try to implement at least some of it tonight.
@tell szabgab see irclog.perlgeek.de/perl6/2009-01-03#i_803031 for TimToady's answer. 18:50
lambdabot Consider it noted.
TimToady or we'll just have a direct serialization interface (.pack/.unpack?) for the class
18:50 rindolf left
masak I'll start by providing the functions. 18:51
I'm in a JFDI mood today.
TimToady I don't see any problem with that
and it's not something we have to "get right first"
szabgab masak: pong 18:52
lambdabot szabgab: You have 1 new message. '/msg lambdabot @messages' to read it.
masak szabgab: well, see above discussion.
szabgab masak: I'll try to write some tests for you 18:54
masak szabgab: and I'll try to implement them for you. :)
TimToady on 4-arg substr, I haven't made up my mind yet 18:56
it's not clear to what extent P6 strings are mutable outside of a variable containing a string 18:57
so it may be some OO notation is better for mutating a string variable in place
pugs_svn r24745 | pmurias++ | [smop]
r24745 | pmurias++ | SMOP::Object::DESTROY calls SMOP_RELEASE
masak TimToady: postcircumfix:<[ ]> ?
masak hides 18:58
szabgab TimToady: it also freaks out C programmers :-)
TimToady we do already allow .[] on Buf types
masak we do? does that include Str? 18:59
TimToady Str is not a Buf type
masak ok.
can I cast it to a Buf easily?
TimToady otoh, NFG is not variable-width in terms of graphemes, so maybe we could allow .[] there too
masak NFG? 19:00
TimToady masak: you can cast as long as it's perfectly clear what hte mapping is supposed to be
Normalization Form Grapheme
masak I guess I'd specify the mapping through pragmas or something?
TimToady not something you'll find in the Unicode docs
well, a pragma could set up defaults, but in general you'd want to have an interface much like Encode provides 19:01
masak oh, I think I know what an NFG is, then.
TimToady NFG is basically a local mapping of multiple codepoints into a single grapheme number so it can be stored in a single array element 19:02
we assign them temporary negative numbers so as not to confuse them with Unicode codepoints 19:03
masak this all sounds familiar.
I think the specs mention it somewhere.
azawawi_ TimToady: Padre::Plugin::Perl6 now uses STD in a separate process for faster typing while highlighting/syntax checking... 19:04
masak moves from one location to another
19:04 masak left 19:06 azawawi_ is now known as azawawi
TimToady speaking of syntax highlighting, I noticed perl6.vim seems to be making my vim slower and slower... :/ 19:06
szabgab regarding tests, can I just copy the test file for pack() from perl 5 and the change it to fit the perl6 syntax or is there some copyright/legal issue there? 19:07
eric256 "Hello"[1] = 'a'; 19:08
TimToady considering I own the overall copyright on Perl 5, unless the individual file says otherwise, I'd say there's not problem
szabgab TimToady: the file does not have any special copyright statement 19:09
TimToady then feel free 19:10
azawawi TimToady: im looking at .panic and .obs; could we add something to identify a warning/error from STD output?
TimToady you have officially "made other arrangements with the copyright holder" :)
dwhipp eric256: indexing into a string feels dangerous -- nice to have, but...
<aa bb>[0] --> "aa" 19:11
<aa>[0] --> "a"
szabgab now the only 2 problems are 19:12
dwhipp endcases like taht are petri-dishes for bugs
szabgab 1) .t files are still considered perl5 files by Padre
eric256 umm wouldn't <aa>[0] still be 'aa'? its a list/array isn't it?
rakudo: (<aa>).perl.say
p6eval rakudo 34895: OUTPUT«"aa"␤»
eric256 rakudo: <aa>.perl.say
p6eval rakudo 34895: OUTPUT«"aa"␤»
szabgab 2) even if I manage to convince it otherwise our syntax highligher will take ages to parse this 2000 lines long file 19:13
eric256 rakudo: <aa>.WHAT.say
dwhipp I had that discussion the other day (even filed a bug)
p6eval rakudo 34895: OUTPUT«Str␤»
eric256 rakudo: <aa aa>.WHAT.say
p6eval rakudo 34895: OUTPUT«List␤»
eric256 okay thats surprising
dwhipp I am told that <aa> returns a scalar
TimToady it pretty much has to, since it's short for ('aa') or {'aa'} when used as a subscript 19:14
eric256 that means that not having a space in there is significant. thats a bit scary actualy
rakudo: ('aa').WHAT.perl 19:15
p6eval rakudo 34895: RESULT«"Str"»
eric256 rakudo: (<aa>).WHAT.perl
p6eval rakudo 34895: RESULT«"Str"»
eric256 rakudo: (<aa b>).WHAT.say; ("aa","a").WHAT.say; 19:16
p6eval rakudo 34895: OUTPUT«List␤List␤»
eric256 rakudo: (<aa>).WHAT.say; ("aa").WHAT.say;
p6eval rakudo 34895: OUTPUT«Str␤Str␤»
eric256 guess that makes it consistent ;) 19:17
TimToady I think it's relatively harmless unless you get into the habit of using <> where you should use ''
19:18 rindolf joined
TimToady for bare terms, pragmatically you only ever use < a b c > for multiple items 19:18
and with .<> subscripts, it mostly doesn't matter
eric256 yea. mostly i think i'm just still working on being able to think in p5 and p6 at the same time ;)
i used < > for a single item list earlier...which obviously wasn't working as expected 19:19
TimToady some of us do go back and forth, and there will always be some recurring brainos because of that :)
eric256 [+] has already proven very usefull and so has X~X 19:20
19:24 rindolf left, rindolf joined
azawawi padre.perlide.org/wiki/Screenshots 19:27
ruoso pmurias, anyway... is the parsing of "use DBI:from<perl5> complicated? 19:30
pmurias looking... 19:31
19:31 ejs left
ruoso don't know exactly where that p5:DBI came from 19:31
19:32 masak joined
ruoso TimToady, is there any change routine_declarator:coro to get into STD? 19:32
pmurias ruoso: not very 19:33
ruoso pmurias, is used parsed as a function call? or as a keyword?
ruoso .oO( by keyword I mean whatever "self" is) 19:34
pmurias it's a statement_control
ruoso hmm... even more explicit
cool
pmurias i use perl mildew --debug to see the VAST
ruoso: you meant use by "used"? 19:39
ruoso yes 19:44
pmurias, I think you can implement use DBI:from<perl5> without any problems... the parsing looks like something that is meant for the compiler to understand directly 19:48
unlike "is export"
19:56 ejs joined 19:57 maerzhase left
ruoso I think it'd be nice to have a package declarator for DelegatedPrototypeHOW 19:59
ruoso goes implement attributes in knowhows 20:01
ruoso realizes s1p_pureprototypehow is not a .ri yet... *sigh* 20:02
20:04 ejs left
ruoso finishes converting pureprototypehow to an RI 20:07
20:07 c9s joined
ruoso strangely notices that make test in smop doesn't raise any memory leak 20:08
pmurias i fixed them all some time ago, but we have lots of leaks in mildew/t to compensate 20:10
ruoso heh...
but I've just understood why pureprototypehow wasn't a .ri yet 20:11
I think I'll add a %singleton tag to .ri
pmurias what would it do? 20:12
ruoso create an empty SMOP__Object* that have the RI as its responder interface
without the need to call new
as in %prototype 20:13
pmurias we could create a single object with .new and put it in the lexical prelude
ruoso seems too complicated... 20:14
specially because in this case it is indeed a singleton
there's no point in creating a new instance of PurePrototypeHOW 20:15
pmurias ok
20:16 brunoV joined
pmurias & 20:22
pugs_svn r24746 | masak++ | [t/spec/S29-str/unpack.t] removed mismatched right paren 20:25
20:30 azawawi_ joined
pugs_svn r24747 | szabgab++ | add pack/unpack tests from perl 5 source code 20:34
r24748 | ruoso++ | [smop] .ri files now can declare a %singleton 20:35
r24748 | ruoso++ | [smop] pureprototypehow is now a .ri
20:37 bsdperl joined
masak szbalint: I'm about halfway towards implementing the first three tests you made. will refrain from svn-upping until after I'm done passing them, for morale reasons. :) 20:37
20:37 rindolf left
masak szbalint: oops, should be szabgab. sorry. 20:37
szabgab masak: yes 20:38
the hungarian notation is confusing :-)
masak :) 20:39
20:45 xinming_ joined 20:48 azawawi left
szabgab rakudo: split(/b/, "abc").join(';').say; 20:55
p6eval rakudo 34895: OUTPUT«a;c␤»
szabgab rakudo: split(//, "abc").join(';').say;
p6eval rakudo 34895: OUTPUT«Statement not terminated properly at line 1, near "(//, \"abc\""␤␤current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:83)␤»
masak szabgab: // is disallowed in Perl 6 20:56
szabgab masak: ah, so how do I split character by character? 20:57
masak rakudo say split('', 'abc)
rakudo say split('', 'abc').perl
rakudo: say split('', 'abc').perl
p6eval rakudo 34895: OUTPUT«["a", "b", "c"]␤»
masak er.
szabgab rakudo: split('', "abc").join(';').say;
p6eval rakudo 34895: OUTPUT«a;b;c␤»
szabgab thanks 20:58
20:58 xinming left 21:00 kisu_ left
masak szabgab: your original tests two and three contain a logical error. in Perl 6 (as in Perl 5), a list within a list is "flattened" out into the outer list. 21:09
hence, the arglists to is_deeply actually contain four arguments each, not three.
(as was intended) 21:12
21:16 Khisanth joined 21:18 kisu joined
masak anyway, I have PIR code here that passes what you meant. 21:18
ruoso wishes "has $.a" could be treated as a macro by STD 21:24
szabgab masak++ 21:28
rakudo_svn r34898 | masak++ | [rakudo] added C<unpack> implementation that passes szabgab's three original 21:30
r34898 | masak++ | tests, and very nearly nothing more
r34899 | masak++ | [rakudo] removed obsoleted comment in any-str.pir
masak szabgab: do you think you could fix unpack.t? 21:32
szabgab: re the new pack.t -- wow!
szabgab I thought you already fixed it,
masak szabgab: no, I just pointed it out. 21:33
szabgab: on the plus side, if you fix it and then build Rakudo, the tests will pass. :)
szabgab then I try to do it
masak it's just a matter of replacing the () with []
I could have done it, but I wanted you to learn from your own mistakes :P
szabgab oh is that the same in p6 ?
masak szabgab: sure! 21:34
szabgab oh thanks :-)
masak as I said above.
"parentheses are only for grouping".
21:36 barney left
masak szabgab: re pack.t -- it'll take some changes to that file for Rakudo to accept it. it's a large file, and it's in Perl 5, so "some changes" may be an understatement. 21:36
szabgab sure but if I understant the =begin pod should take car of that for now 21:38
or am I mistaken ?
masak szabgab: ah, didn't see that one.
no, that should work.
szabgab++
szabgab then once I learn more about it I can slowly move things out
or someone else will do it
masak I might help. 21:39
still, Rakudo chokes on it already.
ah. 21:40
the \001 escape string on line 8 has been deprecated.
should be \o001 instead, it seems.
I'll try and change that and see if it helps. 21:41
szabgab once I compiled rakudo, how can I run a test script ?
simple running it cannot fine Test in @INC
masak szabgab: you have to have Test.pm in the current directory.
szabgab and where is Test.pm ? 21:42
masak it's in languages/perl6
ok, now it compiles -- committing.
pugs_svn r24749 | masak++ | [t/spec/S29-str/pack.t] changed \001 to \o001 some places 21:43
r24750 | szabgab++ | fixing parentheses, masak++
21:43 mberends left 21:44 slavik joined
slavik what's the bitshift operator? 21:44
perl6: say 2<<2;
p6eval elf 24748: OUTPUT«8␤»
..rakudo 34897: OUTPUT«Statement not terminated properly at line 1, near "<<2;"␤␤current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:83)␤»
..pugs: OUTPUT«*** ␤ Unexpected "<<2"␤ expecting "_", fraction, exponent, term postfix, operator, ":" or ","␤ at /tmp/bd42WIeTww line 1, column 6␤»
slavik perl6: say 2+<<2;
szabgab masak: Could not find non-existent sub pack
p6eval rakudo 34897: OUTPUT«Statement not terminated properly at line 1, near "+<<2;"␤␤current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:83)␤»
..pugs: OUTPUT«*** ␤ Unexpected end of input␤ expecting block, "\\", variable name, ">>" or "<<"␤ at /tmp/ANCrpExWz6 line 2, column 1␤»
..elf 24748: OUTPUT«Parse error in: /tmp/qmLEcGdG4t␤panic at line 1 column 8 (pos 8): Error in quotesnabber␤WHERE: say 2+<<2;␤WHERE: /\<-- HERE␤ STD_red/prelude.rb:99:in `panic'␤ STD_red/std.rb:1307:in `quotesnabber'␤ (eval):1:in `__quote_3820646'␤ STD_red/prelude.rb:406:in `block in 21:45
..long...
masak szabgab: that's because it doesn't exist.
szabgab surprise :-)
slavik masak: ?
masak slavik: ¿
slavik bitshift operator?
masak slavik: read the spec. S03.
slavik: I cannot do it for you. 21:46
slavik :P
masak szabgab: the unpack.t tests pass now.
szabgab that's enough for today, & 21:48
masak szabgab: I'm a bit surprised that the [] were needed around the unpack() calls as well. but it seems the tests do not pass without them.
pmurias ruoso: what do you mean in treated as a macro?
slavik perl6: say 2~<2; 21:49
p6eval elf 24750: OUTPUT«Undefined subroutine &GLOBAL::infix__126_60 called at (eval 119) line 3.␤ at ./elf_f line 3861␤»
..rakudo 34901: OUTPUT«Could not find non-existent sub infix:~<␤current instr.: '_block14' pc 62 (EVAL_12:40)␤»
..pugs: OUTPUT«È␤»
slavik perl6: say 2 ~< 2;
p6eval elf 24750: OUTPUT«Undefined subroutine &GLOBAL::infix__126_60 called at (eval 119) line 3.␤ at ./elf_f line 3861␤»
..rakudo 34901: OUTPUT«Could not find non-existent sub infix:~<␤current instr.: '_block14' pc 62 (EVAL_12:40)␤»
..pugs: OUTPUT«È␤»
slavik :(
perl6: say (2 ~< 2);
p6eval elf 24750: OUTPUT«Undefined subroutine &GLOBAL::infix__126_60 called at (eval 119) line 3.␤ at ./elf_f line 3861␤»
..rakudo 34901: OUTPUT«Could not find non-existent sub infix:~<␤current instr.: '_block14' pc 62 (EVAL_12:40)␤»
..pugs: OUTPUT«È␤»
slavik bitshift fail
masak Pugs++
slavik how so? 21:50
perl6: say +(2 ~< 2);
masak slavik: if you want a number as a result, I don't think ~< is what you want.
p6eval rakudo 34901: OUTPUT«Could not find non-existent sub infix:~<␤current instr.: '_block14' pc 62 (EVAL_12:40)␤»
..elf 24750: OUTPUT«Undefined subroutine &GLOBAL::infix__126_60 called at (eval 123) line 3.␤ at ./elf_f line 3861␤»
..pugs: OUTPUT«0␤»
slavik oh
perl6: say (2 +< 2);
p6eval pugs, rakudo 34901: OUTPUT«8␤»
..elf 24750: OUTPUT«Undefined subroutine &GLOBAL::infix__43_60 called at (eval 119) line 3.␤ at ./elf_f line 3861␤»
slavik ahh, awesome
masak slavik: see? all you need to do is to read carefully. :)
slavik I see 21:51
~ == string version/context
masak aye
there's some logic to the madness.
slavik my @guesses; for 0..16 -> $p { for 0..2 -> $g { push @guesses, ($g +< (2*$p)); };}; 21:53
does that make sense?
masak I think so.
slavik I want to generate a sequence of all 00, 01, and 10 that will fit in 32bits
masak but I'd do it with maps instead.
slavik map == for? 21:54
masak slavik: do you know Perl 5?
slavik yes
map is different than for in perl5
masak map in Perl 6 works the same as in Perl 5.
slavik but maps are synonomous with for loops, no? 21:55
masak slavik: I have difficulty answering that question.
slavik don't for loops return a list as well?
rakudo: my @list = for 1..5 { 1; }; say @list;
p6eval rakudo 34901: OUTPUT«Statement not terminated properly at line 1, near "{ 1; }; sa"␤␤current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:83)␤»
slavik rakudo: my @list = for 1..5 { 1; } say @list; 21:56
p6eval rakudo 34901: OUTPUT«Statement not terminated properly at line 1, near "{ 1; } say"␤␤current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:83)␤»
slavik rakudo: my @list = map { 1 } 1..5; say @list;
p6eval rakudo 34901: OUTPUT«Statement not terminated properly at line 1, near "1..5; say "␤␤current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:83)␤»
slavik rakudo: my @list = map { 1 }, 1..5; say @list;
p6eval rakudo 34901: OUTPUT«11111␤»
slavik rakudo: my @list = for 1..5 { 1 }; say @list;
p6eval rakudo 34901: OUTPUT«Statement not terminated properly at line 1, near "{ 1 }; say"␤␤current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:83)␤»
slavik hmm
rakudo: my @list = for 1..5 { say 1 }; say @list; 21:57
masak slavik: it doesn't work like that.
p6eval rakudo 34901: OUTPUT«Statement not terminated properly at line 1, near "{ say 1 };"␤␤current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:83)␤»
slavik :-\
masak for loops aren't expressions.
they're statements.
S04 explains the difference. 21:58
slavik masak: looking at s04, which part in particular? 22:01
masak perlcabal.org/syn/S04.html#The_do-once_loop 22:02
22:02 bloreg joined, bloreg left
slavik can map have a pointy block? 22:02
there do not seem to be map examples :( 22:03
22:03 kisu_ joined
masak map can take pointy blocks. 22:03
22:03 pmurias left
slavik rakudo: map {say $a}, 1..5 -> $a; 22:04
p6eval rakudo 34901: OUTPUT«Statement not terminated properly at line 1, near "-> $a;"␤␤current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:83)␤»
masak rakudo: say map(-> $a { $a + 2 }, 1..5);
p6eval rakudo 34901: OUTPUT«34567␤»
slavik I see
masak slavik: the -> $param goes before the block.
slavik gotcha 22:05
masak slavik: if you feel a dearth of good code examples, check out the spectests.
slavik: or, for that matter, check out the November wiki codebase.
or the newly created "Perl 6 Examples" repository. 22:07
or any number of games that people have been posting on blogs in the last few days. :)
22:08 aindilis joined 22:11 kisu left
dwhipp subs Vs blocks question: if I want to write "sub foo { $xxx.scan: { return } };", how do I write the "scan" method such that the "return" exception will propagate to "sub foo"? 22:13
masak dwhipp: in my limited understanding, you don't need to do anything special. however, Rakudo doesn't yet behave correctly for such a case. 22:14
22:14 azawawi_ is now known as azawawi
dwhipp thx. that explains why it didn't work for me ;-) 22:15
masak dwhipp: the rule is (ideally), if the 'return' is located inside 'sub foo', it will return from there.
there's an RT ticket about it that I could dig out for you if you want.
dwhipp no need thx: I'm sure it will get fixed -- I can google if I need it 22:16
masak rt.perl.org/rt3/Ticket/Display.html?id=61126
got it anyway :P
dwhipp :-) 22:17
masak dwhipp: note that this also means that you could conceivably trigger a return from a sub that has already been run! 22:18
(that will likely cause an exception, I guess)
s/run/exited/
22:19 gravity joined 22:46 dwhipp left 22:49 buu joined 23:08 eric256 left 23:11 eric256 joined 23:13 ayrnieu left 23:23 gravity left
pugs_svn r24751 | masak++ | [t/spec/S29-str/unpack.t] two fixes: 23:27
r24751 | masak++ | * fixed one erroneous test description
r24751 | masak++ | * removed two sets of [] that aren't needed after r34904 in Rakudo's Test.pm
rakudo_svn r34904 | masak++ | [rakudo] in Tests.pm, made the smartmatch check for List, not Array 23:30
23:35 masak left
eric256 rakudo: say ( any<a b c> ~ any<d e f>) 23:35
p6eval rakudo 34903: OUTPUT«Method 'postcircumfix:{ }' not found for invocant of class 'Junction'␤current instr.: 'postcircumfix:{ }' pc 1864 (src/classes/Associative.pir:77)␤»
eric256 rakudo: say ( any(<a b c>) ~ any(<d e f>) )
p6eval rakudo 34903: OUTPUT«Junction<0xb687f04c>␤»
eric256 rakudo: say ( any(<a b c>) ~ any(<d e f>) ).perl
p6eval rakudo 34903: OUTPUT«any(any("ad", "ae", "af"), any("bd", "be", "bf"), any("cd", "ce", "cf"))␤»
eric256 rakudo: say ( any(<a b c>) ~ any(<d e f>) ) ~~ 'ae' 23:36
p6eval rakudo 34903: OUTPUT«Junction<0xb68547a4>␤»
eric256 rakudo: any(<a b c>) ~ any(<d e f>) ~~ 'ae'
p6eval rakudo 34903: RESULT«any(any(Bool::False, Bool::True), any(Bool::False), any(Bool::False))»
eric256 ohh now my WSG answer could be changed to use junctions ;) performance is probably still better using hashes though 23:37
23:49 eric256 left 23:51 slavik left 23:56 vixey left