pugscode.org/ | nopaste: sial.org/pbot/perl6 | pugs: [~] <m oo se> (or rakudo:, kp6:, elf: etc.) (or perl6: for all) | irclog: irc.pugscode.org/ Set by Tene on 29 July 2008. |
|||
00:08
justatheory left
00:34
jferrero left
00:39
[particle]1 joined
00:51
[particle] left
01:34
_Chillance_ left
01:39
Maghnus left
01:40
Maghnus joined
|
|||
pugs_svn | r22166 | lwall++ | [rx.t] fix pugs fudging | 01:59 | |
02:05
meppel-san joined
02:06
justatheory joined
02:10
bacek joined
02:17
justatheory left
02:20
meppl left
02:24
hercynium_ joined
|
|||
meppel-san | good night | 02:43 | |
02:44
meppel-san is now known as meppuru
02:45
meppuru left
02:49
lambdabot left
03:03
elmex_ joined
03:19
elmex left,
elmex_ is now known as elmex
03:24
hercynium_ left
03:27
yahooooo left
03:50
justatheory joined
04:03
alester left
04:13
justatheory left
04:15
lambdabot joined
04:32
alester joined
05:00
eternaleye joined
05:01
aindilis left,
Lunchy left,
aindilis joined
05:32
Psyche^ joined
05:44
Patterner left,
Psyche^ is now known as Patterner
06:17
viklund left
06:18
viklund joined
|
|||
viklund | perl6: say :foo<>.perl | 06:18 | |
p6eval | rakudo 30809: OUTPUT[("foo" => [])] | 06:19 | |
..elf 22166: OUTPUT[Odd number of elements in anonymous hash at ./elf_f line 19.Pair.new(!!!)] | |||
..pugs: OUTPUT[*** Named argument found where no matched parameter expected: (foo,Syn "," []) at /tmp/kGq5mr0wii line 1, column 1 - line 2, column 1] | |||
viklund | hmm, that looks like a bug in rakudo to me, shouldn't the output be ("foo" => "") | 06:20 | |
irhd++ found it while hacking on november | |||
TimToady | well, pugs actually has it right :) | ||
viklund | ok | ||
TimToady | but in general, :foo<bar baz> is short for :foo{'bar', 'baz'} | 06:21 | |
or maybe :foo['bar', 'baz'] really | 06:22 | ||
but the question is whether the [] is constructed by the infix:<,>, which I suspect it is | |||
viklund | should they all work without params? | ||
perl6: say :foo[].perl | 06:23 | ||
p6eval | rakudo 30810: OUTPUT[("foo" => [])] | ||
..elf 22166: OUTPUT[Undefined subroutine &Main::ARRAY called at (eval 117) line 3. at ./elf_f line 3861] | |||
..pugs: OUTPUT[*** Named argument found where no matched parameter expected: (foo,Syn "\\[]" [Syn "," []]) at /tmp/JaCAAIDPeZ line 1, column 1 - line 2, column 1] | |||
TimToady | it ought to be equivalent to "foo" => () | ||
since <> is really qw// | |||
viklund | yes | ||
hmm | 06:24 | ||
TimToady | but () in scalar context is likely to be some kind of undef | ||
viklund | rakudo: ("foo" => ()).perl | ||
p6eval | rakudo 30810: RESULT["(\"foo\" => [])"] | ||
viklund | rakudo: ("foo" => (1)).perl | 06:25 | |
p6eval | rakudo 30810: RESULT["(\"foo\" => 1)"] | ||
TimToady | pugs: ("foo" => ()).perl | ||
p6eval | pugs: RESULT["\\(\"foo\", ())"] | ||
TimToady | pugs: ("foo" => (1)).perl | ||
p6eval | pugs: RESULT["\\(\"foo\", 1)"] | ||
06:26
REPLeffect left
|
|||
TimToady | pugs: ("foo" => (1,2)).perl | 06:26 | |
p6eval | pugs: RESULT["\\(\"foo\", (1, 2))"] | ||
TimToady | pugs: say ("foo" => (1,2)).perl | 06:27 | |
p6eval | pugs: OUTPUT[\("foo", (1, 2))] | ||
TimToady | pugs: say (:foo(1,2)).perl | ||
p6eval | pugs: OUTPUT[\("foo", (1, 2))] | ||
TimToady | pugs seems to be representing pairs as captures of 2 positionals | 06:28 | |
that aside, I think pugs is behaving more sanely on () probably | 06:29 | ||
viklund | ;) | ||
TimToady | I think it could be bad to promote () to [] in general | 06:30 | |
viklund | yes, probably. | 06:33 | |
06:33
viklund left
06:52
eternaleye left
06:54
Alias_ joined
06:56
eternaleye joined
07:06
alanhaggai left
07:17
alester left
07:23
bacek left
07:24
alanhaggai joined,
Alias_ left
07:26
sri_work left
07:48
eternaleye left
07:50
zamolxes joined
07:53
eternaleye joined
|
|||
moritz_ | TimToady: are you aware that rx.t isn't runnable by rakudo? | 07:54 | |
08:11
kane_ left
08:35
jferrero joined
|
|||
moritz_ | TimToady: and where is method Match.produces defined? | 08:46 | |
08:46
alanhaggai_ joined
08:57
eternaleye left
09:02
alanhaggai left
|
|||
Tene | pugs: (foo => 2) | 09:06 | |
p6eval | pugs: RESULT[\("foo", 2)] | ||
Tene | pugs: (foo => 2, bar => 3) | 09:07 | |
p6eval | pugs: RESULT[(\("foo", 2), \("bar", 3))] | ||
Tene | pugs: {foo => 2, bar => 3} | ||
p6eval | pugs: RESULT[(\("foo", 2), \("bar", 3))] | ||
Tene | TimToady: if we have (a => 1,b => 2), what do we need the {} form of the same thing for? | ||
moritz_ | the difference is that (..) interpolates, {...} doesn't | 09:11 | |
Tene | Ah, right. | 09:14 | |
pugs: [foo => 2, bar => 3] | |||
p6eval | pugs: RESULT[\(\("foo", 2), \("bar", 3))] | ||
Tene | What about that? | ||
09:15
iblechbot joined
|
|||
moritz_ | that's a list of pairs, not a hash | 09:15 | |
Tene | Hm. | ||
pugs_svn | r22167 | moritz++ | [t/spec] fudged rx.t for rakudo | ||
moritz_ | rakudo: "a" !~~ /b/ && say "yes" | 09:18 | |
p6eval | rakudo 30812: OUTPUT[Null PMC access in set_pmc_keyed()current instr.: 'parrot;Code;ACCEPTS' pc 5633 (src/gen_builtins.pir:3735)] | ||
moritz_ | anybody willing to fix this? blocks a few dozens regex tests | ||
rakudo_svn | r30813 | moritz++ | [rakudo] added bool.t to spectest_regression, and s/pge-tests/rx/ | 09:20 | |
Tene | in set_pmc_keyed? Weird. | ||
Tene looks | 09:21 | ||
Huh. Code::ACCEPTS tries to set $/ in somewhere inappropriate... | 09:26 | ||
Yeah, in CALLER | 09:27 | ||
Why isn't that working here? That's weird. | 09:28 | ||
moritz_ | !~~ should be Code::REJECTS | 09:29 | |
Tene | REJECTS calls ACCEPTS | 09:30 | |
moritz_ | that's bad | ||
Tene | then negates the result | ||
moritz_ | because REJECTS shouldn't set $/ | ||
(IMHO) | |||
maybe we could add a REJECTS method that doesn't set $/ | |||
Tene | Probably. | 09:31 | |
moritz_ | how can I coerce to bool in pir? | ||
Tene | assign to int, or use a small shrub of goto ... if ... | 09:32 | |
Anyway, it's src/classes/Code.pir:36 | |||
moritz_ | yes | 09:33 | |
Tene | Which I guess you found. | ||
I'm a bit too asleep to swap in enough to figure out why that's null in this case. | |||
rakudo: sub foo { 'a' !~~ /b/ && say "yes" }; foo() | 09:34 | ||
p6eval | rakudo 30814: OUTPUT[Null PMC access in set_pmc_keyed()current instr.: 'foo' pc 140 (EVAL_13:63)] | ||
Tene | rakudo: sub foo { 'a' ~~ /b/ && say "yes" }; foo() | ||
moritz_ | I think I've got it working | ||
p6eval | rakudo 30814: RESULT[{}] | ||
09:34
barney joined
|
|||
Tene | Oh, is that because ACCEPTS is being called from REJECTS? I think so. | 09:35 | |
moritz_ | well, not quite | ||
yes | |||
Tene | Except REJECTS doesn't get a lexpad? | ||
moritz_ | dunno what's the cause it | ||
but match could be NULL if the match fails | |||
anyway, I've got a solution here locally | |||
will run tests and then commit | 09:36 | ||
Tene | fantastic | ||
moritz_ | thanks for your help Tene | 09:37 | |
Tene | btw, moritz++ for tests | ||
moritz_: also, always feel free to harass me by name for rakudo stuff. I'll help if I'm awake. | 09:41 | ||
moritz_ | Tene: ok, will do (gladly ;) | 09:42 | |
Tene | I'll work on anything anyone is willing to ask me about. | 09:43 | |
rakudo_svn | r30815 | moritz++ | [rakudo] implement Code::REJECTS that doesn't set $/ and doesn't die. | 09:44 | |
r30815 | moritz++ | I don't really know if that's correct, though. Will ask p6l for clarification | |||
Tene | moritz_: you didn't change the POD in that copy/paste | 09:45 | |
Formally, you should look up and return Bool::True/False, I think. | |||
moritz_ | thanks | 09:46 | |
no other method seems to look up Bool::True/False (from a quick ack) | 09:47 | ||
Tene | Or, no, maybe you just return whatever the function returns... | ||
for: | |||
unless ... -> $n { ... } | |||
Or is that not allowed? | |||
Bah, specs. | |||
moritz_ | it is allowed | 09:48 | |
but I'd have to negate a match object | |||
which is kinda... weird | |||
Tene | Just leave it until someone writes a failing test. That's what I always do. ;) | 09:49 | |
rakudo_svn | r30816 | moritz++ | [rakudo] fix POD in Code.pir | ||
moritz_ | TDD++ | ||
Tene | (other people doing work for you)++ | ||
09:50
Grrrr left
09:53
iblechbot left
09:58
larsen_ joined
10:07
alanhaggai_ is now known as alanhaggai
10:12
Jedai left
|
|||
pugs_svn | r22168 | moritz++ | [t/spec] rx.t: unfudged, use double quotes where stuff should be interpolated | 10:16 | |
moritz_ | currently 3281 tests pass, which is an improvement over yesterday ;) | 10:21 | |
pugs_svn | r22169 | moritz++ | [t/spec] some more corrections and unfudging in rx.t | 10:29 | |
10:34
ludan joined,
meppl joined
10:37
abra joined
10:43
Grrrr joined
10:57
iblechbot joined
11:13
PZt left
11:18
dr_df0 joined,
dr_df0 left
11:19
Chillance joined
11:31
pmurias joined
|
|||
pmurias | is get a lot of Couldn't match expected type `Buf.ByteString' against inferred type `ByteString' | 11:31 | |
when building pugs, it used to build before | |||
seen a warning at the top which seems to explain the error | 11:34 | ||
11:43
rindolf joined
11:53
pmurias left
11:55
larsen_ left
12:10
kane_ joined
12:12
barney left
12:23
Lichtkind joined
12:26
charsbar left,
charsbar joined
12:33
ludan left
12:35
sri_work joined
12:36
pim joined
|
|||
pim | Hi, how can i write this perl5 code easyly in perl6 : my @files=`ls -1tr`; ....? | 12:37 | |
moritz_ | @files = qx{ls -1tr}; | 12:38 | |
lambdabot | Unknown command, try @list | ||
moritz_ | but I doubt that rakudo or pugs implement that | ||
pugs: say qx{ls} | |||
p6eval | pugs: OUTPUT[*** Unsafe function 'Pugs::Internals::runShellCommand' called under safe mode at /tmp/T4wn7xZceC line 1, column 5 - line 2, column 1] | ||
moritz_ | well, maybe pugs does ;) | ||
12:38
preflex left
|
|||
pim | thanks | 12:39 | |
i try... | |||
moritz_ | works here | ||
12:39
pim left
12:41
preflex joined
12:42
pim joined
|
|||
pim | sorry i have been disconnected. | 12:43 | |
for me this does not work a all : qx{$command}; | |||
no. | 12:44 | ||
12:48
pim left
12:56
Chillance left
13:11
jrockway left
13:12
jrockway joined
13:21
abra_ joined
13:22
aindilis left,
abra_ left,
aindilis joined
13:23
abra left
13:27
larsen_ joined
13:33
iblechbot left
13:36
larsen__ joined
|
|||
moritz_ | qx doesnt interpolate | 13:38 | |
qq:x would | |||
13:42
alanhaggai left
13:49
larsen_ left
13:50
iblechbot joined
14:09
alanhaggai joined
14:16
jrockway left
14:17
Myoma left
14:33
larsen__ left
14:35
rindolf left
14:36
jrockway joined
14:38
alester joined
14:39
pmurias joined
14:50
araujo left,
alester left
14:52
araujo joined
|
|||
pugs_svn | r22170 | pmurias++ | [pugs] pre-working (ugly) start of the m0ld pugs backend | 15:03 | |
pmurias | @tell ruoso what do you thing of the top-level m0ld block receiving and $interpreter and $scope? | 15:04 | |
lambdabot | Consider it noted. | ||
pmurias | * think | ||
TimToady | moritz_: .produces is just a placeholder for however those results should be evaluated; it's just modelled on the notion that Match and Failure both have a .produces tester, neither of which do. | 15:13 | |
probably really wants to be a multi rather than a method | |||
but I didn't know if parrot already had some way of testing against those particular specs | 15:14 | ||
anyway, my job is to make sure it parses under STD, not under anything else :) | 15:15 | ||
15:16
jrockway left
|
|||
pmurias | are there any reasons for not making lots of small commits instead of a few big ones? | 15:19 | |
PerlJam | pmurias: committing in conceptual units? | 15:22 | |
15:24
jrockway joined
15:27
wknight8111 left
|
|||
TimToady | small commits usually make it easier to back out something broken as long as consistency is maintained, but a partial patch breaks things too, so as usual "it depends" | 15:27 | |
pmurias | thanks | 15:29 | |
pugs_svn | r22171 | pmurias++ | [pugs-m0ld] replace ? with generated identifiers | 15:33 | |
moritz_ | TimToady: it would be nice if the method used in the test suite were somehow specced; at least I try to work in that direction | 15:34 | |
TimToady | we're talking about building the basic tests into the language so you can just start with plan | ||
moritz_ | ok ;) | 15:35 | |
TimToady | maybe "produces" should be a very low precedence infix | ||
so we can multi it | |||
originally I was just going to write "ok produces(...)" but that was kinda ugly | 15:36 | ||
pmurias | TimToady: "building the basic tests into the language", you mean having plan and ok in the Prelude? | ||
TimToady | yes | ||
15:37
sri_work left
|
|||
TimToady | and any others we deem common enough | 15:37 | |
and all easily overridden by a real "use Test::FooBar" | |||
but just basic functionality | |||
the idea being that we make it easy to write TAP the way we made it easy to write POD | 15:38 | ||
moritz_ | well, we can always write class Match is also { method produce ... } | 15:39 | |
TimToady | (this was discussed on Wed's conf call, and was generally approved of) | ||
we could do that to | 15:40 | ||
though it forces you to do "is also" on non-cooperative classes | |||
or put it into Object and redispatch to a multi | |||
but if we're building in ok and friends, we could also build in an assertion that could be appied "en passant" to values | 15:41 | ||
and an infix "produces" would work pretty well for that | |||
moritz_ | what do you want the semantics of "procudes" to be? I somehow can't associate useful semtantics with it | ||
TimToady | it would depend on the types of both the left and right args | 15:42 | |
you check Match objects differently than Failure objects | |||
moritz_ | so it's another "smart match", but not ~~ ? | 15:43 | |
TimToady | yes, because ~~ notionally returns boolean, not the left arg | ||
it's like a POST block on a value expression | |||
open to better words for than than "produces" | 15:44 | ||
on the other hand, we're using it as a boolean inside "ok"... | |||
so kinda ignore what I just said :) | 15:45 | ||
15:46
[particle]1 left
|
|||
moritz_ | so basically you want another matcher that's not limited to return a boolean? | 15:46 | |
well, I'll ignore what you jsut said ;) | 15:47 | ||
TimToady | it's okay for "produces" to return Failure if it's checking a Match that fails, but it's not okay for it to return the left object if it it happens to be Failure tha you're crosschecking | ||
pmurias | TimToady: if the builtin subset is too basic, and most things require a real test module it won't save much typing | 15:48 | |
TimToady | but maybe that just means that checking for appropriate failure turns some kind of true object | ||
moritz_ | pmurias: if we can test the prelude and the language with it, it can't be *that* basic | ||
TimToady | I'd say, pretty much everything that the test suite is currently using | ||
but, oddly, perhaps not "is" | 15:49 | ||
since it's almost always better to specify the exact comparison with "ok" | |||
moritz_ | well, is() in the test suite is *very* basic, and often abused | ||
TimToady | most of those should be "ok $a ~~ 42" | 15:50 | |
which is only, what, 2 characters longer than "is $a, 42" | |||
and hopefully has pretty much the same DWIM semantics | 15:51 | ||
moritz_ | well, is() doesn't DWIM | ||
it eq's instead | |||
(as it currently is) | |||
TimToady | the same DWIM semantics that "is" *ought* to have, I should say | 15:52 | |
pmurias | given macros ok can prints as good a error message as is | ||
TimToady | yes | ||
15:52
[particle] joined
|
|||
TimToady | I can see a class of macro-like subs that just happen to remember the text of their 1st arg | 15:52 | |
assert() for instance | |||
sub ok ($bool, $mess) is assertion {...} | 15:53 | ||
not sure how you get at the text though... | 15:54 | ||
moritz_ | can user defined operators catch execptions of one of its arguments somehow? | ||
TimToady | depends on what kind of exception you're talking about | 15:55 | |
moritz_ | thrown ones | 15:56 | |
TimToady | user-defined ops can be macros, but can only influence parsing on the right | ||
however, they can do anything they like with the existing AST on the left, so yes, you could wrap the left arg with an eval node | 15:57 | ||
well, a try node | |||
presumably the AST on the left can return its text too | |||
of course, a prefix macro can do anythig it likes, even with the parsing | 15:58 | ||
but macros are kinda hard, so I wouldn't really want to enforce full macro support onto a budding implementation | 15:59 | ||
moritz_ | aye | ||
TimToady | hence the proposal for "assertion" subs that can just get the text of 1st arg magically | ||
moritz_ | sounds good | 16:01 | |
TimToady | or, I suppose, any arg, once you've declared "assertion" good enough for the parse to see it | ||
maybe it's an attribute of a parameter instead | 16:02 | ||
and causes the argument value to be annotated with a text property | 16:03 | ||
moritz_ | but I still haven't really understood what the 'produces' thingy is needed for | ||
16:03
a-jing joined,
a-jing left,
abra_ joined
|
|||
moritz_ | I mean ~~ doesn't have to return a boolean, just a thing that boolifies correctly | 16:03 | |
TimToady | and Failure doesn't boolify correctly inside ok() | ||
16:04
abra_ left
|
|||
moritz_ | but 'Failure ~~ $stuff' could boolify correctly, can't it? | 16:04 | |
TimToady | so we can't just return the left arg anyway | ||
sure | |||
16:04
abra_ joined
|
|||
pugs_svn | r22172 | pmurias++ | [pugs-m0ld] pattern matching is done with case instead of multiple function definitions | 16:04 | |
TimToady | since ~~ is determined by the type of the right value, we need to distinguish patterns that will work correctly against whatever left types we want to test | 16:06 | |
obviously if we're going to test match objects with the "mob" notation, something has to interpret that notation | |||
I just threw the info in there as a string for now, but that obviously won't work directly | 16:07 | ||
16:07
SamB left
|
|||
TimToady | arguably Failure ~~ /text/ can be taught to work, but is also somewhat perilous in forcing particular error messages | 16:08 | |
though I suppose standard error messsages aren't such a bad thing... | |||
currently though they're just parrots idea of what messages should be, which are unlikely to match what other implementations are doing so far | 16:09 | ||
*parrot's | |||
we probably need to work out message identities that are independent of what language is emmitted | 16:10 | ||
*emitted | 16:11 | ||
so Failure ~~ messid("F_42") or some such | 16:13 | ||
moritz_ | Failure ~~ Error::Parse? | ||
TimToady | would like granularity down to individual messages sometimes | 16:14 | |
so only if every exception has it's own type... :/ | |||
moritz_ | it could be a collection of enums | 16:15 | |
TimToady | which are types | ||
moritz_ | yes | ||
and you don't like the idea ;) | 16:16 | ||
TimToady | well, I'm just worried about the poor guy who just wants to write a simple 'die "my message"' without adding an id of some sort | ||
moritz_ | well, it's enough if "builtin" errors have their types | 16:17 | |
TimToady | we probably allow that, but make it easy to add the id: MyId.die("my message") | 16:18 | |
moritz_ | there's nothing wrong with using a simple string for an exception if you don't want language independant ways to check against it | ||
TimToady | actually, given that types are coercions, just MyId("my message") | 16:19 | |
assuming exception types know how to coerce from Str | |||
I've alway thought that the built-in exceptions should live in package X | 16:20 | ||
X::Parsefail("oopsie") | 16:21 | ||
well, parse failures are something else really | |||
but X::DomainError and such | |||
16:22
SamB joined
|
|||
TimToady | if we put them all in Exception or even Error, that discourages people from using them | 16:22 | |
especially in exception handlers | 16:23 | ||
or maybe we could put them all into the >< package :) | 16:25 | ||
anyway, feel free to mung .produces into anything else; as I said, it's just a placeholder really | 16:27 | ||
moritz_ | if I knew what you'd want to test against, I could :/ | 16:31 | |
anyway, dinner & | |||
16:45
zamolxes left
16:46
Maghnus left,
Maghnus joined
16:53
Maghnus left
16:59
larsen_ joined
17:11
alanhaggai_ joined
17:21
zamolxes joined
17:26
alanhaggai left
17:39
ludan joined
17:40
Maghnus joined
17:42
alester joined
18:05
eternaleye joined
18:06
abra_ left
18:16
larsen_ left
|
|||
rakudo_svn | r30828 | pmichaud++ | [rakudo]: Revert r30815 and r30816. | 18:26 | |
18:27
apeiron_ joined
18:34
apeiron left
|
|||
pugs_svn | r22173 | lwall++ | [rx.t] use ~~ and subset matching instead of .provides | 18:45 | |
18:49
eternaleye left
18:51
eternaleye joined
18:54
alester left
19:00
Myoma joined
19:02
alester joined
19:06
bradb joined
19:10
alester left
|
|||
pugs_svn | r22174 | lwall++ | [STD] allow 'where' clauses on bare type names (mostly for ~~ matching) | 19:12 | |
19:37
IRSeekBot joined
|
|||
pmurias | moritz_: language independence for exception only matters if they are relevant to the user | 19:49 | |
19:58
yahooooo joined
20:00
ruoso joined
20:06
alester joined
|
|||
pmurias | ruoso: hi | 20:10 | |
ruoso | hi pmurias | 20:12 | |
lambdabot | ruoso: You have 1 new message. '/msg lambdabot @messages' to read it. | ||
ruoso | pmurias, do you mean by you having special $interpreter and $scope variables available in m0ld? | 20:13 | |
meppl | good night | 20:14 | |
rakudo_svn | r30832 | pmichaud++ | [rakudo]: spectest-progress.csv update: 156 files, 2798 passing tests | ||
20:15
allbery_b left
20:16
allbery_b joined
20:17
meppl left
|
|||
pmurias | ruoso: not just having my $interpreter;my $scope in the top m0ld block and passing them the same way as in Code | 20:18 | |
ruoso | oh... you mean defining that as a calling convention? | 20:19 | |
that looks fine to me | |||
pmurias | yes | ||
once we have a lexical scope we don't have to use ¢ | 20:20 | ||
ruoso: if you don't implement map in terms of gather/take what do you want to use to create the lazy list/iterator | 20:23 | ||
or do you plan to implement map in C? | |||
ruoso | pmurias, it cannot be implemented in C because it has too much recursion... | 20:25 | |
pmurias, have you seen the wiki page? | |||
it mostly explains how it's going to work without gather/take | |||
and it also should serve as a initial concept model for gather/take | 20:26 | ||
it's going to be implemented in C+m0ld, btw | |||
20:28
eternaleye left
|
|||
pmurias | why not implement it it terms of gather and take? | 20:30 | |
ruoso | how does it solve the problem? | ||
I mean... | 20:31 | ||
this problem might look simple at the beginning, but when you try to figure out how it's going to be translated to actual method calls, it becomes pretty tricky | |||
20:32
Auzon joined
|
|||
pmurias | what is the problem? | 20:32 | |
ruoso | how to iterate the input list without causing eager evaluation? | ||
and mix with that what slice context adds in complexity | 20:33 | ||
(have you read the wiki page about the SMOP map operator?) | |||
pmurias | yes | 20:34 | |
20:34
yahooooo left
|
|||
ruoso | gather take only solves the part on how the map itself will be lazy | 20:35 | |
pmurias | twice ;) | ||
ruoso | but not on how to consume the input list lazily | ||
pmurias, do you see where the problem is now? | 20:39 | ||
pmurias | yes | ||
sub map(@array,&code) { gather {my $i=0;while @array.exists($i) {take code(@array[$i]);$i++} } | |||
ruoso | pmurias, well.. you have an iterator... but you're still using a two-phase iterator API (like the Java api)... | 20:43 | |
pmurias | pugs: my $sub = sub {say 3};$sub.(3); | ||
p6eval | pugs: OUTPUT[3] | ||
ruoso | while you still makes the life of cursor-based iterators harder... | ||
pmurias | pugs: my $sub = sub {say 3};$sub(3); | ||
p6eval | pugs: OUTPUT[3] | ||
ruoso | and the other half of what's described on the wiki explains how gather/take would work | 20:44 | |
pmurias | actually it's sub map(Code $expression,*@values) { gather {my $i=0;while @values.exists($i) {take $expression(@array[$i]);$i++} } } | ||
ruoso | making index-based access is something I'm trying to avoid... | 20:45 | |
pmurias | ruoso: handling cursor based iterators specialy is just an optimalisation | ||
ruoso | but you're still accessing the iterator making two calls | 20:46 | |
.has_next => .exists and .next => .[] | |||
cursor based iterator is not the exception, but the common case, since Perl 6 is mostly lazy | 20:47 | ||
feed operators point in that direction too | |||
pmurias | ruoso: i used .exists and .[] because prefix:<=> is not sufficiently specced | 20:48 | |
ruoso | pmurias, that's the part the wiki page is discussing | 20:49 | |
the other part explains how gather/take would work | |||
20:49
Lichtkind left
20:50
broquaint left
|
|||
ruoso | but when you get to low-level... | 20:50 | |
20:50
broquaint joined
|
|||
pmurias | ruoso: how do you know that prefix:<=> has no more items | 20:50 | |
ruoso | because prefix:<=> returns a capture | ||
or a failure | |||
pmurias | ok | 20:51 | |
ruoso | when you get to the low-level, implemeting map directly is even simpler than using gather/take | 20:52 | |
because you can have a generic lazy list type that consumes whatever iterator | |||
pmurias | directly means in C/m0ld? | ||
ruoso | yes | ||
and gather would also return an iterator | 20:53 | ||
pmurias | are there other lazy imperative languages? | ||
ruoso | heh... I think that's a very unique characteristic of Perl (5 or 6) | 20:54 | |
(not that perl 5 is lazy, but it does inherit functional characteristics in an unique way) | |||
pmurias | only list context is lazy, so we might just stick to item context if it turn out a very bad idea | 20:57 | |
ruoso | pmurias, that's not really true | ||
TimToady agreed that only Void is actually specially eager | 20:58 | ||
in item context it can return a lazy scalar that implements prefix:<=> | 20:59 | ||
20:59
yahooooo joined
|
|||
pmurias searches the spec | 21:00 | ||
ruoso dinner & | |||
pmurias | i wonder what inspired all the lazyiness in Perl 6 | 21:01 | |
PerlJam | pmurias: haskell :) | ||
pmurias | haskell is extremly strict when it comes to side effects, | 21:03 | |
it forces my $a=side_effect();other_side_effect($a) style | |||
Myoma | hehe | ||
@remember pmurias haskell is extremly strict when it comes to side effects | 21:04 | ||
lambdabot | Okay. | ||
21:04
alester left
|
|||
pmurias | by typo is remembered ;( | 21:05 | |
Myoma | lol | ||
pmurias | * my | ||
21:06
ludan left
21:07
ludan joined
21:10
alester joined,
alester left
|
|||
pmurias | a dialect of haskell which implicitly added monads would be fun | 21:11 | |
21:12
lambdabot left
21:14
lambdabot joined
|
|||
pmurias | g'night | 21:16 | |
21:16
pmurias left
|
|||
rakudo_svn | r30835 | pmichaud++ | [rakudo]: Restore Code.REJECTS, but have it set $/ like Code.ACCEPTS does. | 21:35 | |
r30835 | pmichaud++ | This is a workaround until we have infix_prefix_meta_operator:<!> implemented. | |||
22:07
iblechbot left
23:08
bradb left
|