Pugs 6.2.8 released! | pugscode.org | pugs.kwiki.org | paste: sial.org/pbot/perl6 | www.geeksunite.net
Set by autrijus on 13 July 2005.
yrlnry I need some advice regarding Quantum::Superpositions. I have a list of items, and I want to use Q::S to find an item X such that f(X) and g(X) are both true. $x = any(...); $z = eigenstates(f($x) && g($x)); is not at all what I want. How do I set this up? 01:54
mugwump is the opposite of a premature optimisation called a premature abstraction? 03:33
?evalbot sub f { 8 > $^x > 6 } sub g { $^x & 1 } my $x = any(1..9); sub find(Scalar $x) { if(f($x) && g($x)) { return $x } }; find($x) 03:42
?eval sub f { 8 > $^x > 6 } sub g { $^x & 1 } my $x = any(1..9); sub find(Scalar $x) { if(f($x) && g($x)) { return $x } }; find($x)
evalbot6 Error: Undeclared variable: "$^x"
mugwump ò_ó 03:43
this works for me in pugs 6.2.7, ho hum 03:51
see also examples/sendmoremoney.p6 03:52
ok, that worked once 03:53
Khisanth oh 04:29
mugwump: you didn't get the news?
mugwump Khisanth: news? 05:44
Did someone change the semantics of junctions and autothreading on me? :) 05:45
Khisanth no I mean the $^x
mugwump oh
gone?
Khisanth "Implicit variables like $^a now only work in bare blocks" 05:47
nothingmuch morning 06:12
brentdax waves. 06:23
nothingmuch waves back 06:24
QtPlatypus waves 06:25
nothingmuch waves again 06:27
but this is the last time, my elbow hurts
Khisanth perhaps you should try particulating :) 06:28
nothingmuch thinks of multi-events, and multimethod event handlers 06:29
method get_wave ($waver when { $waver == $QtPlatipus | $brentdax }) { ./reply } 06:30
method get_wave (Any $waver) { }
err, s/when/where/;
07:32 mathieu_ is now known as sphex
dudley Is there a p6 equivalent to Haskell's 'import qualified'? 07:43
e.g. 'use Foo::Bar::Baz as Baz' 07:44
Aankhen`` Not as such 07:45
.
brentdax Glad to see you were amused, Aankhen. 07:57
Aankhen`` Very. =) 07:59
nothingmuch no strict as moose;
i think there was talk about it 08:00
groups-beta.google.com/group/perl.p...this+group <--- maybe this helps? 08:02
dudley hmm, not quite. How can I accomplish the same thing? Refer to a fully qualified class name as a shorter name, I mean. I know I can do 'my $Baz := $Foo::Bar::Baz', but I don't like the sigils in my class names. 08:13
brentdax dudley: There's been lots of talk about supporting C< ::Baz ::= (use Foo::Bar); >, but I somewhat doubt Pugs supports it yet. 08:18
dudley If I declare a class as 'our class Baz{}' within package Foo::Bar, then I can call that Baz within the package and Foo::Bar::Baz from outside the package, right? 08:25
brentdax Yeah, but once again I think Pugs doesn't support that yet. 08:30
dudley Just wanted to make sure it'll work someday :-) 08:32
sleep & 08:34
brentdax How much support does Pugs have for YAML? 10:13
luqui poke 11:03
anybody who knows haskell 11:04
brentdax I'm afraid I'm firmly on the camel side of the camp. 11:12
mugwump I saw an HS-plugin yaml bit, don't know how far it got 11:19
luqui hmm? 11:20
that sentence parsed, but my semantic analyzer segfaulted 11:21
wolverian it was re: 13:13 brentdax : How much support does Pugs have for YAML? 11:24
(probably :)
luqui ah
how do you check if a sub is defined? 11:28
in either pugs or perl 6 (preferrably already implemented)
Aankhen`` ?eval sub foo { 1 }; defined &foo 12:01
evalbot6 bool::true
Aankhen`` ?eval sub foo { 0 }; defined &foo
evalbot6 bool::true
Aankhen`` ?eval defined &foo
evalbot6 Error: Undeclared variable: "&foo"
Aankhen`` luqui: There you go.
luqui oh my 12:04
that was, um, obvious
I was using exists()
thanks
wolverian can I check for specific signatures like that too?
Aankhen`` ?eval sub foo { 0 }; exists &foo
evalbot6 Error: No compatible subroutine found: "&exists"
luqui oh wait
that's no good
wolverian ?eval sub foo () { 1 } defined &foo:()
evalbot6 Error: unexpected ":" expecting word character, "::", term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input
luqui I need it to return bool:false when it's not defined, not die 12:05
Aankhen`` ?eval sub foo (Str $bar) { 0 }; defined &foo:<Str>
evalbot6 Error: unexpected ":" expecting word character, "::", term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input
wolverian I _think_ larry has been using :() lately, but I'm not sure
Aankhen`` wolverian: I think you can't yet grab a particular variant.
?eval sub foo (Str $bar) { 0 }; defined &foo:(Str)
evalbot6 Error: unexpected ":" expecting word character, "::", term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input
wolverian Aankhen``, right. thanks :)
luqui ?eval defined &main::foo
evalbot6 bool::true
Aankhen`` luqui: Wrap it in a try { ... }?
luqui whoops
hmm
Aankhen`` Or that.
Hrm, one sec. 12:06
wolverian ?eval sub foo { 0 } if try { &foo } { "ok" }
evalbot6 Error: unexpected "i" expecting ";", statements or end of input reserved word
wolverian ?eval sub foo { 0 }; if try { &foo } { "ok" }
evalbot6 Error: unexpected "i" expecting ";", statements or end of input reserved word
Aankhen`` ?eval defined %::($?PACKAGE)::<&foo>
evalbot6 Error: unexpected "<" expecting "(", "!", "/", "^", "*", "?", ".", ":" or word character
luqui I'm writing this from Haskell... so I think these are a little... heaviweight
I'm trying to use findSub
but it returns an Eval 12:07
and I'm not sure how to get that back into a boolean that haskell can look at
if that's even possible
Aankhen`` I'm sorry, I dunno about the Haskell side. 12:08
svnbot6 r5786, luqui++ | r1956@jabberwock: fibonaci | 2005-07-24 06:43:57 +0000 12:55
r5786, luqui++ | Added an import test that is bugging the hell out of me. The test doesn't seem to be gracefully detecting failure; somehow "use" supercedes "eval"'s guards.
r5787, Stevan++ | Perl6.MetaModel - (JS version) 13:25
r5787, Stevan++ | * added support for next_METHOD
r5787, Stevan++ | - added test file for this
Aankhen`` ?eval coro foo { yield "first"; yield "second"; }; (foo(), foo()) 14:00
evalbot6 ('first', 'second')
Aankhen`` ?eval coro foo { yield "first"; yield "second"; }; (foo(), foo(), foo())
evalbot6 ('first', 'second', 'first')
Aankhen`` ?eval coro foo { yield "first"; return "hi"; yield "second"; }; (foo(), foo(), foo())
evalbot6 ('first', 'hi', 'hi')
QtPlatypus Cool we have coroteans 14:02
Aankhen`` Actually, we've had coroutines for quite a while, IIRC.
QtPlatypus nods
Aankhen`` I was just wondering what happens when you put a `return` in there.
Excalibor greetings 14:03
Aankhen`` Hiya.
svnbot6 r5788, iblech++ | Usual svn properties. 15:01
r5789, Stevan++ | Perl6::MetaModel - (P6 version) 16:22
r5789, Stevan++ | * moving SELF, CLASS, next_METHOD, WALKMETH, WALKCLASS to the global namespace (*::)
r5789, Stevan++ | - altered tests and files to accomidate this
r5789, Stevan++ | NOTE: This is step 1 in breaking the circularity issues with the metamodel
gaal luqui, ping 16:41
findSub returns Eval (Maybe VCode) 16:42
you can say maybeM (findSub "foo" Nothing []) 16:44
see findVar
luqui what does maybeM do? 16:46
gaal do you know "maybe" without the M? 16:47
luqui not in lowercase
gaal say you have x :: Maybe String
luqui mmkay
gaal you want an expresion that is the string (w/o the Just) if it's Just String 16:48
or some default value that you specify if it's Nothing
luqui right
gaal demote a Maybe to a simple value, with whatever fallback makes sense in your local code. 16:49
luqui how is the fallback specified?
gaal so MaybeM does the same thing with an m (Maybe foo) isntead
as one of the args 16:50
maybe :: a -> (b -> a) -> Maybe b -> a
maybe n f Nothing = n
maybe n f (Just x) = f x
luqui gotcha 16:51
okay, I'll give it a shot
maybeM just works with any monad whatever?
gaal it's defined in Pugs.Internals. around 264 16:52
and it's lifted higher than Maybe
loftier than what I grok really
luqui there's that word again
"lift"
gaal oh that 16:53
it has to do with the law of
nothingmuch lift == be naughty
gaal what do you call it
nothingmuch use a nested monad in the transformed monad
gaal the same law that makes sea level level
nothingmuch e.g. ReaderT IO
liftIO inside a ReaderT IO is ok 16:54
gaal interconnected vessels or something
luqui uh
luqui smiles and nods
nothingmuch but plain old IO is not the same type as ReaderT IO
gaal you lift the monad thingy
your head drops to the floor
nothingmuch but the monad already has your brain
it sucks out your eyeballs, and moves to the next victim 16:55
gaal yeah, that's shiftT
when you had enough, you resetT
nothingmuch luqui: you know the properties of >>= as far as typing goes?
luqui I think so
nothingmuch do { foo; foo; foo } -- all foo's are of the same type 16:56
luqui well, "know", not "grok"
nothingmuch normally
well, if you are in ReaderT IO
for example. 16:57
or any other transformed monad
in order to safely use the type of the nested monad (IO) with a ReaderT IO type, you just wrap the call with liftIO
luqui oh my 16:59
nothingmuch dinner
luqui good thing I'm working on this
&import calling conventions are very broken
nothingmuch luqui: see chapter 5 or so of harrorth
gaal btw, luqui: www-users.cs.york.ac.uk/~ndm/hoogle/ 17:02
the *very neat* thing is that you can search by type signature too, not just function name.
luqui thanks 17:03
gaal try it: say (a -> b) -> [a] -> [b] in the search box and you'll get map (and some other things as well) 17:04
Khisanth doesn't lambdabot do that too?
gaal "@hoogle" does
Khisanth heh 17:05
gaal brb 17:06
luqui gaal: poke 17:43
stevan hey luqui, hows things? 17:45
luqui things are okay 17:46
yet again trying to wrap my brain around haskell 17:47
stevan luqui: I can see :)
luqui and just think, it's all yak shaving anyway
the reason I've spent four hours staring at six lines in Parser.hs 17:48
is because it dies if there is no "import" when you pass arguments to "use"
I could have gotten around it just by, well, not passing arguments to "use"
svnbot6 r5790, Stevan++ | Perl6::MetaModel - (P6 version)
r5790, Stevan++ | * added Perl6::Instance to represent instances of object
r5790, Stevan++ | * removed all circularity (at least I think I did)
r5790, Stevan++ | * Perl6::Object is now completely defined in the metamodel
luqui I see you've just been going on the metamodel since yapc 17:49
stevan luqui: yup, have a Perl6, Javascript and Java version going
luqui Javascript... that's awesome
stevan it's starting to get there I think (assuming Larry doesn't change things again)
luqui We can use Perl 6 to script flash :-)
stevan yup 17:50
have you see iblech's PIL -> JS compiler?
luqui nein
stevan ah
look in perl5/PILJS (i think that is the folder name)
luqui does it have a frontend?
yes 17:51
sweet 17:54
svnbot6 r5791, iblech++ | PIL2JS:
r5791, iblech++ | * Fixed .ref on String, Number, and Boolean objects.
r5791, iblech++ | * $foo[...] dies now if $foo isn't an array. Same for $foo{...}.
r5791, iblech++ | * Yesterday's bug, say ~@array.delete(...), is fixed now.
luqui what's a js interpreter for linux? 17:55
nothingmuch mozilla spidermonkey supposedly
maybe it's not mozzilla only
e.g, has a standalone thingy 17:56
but you won't have any dom
Khisanth maybe someone will write one for parrot :)
geoffb `apt-cache show libsmjs1`, if you are on a Debian-derived linux
Khisanth, that has been discussed here and there, I think
`apt-cache search javascript | grep -i javascript` is fairly impressive 17:58
(to me, at least)
luqui adores gentoo
emerge spidermonkey
stevan Khisanth: IIRC, cwest was working on one in Perl 5 (to eventually get converted/compiled to Parrot)
geoffb luqui, OOC, is there an `apt-cache search`-equivalent for gentoo?
stevan luqui: you can always use a browser too
iblech geoffb: esearch
geoffb iblech, ah 17:59
Wheee, chapter 9, About Monads . . .
Khisanth there is also equery
geoffb finally getting back to reading Haskell tutorials after a couple days off
nothingmuch YAHT? 18:00
geoffb _A Gentle Introduction to Haskell_
nothingmuch ah
nothingmuch hasn't tried that one yet
geoffb Appears to be written as a companion to the standard reference material
(Sorta like the red book is a companion to the blue book in the OpenGL world, I guess) 18:01
stevan iblech: I think the JS metamodel is probably evolved enough to begin intergration
geoffb Yayyy
iblech stevan: Great! :) 18:02
stevan iblech: the big issues I can see are integrating the base container types (Array, Hash, etc)
luqui wow... umm... pil2js is good enough to run Test.pm
I'm thoroughly impressed
geoffb stevan, earlier you said you had P6, Java, and JS versions working -- what about the P5 version?
iblech luqui: And many actually tests pass :)
stevan geoffb: sorry, not p6, it's p5
geoffb iblech++ # giving autrijus a run for his money in implementation speed
stevan has a cold, and is pretty spacey from the meds right now :) 18:03
nothingmuch meds--
sleep++
geoffb stevan, yucko, hate that myself
nothingmuch water++
stevan yes, water++
luqui has to sleep now, but will be back in <=12 hours to work on the pil2p5 compiler
stevan luqui: putter started one of those too
geoffb luqui, yay! again
luqui I'll look at putter's 18:04
geoffb stevan, is there anything left of the P6 MM? Or did it have to be completely scrapped?
luqui I intend to write it in perl 6, if he hasn't
anyway 18:05
hasta luego
stevan luqui: yes, his is in p5
geoffb: that is mugwumps work currently
but is more a sketch, nothing works
nothingmuch stevan: huh? 18:06
stevan iblech: are there JS level container types 18:13
iblech: I see, PIL2JS.Hash 18:14
brentdax Anyone want to fix my pet peeve about Pugs's error messages, and make the "no compatible sub found" error print out the argument types you passed in? 18:15
18:30 iwlx is now known as wilx
geoffb OK, well *that* was brain-melting 18:46
time for a break
gaal meow 18:51
geoffb *yawn* OK, time for ch 10 19:03
Aankhen`` goes to sleep. 19:10
G'night.
iblech Hm... svn.openfoundry.org down, can't checkin PIL2JS patches... 19:24
Anyway, need to sleep now :)
Good night all :)
brentdax Hmm...I have a hashref with some named parameters for a function. If I splat it, it seems to flatten the pairs, too. What to do, what to do... 20:12
(d'oh.)
dudley Can anybody point me towards an explanation of :() ? 21:08
Khisanth a smiley? :)
dudley :( 21:10
Does it mean anything? Or am I just making stuff up now? 21:14
dudley grows ever more confused
Khisanth are you seeing it being used somewhere? 21:16
dudley No, I thought I remembered people talking about it a while back, but I might be hallucinating. 21:17
Khisanth dudley: perhaps you mean ::()? 21:20
dudley Possibly, but they were separate things in my brain. 21:22
Khisanth hmm both ::() and :() appears in the log 21:23
dudley: I guess you can asl wolverian :) 21:24
brentdax I think :() allows you to create a siglet, like :(Str, Int, Array), while ::() is the symbolic dereferencer. Could be wrong about the former, though. 21:29
dudley Aha! it is a siglet! 21:50
groups-beta.google.com/group/perl.p...&hl=en
brentdax++
coral (darren duncan)++ # "I will 21:53
(darren duncan)++ # "assume that =:= is the definitive answer until the official docs
decide to unambiguously say otherwise. "
coral has no idea how that worked out from a single paste keystroke
Khisanth you pasted a newline char :) 21:55
coral it filled in the karma from the previous line, though 22:02
like autointent through irssi somehow
(er, indent)
geoffb pops back out of the left branch (haskell) and heads for the right branch (forth) of his postorder harrorth traversal 22:53
Anyone have a recommendation of which forth interpreter to learn with? Or are the various options fairly close to equivalent? 22:57
A short apt search shows pfe, kforth, gforth, pforth, and yforth . . . . 22:58
mugwump OpenBOOT? 23:00
coral searching for an answer i found a tangent
geoffb heh, I think my wife would actually like to be able to use her Mac at the same time I'm learning forth . . .
coral angg.twu.net/forth.html # Tcl<->PForth
geoffb OK, yforth seems to knock itself out (the package description says "For general Forth programming or learning under Linux, yForth? is not the best choice.") 23:01
?eval ([|] <pfe kforth gforth pforth yforth>).pick 23:02
evalbot6 Error: Cannot reduce() using a unary or nullary function.
geoffb ?eval <pfe kforth gforth pforth yforth>.pick 23:03
evalbot6 'pforth'
coral www.softsynth.com/pforth/pf_tut.htm # pforth tutorial
heh
nice
geoffb and there you go
coral that felt a lot like hitting a small jackpot
geoffb heh