Pugs 6.2.6 uploaded by cpan-upload.p6! | pugscode.org/ <Overview Journal Logs> | pugs.kwiki.org | paste at sial.org/pbot/perl6
Set by integral on 2 June 2005.
svnbot6 r4361, eric256++ | nested_loops/oo.p6 - changed to make a little clearer what the example is doing (hopefully) 00:10
r4362, ninereasons++ | shuffle.p6: sprinkle with more perl 6 -isms 00:18
00:25 Limbic_Region_ is now known as Limbic_Region
Limbic_Region can't tell if that last commit worked or not 00:27
eric256 ping 00:33
Khisanth Limbic_Region: he quit a while ago 00:42
Limbic_Region thanks Khisanth 00:43
I was having problems myself
Khisanth just use tab completion :)
Limbic_Region I am 00:44
Juerd wolverian: What is the yyy in your hostname?
Limbic_Region my client apparently continues to work after they have left
Juerd wolverian: This has bothered me for almost 24 hours now.
wolverian: I can't make any sense of it.
Khisanth Limbic_Region: that is rather odd behaviour
Juerd While cmxxvi certainly does look roman
(926)
Limbic_Region Khisanth - leafChat 1.8 00:45
Limbic_Region hasn't been nor does he intend to become an IRC weenie
it works and that's all I care about
Khisanth goes to track down where the hell is is messing up the heap
wolverian Juerd: I have no idea. :) You'd need to ask my ISP. 00:46
Juerd awww. 00:47
Damnit.
wolverian maybe they are zeroes.
Juerd zeroes in a roman number? 00:49
wolverian exactly! 00:50
it's a brilliant idea.
Khisanth O_O valgrind is reporting quite a few bugs in my X11 library 00:52
nothingmuch blah 01:03
svnbot6 r4363, Limbic_Region++ | Another arbitrary nested loops example (Roy Johnson)++ 01:04
Limbic_Region nothingmuch - I broke down and decided to read YAHT 01:08
nothingmuch Limbic_Region: good luck 01:09
i didn't get along with it
it was nice
up to the monads
then it made perfect sense
except I couldn't see what the heck it was actually doing
in the general sense
that is, i couldn't interpret the meaning, and try to apply it to a hypothetical problem I just invented 01:10
Limbic_Region well - perhaps I will be able to add to my experience to your tutorial
s/to my/my/
I thought you were going to bed? 01:11
Limbic_Region is going to call it a night 01:31
TTFN all
svnbot6 r4364, mrborisguy++ | Added test for 'if' and 'while': if( my = ... ) and while( my = ... ) 01:36
Khisanth NCI should make calling C from Perl easier but how about calling Perl from C? anything to make that easier? 01:44
nothingmuch any haskell heads around? 01:50
scook0 nothingmuch: I'm not awesome with Haskell, but what do you need? 02:03
nothingmuch but i don't know exactly what GHC.Prim.State# is
can you annotate `:i IO`?
i can grok it sort of 02:04
pasteling "nothingmuch" at 212.143.91.217 pasted "my interpretation of the IO monad" (51 lines, 1.9K) at sial.org/pbot/10693
nothingmuch you can probably guess the context 02:05
scook0 nothingmuch: I always just think of IO as being opaque, myself 02:06
nothingmuch i was never satisfied with that ;-)
up already castaway ? 02:07
scook0 well, if you understand the State monad, the hand-waving process is easier 02:08
nothingmuch it's the little pound signs which are confusing me, not state
scook0 nothingmuch: I dunno, it's probably just GHC internals stuff 02:09
nothingmuch =)
scook0 I just think of IO as a State monad that somehow accepts values of the real world and produces new ones
except I can't actually fit the real world in my computer :)
nothingmuch right, that's exactly what that definition says
well duh, you evaluate it lazily using getChar ;-) 02:10
scook0 ultimately, I'm not sure there IS a satisfactory non-hand-waving explanation of IO
if it really bugs you, just explain State, then explain IO by analogy 02:11
nothingmuch i was actually very very satisfied by taking 2 minutes to carefully read :i IO
it's just those damn #'s now
scook0 my hunch is that # just means 'here be implementation-specific dragons', but I dunno 02:12
nothingmuch fair enough =)
autrijus oh. there's a good explanation of IO in the awkward squad paper
complete with operational semantics
nothingmuch morning autrijus 02:13
i think this experiment is becoming very successful, for me at least
autrijus yo nothingmuch. great work on harrorth! not yet propagated to darcs?
you can chase the references in the awkward squad paper if you want to understand IO thoroughtly
nothingmuch no, i 02:14
m still writing chapter 4
i think this is good enough for 5:13 AM
autrijus btw you can ignore the #
the # means "unboxed"
don't worry about that
nothingmuch ah 02:15
autrijus so it's like 02:16
data IO a = IO (State RealWorld -> (State RealWorld, a))
nothingmuch okay
autrijus "the IO type, parameterised by another type 'a', means a function that takes the real world, then returns a modified real world, along with a computed value of the type 'a') 02:17
nothingmuch autrijus: read my nopaste
autrijus the key is the Haskell ensures each RealWorld is only used once
nothingmuch please tell me if it's an accurate interpretation
autrijus looking
err, the RealWorld is parameter to State 02:18
it's not two args
if it's two args it'd be
State -> RealWorld -> ...
instead it's (State RealWorld) -> ...
nothingmuch oh, right
right 02:19
... This function accepts GHC.Prim.State containing a GHC.Prim.Realworld, and
...
autrijus yup.
otherwise correct.
"the universe is just another parameter"
but I need to run for breakfast now. ttul! & 02:20
nothingmuch autrijus: darcs pull 02:31
nothingmuch goes to the shower 02:32
kelan nothingmuch: IO isn't impure if you think about it like this: the IO computation will return the same value every time it's called with the same world 03:26
nothingmuch kelan: as I see it it's a way for it to be impure, but consistent with pure semantics 03:27
but i'm really asleep now, so this may be a lie
kelan heh
nothingmuch and even when I was awake, i was probably wrong
kelan well practically it is impure 03:28
but you can think about it theoretically being pure
if you think of the world as an argument
nothingmuch right 03:29
i'll try to use these fnords, they have good potency
kelan then you see that the IO is taking different arguments every time
nothingmuch yup
kelan so you're writing a haskell tutorial?
nothingmuch yes, except i don't know haskell yet
kelan hah
nothingmuch so it might be easier for others to follow
kelan yes
i think that is a good idea 03:30
nothingmuch since i can't assume anything, we are really on the same level
i'm also learning forth, and eventually parrot
(that's the plan at least)
and please don't comment on how horrible the forth representation is right now - we are going to rethink it soon ;-)
kelan i was wondering what harrorth meant
i don't know forth, so no complaints from me 03:31
nothingmuch did you read the nopaste? or the chapter itself?
kelan the nopaste
nothingmuch in that case: feather.perl6.nl/~nothingmuch/harrorth
i think it's been a pretty successful experiment so far 03:32
kelan someone should write a kwid2html filter for the docs
nothingmuch yes, someone should 03:33
someone probably did but forgot to put it on CPAN
kelan ah, a forth compiler targetting parrot in haskell
that sounds complicated:)
nothingmuch and someone did, but packaged it as part of spork 03:34
yep =)
the premise is: i don't grok haskell, the tutorials haven't been practical enough
it's supposed to be
by introducing complication (fun complication I hope), more real world scenarios can be encountered
instead of nice examples being distilled
kelan do you have an interest in forth, as well? or did you just pick that from a hat
SamB someone wrote something about the G-machine in FORTH on haskell-cafe recently...
nothingmuch i have a mild interest
arcady forth is a pretty simple language, too 03:35
nothingmuch i don't plan to develop in it, but it seemed like a very pretty language
arcady plus, it comes free with openfirmware!
nothingmuch annd now that i made some errors deciphering it, and realized them, i see that it's much prettier than I thought it was initially
but we're going to learn those parts of forth tomorrow =)
btw - for the record, i do like distilled examples very much 03:36
arcady have you seen forth's if/then yet?
kelan what is GADT?
nothingmuch i think the most beautiful bit of haskell I saw so far is Eric Somethingorother's definition of fib
GADT - i'm actually not sure i'll be using it now
i think it's like guards for types
see autrijus's journal entry on it
kelan ah
nothingmuch i just know it exists, and allows for more complicated type checking 03:37
forth is appearantly too simple for it though
kelan heh
nothingmuch arcady: yes, but haven't thought of implementing yet
on the other hand, I have been enlightened on the behavior of the ':' and ';' words, so i suspect it's something similarly elegant
oh shit, it's nearly 7am 03:38
arcady implemented the same way, basically
yeah, you should probably sleep first
nothingmuch at least my hair dried a bit =/ 03:39
yeah, i have to teach assembler at 11 again
nothingmuch makes it 12:
SamB I thought it was just a way to have data constructors fix certain arguments to the type constructor?
nothingmuch SamB: you probably know more than me
autrijus SamB: it's a way to write out data constructors as full functions 03:40
so the element types do not neccessarily appear as parameters to the type constructor 03:41
SamB oh?
autrijus compare autrijus.org/tmp/gadt.hs with autrijus.org/tmp/old.hs
SamB googles his mailbox to look for one of those literate-haskell posts... 03:42
SamB wishes google would find GADTs when searching for GADT 03:43
nothingmuch Ground Air Defence Threat 03:44
eh?
SamB oh, right, I getcha.
scook0 so Haskell is now a national security risk? :) 03:45
SamB groans.
nothingmuch castaway.ruffle(SamB);
kill STOP => nothingmuch.pid 03:46
SamB "[Haskell] Fixed-length vectors in Haskell, Part 1: Using GADTs" may be of interest
?google Fixed-length vectors using GADTs 03:47
SamB remembers that perl people have never heard of all-singing all-dancing bots
how do you google from the channel 'round these parts? 03:48
nothingmuch actually purl is pretty annoyingly-all-singing-all-dancing 03:49
SamB oh?
annoyingly-all-singing-all-dancing? 03:50
Odin-LAP The craziest bot I ever saw can be recoded live.
THAT is insane.
SamB Odin-LAP: what is it written in?
I know one that can reload plugins live...
Odin-LAP SamB: Emacs lisp.
SamB oh, well duh an elisp bot can be recoded live...
Odin-LAP (So there's more than one source of crazy. ;) 03:51
SamB as long as it leaves the input loop running
well, it sounds only slightly crazier than a mIRC-based bot...
Odin-LAP I mean live, as in over IRC. 03:52
SamB oh, that sounds like a security hole!
Odin-LAP Nah. There is some insulation. 03:53
SamB then again, I guess it isn't going to be much worse than a unix filesystem based MUD...
kelan mooix!
SamB thats the one
Odin-LAP O_o
SamB I don't think I installed it, it sounded so crazy...
kelan i think its a pretty good idea if you don't need the box for anything else 03:54
Odin-LAP That sounds ... interesting.
SamB much saner to write an httpd in conventional MOO ;-)
kelan why reinvent everything like the networking, multitasking, etc, when the OS will do it for you
Odin-LAP: mooix.net 03:55
er
hmm
SamB kelan: maybe it would be a good use of UML
kelan or xen! 03:56
i'd like to try xen, but its not drop-dead easy yet
and i'm too lazy:)
sproingie grumbles. don't TALK to me about UML ... 2.6.8, gotta get the kernel myself... 03:57
Odin-LAP Interesting idea, that.
sproingie xen is something you have to boot into, right?
SamB yeah, you need a special monitor and specially compiled kernels
(where monitors have nothing in particular to do with that screen on your desk) 03:58
sproingie yah i want to build a minimal linux to use it strictly as a device driver host. thought i could do the stripping down part with UML
scook0 autrijus: do you have a good reference for subcontinuations (shift/reset et al)? 03:59
sproingie looks like i'll have to use a kernel.org kernel, since apt doesn't show a kernel that kernel-patch-uml supports
SamB is it really a problem to run a 2.4-series UML? 04:00
autrijus scook0: "shift to control" is how I learned it 04:01
scook0: also see chneukirchen.org/blog/archive/2005/...reams.html 04:02
scook0: it's really easy to explain though
(assuming you already grok callCC)
scook0 autrijus: thanks
autrijus callCC $ \esc -> do { foo; bar; baz; esc 123; neverReached } 04:03
scook0 shift/reset aren't the easiest things to google for :(
yeah, I get callCC
autrijus the problem with callCC is you always escape out the whole computation
so neverReached is never reached
scook0 ah
so the escaping continuation needs to provide some way to get back to what it was doing previously? 04:04
autrijus resetT $ do { foo; bar; shiftT $ \esc -> do { baz; esc 1; esc 2; esc 3; return 4 }; neveReached }
scook0 (to ensure that everything that's supposed to get executed eventually does)
autrijus so look at that
resetT creates a "prompt"
then runs some computation
inside that computation you can "shiftT" 04:05
which is like callCC
but the "esc" it gets can be called several times
scook0 nifty
autrijus each time stopping at the place of resetT, never going beyond it
finally at "return 4", it returns on resetT's behalf
so neverReached is still neverReached
scook0 oh, that's easy--thanks for the explanation (autrijus++) 04:06
autrijus but the important thing is that you "fetch" the \esc at the shiftT time
instead of like, in callCC's case, you get the esc upfront
and carry it all the way thru computation
invoking it only once
scook0 I shall ponder this...
autrijus so it's extremely handy to implement perl's return() 04:07
where when you call some function, you push a prompt via resetT
and to return from that function, you simply do a
shiftT $ \esc -> return val
the esc is ignored -- all we care is that we go back at the prompt
scook0 autrijus: I remember someone once explaining callCC as:
autrijus \&return;
(that's my explanation anyway) 04:08
scook0 sub callCC(&f) { f(\&return) }
autrijus right. except it's kind of misleading
because you'd think you can write &f as
sub (&esc) { esc(1); esc(2) }
while in fact esc(1) will never return
so esc(2) will never happen 04:09
unless you delimit it somehow (which is why resetT was invented)
scook0 because activating a callCC continuation will clobber the current path of execution
autrijus yeah.
scook0 cheers
autrijus =) glad to be of help
for further enlightenment, read oleg's two posts 04:10
www.haskell.org/pipermail/haskell/2...15769.html www.haskell.org/pipermail/haskell/2...15844.html
in it he describes how to represent shiftT/resetT on a AST as a Zipper-like structure that can remember its position, so you can freely serialize them -- even multiple coroutine-like thread of execution 04:11
trippy stuff.
er, one correction 04:15
resetT $ do { foo; bar; shiftT $ \esc -> do { baz; esc 1; esc 2; esc 3; return 4 }; neverReached }
the "neverReached" is actually reached after "esc 1", "esc 2" and "esc 3"
it's just not reached when you do "return 4". 04:16
(for obvious reasons)
scook0 autrijus: I was just about to ask that :)
autrijus :)
scook0 so when you activate 'esc', it provides the value to 'neverReached'
autrijus well, yeah, but you need to write it properly
scook0 then when 'neverReached' steps off the end of the block, it goes back to after the 'esc' call
autrijus { val <- shiftT $ \esc -> ...; neverReached val} 04:17
or
shiftT (\esc -> ...) >>= neverReached
exactly.
scook0 oh, so in your example the value just gets discarded
autrijus yes, as is the standard do notation
when you don't write <- it's just discarded
scook0 aye 04:18
autrijus when you have full callCC and runCont
implementing shift/reset is trivial
scook0 so the <- would need to be attached to the shiftT for neverReached to see it
autrijus a prompt is just a restart of runCont
right.
but that's just syntactic aspartame for >>=
(but you already know that) 04:19
ken's slides: www.eecs.harvard.edu/~ccshan/recur/talk.ps.gz 04:21
page 8 gives operational semantics 04:23
oh, you can actually pull a value out of "esc 1" to 04:29
too
shiftT (\esc -> do { x <- esc 1; ... }) 04:30
scook0 talk.ps.gz was helpful, but scheme makes the control flow hard to understand
it's much easier with Haskell & do notation
autrijus amen to that :)
but you can hand-translate them; it's good (and easy) exercise 04:31
i.e. (cons 'x (reset (cons 'y '())) becomes
x <- return "x"
rest <- resetT $ do 04:32
y <- return "y'
nil <- return []
return (y:nil)
return (x:rest)
scook0 shiftT has an implicit resetT, right?
so with nested shiftTs, the inner one will only execute up to the end of the outer one 04:33
(the inner esc, I mean)
autrijus yes. if you shiftT without any outer resetT 04:34
then I imagine it behaving as callCC
i.e. effectively undelimited
oh wait. that's not what you're asking
you're asking shiftT $ \esc -> shiftT $ \esc2 -> ...
no, the outer shiftT doesn't create a new resetT
the two esc share a single prompt
leading to very mind-bending evaluation 04:35
page 11 discusses a variant of shift, called control, that erases the reset when invoking esc 04:39
SPJ discusses all those variants in depth, using monadic notation, at research.microsoft.com/Users/simonp...ontrol.pdf 04:40
(with dybvig and sabry)
their treatment is what Pugs.Cont.* is based one
s/one/on/
scook0 oh, I won't worry about it then 04:41
autrijus it's hard for me to ponder these thoughts without feeling sanity crumbling away :) 04:42
scook0 oh, how come we have two different definitions for shiftT/resetT in Pugs? 04:44
autrijus I think they are compatible 04:45
the one given in AST.Internals is just rigidifying the types
limiting both the prompt and the reset return type as Val
it's there because EvalT is a new monad transformer 04:46
so we can't simply reuse ContT's definition
but have to define MonadCont-compatible shift/reset, by "boxing" EvalT/runEvalT 04:47
on top of the existing definition
scook0 oh, ok
autrijus all these trouble is only because I want a new definition of fail""
if we were simply ContT ReaderT IO
fail"" will trigger ioError
and discard the prompt 04:48
compare it with
fail str = do
pos <- asks envPos
shiftT . const . return $ VError str [pos]
which gives a much better treatment
(it'd be lovely if you can haddock this) :))
scook0 autrijus: that's the idea 04:49
autrijus cool. basically the new fail"" semantic is
"drop the current subcontinuation; report the error, along with the current position, at the caller's prompt" 04:50
the caller will use Eval.trapVal to propagate the error upward
adding the stack trace as it goes
or handle the error itself
compare it with the old fail"" semantic
scook0 I'm still not exactly sure what 'prompt' means though 04:51
autrijus "drop the ContT context with ReaderT environment, raise IO error at the topmost execution"
okay. a "prompt" means "something that waits for a value"
resetT creates such a prompt
do { val <- resetT; ... }
do { val <- resetT computation; ... }
scook0 so the new fail lets you get sane stack traces, and even possibly recover?
autrijus here the resetT is a prompt for computation
exactly. that's the idea
scook0 curious 04:52
hopefully I can get something written up this weekend
autrijus before this new fail"", almost all exceptions are uncatchable :)
scook0 because I have exams all next week :( 04:53
autrijus ahh. take your time then.
scook0++ # immensely helpful
scook0 autrijus++ # doubly so
scook0 is afk (going for a drive soon) 04:55
autrijus :) I'll return to my paper now
autrijus afk &
autrijus ponders how to implement the harmful control construct goto/label in pugs. 05:10
each label takes a callCC and store it in some global hash, probably. 05:11
fortunately there is no active demand for that feature :)
QtPlatypus Is there even a goto/label in the perl6 spec? 05:12
arcady there should be a come from 05:14
autrijus To jump into the next "when" block you must use a "goto"
(S04)
Ordinary "goto" should work as long as itā€™s leaving the current "try" scope. 05:15
(A04)
so obviously it's still there
arcady I thought that was "continue", but okay
autrijus arcady: search.cpan.org/dist/Acme-ComeFrom/
I even made sure that
label: comefrom label; ... comefrom label;
forks at the label: point
;)
arcady heh
autrijus implicit parallelisation! 05:16
arcady but yeah, the falling through to the next when block is done with "continue" according to S04
"You can explicitly break out of a when block and go to the next statement by using continue. " 05:17
oh, hm
autrijus arcady: the diff is
given $blah {
when 1 { ... }
arcady yeah, i see now
autrijus print "foo!" 05:18
when 2 { ... }
}
it results from the very loose coupling between given and when
arcady continue overrides the implicit jump out of given
autrijus yup
arcady and i see pugs has continue 05:21
but not goto?
autrijus yeah.
because we don't yet have labels
we have the &sub.goto() form
which is just claling &sub without changing caller 05:22
arcady oh ah
Khisanth what would be the result of 1..10:by(3) ? 06:01
autrijus (1,4,7,10) ? 06:02
chromatic I'm feeling bug-fixing-ish. 06:03
Particularly t/oo/submethods.t. 06:04
Can anyone who understands signature handling give me a hint? 06:05
Khisanth autrijus: oops, 1..11:by(3) :)
autrijus chromatic: what do you want to fix?
Khisanth: same I think
chromatic Passing values to methods with named parameters that aren't object attributes. 06:06
Khisanth, I agree with autrijus.
autrijus chromatic: method foo ($bar) { ... } ; $obj.foo(bar=>3); 06:07
like that?
chromatic Yep, see t/oo/submethods.t tests 21, 22, and 24.
Khisanth ok, so is there a haskell equivalent of perlfunc? (I know where to find the list them but not the actual descriptions)
chromatic I'm looking in Pugs.Bind.
autrijus chromatic: you give weird things 06:08
$.value = 'default calculated value' unless $value;
chromatic Khisanth, from ghci try :b packagename.
autrijus I'd thought
chromatic :b Prelude
autrijus submethod BUILD ( ?$.value = 0 )
am I mistaken?
chromatic: the way to write it of course the 100 is not assigned
chromatic Yes, that's probably a bad example. 06:09
autrijus s/to/you/
so if I have
method blah ($.x) { }
does calling blah(3) automatically assign into $.x?
that sounds weird, but if that's that, that's that.
chromatic It's positional in that case into the first one I think. 06:10
autrijus huh?
chromatic I don't remember all of the rules on where the switch is from positional to named.
Khisanth chromatic: I was thinking of something closer to "man strcpy" than "less string.h"
chromatic :browse gives their names, :t gives more details on function types. 06:11
That's as much as I use of ghci at the moment anyhow.
autrijus :i is useful too
chromatic: hey. I'm writing about perl6's execution model.
chromatic: do you have some time so I can run it by you here for sanity-checking purposes? 06:12
chromatic Sure!
If you help me with making these tests a) better and b) pass. :)
autrijus sure thing :)
chromatic Suppose I said submethod BUILD ( $?value = 1 ) { $.double_value = $value * 2 }
Is that more sensible? 06:13
autrijus sure.
chromatic Alright, I'll check that in.
autrijus the trick to make them pass is simple
make op1WalkAll take an extra parameter, the list of args to new 06:14
I mean to BUILD
chromatic Is it only BUILD where this doesn't work?
autrijus and make BUILDALL take a list of arguments, instead of nothing
sure. the problem is only that .new() doesn't pass args to BUILD.
that's all. 06:15
also I think you want ?$value=1
not $?value=1
chromatic Yes, that was a typo here, not in the test.
autrijus k. so just make BUILDALL a op2
taking the named args as the argument 06:16
then pass all of them as separate pair of values into BUILD
that's all
chromatic Where do I find the args?
autrijus they are unpacked for you already
in line 939 Prim
as "named" 06:17
chromatic Ah, I see.
autrijus say if it's
a map of (:x<a>, :y<b>)
then you want the op1WalkAll call as
chromatic writes a list comprehension in his head 06:18
autrijus "&BUILD" (Just (Val obj)) [ App (Var "&infix:=>") Nothing [Val key, Val val] | (key, val) <- Map.assocs named ] 06:19
er I mean
App (Var "&BUILD") (Just (Val obj)) [ App (Var "&infix:=>") Nothing [Val key, Val val] | (key, val) <- Map.assocs named ]
ingy hola camelambs
autrijus or something like that.
hi ingy
ingy hi again =)
autrijus chromatic: now, can I start ranting about the execution model? :)
chromatic Hm, when I'm sure I have the right code. 06:20
I'm in Pugs.Prim right now.
autrijus I think I'll type away anyway :)
chromatic Sure.
I'm looking at op2 "BUILDALL", around like 550. 06:21
autrijus (the background is section 2 of svn.openfoundry.org/pugs/docs/talks/hw2005.txt )
(where I'd welcome sanity-checking too -- it's about perl 6 history without me having any first-hand knowledge)
chromatic It looks pretty reasonable. 06:22
There were a couple of Perl.com articles about the RFC process that might be interesting background.
I don't know how much detail you need though.
autrijus I've read all of them, I think :)
so. perl 6 proposes a highly unusual execution model to address the metaprogramming needs.
perl 6 assumes no static grammar. instead, the parser is assumed to be running inside a perl 6 execution environment 06:23
chromatic Yes, mostly. 06:24
It's unclear how that will work with IDEs and things that want to parse Perl.
autrijus with an initial set of Rules that correspond to the default syntactic constructs.
chromatic Yes.
autrijus when a source code is parsed, the perl 6 program -- that is the parser -- runs
taking the source as the input to the toplevel "program" Rule
which is composed of sub-rules that returns AST nodes of various types. 06:25
at various point during parsing, for example during a BEGIN{} block, the parser hands the partly finished AST to the code generator 06:26
the codgen turns that partial AST into object code
chromatic At various points, rules can execute code themselves.
autrijus load it into memory, and execute them. 06:27
those object code have full access to the intermediate parse tree
as well as the parser itself and the active grammar 06:28
and it can modify them freely at will
(I'm not sure if the modification is constrained in the lexical scope.)
(or indeed whether the idea of a lexical scope can be altered.)
QtPlatypus chromatic: My understanding that its intended for perl6 to spit be able to spit out an AST for IDE's to be use for code highlighting ect. 06:29
chromatic I'm not sure the scope is lexical either.
autrijus chromatic: right, but the S* keeps referring those dangerous rewritings as lexical and hygenic
but anyway.
it is also not sure if the BEGIN{} block can modify the codegen. 06:30
chromatic I've always thought of it as replacing parts of the grammar in a dynamic sense, if there's scope or such.
autrijus i.e. by extending the types of AST nodes 06:31
or augmenting the code generator by redefining of subclassing it.
it sounds like a natural consequence of allowing BEGIN{} blocks _and_ having the parser/codegen running in a normal perl 6 execution context.
I'm also not sure how it deals with multiple code generator backends. 06:32
chromatic I'm not sure anyone asked that question before.
autrijus but in any case, both the grammar, the parser and the code generator may be augmented -- or swapped out entirely -- by some compile-time code in the program. 06:33
chromatic Exactly.
autrijus so this is unlike the metaprogramming in Lisp or Forth
acting on the parsed AST level
this is instead acting on the concrete syntax level
i.e. the source code string itself. 06:34
chromatic That depends.
Khisanth in other words "this bit of code might do something completely different from what you expect"?
autrijus that is, while lisp macros typically transforms AST to AST, perl macros can redefine how the parser transform source code to AST. 06:35
chromatic Clearly the easiest way to describe a new grammar is by writing rules that manipulate source code strings and produce AST nodes, but I've always expected to transform AST as well.
autrijus (it can, by extension, also do AST->AST.)
by augmenting the parser.
but the "is parsed" and what little macro specification we see
chromatic Ugh, now I have two different signatures for op1WalkAll. 06:36
autrijus is all based on the C-macro-like source transformation model
instead of operating on ASTs alone
chromatic: that's fine, have DESTROYALL pass an empty args.
chromatic autrijus, I think the C-macro-like is just the easiest entry point. 06:37
autrijus chromatic: nod. 06:38
but anyway. it's clear that how &infix:<(((> changes the grammar
chromatic I mean, it's an actual language, not just an AST. Lisp's had 50 years to come up with a syntax and Erlang's not exactly replacing C yet.
Do you mean by text-substitution? 06:39
autrijus I hope not.
chromatic Me neither. Good. 06:40
autrijus I meant that &infix:<(((> creates a new rule in the precedence parser.
and persumably "is parsed" and "macro foo" calls creates entries into the parser classes
as callbacks that can potentially redefine parts of the parser
finally, depending on the code generator in effect, BEGIN{...} blocks also have a chance of affecting how the object code is generated. 06:41
chromatic The last I remember is that they override methods of the parser.
autrijus right, that's what I thought too.
chromatic Think of Grammar as a class and Rule as a method.
autrijus so it's all highly dynamic and not at all what you'd expect from a separate compilation regime. 06:42
chromatic Exactly.
autrijus so suppose my program looks like: 06:43
use Foo; print 1;
chromatic I'm not sure exactly the role of BEGIN. From the Perl 5 sense, that's where you'd load modules that could define macros or alternate grammars.
autrijus can the Foo module alter how the "print 1" is parsed?
perl 5 lets you do that via source filters among other things.
however, if macros in the Foo module are constrained to be lexical, it cannot touch the calling program. 06:44
chromatic I don't see why not.
autrijus so they are not lexical.
chromatic I think they can escape.
autrijus okay. suppose they escape.
chromatic Otherwise how would you use a grammar defined elsewhere?
autrijus now Foo is not "Foo.pm"
but rather "Foo.pbc"
since we assume separate compilation
(or "Foo.so", or "Foo.jar") 06:45
right?
chromatic I'm not sure.
autrijus but that is a critical point :)
chromatic Foo doesn't have to be Foo.pm, at least. 06:46
autrijus I thought the idea was that we no longer need to keep the source code of all modules involved to compile a program.
because it will make it impossible to hide the source code, among other things.
chromatic Right. You have the option of loading from bytecode.
autrijus so assume Foo.pbc is bytecode.
then we have a mismatch in the execution context. 06:47
if Foo.pm is source code, it will be parsed along with my main.p6
chromatic You need an alternate loader.
I need an empty VHash in the DESTROYALL call.
autrijus just as if I wrote "BEGIN { eval slurp("Foo.pm") }"
chromatic: an empty VHash is written as Map.empty
so. if Foo.pm is source code, it will be parsed along with my main.p6 06:48
chromatic Yes.
autrijus and its BEGIN{} block will run.
whenever I compile my main.p6.
if Foo.pbc is bytecode
it has no BEGIN{} block.
and whatever ways it has to affect the parser will be moot.
when I compile my main.p6. 06:49
that's the thing that bugs me.
perl5 doesn't have this problem because we assume that source filters, BEGIN blocks and other macro things are always executed
chromatic It should be able to affect the parser.
arcady you could maybe put BEGIN blocks in the pbc somehow
chromatic Parrot bytecode has @LOAD and @INIT hooks on subroutines. 06:50
autrijus arcady: except they are specified to not effect runtime... INIT{} blocks do.
arcady right
but they'd be run at compile time
autrijus chromatic: I thought the idea of BEGIN block is that they are always compiled away.
say Foo.pm has "my $x = BEGIN { 3 };"
Foo.pbc should just mean "my $x = 3"
if it's not like that, then the spec of BEGIN needs to change
arcady well, it might have a "BEGIN" segment that's only for running by the compiler 06:51
chromatic I see why you wonder if grammar changes are lexical.
autrijus thanks for understanding. 06:52
chromatic If they are, then they only affect the current compilation unit and by the time it produces an AST to turn into bytecode, it's as weird as it's going to be and it's fine.
autrijus exactly! that's how most other language do that.
but if it leaks out to other compilation units
then those units will depend on the grammar changes to always be recomputed 06:53
chromatic If it leaks out (as I think it does), then bytecode needs to save something to run on load to mangle the world again.
autrijus but what exactly?
because we can't just snapshot a delta
there's no delta
chromatic P5 import() keeps coming to my mind.
At compile time of SomethingSpiffy.p6, it loads IngyGrammar.pbc. 06:54
Then it calls the moral equivalent of import() which makes everything funky in SomethingSpiffy's grammar and life continues as nicely. 06:55
I dunno. That's my impression.
autrijus the signature of that import() will be very curious then.
chromatic import( "Everything I Know About Myself" )? 06:56
autrijus right.
{ use LexicalPragma; python code here } 06:57
chromatic Or there's some hook for current grammar.
autrijus then LexicalPragma.pbc must contain some way to turn python code into PIR 06:58
and swap out the parser entirely
chromatic upgrammar
autrijus upgrammar?
chromatic It's like upvar, but scarier. 06:59
autrijus and if the current compilation target is not PIR, then LexicalPragma.so must contain some way to compile python code to compatible .so
and emit the neccessary loading magic.
chromatic Can it just know how to compile whatever to the standard AST? 07:00
autrijus there's no standard AST for inline C code, is there.
arcady and isn't PIR supposed to be replaced with some sort of AST?
autrijus arcady: sure, but those won't be Perl6 AST.
unless of course perl 6's design goal of compiling to non-parrot machines gets dropped :) 07:01
chromatic There's potential AST that knows how to wrap inline C code.
autrijus chromatic: sure. but it's just handing the problem to the codegen. 07:02
I don't think we can do
foo.p6 -> foo.p6ast -> foo.pbc
because the parser and codegen are executed in lockstep
unless the .p6ast somehow serialises the active grammar, parser state and continuation 07:03
chromatic It ought to serialize loading the grammar anyhow.
autrijus hm? 07:04
chromatic Maybe not. 07:05
Tough question.
autrijus this also means that the Parser and codegen must be written in Perl 6, or something isomorphic to Perl 6. 07:06
(because otherwise you can't augment them with perl 6 code. )
chromatic Yeah, that's been true for a long time.
autrijus since perl 5.000.
:)
hm, 10 years.
it also means the parser and codegen can't be two programs. 07:08
they must share the each other's symbol table.
i.e. a global variable defined in parser stage still needs to be visible during the partial codegen in BEGIN, and vice versa.
chromatic Because parsing might have side effects? 07:10
autrijus exactly.
or may indeed depedn on side effects.
chromatic Right.
hm, op2 "BUILDALL" obj named
named is a VHash, but op2 expects a Val there.
Do I cast? Wrap? Curse? 07:11
autrijus curse I think
you can either:
1. wrap it into a (VRef . hashRef) 07:12
or
2. unpack them into a VList 07:13
or
3. expToEvalVal.
i.e. prepare the Exp in new
then use expToEvalVal to turn it into a Val
you can get back that Exp using a regular fromVal. 07:14
improvise :)
chromatic #1 sounds the easiest
op2 "BUILDALL" obj $ (VRef . hashRef) named
Of course, "easy" often misses "subtly wrong". 07:15
autrijus ok... then you can get "named" back with
doHash val hash_fetch 07:16
i.e.
fetch <- doHash val hash_fetch
named <- fetch
or, more easily
named <- join $ doHash val hash_fetch
chromatic join?
autrijus monadic join. 07:17
join :: (Monad m) => m (m a) -> m a
chromatic Ah.
autrijus it turns a Eval (Eval a) into Eval a
handy stuff.
chromatic Y'know, at some point that's just silly. 07:18
autrijus sure... but silliness beats insanity 07:19
trying to reason about things without using types are far insaner.
(if indeed easier)
(for simple cases) 07:20
chromatic Alright, I'm fairly stuck now.
I'll paste the patch so far.
autrijus cool. time to commit! :)
pasteling "chromatic" at 63.105.17.30 pasted "Adding arguments to BUILDALL and DESTROYALL" (49 lines, 2.1K) at sial.org/pbot/10699 07:22
chromatic Hmm, I'm guessing that having hashval after v is a problem now. 07:23
autrijus all fixed, committed. 07:25
two things: VStr key needs to be (Val (VStr key))
and the Map.empty needs a signature of (::VHash).
enjoy :)
r4367
scook0 returns 07:26
chromatic Were my parameters to op1WalkAll in the correct order in the proposed patch?
autrijus no, you forgot the x 07:27
but it's just currying
so I did away the the explicit unpacking
op2 "BUILDALL" = op1WalkAll id "BUILD"
'sall
chromatic Yeah, I saw that and realized "Wait, that's not enough arguments, so it's currying." 07:28
autrijus *nod*
soon you'll be writing higher-order functions without thinking about it. :)
chromatic Look at Text::WikiFormat sometime.
Actually, don't. Just trust me on that. 07:29
autrijus I think I submitted a patch long ago :)
possibly my first patch to the perl community
chromatic It's a lot easier to identify HOF when there's syntax showing that you've partially applied arguments.
autrijus sure, but it's much harder to do abstractions while having to think about it 07:30
so it's all about what to optimise for :)
chromatic Sure. I'll complain about the opposite tomorrow. 07:31
autrijus XD
ok 24 - ... or value passed in # TODO bug 07:32
isn't it nice that it works whenever it compiles? :)
chromatic++
chromatic I'm not sure why v and hashref aren't backwards. 07:33
hashval
autrijus the v is invocant 07:34
the object itself
the hashval is named args
chromatic Ah, right.
I thought V was for Vendetta though.
autrijus heh.
no, it's for von neumann
chromatic There's a Von Neumann Drive just down the street a ways from here. 07:35
I keep thinking "Road is Sidewalks" but they don't appreciate that.
autrijus so it seems that I can change the rules that defines the grammar of Rules.
thereby metaprogramming the macros. 07:36
chromatic Seems right.
autrijus can't do that while PGE is written in PIR though.
needs to lift PGE into perl 6 to do that. 07:37
chromatic Or at least have it overridable from Perl 6.
That's the last plan I heard.
autrijus hm, how?
that sounds kind of impossible in light of callbacks from rules. 07:38
chromatic Make them visible to Perl 6 as "objects".
autrijus er, sure, but I mean the PGE/P6Rule parser itself
say I want to rebind the "character class" subrule.
chromatic Define a subrule that overrides it. 07:39
Cringe.
autrijus can't do that unless PGE/P6Rule is written in PGE.
I'm sure you know what I mean :)
say I want to rebind the 'a' token to always yield 'b'.
chromatic Four hours ago, sure! Right now? It doesn't seem completely impossible.
Oh, at an atomic level?
autrijus yeah. 07:40
'a' is just another token, no?
as part of a rule
chromatic I see your point.
autrijus hence "metaprogramming the macros"
chromatic Right. 07:41
Argh, that didn't fix everything I wanted to fix.
autrijus what else you want to fix?
chromatic I forgot that roles aren't quite there.
autrijus oh. right.
stevan is supposed to have a concrete implementatoin for me to copy. 07:42
(written in perl5)
chromatic I also have better rules for $?CLASS, $?MODULE, $?PACKAGE, and $?ROLE, but they depend on the metamodel to some extent.
autrijus so I was thinking I'd wait on that while focusing on perl5embed and parrot codegen
nod. I wonder if you can get in touch with stevan to hack the p5-based metamodel prototype 07:43
chromatic All I really need at the moment is to be able to call BUILD submethods from roles.
autrijus it seems an easy way to produce more rigorous tests.
chromatic Will do. I can look at that some tomorrow.
autrijus chromatic++ 07:44
chromatic Are roles not parents? 07:45
In the current implementation, I mean?
autrijus role is synonym to class 07:46
and does is synonym to is.
and submethod is synonym to method.
so it's more like completely missing instead of subtly wrong :) 07:47
chromatic I thought so. Let me dig a little more into my failing tests.
autrijus, can you look at tests 02[1-4]*t for Test::Builder? 07:54
If I make $.diagnostic $diagnostic in BUILD() and set it manually, they pass.
In Test::Builder::Test, that is, in the Test::Builder::Test::Base role.
autrijus sure. because sub doesn't take dot-params yet. 07:55
I need a definition of its semantic.
method set_foo ($.foo) {;}
method set_foo (?$.foo) {return $.foo}
method set_or_get_foo (?$.foo) {return $.foo}
is that legal?
chromatic It sets some of them though.
sili_ where should i be looking to learn perl6 so far?
autrijus "Rules are composable, first-class functions, written in a sub-language of Perl
6 that can parse context sensitive, infinite look-ahead grammars.
"
gawd that sentence is dense. 07:56
sili_: docs/quickref/ in Pugs -- also examples/ -- also the Synopsis documents in dev.perl.org
sili_ thanks
autrijus np :) 07:57
chromatic autrijus, I'm not sure of your question.
autrijus chromatic: okay.
sub foo ($.x); # syntax error?
sub foo ($.x) {...}; # syntax error?
chromatic First one, probably without a block a syntax error.
autrijus method foo ($.x) {}; # automatically set $.x upon calling?
chromatic Second one, runtime error.
Wait, sub... yeah, those are probably syntax errors. 07:58
Third one, yes, the comment is right.
autrijus method foo (?$.x) {}; # sets $.x to undef if called without arguments?
Khisanth why does that block have a ;?
chromatic Because it loves to cuddle ;s.
autrijus Khisanth: no good reason :) 07:59
chromatic How about "leaves $.x with its current value".
autrijus I thought ?$x is specced as ?$x=undef .
do we extend ?$.x to mean ?$.x=$.x ?
chromatic Good question. Let me peruse AES.
autrijus I'm also wary of parameter bindings that does nonlexical assignment. 08:00
but if that's the common case we're optimising for, oh well.
chromatic $.foo is lexical in the sense that it's operating on a lexical invocant. 08:01
autrijus but it erases something, namely $.foo's old value.
i.e. it destroys information
while normal binding doesn't do that.
chromatic Yeah, but we *really* liked it when we came up with it. 08:02
autrijus dons the implementation monkey hat
Ook!
chromatic Alright, S06 confirms that they default to undef.
autrijus easy then. 08:03
chromatic I'm not sure about that for attributes, but there you go.
Shouldn't that be "implementation orangutan"?
autrijus heh.
okay. now look at this.
method foo ($.x) {"do nothing"; return}
$obj.foo(1|2);
say $obj.x; 08:04
this is undefined right.
i.e. it may print 1 or 2 depending on the phase of moon
chromatic Can I mumble "autothread" and run out of the door in the ensuing confusion?
autrijus among other factors
sure, we know .foo is called twice :)
and $.x is set either first to 1 then 2, or first to 2 then 1. 08:05
chromatic Unless there's a pragma in effect that says "Don't autothread outside of a junctive expecty context".
If there's such a pragma.
I'm okay with leaving that undefined now though.
autrijus I'd also like to know how to define such a pragma.
chromatic It's an extension of taint mode.
Call it uncertainty mode. 08:06
autrijus not concrete enough :)
chromatic "Future too hazy at some_program.p6, line 42: ask again later"
autrijus but I'll let it pass for now...
Khisanth perl6 will also be a fortune teller :) 08:07
chromatic I don't think that discussion has ended quite yet. Damian and Patrick had a short conversation about how a core-enough implementation of sets would help unconfuse people about junctions.
autrijus alright then. 08:08
I'll wait until I can see test or code :)
the easiest way to implement method ($.x) is by hacking applyExp to look at each bound symbol that matches (sigil:'.':name)
sili_ i'm having troubles writing a for loop :( how do i iterate over 1,2,3 with a lexically scoped $foo?
autrijus and execute a evalExp (Syn "=", [Var var, Val bound]) 08:09
on the spot.
chromatic Okay, digging.
autrijus you can do it at Pugs.Eval.applyExp level, or at line 1192 in doApply.
Khisanth sili_: for 1..3 -> $foo { } ?
autrijus ?eval for 1,2,3 -> $foo { }
evalbot6 undef
autrijus ?eval (1,2,3).map:{ $^foo + 3 } 08:10
evalbot6 Error: unexpected ":" expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input
sili_ $foo automagically gets lexically scoped?
autrijus ?eval (1,2,3).map:(-> $foo { $foo + 3 })
evalbot6 Error: unexpected ":" expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input
autrijus sigh, evalbot6's quotemeta needs a serious fix
sili_: right, because
-> $foo {}
is just syntactic sugar for
sub ($foo) {}
although the former is a block and the latter is a routine
?eval for 1,2,3 sub $foo { } 08:11
evalbot6 Error: unexpected "f" expecting program reserved word
autrijus ?eval for (1,2,3) sub $foo { }
evalbot6 Error: unexpected "f" expecting program reserved word
autrijus good.
so only blocks can work at that position
sili_ sub sili (Int $foo){say $foo} sili("asdf") # what is the effect of "asdf" on Int $foo? 08:12
Khisanth ?eval sub sili (Int $foo){say $foo} sili("asdf")
evalbot6 Error: No compatible subroutine found: "&say"
sili_ works for me :)
autrijus sili_: theoretically "asdf" should be coerced into Int upon binding to $foo.
sili_: practically it's not yet implemented in Pugs. 08:13
sili_ gotcha
autrijus it however affects mmd.
?eval multi sub sili (Int $foo) {3}; multi sub sili (Str $foo) {4}; sili("str")
evalbot6 4
autrijus ?eval multi sub sili (Int $foo) {3}; multi sub sili (Str $foo) {4}; sili(1483)
evalbot6 3
sili_ stop it you're turning me on 08:14
autrijus glad to be of help.
Khisanth turns sili_ into a unix
chromatic Something like applyExp ('$':'.':name) bound (Prim f) = ... ?
autrijus chromatic: sadly, no. the Exp doesn't matter anymore
chromatic: it's in the bound
chromatic bound _ = ... ? 08:15
Oh, wait.
autrijus chromatic: look at Junc.hs for definition of ApplyArg
you want to do something like
applyExp styp bound body = do
sequence_ [ applyExp (Syn "=" [Var name, Val val]) | ApplyArg{ argName = name@(_:'.':_), argValue = val } <- bound ] 08:16
applyThunk styp bound (MkThunk $ evalExp body)
hm, that's all ;)
not sure if it should be "=" though. maybe ":="
depending on spec
er, make the applyExp a evalEXp 08:17
chromatic What's sequence_?
autrijus sequence :: (Monad m) => [m a] -> m [a]
chromatic Right, don't want to recurse forever.
Ahh.
autrijus sequence_ :: (Monad m) => [m a] -> m ()
map.assuming({$_()}) 08:18
&map.assuming({$_()})
I think that's definition of sequence in perl6 :)
in haskell, sequence can be defined as (mapM id) 08:19
chromatic This won't handle private variables though.
autrijus what private variables?
chromatic $:foo
Sorry, private attributes. 08:20
autrijus [ ... | ApplyArg{ argName = name@(_:twigil:_), argValue = val } <- bound, (twigil ==) `any` ".:" ]
something like that. 08:21
chromatic How greedy is the first _ in the list?
autrijus likes how "any" and "all" works in haskell without worrying about junctions
chromatic: it's always an element.
chromatic Just one?
autrijus i.e. a char.
yeah. otherwise the types won't match.
(:) :: a -> [a] -> [a]
so all the _ except for the last is of "a" type.
chromatic Oh right. I forgot about that operator. 08:22
Good, now it's giving a different error. "Undeclared variable $.reason".
At least the assignment is trying to work! :) 08:23
autrijus everyone wants the colon, so the most common operation -- namely cons, gets it
chromatic Shhhh, cons is slow.
autrijus colon is also cons in perl6.
:a(:b(:c(nil))) 08:24
so. hm.
you need to write out the full form then.
name@(_:twigil:key) 08:25
and then
(Syn "{}" [Var "$?SELF", Val (VStr key)])
instead of
(Var name)
chromatic Ahh, yes.
autrijus you can drop the name@ binding too.
chromatic Can't ignore the invocant.
autrijus yup.
chromatic Is the twigil not part of the name?
autrijus not part of the key
because spec says you can't have both $:foo and $.foo
chromatic Right, good.
autrijus nor $.foo and @.foo
dinner, bbiab. & 08:26
castaway peers at nothingmuch 08:28
gaal ?eval (1,2,3,4).scalar.perl.say 08:29
evalbot6 Error: No compatible subroutine found: "&say"
castaway woops, ENOHDSPACE
gaal ?eval (1,2,3,4).scalar.perl 08:30
evalbot6 '(1, 2, 3, 4)'
gaal shouldn't that be [1,2,3,4] ?
sili_ nmm. given looks like a switch, is that correct?
gaal sili_, given localizes the expression to $_, so you can use 'when' to check cases
they implicitly use smartmatch (~~) 08:31
so you can compare against numbers, types, rules, etc. with very little verbiage.
arcady also, a when's block automatically jumps out of the enclosing given
castaway anyone alive? can one checkout just a subdir of a svn repository? (and how)
chromatic Add the directory name to the end of the path when you do the checkout. 08:32
svn co project.example.com/trunk/path/
autark-jp ?eval qq[&pi() = 3] 08:33
evalbot6 '3.141592653589793= 3'
autark-jp ?eval $?PUGS_VERSION
evalbot6 \'Perl6 User\'s Golfing System, version 6.2.6, June 2, 2005 (r4368)'
sili_ where is ~~ documented?
gaal end of s03 i think? 08:34
castaway ?eval (1,2,3,4).scalar.perl
evalbot6 '(1, 2, 3, 4)'
sili_ yup, thanks
ah, more in so4 08:35
gaal yes, right, there's an important table there
eg %hash1 ~~ %hash2 may not do the first thing you imagine it to (it just compares keys) 08:36
castaway hmm, doesnt it like me?
gaal c, ?
sili_ neat 08:37
good ol perl 08:39
gaal any haskellheads around?
scook0 gaal: what's your issue? 08:40
gaal Pugs.Prim.Eval, around line 60:
the two lines guarding on "trans"
i don't understand the layout: why are these two lines indented?
only because of let in the line before them? 08:41
(the indent is required)
integral trans is being let as well. The let is for env' and trans 08:42
gaal hmmmmm
ok, that makes more sense
thanks :)
integral the = is buried way out to the right :-) 08:43
scook0 trans gets set to (`mergeStmts` Syn "env" []) or id, depending on flag
gaal so the trans is being let conditionally?
scook0 aye
gaal yeah, okay
thanks.
integral nicer than the ternary ;-)
gaal no
gaal likes the ternary :)
scook0 I like the way all the '|'s line up though, looks pretty 08:44
gaal is reminded of the xmas three somewhere in p5 online docs
xmas tree
pasteling "chromatic" at 63.105.17.30 pasted "Nearly Working Attribute-Setting in Method Signatures" (21 lines, 969B) at sial.org/pbot/10701
castaway (durned freenode) 09:08
theorbtw1 Woo, all caught up. 09:10
autrijus, chromatic, still awake? Inside a module, the exportation of new grammars should probably be in import, not BEGIN. 09:11
09:11 theorbtw1 is now known as theorbtwo
theorbtwo ...and exported more or less like anything else that we can lexically export -- $OUTER::*GRAMMAR, or suchlike. 09:11
wolverian heh, some lively p6i discussion! 09:14
theorbtwo It's time to get going, though.
Now I get to go to the post office, and go back, and read yet more scrollback buffer. 09:15
arcady hm... S04 says that given/when's "default" is exactly equivalent to "when true {...}" 09:28
which isn't what pugs thinks
?eval my $a = 0; given $a { when(bool::true) { 1 } default { 2} }
evalbot6 2
arcady then again, I think pugs is probably doing the right thing
wolverian hm. S04 is probably wrong there, as true() is the opposite of not(), not bool::true 09:30
(even if it wasn't it's probably wrong, given the ~~ semantics)
arcady oh, okay 09:31
there's no true() in pugs
wolverian I think that's a good thing. it's the worst named builtin ever. 09:32
arcady if $x == true
if ($x == true) == true
etc.
wolverian yes, that's what newbies would think it does.
arcady in fact, that probably wouldn't even work, because 2 is true but not == true 09:39
and there's no boolean comparison operator
wolverian == is not boolean? 09:44
(well, it doesn't take booleans as args..)
arcady nope 09:45
== numifies its args
so bool::true becomes 1
wolverian right, but it returns a bool.
oh, that's what you meant
arcady ?eval 2 == bool::true
evalbot6 bool::false
wolverian yes. :) 09:46
?eval true 2
evalbot6 bool::true
wolverian ?eval true 0
evalbot6 bool::false
wolverian implemented!
?eval true not true not not true 1
evalbot6 bool::false
wolverian (well, that was fun) 09:47
arcady: if you want, you could ask p6l about the default thing in S04. it _looks_ wrong to me (did it mean 'if bool::true { ... }'?), but maybe people haven't noticed it. 09:48
arcady wait, true just says if something is true
either way it's wrong
oh, and I guess we do have boolean comparison then 09:49
but two operators instead of one
and they're called &true and &not
wolverian yes.
exactly. 09:50
and newbies generally will confuse &true and &bool::true
arcady either way, that thing in S04 is wrong 09:51
wolverian yes, that's my point
as I said, if you want, ask p6l about it!
(it should be 'if bool::true { ... }')
(well, no it shouldn't - that doesn't break the switch.) 09:52
(but something like that!)
arcady it doesn't need to be anything
there's a way to write an always-matching when, and that way is "default" 09:53
wolverian perl wants to implement itself in itself.
arcady well then you'd need a macro or so 09:54
wolverian hmm. no. you can attach a LEAVE { break } to the when's closure argument
arcady oh, okay 09:55
actually, that's what the macro would do 09:56
when expr, &block -> if $_ ~~ expr { &block; break } 09:57
wolverian I'm not convinced when would need to be implemented as a macro. a sub *statement:<when> seems enough
(if it's a statement. I think it is.) 09:58
arcady: correct.
sub *statement:<when> ($expr, &block) { if $CALLER::_ ~~ $expr { block; break } } 09:59
arcady which is basically a fancy way of saying "macro" 10:02
wolverian right, but I don't deal with implementation. ;) 10:03
nothingmuch good afternoon 11:03
larsen good afternoon 11:04
Juerd I/win 32 12:29
s/I//
wolverian you win? :)
(you have more windows than me. congratulations.) 12:30
svnbot6 r4371, iblech++ | evalbot/evalhelper.p5 -- Don't quote '^' (so $^a etc. works now).
r4372, iblech++ | evalhelper.p5 -- Oops, didn't delete a debugging warn().
r4373, iblech++ | svnbot.p6 and evalbot.p6:
r4373, iblech++ | * ?help
r4373, iblech++ | * ?quit only available in private messages so other bots on the same channel
r4373, iblech++ | don't /QUIT as well.
Juerd wolverian: I have more than 32. You have less? 12:37
Two irssis combined, I have over 45
wolverian Juerd: Yes, I only have 28. Why do you have two irssis? 12:38
nothingmuch tabbed browsing is evil
Juerd History.
Until I joined this channel, I had all perl stuff in its own irssi.
But this was a perl channel on a network I was already on :)
wolverian Juerd: Right. :)
nothingmuch i usually have aboug 500-750mb of ram taken by browsers
Juerd wolverian: Note that my hostname on efnet and irc.perl.org is different.
hartkeks++ 12:39
wolverian hartkeks?
Juerd Hard and very nutricious biscuits 12:40
svnbot6 r4374, iblech++ | Limbic_Region++'s examples/nested_loops -- Usual svn props.
Juerd Combined with water, one can replace a sandwich.
wolverian Hmm. That reminds me, I haven't eaten anything today.
Juerd They're also called "Army biscuits"
revdiablo Juerd: do they taste how they sound like they might taste? 12:41
Juerd revdiablo: If you find them sound like slighly vanilla-ish, then yes. 12:42
They're quite addictive
Which is a problem, because as soon as you drink anything, your stomach tends to explode if you ate too many ;)
nothingmuch Hols Limbic_Region... how's YAHT going? 12:48
Limbic_Region sorry - just woke up 12:51
my eyes were getting tired so I didn't make it much past the part where it said 12:52
"multiplication binds more tightly than division"
this struck me as a bit odd
so I decided a break was warranted
3.3.1 - "Strings" 12:53
after I finish my morning routine I will start reading again
how's things with you?
autark-jp S2 says: You may interpolate double-quotish text into a single-quoted string using the \qq[..] construct. Other "q" forms also work, including user-defined ones, as long as they start with "q". 12:58
is that _really_ meant as only using []?
?eval q[ \qq[&pi()] ] 12:59
evalbot6 ' 3.141592653589793 '
autark-jp ?eval q[ \qq{&pi()} ]
evalbot6 ' \\qq{&pi()} '
autark-jp and what about the opposite:
?eval qq[ \q{&pi()} ]
evalbot6 ' q3.141592653589793 '
Limbic_Region autark-jp - that's not the way I read it 13:00
but that might just be that it is unimplemented
and not that who ever added the [] functionality disagreed with you
autark-jp so you see the \qq[] as an example? 13:01
Limbic_Region yeah
if not just an example
why bother say Other "q" forms also work
autark-jp I thought maybe they were thinking of \qa[] \qs[] and so on.
anyway, then I'll try to add that feature. 13:02
Limbic_Region oh - I see where the ambiguity might come in 13:03
but that really doesn't make much sense to me
autark-jp where?
Limbic_Region your counter examples 13:04
still [] but just changing the second letter
seems quite silly to me that would be what was meant
autark-jp which second letter?
Limbic_Region \qa[] vs \qq 13:05
Limbic_Region is obviously not communicating effectively
too early in the morning and not enough caffeine 13:06
autark-jp almost bedtime here :)
Limbic_Region IMO - all q constructs should work as you expect
9:10PM is bedtime on a Saturday night?
autark-jp ... :) 13:07
well 22pm, but I said _almost_ ;)
svnbot6 r4375, scook0++ | * Initial Haddocks for shiftT/resetT 13:13
r4375, scook0++ | * Minor tweaks to hw2005.txt
geoffb *yawn* g'morning, all 13:20
Limbic_Region salutations 13:22
geoffb Bloody hell -- firefox crashed, taking all of my half-read tabs with it.
Limbic_Region geoffb - do you have a tab extension or two installed
gaal geoffb - google for "firefox session saver" 13:23
geoffb Bleah . . . what the world needs is a browser that maintains tab state through crashes, like a decent editor would.
Limbic_Region geoffb - FF has it
geoffb Limbic_Region, nope. gaal, ooooh
wolverian geoffb: epiphany does that too, built-in. 13:24
gaal opera was the first that got it right i think
Limbic_Region well FF can't do it out of the box
Aankhen`` geoffb >> Just search for SessionSaver. 13:27
geoffb I love that they have a vibrant extension community and all, but I'd like to be able to `apt-get firefox-bloated-pig` and just get every extension that makes some modicum of sense. Perhaps they need a pumpking who likes to merge extension modules into the core set . . . .
gaal how do i export data constructors in haskell? 13:29
without enumerating them?
integral Type(..)
gaal that's on the import decl, no? how do i do it on the module (export) decl? 13:30
integral err? That is on the export decl
gaal then it ain't working :)
integral eg. module Pugs.AST.Internals ( Exp(..), ) where ...
gaal i have to stare at this some more, i am trying that but am obviously doing something wrong. 13:31
integral is GHC giving an error?
gaal the code using that module gives a Not in scope error 13:32
isn't importing the constructor, obviously
integral hmm, is it importing with a specific list?
gaal no
oh, maybe another module before that one had already imported it? 13:33
integral hmm?
gaal i'd expect the compiler to do the right thing, but...
if i do import A, then import B
and B's the one i want the constructors from
but A itself had done import B with a qualified list 13:34
integral they both export the same constructors?
gaal no, no
integral hmm!
gaal oh, crap, just a typo! 13:35
integral :-)
gaal somehow these things always are.
but the rule is you never discover it until you ask someone etc. 13:36
hmm. okay, now how do i throw an exception not from Prim.hs? 13:42
fail doesn't do anything.
integral is out his depth there
geoffb Limbic_Region, you logged off before I could mention to you: please do more p6 puzzles . . . puzzle 2 was a nice brain stretch, and fun to boot . . . , 13:45
Limbic_Region geoffb - have you seen some of the other p6 posts I have made? 13:47
geoffb Nope, I was out for most of yesterday -- unexpected house guests. 13:48
I know only of cribbage (p6 puzzle 1) and nested loops (puzzle 2)
Limbic_Region perlmonks.org/?node_id=453215
geoffb I've had no chance to explore your node history. ;-)
gaal seen autrijus
jabbot gaal: autrijus was seen 5 hours 21 minutes 56 seconds ago
Limbic_Region perlmonks.org/?node_id=451398
there's two more for you to play with 13:49
geoffb Fed to newly session-saving Firefox, will take a look after backlog reading (and perhaps doing the --perl5 import tests autrijus asked for yesterday) 13:50
thanks!
gaal geoffb, tests for caller() would be very welcome too 13:51
Limbic_Region ok - making slow progress with YAHT
geoffb gaal, OK, will consider
gaal L<s06/The "caller" function">, already some in t/builtins/caller.t
thanks!
geoffb gaal, thanks for the S* and t/*/* pointers, saves me having to use my noodle at this ugly hour 13:52
gaal sure
(here it's actually the most beautiful hour of the day -- i might go out for a walk) 13:53
Limbic_Region is going to meet another monk later today and make my wife happy by finally going to a filipino restaurant 13:54
only after the fact will I tell her that it is my anniversary gift to her
gaal & 13:57
masak Limbic_Region: why? 14:16
svnbot6 r4376, gaal++ | opEval refactoring, introduce EvalStyle type
r4376, gaal++ | TODO: allow some evals (eg., require/use) to raise exceptions on errors
Limbic_Region masak - why what? 14:17
masak why will you only tell her after the fact? 14:18
s/only tell her/tell her only/
theorbtwo Limbic_Region: You're going to take somebody else with you when going to your anniversary dinner?
Limbic_Region theorbtwo - yep, jdporter and his wife 14:19
masak ah, and I guess that's the reason too :)
geoffb nothingmuch, (reading backlog) Very cool for doing TAP in assembly. :-)
Limbic_Region and because my wife is silly when it comes to things like flowers or chocolates or diamonds for gifts
she would rather me give her money
which I won't do
theorbtwo Um, don't you keep joint accounts anyway?
masak :)
Limbic_Region theorbtwo - I am single acct holder on my account and joint on hers 14:20
>:-)
theorbtwo Ah.
Still seems kind of silly.
Limbic_Region you weren't raised in a 3rd world country 14:21
theorbtwo This is true.
Limbic_Region where the cost of a dozen roses in the US equates to a week or two's salary
theorbtwo This is true. 14:22
Limbic_Region is liking Haskell so far
but I am progressing very slowly
theorbtwo I'd rather have money for my birthday from most people... but not from Jess.
...since there is effectively no difference between me having money and Jess having money. 14:23
Limbic_Region doesn't observe his bday and hasn't since he was 8 or 9
theorbtwo does.
Aankhen`` does too.
theorbtwo More to the point, other people do, by giving me gifts.
Juerd birthdays suck.
Aankhen`` Birthdays rock.
geoffb Juerd, mine will if my wife's does. :-) 14:24
theorbtwo Somebody needs to write a firefox extension to .deb maker. 14:28
Juerd extensions are installed in your user profile, not system wide.
theorbtwo Juerd: Can do either way. 14:29
Limbic_Region I know some modules ask if they should be installed locally or globally 14:30
I wasn't aware there was a way to make an extension that didn't ask install globally
s/modules/extensions/
svnbot6 r4377, autrijus++ | * related work: Perl6::Rules, P6C and PGE. 14:40
Aankhen`` Is `if(...)` a valid construct? 14:41
Or is the space between the statement and the brackets required 14:42
?
theorbtwo Aankhen``: So far as I know, there's no spacing dependency there.
Limbic_Region those are backticks right
so it is shell dependent
Limbic_Region personally prefers ksh
Aankhen`` The backticks was just to distinguish the code from the rest of the sentence. :-)
s/was/were/ 14:43
Limbic_Region oh
heh
and that isn't ls as in list the directory
it was Is as in a question
Limbic_Region really needs more caffeine
Aankhen`` Yep.
Heh.
theorbtwo Aye.
OTOH, `-as-quote-- 14:44
Aankhen`` Strange.
theorbtwo ` looks nothing like a quote -- it looks like an accent mark, by no accident.
I really hate it when things try to make quotes out of `` and ".
Aankhen`` When I run t/rules/from_perl6_rules/charset.t manually in Pugs, it runs the tests without problems.
theorbtwo They don't match.
Aankhen`` But `nmake test` is giving me a parse error. 14:45
Aankhen`` wonders if the parsing changed in the newer versions.
theorbtwo >> I'm just following Markdown syntax.
I was using |...| earlier, but that looked marginally more ugly. :-)
arcady hm, pugs does not support ``, or qx[] 14:48
theorbtwo C< ... > is the perl5ish way to do it. 14:50
Aankhen`` That's three keystrokes instead of two, plus Shift.
theorbtwo ` ... ` is the kwiki-doc-thingy way to do it, but I'm not too fond of that either.
Generally, around here, just say what you mean with no quotes, and hope people know what you mean. 14:51
Aankhen`` Mmm, I guess.
Wow. 14:55
Win32: Only 45/6128 subtests failed.
eric256 ?eval localtime 15:04
evalbot6 Error: No compatible subroutine found: "&localtime"
eric256 ?eval time 15:05
evalbot6 171212725.332989
Limbic_Region ?eval localtime(time)
evalbot6 Error: No compatible subroutine found: "&localtime"
Limbic_Region wanders off for breakfast 15:06
castaway tumtitum 15:07
ah, much better
eric256 pugs doesn't have a local time equivalent yet?
theorbtwo eric256: Not that I'm aware of. 15:08
Write one in p6, and stick it in src/perl6/Prelude.pm?
castaway wow, I can see something..
eric256 does the perl5 localtime convert those seconds to the date? or is there another form of magic that can be used?
theorbtwo eric256: Convert the seconds since Jan 1 2000 to the localtime. 15:10
The hard part is figuring out what TZ to use.
That may need some extra magic...
eric256 and leap years, etc.
theorbtwo Yeah, perhaps my plan is not the best.
eric256 lol. maybe haskel has a builtin for that. i'm googleing to see if the algorythm is sitting out there somewhere 15:11
wolverian should the perl6 time primitives return time objects?
theorbtwo wolverian: Don't think so... possibly, with overloaded nummification. 15:14
castaway sighs
geoffb wolverian, I'd like them to . . . with appropriate numify and stringify
While I hate that DateTime is slow as a dog, I'd have to say functionality-wise it has been a godsend 15:15
wolverian I agree. :) 15:16
eric256 can you force context ? my $x = Object time();
geoffb I've had to subclass it on occasion to have a faster new(), but other than that, good stuff.
I would assume my $x = time() would get the object. 15:17
integral eric256: hmm, would my Time $x = time() maybe work?
geoffb Then you would do +$x or ~$x to get the num or string
integral someone said something about context including type information, but it may have just been speculation
eric256 integral looks like the same idea
since you can tell subs what they return, you should be able to pick which sub based on what you want to get 15:18
geoffb honestly, I'm not understanding why you don't want to always get the object here, and just numify and stringify properly . . . .
integral I suppose I would never really want time() to return an Int anyway.
QtPlatypus Does MMD match on return values? 15:19
theorbtwo Having time return something you can treat as an integer is often nice... but there's no purticular reason I'd want to have it be a hard number, and when I really do, I can always use +.
QtPlatypus: No.
integral yes, _treat_ as an integer, but it's not an integer
you can add it with other _times_, but adding an integer to it doesn't make sense.
eric256 i don't care so much about that specific case, but shouldn't dispatching take into account the return value? 15:20
theorbtwo Well, no.
If I want 10 seconds from now, time+10 should do what I want.
(BTW, time should be straight nullary.)
integral time + Time->new(seconds => 10)
10 doesn't encode the idea the it's seconds.
theorbtwo Ugh.
It's in seconds because that's what time returns. 15:21
integral it does? eww!
eric256 i would hope at worst it would be Time.seconds(10) or even 10.seconds
theorbtwo I'd rather have it in my head once then in every bit of code I write that manipulates time.
10`s would be OK, but the Units thing can override time(). 15:22
eric256 time() + 10 ` sec; #isn't even that bad
geoffb The problem is that if you always assume numbers are seconds, then you instantly get people thinking a day is 86400. Which it's not.
eric256, that would be more reasonable
eric256 is ` still the system quote thing or is that gone? /me is hoping it is gone 15:23
theorbtwo eric256: `` is qx as a circimfix quote operator; ` as infix may be units (with a module, please!)
eric256 then how does it know my $x = 5`m + 10`f; is infix instead of circumfix? 15:24
integral is there a reason to use ` rather than *?
eric256: a circumfix operator doesn't make sense after a 5.
my $x = 5 qx(...);
gaal rehi 15:25
eric256 hmmm i as long as it understands. lol. as usual perl is going to be smarter than i give it credit for. ;)
geoffb hi gaal 15:26
eric256 i thought barewords are no longer allowed... how do we do `m then? or do i make `m the whole operator and make it postfix?
integral m is a bareword?
sub m { return MassUnit.new } 15:27
eric256 my $x = 5`m;
hmmm. that is an interesting idea. and since we now have prototype perl will know not to expect any arguments for m
integral oops :-) sub m () returns Units::Unit { return Units::Mass.new } 15:28
QtPlatypus Could it be a postfix function? And pass 5 Units::Distence.new ?
(m is a unit of distence) 15:29
integral would be happy with: my $x = 5 * gramme;
eric256 then ` could be multisub infix:<`> (Int $value, Units::Unit $unit) { $unit.convert($value) };
integral why does it need to be ` not * ?
eric256 i think it reads clearer 15:30
because you arn't multiplying, you are converting a number to a unit object
theorbtwo I think so too.
Also, not all "apply unit" is multiplication.
20`degC, for example.
integral hmm, ok. So ` combines a number with a unit, and * works on pairs of numbers or pairs of units
theorbtwo 20`AWG even more so.
Or combines a unit with a unit. 15:31
integral mm, isn't that just * working on a pair of units?
theorbtwo $yards = (20`ft + 10`m)`yd
No.
$area = (20*ft + 10*m)*yd
eric256 yea. you want math to read clear to. my $x = 5'f * 6; is clearer than my $x = 5 * f * 6; 15:32
integral ah, that's what I was missing
I didn't think of converting a mixed thing to a unit like that. theorbtwo++
theorbtwo The idea is that in general, it messes with the units without you looking.
But it can't pick between multiple equivlent units that way.
(Of course, it can probably guess pretty well, pretty often.) 15:33
eric256 multiple equivalent units that way? what? 15:34
QtPlatypus 25'm * 7'f
theorbtwo If I add feet and meters, it doesn't know if the result should be in feet, or in meters.
QtPlatypus I would default it to metric 15:35
eric256 yea. but it should convert to one, and put it in an object, the object could default to the last but since its an object it could be asked for either.
QtPlatypus If the behavour if units(1) is a good indercator 15:36
theorbtwo Right, I'd default to metric as well, where applicable.
Well, probably whatever the input was in, but if we have to do any conversions, become metric. 15:37
In any case, I'm also hoping I'll be able to convert to ftin and have it tell me that I'm 5ft + 6in.
gaal anyone remember how to ask ghc to use less ram during make?
QtPlatypus I realy cleaver implementation would guess from the local. 15:38
theorbtwo No, QtPlatypus, that'd be horrible. 15:51
Code would suddenly, unexpectedly, do something different when run elsewhere.
uk pint vs us pint is bad enough. 15:52
integral use Units::Imperial; use Units::US; use Units <US>; use Units::OneTrueSystem::Metric; ;-) 15:53
geoffb integral, didn't metric change as well . . . I seem to remember cgs v. mks . . . 15:55
integral hmm, I would call the systems CGS and Metric
I don't really know much, but I've never heard CGS be called metric
geoffb fair enough . . . my History of Science is fairly poor
I always found it odd that in either case, one of the fundamental units is prefixed. 15:56
integral went to some history of maths lectures but can't remember much
it is a wee bit odd :-) 15:57
gaal can recommend one or two good books on the subject
look for ones by Morris Kline 15:58
svnbot6 r4378, gaal++ | fix to use EvalStyle
geoffb gaal, which subject? HoM or HoS?
gaal math
eric256 in examples i just commited units.p6.. its just a basic proof of concept and its broken but i'm not sure why. ;) 15:59
geoffb gaal, I have enough trouble with math itself. HoM may just kill me
gaal why? i imagine a history of haskell might be less lethal than haskell. 16:00
eric256 i did some weird things that arn't needed now...5 minutes after starting it. lol. if anyone could help me figure out the error it throws that would be great. in the mean time i'm updating my pugs, perhaps its a bug thats fixed already 16:01
geoffb gaal, point taken
gaal which file, eric2^8? 16:02
geoffb I just never had luck in political history classes, because I constantly got "On date foo, bar happened. On date quux, baz happened." And had no way of knowing if bar and baz were related. I assume the same will happen in HoM. Unless the author is very good and explains the items at hand I suppose. 16:03
svnbot6 r4379, eric256++ | The very start of a units module. Just proof of concept stuff so far.
eric256 units.p6 in examples.
geoffb But that kind of writing skill is rare
Limbic_Region is finding Haskell incredibly difficult 16:04
Limbic_Region has spent too much time training his brain to think iteratively
gaal geoffb, actually he uses just enough philo of math to make it cogent and interesting, withough (for me, at least) being overwhelming. --and i don't know mathe very well!
qmole Limbic_Region: what are you struggling with?
Limbic_Region thinking recursively 16:05
nothingmuch good evening 16:06
geoffb Out of curiosity, why did you train yourself to think iteratively? (That's a real question, BTW)
qmole ah
gaal ugh, that unit stuff is giving me a headache, sorry eric, can't help i'm afraid. 16:07
eric256 lol. it seems if i qoute the Meter it works. ;)
nothingmuch Limbic_Region: how's your YAHT progress going?
eric256 its ugly in its current state gaal
Limbic_Region geoffb - that is a paragraph answer
nothingmuch oh wait, have to cook for my sister
Limbic_Region nothingmuch - still in chap 3
the underlying reason is that I am interested in writing efficient code efficiently 16:08
gaal not your fault eric
geoffb Interesting book list, gaal: www.marco-learningsystems.com/pages...kline.html
theorbtwo I thought CGS and MKS were both metric, but only the later is SI.
svnbot6 r4380, gaal++ | usual svn props on units.p6
theorbtwo In any case, CGS and MKS are pretty well interchangable, no?
geoffb (er, I assume you already knew that, I meant "it looked interesting to me")
Limbic_Region iterative solutions to naturally recursive problems usually take far more time to come up with then is saved then running the recursive version 16:09
so by training my brain to think iteratively - I get the best of both worlds
gaal i read _Mathematics in Western Culture_ and _Mathematics for Liberal Arts_, i think, maybe another one too (it was a while ago :)
geoffb Limbic_Region, interesting.
crysflame www.sidhe.org/~dan/blog/archives/000400.html # Dan exits Perl 6 16:10
gaal the two i mentioned were fairly similar in scope, actually; with the latter being a little gentler.
geoffb gaal, which would you reccomend to start with
Limbic_Region can't really think of any serious code that I have written with recursive functions (in Perl that is)
geoffb Limbic_Region, whereas I can't think of a complex naturally recursive function that I got right when I tried to do it iteratively. :-) 16:11
gaal they were both good. if you haven't ever read anything about, oh, cantor for example, then the second might be more appropriate
for some reason when i look at that list most of the titles look familiar :) but i'm sure i couldn't have read them all 16:12
Limbic_Region geoffb - besides - write a recursive function for fibonacci series w 16:13
without caching
and ask it to calculate fib(100)
geoffb crysflame, *sigh* too bad he's not planning to do a public postmortem -- though I suppose that means there's some personal issues involved
gaal, thanks
gaal sure 16:14
geoffb Limbic_Region, right, true . . . but memoizing is a fundamental recursive concept. Not optimally efficient, of course, but hugely better.
crysflame it's perl 16:15
gaal if the argument to a p6 function is a bare class, what's the signature? sub foo(Class $c) ?
ie called foo(Cat) 16:16
geoffb Mind you, this is coming from someone whose first language after BASIC was Z80 assembly . . . so I get wanting to be able to do optimally efficient execution kernels
theorbtwo Limbic_Region: [*] 1..$_ 16:17
geoffb I just have a hard time fitting enough of a complex iterative mess into my head to do algorithmic optimization . . . I find that easier to do when the code is very small. 16:18
theorbtwo Isn't that just so wondefully concise?
Limbic_Region theorbtwo - that's not fibonacci
geoffb theorbtwo, different function
Limbic_Region that's factorial
and yes
I know how to use infix operators
that's not the point
eric256 hmmm. done for now.. working more and looking cleaner yet. hehe. but the overridden + still isn't working, i think there are still issues with those
theorbtwo Oh, fibonacci.
Limbic_Region in general - haskell wants you to think recursively
geoffb Actually, come to think of it, I often get just as much mental clarity out of using multiple iterative passes as going all the way to recursion -- sometimes more. 16:19
Learning that it was OK to take more than one pass over my data made a HUGE difference to my ability to handle complex problems.
theorbtwo Limbic_Region: I'm not 100% sure of that, but largely.
geoffb I'd been taught for so long to only ever take one if algorithmically possible 16:20
Limbic_Region geoffb - when I think of how to solve a problem I think how I would solve the problem myself (on paper usually)
iteratively - I only need to know the previous state to get the next one
recursively you need to keep a running list of everything you have seen before until you get to some stop point
IOW - iteratively once you have completed an operation you can effectively throw it away 16:21
recursively you can't
geoffb Limbic_Region, nodnod
theorbtwo Yeah... I generally prefer thinking iteratively, because it prevents me from blowing /my/ stack. 16:22
(I care a lot less about the computer's stack.)
geoffb You know, now that I think of it, each new execution model I grok makes it easier for me to cast a given problem into some easy form. Duh. I suppose that's obvious
theorbtwo Yeah. 16:23
geoffb I just spent too long trying to force everything into the iterative model, and hence the reason I no longer trust it quite so much.
theorbtwo, thanks for the vote of confidence. ;-)
theorbtwo Given enough eyeballs, all bugs are shallow. 16:24
geoffb reminds himself "Better to be thought an idiot than open ones mouth and prove it." sigh.
Limbic_Region s/prove it/remove all doubt/
geoffb See, and there you go.
theorbtwo Most things that humans can even consider will fit well in one model, given that you have enough to choose from.
geoffb is too tired to have a big ego. That comes with sleep.
theorbtwo geoffb: Everybody is idiotic sometimes. 16:25
theorbtwo is idiotic most of the time.
geoffb Somebody just blogged about that on use.perl.org this week.
geoffb wonders whether hubris and tiredness are in fact inversely correlated 16:26
Limbic_Region puts YAHT down for a while to absorb what he has learned up to this point 16:27
theorbtwo What is "this point", limbic?
eric256 heads off. could someone peek at units.p6 (in exmaples) and see if you can get the + overloading to actualy get called? 16:28
later
Limbic_Region 3.8
ok - I think I am also going to go spend some time away from the puter 16:31
TTFN all
nothingmuch phew 16:33
too many things to do
gaal is there something akin to ask, that gets my VCode? 16:35
actually, no
given an env, where's the VCode?
nothingmuch which vcode? 16:36
gaal i'm doing caller 16:37
i can get to the caller env
but i want to query the vcode
subName etc.
nothingmuch hmm 16:38
grep recursively for CALLER
i forgot how it's done
$?CALLER::SUB should contain the vcode in question
gaal ah right, CALLER
thanks
btw: 16:39
:set grepprg=grep -n -r --exclude=*.svn* --exclude=*.o --exclude=*.hi
makes vimming happier
you obviously need gnu grep for this
nothingmuch how does grep work from vim? 16:40
gaal :grep moose src/ 16:41
:cl # shows a list of hits
:cn # next on
:cp # prev one
:6cc # 6th one
same as quickfix
nothingmuch really has to learn to use quickfix 16:42
gaal 06nothingmuch really has to learn to use quickfix01
nothingmuch most of my compilations are on remote machines though
integral o_O purplish
theorbtwo nothingmuch: When are you arriving in toronto? 16:43
nothingmuch 21st
i think afternoonish, but I'm not too sure
theorbtwo Are you staying someplace for the night, and then being picked up? 16:44
nothingmuch yep
theorbtwo OK.
nothingmuch why do you ask? 16:45
gaal food, bbiab & 16:48
geoffb iblech.ping 16:56
Or hell, can anyone explain the story behind these:
r4374, iblech++ | Limbic_Region++'s examples/nested_loops -- Usual svn props. 16:57
I see several of them in the past hours.
gaal docs/other/development_tips 16:58
geoffb gaal, thx 16:59
gaal: docbot :-) 17:00
geoffb blinks
Um, why is that not just done as the global default? Does SVN not do that? 17:01
iblech geoffb: Pong 17:03
geoffb: There're some ways to make that thing automatically, but they're, at least last time I checked, a bit kludgy 17:04
geoffb ah 17:05
nothingmuch back to teaching assembler... ciao guys!
geoffb So I should just always do that sequence before commit
nothingmuch++ just for doing that
nothingmuch geoffb: eh? 17:06
iblech ...before you checkin a new file, yep
iblech food &
geoffb teaching assembler. It's a good thing to do
iblech, thx
nothingmuch ah
i'm afraid we aren't getting far with it... it's more of a "make sure it's done by tomorrow" sort of thing 17:07
geoffb And TAP for assembly is genius, I might add
nothingmuch she called me a bit too late
geoffb s/teaching/tutoring/?
nothingmuch oh, it's very ugly
geoffb: perhaps, i don't really know the diff
tutoring == 1 on 1?
geoffb I often think of it as 1 on 1, sure, but I really meant "it sounds like she's taking a class (from someone else?), and asked for your help?" 17:08
Or are you the prof?
nothingmuch no, i'm not a prof
her major was something else in school, i forgot what 17:09
and then she was moved to computers
and her sister is a very good friend of mine
so i was called in to help
geoffb heh
gotcha
nothingmuch make up for a year of missed studies mostly
geoffb nodnod
nothingmuch it's a shame it's so annoying to her 17:10
she doesn't appreciate this stuff very much
ooh, /me is like a snake.. burned finger 3 days ago, and now skin is peeling 17:11
geoffb sigh
(about the lack of appreciation)
nothingmuch aye 17:12
Khisanth nothingmuch: so why is she in this field of study?
nothingmuch Khisanth: she was moved because her previous major course was canceled or something
and in order to finish high school she needs to be tested on a subject
someone decided for her, methinks 17:13
Khisanth that seems rather silly
nothingmuch it's very sill
Khisanth that sounds worst than here in fact
nothingmuch they also teach it quite badly
gaal anyway, nothingmuch, CALLER unfortunately doesn't do what i need for, ah, caller.
i don't want to go through SUB
nothingmuch gaal: look at how it's set up
gaal in the parser?
nothingmuch i forgot how it's done, but I remember that it's simple
no, in the evaluator 17:14
gaal but i don't have a handle on that through env
i can upstack, but that's only for env
nothingmuch hmm
gaal that has position, filename, etc, but not code.
i suppose i *can* readVar "&?SUB", but that's hacky 17:15
nothingmuch their excercises are very stupid too... They are always dummy problems with no meaning, odd requirements, and they use the wrong tools for the job
anyway, i must be off
gaal byea. 17:16
i'll bbiab also. & 17:18
Aankh|Clone Does Perl 5 embedding work for anyone on Win32? 17:54
(MSVC++)
17:54 Aankh|Clone is now known as Aankhen``
Aankhen`` And what exactly do !!! and ??? do? 18:05
mugwump >> Ping. 18:10
theorbtwo !!! dies when executed, ??? warns when executed, ... gives back a value that warns when looked at.
Aankhen`` theorbtwo >> Ah, thanks.
theorbtwo AFAIK, the first two don't have names -- bang-bang-bang, huh, and yaddayaddayadda? 18:13
Aankhen`` LMAO.
svnbot6 r4381, Aankhen++ | * Date::Gregorian -- fixed Perl 5 array syntax. 18:16
mrborisguy kharma Aankhen 18:17
karma Aankhen
jabbot mrborisguy: Aankhen has karma of 53
gaal Aannkh - they don't currently work.
it
mrborisguy karma Aankhen``
jabbot mrborisguy: Aankhen`` has karma of 4
gaal it dosen't work
(p5 embedding)
Aankhen`` Ah.
Dang.
I was hoping to use Date::Gregorian to replace HTTP::Date.
But it might be a little hard to develop and debug if I can't even use the module. :-\ 18:18
gaal hard to fix, too, because GHC used msys gcc.
geoffb mrborisguy, do you happen to know if it counts ++'s multiple times when a multiline svnbot6 appears?
bah 18:19
always just missing people
gaal i think it does, geoffb.
Aankhen`` It does, geoffb.
perlbot karma Aankhen
perlbot Karma for Aankhen: 56
geoffb perlbot karma geoffb 18:20
perlbot Karma for geoffb: 5
geoffb wow, I'll be damned.
Aankhen`` I think MusicMatch Jukebox didn't like being asked to prepare a CD label for a 5,000 song playlist...
geoffb Is examples/perl5/ supposed to be for things that make use of use Foo--perl5 ? 18:22
gaal seen autrijus
jabbot gaal: autrijus was seen 9 hours 55 minutes 49 seconds ago
gaal geoffb, dunno. 18:23
Aankhen`` Oh great, it finally wakes up and tells me I have no printers installed.
gaal what were you expecting it to do, rampage? 18:24
("it" sounds like you're constructing a golem :-)
Aankhen`` No, I was expecting it to show me a preview of how it would fit 5,000 artists and song titles on one tiny CD label.
pasteling "geoffb" at 69.110.115.185 pasted "Something not right with use Foo--perl5; supposedly equivalent code in p5 and p6 don't act the same (but don't crash, either)" (35 lines, 1.1K) at sial.org/pbot/10709 18:43
geoffb I have a funny feeling that debugging the above is beyond my current skills -- given that I don't read Haskell yet. :-) 18:47
afk for a bit (sandwich and head-clearing 19:12
mrborisguy can somebody help me with trying to use XML::Simple's XMLin to work in p6? 20:28
svnbot6 r4382, mrborisguy++ | Vim Syntax Highlighting: support for q:1{..} and q:2{..} (so my entire file doesn't turn red if I use one of those! ;) )
mrborisguy i can't seem to figure it out! 20:29
when I do: use XML::Simple--perl5; my %hash = XMLin( "test.xml" ); it gives me an error about XMLin not found 20:32
use XML::Simple--perl5 <XMLin>; my %hash = XMLin( "test.xml" ); gives me an error about not being able to find XML::Simple
(i'm on feather, and I did a locate, and XML::Simple is in one of the perl5 directories
crysflame has no skill to answer the question 20:33
iblech Try XML::Simple::XMLin? 20:36
(But I can't be of much help either, as my Pugs doesn't embed Perl 5)
geoffb mrborisguy, sorry for delay: Are you expecting &XMLin to be exported to you? It isn't right now . . . its a feature. 20:38
er, unimplemented feature
export from --perl5 doesn't happen.
mrborisguy iblech: *** No compatible subroutine found: "&XML::Simple::XMLin"
geoffb Autrijus asked for tests, which I've been idly plaing with over time. 20:39
mrborisguy geoffb: is there anyway I can use XMLin then?
or will I just have to be patient?
geoffb mrborisguy, yeah, see my pasteling above
sial.org/pbot/10709
(My problem seems to be farther down the line, but I did get past the initial binding problem)
mrborisguy so just use 'eval_perl5' is my way to go? 20:40
geoffb Autrijus also claims the following will work:
autrijus: geoffb: it's merely adding "our &foo := Module::Name.can('blah')" calls 20:41
Didn't try that variant though
hhhhh hi 20:44
anyone awake?
geoffb yep, for some of us it's still light out 20:45
arcady or the middle of the day, even
ingy hola 20:47
geoffb allo
mrborisguy geoffb++: alright, that definitely worked for me... thanks
geoffb mrborisguy, np. Did you go the eval_perl5 rought or the .can() route? 20:48
mrborisguy eval_perl5 route
ingy while pugs is compiling I have a question... 20:49
mrborisguy ingy: fire away
ingy does `prove` work with pugs testing?
prove t/foo/bar.t
etc
iblech It does. 20:50
mrborisguy geoffb: i just tried the 'can' method too, and that works just as well!
geoffb schweet. And looks cleaner too, I may switch then.
ingy iblech: thanks 20:56
geoffb Wheeee . . . recompiling fun 21:09
svnbot6 r4383, mrborisguy++ | Vim Syntax Highlighting: a few more small changes ( q :1 { .. } )
ingy has a new module that should help make pugs testing faster... 21:12
geoffb ingy, please! It's brutally slow here
ingy hmm 21:13
prove t/builtins/arrays/end.t <--- *blows up*
t/builtins/arrays/end....Can't exec /usr/bin/pugs at t/builtins/arrays/end.t line 1.
geoffb But other tests work? 21:14
ingy it is `prove` that is not working 21:15
./pugs t/builtins/arrays/end.t <--- passes all 13 tests
geoffb sorry, I meant "But prove with other test files works"?
ingy prove is not working with pugs environment
iblech Ah, it's probably because of missing ENV variables 21:16
geoffb I'm guessing you did not 'make install' pugs, given that you refer to ./pugs above, but you want it to notice that there is a bugs in the cur_dir and use that instead?
er s/bugs/pugs/
hmmm 21:17
geoffb is Obvious Boy today
iblech Add your Pugs dir to $PERL6LIB and $PATH
ingy well /usr/bin/pugs is not where my pugs installs
iblech: why would prove care about PER6LIB? 21:18
my answer likely lies in inc/Test/Harness.pm 21:21
hi DrForrester
iblech ingy: So the tests find Test.pm
ingy iblech: that's not my problem though
hrm... prove is execing the #!/usr/bin/pugs 21:23
iblech Ah, that's another problem. IIRC there's $PERL_HARNESS or so, but I've simply created a symlink from /usr/bin/pugs to $PWD/pugs 21:25
ingy hmmm 21:26
well that is *one* way to do it
ingy dives into Test::Harness...
iblech Yep. And it allows you to start Pugs by entering "pugs", and not "./pugs" :) 21:27
ingy iblech: HARNESS_PERL=./pugs prove t/builtins/arrays/end.t 21:44
is what I neeed :)
iblech :) This should definitely go into docs/other
SyntaxNinja wow. lots of folks in here these days :) 22:38
ingy hi SyntaxNinja 22:41
SyntaxNinja hi ingy 22:52
ingy is there a way to set an environment variable such that it always interpolated to the current date 23:04
geoffb ingy, I would think not without the complicity of any called programs -- otherwise, at best you could get an interpolation as of the start time of a subprocess. 23:05
But maybe that's enough . . . .
Sadly, though I think this would be possible, my shell-fu is too weak to do it. Some sort of delayed evaluation beastie, I suppose 23:06
ingy hmm. I know what to do now....
svnbot6 r4384, geoffb++ | Added golfed version from perlmonks.org/?node_id=463610 23:22
geoffb And with that, I'm out for a while. 23:23