Foundry down, use svn.perl.org/perl6/pugs/trunk for now | pugscode.org <Overview Journal Logs> | r1773/winxp: 587/4256 smoke/win2k (occasional): xrl.us/fqum (158/4302, r2032) | pugs.kwiki.org
Set by autrijus on 16 April 2005.
elmex new? 00:02
theorb my $self = bless {}, $class;
nothingmuch that is what I'm doing, but it's, sysiphic, sort of 00:17
use base qw/Object::Boring/; # provides a new that does just that
stevan so I am trying to implement throws_ok into Test.pm 03:04
and I ran into this bug 03:05
pugs -e 'sub foo (Sub $code, Str $a, Str ?$b) { ref($a).say }; foo -> { "test" }, "test", "test2";'
prints: List
I also tried a number of other versions of this as well 03:06
this one is the only one which works:
pugs -e 'sub foo (Sub $code, Str $a, Str ?$b) { ref($a).say }; my $block = { die "test" }; foo $block, "test", "test2";'
it prints: Str
I am writing a t/pugsbugs/ test for this now :)
it will be t/pugsbugs/code_blocks_as_sub_args.t 03:07
(but since we are still on svn.perl.org I can't commit yet)
here is another fun one :) 04:07
pugs -e 'my @a = 0 .. Inf; push @a, 10;'
I think this should probably throw an error.
or we can just go with the policy that if you do something stupid you deserve whatever you get. 04:08
kelan i vaguely remember larry saying that was fine
you just couldnt get the 10 back again
stevan kelan: and it will take forever :) 04:14
kelan there was discussion on that 04:15
that maybe perl wouldnt need to calculate the actual list
stevan autrijus: when next you have tuits, the MMD on types needs some work
kelan in this case anyway, it could just turn the push into a noop 04:16
stevan kelan: so it just pushes into some kind of inter dimensional portal where you can never get it back :)
kelan right 04:17
here we go: www.mail-archive.com/perl6-all@perl...39891.html
stevan kelan: thanks, this actually helps me write the tests :) 04:19
kelan no problem:) i knew lurking on p6l would come in handy some day 04:20
ingy hola 04:22
stevan hey ingy 04:23
stevan has to reboot to finish the 10.3.9 install 04:24
kelan whats the 10.3.9 install? 04:33
stevan kelan: Mac OS X
actually it was an upgrade not install really
kelan ah. whats this one called? ocelot? ;) 04:34
that should be the codename for the next one
stevan Tiger :)
kelan it sounds cool
brothers puma, clearly 05:17
nothingmuch morning 05:18
i think puma was the first one
nothingmuch hopes apple will make a MacOS X $n - Tabby soon 05:20
brothers nothingmuch: i stand corrected
Tiger. Apple has also registered the trademarks Lynx, Cougar, and Leopard for future use. 05:21
-wikipedia
nothingmuch they're so silly that way
anyway, /me must do hygene stuff
nothingmuch heads off to work 05:36
morning 06:44
07:12 rob___ is now known as rob-
autrijus hey. 'hat trick' fixed. 07:22
assignment to negative array indice now works. iblech++ 07:23
I wonder who did this, though ;) en.wikipedia.org/wiki/Autrijus_Tang
Corion A good morning! (backlogging) 07:31
autrijus hey Corion-san
Corion Hi autrijus! I've promoted lots of skipped/todo tests, but can't commit! I think I have commit-addiction!
autrijus bwahaha. are you using svn? 07:32
Corion autrijus: But I got a new bug for you - pugsbugs golf: pugs -e "=<>"
Yep - I'm using svn and not svk :)
autrijus Corion: in that case you are doomed and must repent
err, wrong personality
in that case, please run "svn diff -u" and sent patches my way
Corion autrijus: Ah no - I can wait until "monday" (that is, monday for you :), which is sunday evening for me, I think :) 07:33
autrijus alright.
Corion autrijus: You survived without IP packets for a day, so I can survive without commits too! 07:34
I'll be strong!"
autrijus good kid :p
I see the reason. 07:35
I intended <f> to be a string
not a list of strings
but since we are now using spli 07:36
split
it's now always a list.
Corion autrijus: Ah, so it's an internals bug, and not a parser bug
autrijus yeah.
Corion autrijus: "Not always" ? I would think it is always a list.
autrijus and the reason I intended <f> to be a string is that
Corion Aaah - "Now", not "Not". I need to read ...
autrijus %x<f> = foo();
should give scalar cxt to foo
like
Corion autrijus: Yeah ...
autrijus %x{'f'}
but unlike
%x{'f',}
Corion autrijus: Then what about @list = %x<foo bar baz> ? 07:37
autrijus but maybe there's better way to achieve that.
Corion (ugly)
autrijus %x<foo bar> is %x{'foo', 'bar'}
clearly a list
the idea is for <string_without_whitespace> to be a string
and <string whitespace> a list
Corion autrijus: Yeah, that makes sense
autrijus exactly I'm not at all sure whether it makes sense :) 07:38
maybe what should be done is for %x<foo> to special case.
Corion autrijus: So consider making the [App "&list:", ... ] dependent on rx:perl5/\s/ maybe?
(in qLiteral, I mean)
autrijus we'll deal. sec 07:39
your bug is fixed.
now I need to think about %foo<bar>.
Corion autrijus: You mean, you exchanged one bug for the other :) 07:41
Maybe we should collect these two cases in one test file, and post that test to p6l for clarification, and link the thread from the test? :))) 07:42
autrijus no I didn't exchange one bug for another ;)
I just fixed the "=" operator.
strangely... it still works 07:43
woot.
roie++ # sensible implementation
it turns out that %x<> is handled by a different thing 07:44
not by split
so the <> in that case and the <> as subscript are gramatically different things.
Corion autrijus: :)
autrijus that's good, and it now works.
autrijus spreads some flowers
Corion ... anyway - I'm away from the keyboard now anyway, and when I get back, svn will be fixed, I hope :) 07:45
Eh. If %x<foo> is not handled by split/qLiteral, does it have the same bugs that I fixed in <foo bar baz> ? 07:46
autrijus leading space? 07:48
Corion autrijus: Yes, and tab/ \r / \n
autrijus seems it's free of such errors.
it just calls haskell 'words'
Corion autrijus: Hmmm. "words" does split on \x20 and nothing else from what I remember 07:49
... or maybe I remember wrongly
autrijus you did remember wrongly
Corion ... need to run now, sorry, can't investigate
cool
autrijus see ya :)
nothingmuch hola autrijus 08:37
autrijus yo nothingmuch 08:43
castaway_ hawo nm, autrijus 08:47
08:48 castaway_ is now known as castawa 08:55 castawa is now known as castaway
nothingmuch is back 09:03
castaway hey nm
nothingmuch how are things? 09:04
castaway not bad.. hows yerself?
autrijus just fine. I'm going to lunch :)
I mean, breakfast
err. I mean dinner.
castaway laughs 09:05
autrijus that's the problem of living in a state without a bio clock :p
castaway what time is it there?
autrijus 5pm... it's 3hrs after I wake up
and it is my first meal.
castaway sounds like breakfast to me
nothingmuch bon apetite
autrijus breakfast then
castaway have a good one 09:06
castaway is making beans on toast for breakfast
nm, is SEE running?
autrijus schweinshaxe++
&
nothingmuch i think not
nothingmuch will try to fix
nope, sorry 09:09
castaway someone reboot it again? ;) 09:13
yay, schweinshaxe++ 09:14
nothingmuch prolly
i don't use that box often
didn't check uptime this time
castaway nods 09:15
roie_m Corion: the %a<> notation should be handled by the same thing that plain <> does (I'm doing it now) 09:16
Oh, he's not here, is he?
nothingmuch nope 09:17
nothingmuch mumbles something about an asian mafia taking over pugs
roie_m Oops.
nothingmuch wonders if gaal got around to kill 09:18
theorb wonders if jabbot got upgraded. 09:21
gugod yes, per-channel encoding support
theorb Cool. 09:22
gugod jabbot: utf8? 09:27
jabbot gugod: utf8 is all about seeing the hot-spring symbol ( ā™Ø)
theorbtw1 Hm, did somebody just /msg me? 09:34
09:34 theorbtw1 is now known as theorbtwo
roie_m Anyone here understand Pugs.AST? 09:38
nothingmuch roie_m: I understood little bits a while ago 09:39
theorbtwo I've mostly avoided looking at it for fear that it will melt my brain.
roie_m theorbtwo: I completely understand.
nothingmuch Pugs.AST? how?
;-) 09:40
roie_m :-)
Can you tell me if this makes sense?
cxtOfExp (Syn "cxt" (Val(VStr c):_)) = c
For some reason Syn "cxt" "List" was interpreted as a scalar somewhere 09:41
nothingmuch too much for me =P
autrijus should be back from breakfast soon, though
roie_m OK, thanks 09:42
nothingmuch it looks ok superficially
but i really don't know enough
(just extracts the string that is the context out of the exp structure, right?)
roie_m Yeah, and report that as the context of the expression
But it's weird that it wasn't there before 09:43
nothingmuch what wasn't there before? the whole function?
roie_m It's like Syn "cxt" didn't really change the context...
nothingmuch ah
nothingmuch wonders where cxt is propagated
Eval.hs tacks it on to exprs?
nothingmuch is tempted to have a look but knows it's not the right thing to do at work 09:44
roie_m Something like that, I guess. It's in Eval.hs 09:45
Another brain-melter
mj Pugs r1959
my $a = [ { a => 1, b => 2 } ];
say join ' ', $a.ref, $a[0].ref, $a[0].kv; # Array Pair a 1
nothingmuch ooh 09:46
interesting
it's as if { } didn't exist
mj: did you commit a test?
mj no, i am not test guru. could you do it? 09:48
and my old one
my $a = [ { 1 } ]; say $a().ref; # Inf
my $b = [ { 1 }, { 2 } ]; say $b().ref; # pugs: cannot cast from VList [VCode...
roie_m It only happens when you assign to a variable. 09:52
[ { a => 1, b => 2 } ] .[0] .ref # Hash
mj and 09:54
my $a = [ { { a => 1, b => 2 } } ]; say $a[0].kv;
is interesting too
nothingmuch oh wait, is openfoundry still down?
sure
looks like it... does anybody have perl.org commit access? 09:55
mj autrijus said "send patch to p6c" 09:57
roie_m mj: what does that do on your machine? 09:58
mj $a[0].kv ... eating memory 10:00
probably loop
roie_m almost crashed my bloody computer 10:01
It should fail on the single key in the hash, right? 10:02
mj my $a = [ { { a => 1, b => 2 } } ]; 10:06
say $a[0]().kv; # a1b2
seems ok
say $a[0].ref; # Sub 10:08
Sub.kv is not defined, IMHO
sub ta () { 11:19
my @a = <a b>;
my @b = <1 2>;
return @a, @b;
}
my ( @a, @b ) = ta(); say 'a: ' ~ @a; say 'b: ' ~ @b;
# a: a b 1 2
# b:
castaway back from breakfast? ;) 12:23
nothingmuch woo! boss OK'd vacation time for YAPC + hackathon 13:25
theorbtwo Yey! 13:32
autrijus yay! 13:34
rejoices!
nothingmuch now all i need is to book a flight
or rather, for a flight to get booked for me
s/for/get a/ 13:35
theorbtwo Get a flight booked for you?
nothingmuch mom's travel agent
she's pretty good
autrijus cool
14:24 Limbic_Region_ is now known as Limbic_Region
castaway looks for a func that says "$x is between 0 and $y" 15:14
(in p5 ,) 15:15
autrijus define one? 15:16
castaway bah
Limbic_Region castaway - you mean something like 0 <= $x <= $y;
or just between($x, 0, $y); ? 15:17
castaway it needs to work both sides of zero
theorbtwo sign($x)==sign($y) and abs($x)<abs($y) 15:18
Limbic_Region doesn't see why either of the two things he posted wouldn't work on both sides of zero
well - except perhaps because of the <= might want to be just <
theorbtwo 0 <= -5 <= -50 15:19
Limbic_Region theorbtwo - that would work by moving things around
so I guess what castaway is saying is that she doens't want to need to know the order
castaway well between I've not heard of
Limbic_Region just invented it and was going to write it for you if that's what you wanted
castaway right, but by moving things around, I need to write it twice, so yes, the 2nd makes more sense 15:21
s/I/I'd/
Limbic_Region ok
castaway anyway s/func/builtin func/
castaway can write it, otherwise 15:22
Limbic_Region perlbot paste 15:24
perlbot Paste your code and #perl will be able to view it: sial.org/pbot/perl dragon.cbi.tamucc.edu:8080 erxz.com/pb
pasteling "Limbic_Region" at 69.250.48.119 pasted "between()" (9 lines, 192B) at sial.org/pbot/9414 15:25
Limbic_Region only it has a typo
pasteling "Limbic_Region" at 69.250.48.119 pasted "between()" (9 lines, 190B) at sial.org/pbot/9415
Limbic_Region fixed
theorbtwo hmms. 15:26
I'm not actually sure you want the test you're thinking about here.
Limbic_Region well - then I must be assuming something that isn't correct 15:27
theorbtwo No, I mean that I'm not sure in this context that between checking is sane. 15:28
Mm, probably.
castaway hmm?
theorbtwo Probably is good to check in this case.
Well, so long as they add up correctly, it's OK to make a positive and negitive pair.
(And not just two positives or two negitives.)
Limbic_Region for brevity, I like this better though 15:29
sub between { return (sort {$a <=> $b } @_)[1] == $_[0] ? 1 : 0 }
castaway eh?
you missed the shift there
Limbic_Region no need to shift
castaway is confused 15:30
Limbic_Region it sorts them in numerical order and checks to see if the first element passed is in the middle
theorbtwo No need for the ? 1 : 0.
Limbic_Region theorbtwo - that's correct - habit
castaway between 1,0,3 -> 1 == 0 ?
Limbic_Region no
castaway you have a == in there 15:31
Limbic_Region right
so it would be 0,1,3 -> 1 == 0
which is false
theorbtwo between($a, $b, $c) checks if $a is between $b and $c.
Limbic_Region it can be broken though if either end point is equal to the target
castaway sneaky 15:32
Limbic_Region which is why I didn't paste the brevity example
it is cool but easily broken - the longer version can still be broke but not as easily
non numerical arguments, not enough arguments, etc
theorbtwo Nonnumerics should be treated as 0. 15:33
castaway non numeric gives a 0, no
theorbtwo It's the Perl Way.
Limbic_Region my point being is it does error handle
or rather, it only gives accurate results when it is passed 3 numeric args 15:34
theorbtwo Hello, roie_m.
Limbic_Region wanders off to take Jean to church
roie_m Hi, theorbtwo 15:35
theorbtwo
.oO(Church at 11:30?)
nothingmuch loaths methods that return refs when the structure need not be mutable 16:03
castaway ? 16:13
Corion re 16:18
autrijus hey Corion
Corion roie_m: Interesting - so in theory %a<\tfoo> # should simply work now. That means that autrijus has to work around it a bit. 16:19
hi autrijus :)
Corion returns from a day of fruitful motocycling
I guess I'll work on creating/fixing/un-todo-ing even more tests :)
autrijus what should I work around what?
Corion autrijus: If roie_m is correct about %a<foo> using the same code as <foo>, then %a<foo> will also always get a list, even if it's just one element. 16:20
I think that was what you said was tripping =<> up
(or =<foo>
)
autrijus roie_m: huh? %a<foo> does not use the same code as <foo> 16:21
Corion autrijus: I thought I saw something like that in the backlog ...
Corion goes looking again
autrijus ruleHashSubscriptQW = do exp <- angleBracketLiteral return $ \x -> Syn "{}" [x, exp]
so %a<foo> uses angleBracketLiteral
Corion colabti.de/irclogger//irclogger_log...2005-04-17 - 9:17 - roie_m said (s)he was doing it now, so it might be done, or not. 16:22
autrijus while it's qLiteral
oh.
so roie_m is working on that
I'm fine, I can deal either way
I do wonder however why we need to use a split
Corion I might be confusing things anyway :)
autrijus instead of calling words at haskell level
theorbtwo
.oO(Millions of peaches, peaches for free.)
16:23
Corion autrijus: Dunno. I wouldn't use split() anyway, but either match on /(\S+)/g. I don't know if there is Unicode whitespace we need to be afraid of
Also, does Haskell words() properly ignore \r \t \n ? 16:24
theorbtwo \S and \s should be unicode-aware.
Steve_p throws millions of peaches at theorbtwo
Corion Err - yes, it does - it uses isWhite
theorbtwo Looks Out!
Corion err - isSpace
autrijus Corion: it does
Juerd Every time I look here, there is some discussion about whitespace going on.
autrijus and our isSpace is the special power UnicodeC one
Juerd: because perl 6 is WhiteSpace SensiTive and we are not yet used to that
Corion Juerd: I bring it up, again and again ;) 16:25
Juerd Perl 5 is whitespace sensitive too, but less.
autrijus perl5 does a good job hiding its whitespace sensitivity.
hmm I discovered my old Language::Haskell on CPAN
I should probably rename it to Language::Hugs 16:26
to make room for Language::GHC
stevan hey autrijus :) 16:27
Corion autrijus: Language::Haskell::Hugs / Language::Haskell::GHC ?
Or, even worse, Language::Haskell::Haskell98::Hugs
autrijus hey stevan. got time to do changelog? :) 16:28
Corion :-)))
autrijus still plans on a release tomorrow or something
would be tonight, but svn.openfoundry is out
stevan autrijus: I have a little time right now,.. and more later this evening
so yes :)
autrijus stevan: cool. mostly I think the multiple infinite loops in 6.2.0 warrants a point release
stevan ok
autrijus nice. if svn is back in 9 hours as it should, please commit away, else mail to p6c
stevan++ 16:29
I think svn.perl.org has all the logs
stevan BTW - did you see my bug reports in the log regarding sub parameters?
Corion Heh. I should set up a cronjob that will commit my test fixes in 9 hours :))
autrijus Corion: L::H::* is a good suggestion. I'll go from there 16:31
Corion ...
autrijus stevan: t/pugsbugs/code_blocks_as_sub_args.t ? 16:32
Corion autrijus: I'm usually quite bad with naming things, so you might want to listen to other suggestions :)
autrijus stevan: is the test somewhere?
stevan autrijus: yah I need to mail that to you
autrijus do that (to p6c) then
Corion Is there a peer-to-peer version of svn? Or is svk that? So we can easily/conveniently share the patches even if openfoundry is down? 16:35
(or is SEE our peer-to-peer cvs ? :) ) 16:36
autrijus svk is that.
stevan autrijus: pugsbug sent
stevan needs to run after his kids bbiab 16:37
autrijus k, thx
Corion autrijus: Ah. So I'll have to look into getting svk to work on Win32. Or on Debian, and then how to access it from Win32. Later :)
Corion runs outside to find something to eat.
bbl
theorbtwo notes that svk is packaged for debian.
Strange: src/Main.hs: unknown flags in {-# OPTIONS #-} pragma: _GHC 16:38
(I don't see any whitespace there...)
autrijus theorbtwo: you are running it with ghc 6.2.
don't do that :)
theorbtwo wonders how that happened. 16:39
roie_m autrijus: It does on this side of the continent. I changed angleBracketLiteral to use qLiteral internals 16:41
autrijus roie_m: I'd be happy if you can post that patch to p6c so I can apply it :)
roie_m That way we get interpolation
theorbtwo wonders if .il and .tw count as the same continent.
autrijus .tw is not continental at all :) 16:42
roie_m I will, but I was wondering why you said that not having them use the same thing was good thing this morning.
nothingmuch theorbtwo: il is usually either asia or europe depending on who you aswk
i think for DNS it's europe
autrijus roie_m: it's just cxtOfExp in AST.hs 16:43
pjcj .il won the eurovision song contest a few years back ;-)
roie_m Corion: %a<\tfoo> shouldn't work in any case, because <> doesn't interpolate \t
autrijus it needs to be fixed to correctly identify <foo> as a scalar
i.e. same as {'foo'}
not as {'foo',}
as the naive implementation would suggest
roie_m: I think Corion means a tab not a literal \t
roie_m That makes sense 16:44
but how can that be done in runtime?
autrijus %h<<$foo>> when $foo is a scalar 16:45
roie_m considering that <<$foo>> can interpolate to one word or many
autrijus it is a good question that I have no answer to. 16:46
I suspect we can count the element numbers.
I further suspect you should raise it to p6l :)
$h{'foo'} = want(); # Scalar
$h{'foo',} = want(); # List 16:47
$h<foo> = want(); # Scalar
$h<foo bar> = want(); # List
$h<<$foo>> = want(); # ???
roie_m OK, I'm sending it off in a moment 16:49
nothingmuch beh
beat up friend #2 now has to put all the numbers in his new cell phone
poor thing 16:50
theorbtwo #2?
nothingmuch they were 4 in the car
one got out, got run over
his girlfriend went out after him, and so did the driver and the other guy
driver is #2
he got beat up to
o
theorbtwo Ah.
nothingmuch anyway, ride is here 16:51
ciao everyone
autrijus ciao
theorbtwo Later!
stevan do we have tests for negative indexing in Inf lists? 17:04
autrijus what does that test test? 17:05
stevan I am reading this thread (www.mail-archive.com/perl6-all@perl...9891.html) right now
because I wrote some tests for (0 .. Inf).pop()
but they are discussing that 17:06
it tests insanity really :) 17:07
anyway back to chasing kids around... 17:08
be back in a few hours
roie_m autrijus: how do I generate diffs to post to p5c? "svn diff"? 17:09
autrijus roie_m: svn diff -u 17:10
theorbtwo wonders why hs-plugins uses AltData instead of Data... it means that I can't implement a Typeable a => a -> Val without uglyness. 17:12
(I think...)
Hm, I may be able to do it inside of Embed.Haskell if I create another -boot file. 17:13
autrijus that's fine with me.
roie_m++ # working out lots and lots of corner cases 17:14
roie_m what svn client are you using? mine doesn't like -u... 17:15
thanks, I was afraid I was just being an ass with my questions
autrijus er sorry, just "svn diff"
roie_m: no, you are massively improving the s/n ratio of p6l.
roie_m I use cvs at work too
autrijus I'm using svk as the svn client, hence the confusion 17:16
roie_m Oh. I thought diff -u was CVS syntax (that's probably where it came from) 17:17
autrijus err. never mind me
svk doesn't support diff -u as well.
I was thinking in darcs terms.
ETOOMANYVCS
clkao orz 17:19
Ovid Isn't the command to switch to a different subversion repository "svn switch svn.perl.org/perl6/pugs/trunk"? 17:20
autrijus yes it is
Ovid Is there any alternate syntax? That keeps giving me an error, the last line of which is "svn: PROPFIND of '/pugs': could not connect to server (openfoundry.dyndns.org)" 17:22
autrijus hm, mumble, no idea
just do another svn co
it will be fixed in 8 hours :)
"svk switch" works, but I think "svn switch" need to connect to the old repo 17:23
Ovid OK, doing the co now. Thanks.
roie_m autrijus: One last question before I send the patch: does this make sense? 17:24
+cxtOfExp (Syn "cxt" (Val(VStr c):_)) = c
autrijus roie_m: you are patching against an old tree... Syn "cxt" is now Cxt 17:25
roie_m I couldn't really wrap my brain around AST.hs, and neither could anyone who was in the chatroom this morning (you were out to breakfast)
autrijus and I've added that to cxtOfExp already
cxtOfExp (Cxt cxt _) = cxt 17:26
but send the patch anyway, I can merge
(but, to answer your question, sure, it makes a lot of sense.)
roie_m Oh, darn. I'll get the new version from the other repo, then.
Corion reappears with a somewhat filled stomach 17:29
autrijus greetings Corion-san
theorbtwo Allo, Corion.
Corion autrijus: I just had a weird idea - maybe Benchmark.pm should be ported :)
... so we can track progress :)
autrijus makes sense :) 17:30
and once chromatic ports over Test::Builder
we can then work on Test::Harness :)
nothingmuch evening 17:38
autrijus yo
nothingmuch sits down and earns his YAPC 17:39
elmex cats 17:43
nothingmuch moose
(meese?)
theorbtwo mouse! 17:44
Corion eek 17:50
theorbtwo mousse?
castaway yummy 17:55
theorbtwo Allo, Corion_. How's Corion doing? 17:58
Corion_ theorbtwo: I'm too lazy to ghost him
theorbtwo figured. 18:00
But I'm bored and apparently in the mood to make bad jokes.
autrijus so... journal up 18:01
and I sleep. going back to @family tomorrow
castaway night autrijus
theorbtwo G'night.
See you tommorow (or the day after?)
autrijus tomorrow I think 18:03
autrijus waves &
elmex *grmbl* 18:30
i love bugs...without bugs the life would be so boring 18:35
castaway indeed 18:37
Corion_ Huh ? splice() doesn't exist yet? Weird ! :) 18:40
Hmmm. To implement splice(), I will need to write the four incarnations of splice, correct ? The op1, op2, op3 and op4 (for the one through 4 arg versions, as defined by perldoc -f splice) ? 18:59
... of which the splice1 version is the easiest :)
... and Perl5 doesn't even test for is( (splice @a), [], "single-arg splice() works") 19:00
... not that the one-arg form of splice makes sense IMO. 19:01
gaal: You've been implementing some internals, correct? Is it possible to have the same builtin as an op1 and an op2 ? I'm looking at implementing the four forms of splice() 19:07
19:18 Corion_ is now known as Corion
gaal whoops, sorry was away 19:23
i don't think you can do that, you need to use the ? syntax and then handle the different forms in once place
not sure, but that's the code i did see.
take a look at op2 "exp" as an example 19:25
Corion gaal: np ;) I went with the op4 thing. It doesn't work, but I'll nopaste my code for the lambdawizards to correct ;) 19:38
gaal if i understand things correctly, you should be able to check each value with defined.
see substr, that's 4-op too 19:39
there's a chance you need some extra code in the parser too? i dunno 19:40
probably nor sice the op is defined "pre".
(the op==substr)
theorbtwo You probably will have to do something odd if you want to implement the lvalue style. 19:43
gaal oh, right, there's that too.
but substr should be a good model for that.
theorbtwo Aye. 19:44
pasteling "Corion" at 217.234.103.30 pasted "Rough, nonworking implementation of splice()" (56 lines, 2.2K) at sial.org/pbot/9423
theorbtwo And the perldoc -f is confusing, anyway. 19:45
There is /always/ a replacement list, and the replacement is always done.
If you don't specify anything there, it's an empty list.
Corion substr() seems to be quite what I want, at least I modeled the code after it. It doesn't work, but that's about it.
theorbtwo Of course, that may not hold in p6...
Corion theorbtwo: True, at least that's how I set my defaults.
theorbtwo: Well, as we currently define Perl6, that's up to the implementation ;))
I'm getting lost in all the monads, I guess. But I'm too hazy/tired to understand it at the moment, so I punt, and come back to it tomorrow, with a fresh mind. 19:46
theorbtwo: And while I see you, Tanktalus has asked to get access to the pmdev server - can you add him to the user group? I guess he doesn't even have an account there %-) 19:47
(he's already pmdev on pm) 19:48
gaal Corion, what's the signature (at the bottom of Prim)? 19:51
Corion gaal: No signature yet - I wanted to add that as soon as I get to compiling it :) 19:52
gaal ah :)
Corion gaal: Baby steps ;)
theorbtwo All done, Corion, and the pass /msg'd. 19:53
gaal 'let (pre,rest) = splitAt start arr' makes things better.
Corion yay theorbtwo! 19:54
gaal working on the next problem
Corion gaal: Gah! let ... not <- ... some day, I'll learn the difference ... <- is for monads, right?
gaal yes
what do you want to doArray?
theorbtwo Use <- when the thing being assigned has a Monad m => m a type.
Use = when it doesn't.
Corion gaal: Now it compiles for me, yay! :) 19:55
gaal 'result <- doArray res' doesn't compile for me
theorbtwo (I think...)
Corion gaal: I thought that doArray would be the equivalent to doString, but I didn't look if there _is_ a doArray :)
gaal there is, yes, but it has a different signature
Corion ... I assume that doArray packs a Haskell array into a Pugs array.
Hmmm. No wonder it compiles for me. I commented the whole block out :))) 19:56
gaal :)
Corion Yeah - now I see the type conflict as well :)
gaal where do you see doString?
(i don't see it)
Corion gaal: I found it in substr, I think 19:57
gaal that's doSubstr :)
Corion Ah, no, that was doSubstr, which is defined directly below it
gaal not below, in
it's a local funtion.
what are you trying to do in that line?
Corion gaal: I try to cast res into a VList / VArray... But now I see that doArray is used to perform Haskell array modifications, and not container conversion 19:58
gaal I think that's just VList res 19:59
Corion ah. let result = VList res works
gaal: Yes :)
Now I just need to get to grips with VRef vs. the real array ... 20:00
gaal so you can just return $ VList res
Corion (as writeRef seems to want a VRef and not an array, understandably)
gaal: Yep
But I wonder how I do the inplace modification of the original array ...
castaway 4/away bed 20:10
Corion 4 ? I thought you were two ...
clkao i/win24 20:11
Corion gaal: Yay! Now my splice() at least returns something (not the final result yet). 20:12
gaal how did you solve the writeRef thing? I'm still playing with it.
Corion gaal: I commented that part out, to see if the result itself works (and that seems to work) 20:13
gaal it should... just no rw
actually, that's committable stuff 20:14
Corion gaal: I would commit, if svn was up ;)
gaal ah, right, there's that :( 20:15
Corion Hmm - no, seems like some index is wrong, as it doesn't completely work yet
gaal: I'll nopaste my current incarnation
gaal weird, when i try that code i get three wartnings about unused vars, plus an error wi th no message. 20:16
pasteling "Corion" at 217.234.103.30 pasted "Updated splice() code, no-side-effects version" (26 lines, 973B) at sial.org/pbot/9426
Corion gaal: Yep, I commented the unused stuff out. See the nopaste 20:17
but according to t/builtins/arrays/splice.t, it returns "green blue" where "blue" is expected. Let's look if the test is wrong, maybe :)
Hah. The test is wrong. :)) 20:18
gaal :)
Corion Ah. No. The test is not wrong. The idea is that in scalar context, splice() returns the last element spliced.
Bah.
gaal i need to go do some other stuff now - good luck :)
Corion gaal: np - have fun! And thanks for your help! 20:19
Bah. The other tests all rely on the previous test succeeding. That's really ugly. I'll write my own second set of tests into the file.
gaal sure!
Corion Hmmm... Something more for the pixies - I get an "unimplemented 3ary op splice()", even though I've declared splice() as 4ary op with 3 optional arguments, just like substr. 20:23
good night! 20:57