|
freespectrum.herokuapp.com/workshop...-links.svg -- gist.github.com/masak/5431185 -- logs at olive.undo.it/log?channel=masakism Set by moderator on 1 May 2013. |
|||
|
00:04
markrtoon joined
01:09
Sycosys joined
|
|||
| Sycosys | ahha! i have found people | 01:09 | |
| labster | yes? | ||
| Sycosys | Hi | ||
| labster | What's up Sycosys? | ||
| Sycosys | not much, jsut trying to sort out the G+ python study group | 01:10 | |
| labster | It's 6PM US-Pacific time, but the lesson is pretty much over. you can still do the work, though. | ||
| Oh... this is more of a Perl crowd than a Python crowd. | 01:11 | ||
| Sycosys | oh.. odd, i was linked here from a Learn Python the hard way study group | ||
| probably not a bad idea to learn perl while im at the whole expand my program language list. | 01:12 | ||
| labster | And most of us are asleep because there are a lot of Europeans in the group. | ||
| Cool! Well, I'd be happy to help. | |||
| Are you more interested in Perl 5, the well developed language supported on many platforms with like millions of modules on CPAN? Or in Perl 6, the new language with lots more features and syntactic sugar but it's still under development? | 01:14 | ||
| Sycosys | excellent, well can't say i have any questions at the moment seeing as how this is not the Python chat if thought it was. I'll be sure to drop in if/when i dig into perl Thanks :) | ||
| labster | We hang out in #perl6 most of the time, if you're interested in that one. | 01:15 | |
| Sycosys | I am stuck between python 2.6 (for work) and python 3 (for everything else) | ||
| labster | Yeah, basicallly the same deal in python. Except we're working on a Perl 5 in Perl 6 mode, where nested blocks can be written in the old language. In theory, it could be extended to run Python in Perl 6, but no one's worked on the grammar yet. | 01:16 | |
| Sycosys | Well Thank you for your help. I'll be sure to stop in when i get into Perl. Thank you! | 01:20 | |
|
01:22
trexy joined
01:30
FROGGS_ joined
02:55
cognominal__ joined
03:10
msimp joined
|
|||
| msimp | good evening | 03:11 | |
|
03:53
shoerner joined
03:55
shoerner left
04:25
Psyche^ joined
04:48
trexy left
05:07
moritz_ joined
05:52
spuelrich joined
06:01
cognominal joined
06:17
FROGGS_ joined
06:21
spuelrich left
07:02
ilbot_bck joined
|
|||
| moderator | freespectrum.herokuapp.com/workshop...-links.svg -- gist.github.com/masak/5431185 -- logs at olive.undo.it/log?channel=masakism | ||
|
07:19
camelia joined
07:46
cognominal joined
07:50
Farow joined
|
|||
| masak | so, did some Python people think it was a fun idea to link here from a G+ thread and say it's "Learn Python the Hard Way"? | 08:02 | |
| lizmat | apparently | 08:03 | |
| masak | well, that explains one of the participants yesterday. | ||
| FROGGS | well, publicity of us, no? | ||
| masak | I thought he was trolling, so I hugged him. | 08:04 | |
| you can find it in yesterday's logs. | |||
| moritz | so, how was the workshop? | ||
| lizmat | I understand that is a typical Swedish thing to do | ||
| masak | moritz: I can only speak for myself; I enjoyed myself greatly. | 08:05 | |
| moritz: people sent in a total of 45 solutions. my brain melted. | |||
| lizmat | for me it was less enjoyable, as I got stuck on a "@array.push &foo" thinko :-( | 08:06 | |
| masak | aww | ||
| lizmat | I will not make *that* mistake again soon | ||
| masak | I'm thinking we should have a warning or something for that case. | ||
| it's really not DWIM what it does right now. | |||
| lizmat | perhaps, any other sigil would have done a 2 terms in a row error | 08:08 | |
| masak | yeah. | ||
| lizmat | rn: my @a; my $b; @a.push $b | ||
| camelia | rakudo 802574: OUTPUTĆĀ«[31m===[0mSORRY![31m===[0mâ¤Two terms in a rowâ¤at /tmp/Ikido_R9q4:1â¤------> [32mmy @a; my $b; @a.push [33mĆ¢[31m$b[0m⤠expecting any of:⤠method arguments⤠postfix⤠infix stopper⤠infix or meta-infix⤠statement endâ¤ Ć¢ā¬Ā¦ | ||
| ..niecza v24-37-gf9c8fc2: OUTPUTĆĀ«[31m===[0mSORRY![31m===[0mâ¤â¤Two terms in a row (method call requires colon or parens to take arguments) at /tmp/zI0iJ7eFX0 line 1:â¤------> [32mmy @a; my $b; @a.push [33mĆ¢[31m$b[0mâ¤â¤Parse failedâ¤â¤ĆĀ» | |||
| labster | masak: ONELINERS gist.github.com/labster/5497694 And it's the only solution that did the bottom five problems | ||
| masak | lizmat: I've encountered the &-interpreted-as-infix problem in connection with some blocks not getting semicolons properly at the end of lines. very frustrating. | 08:09 | |
| lizmat | rn: my @a; sub foo {1}; @a.push &foo | ||
| camelia | rakudo 802574, niecza v24-37-gf9c8fc2: ( no output ) | ||
| lizmat | rn: my @a; sub foo {1}; @a.push & foo | ||
| camelia | rakudo 802574, niecza v24-37-gf9c8fc2: ( no output ) | ||
| masak | labster: nice! | 08:10 | |
| lizmat: it violates Least Surprise. so we should do something about it. | |||
| lizmat | would there be any way to force whitespace after an infix & ? | ||
| labster | It's hard for me to use intermediate variables. The methods all seem to be like natural language in Perl 6, so I just keep chaining them. | ||
| lizmat | or "termize" &[alpha] ? | 08:12 | |
| labster | lizmat: that makes sense | ||
| masak suggests moving this discussion to #perl6 | 08:14 | ||
| labster: nice! I added your solution. | 08:16 | ||
| lizmat will do so after fitness, away for ~2 hours or so | 08:19 | ||
|
08:51
simbabque_ joined
|
|||
| timotimo | this enables colors, no? | 09:13 | |
| r: 1 + + + | |||
| camelia | rakudo 802574: OUTPUTĆĀ«[31m===[0mSORRY![31m===[0mâ¤Preceding context expects a term, but found infix + insteadâ¤at /tmp/AlL8Or12WV:1â¤------> [32m1 + + +[33mĆ¢[31m<EOL>[0mâ¤ĆĀ» | ||
| timotimo | hm, no, doesn't | ||
| #perl6 has +C and -c, but i can't seem to -c this room | 09:14 | ||
|
09:15
eyck joined
|
|||
| timotimo | apparently because of the MLOCK in chanserv? | 09:15 | |
| felher | Dumb question, but what does "@array.push &some-sub" even do? | 09:31 | |
| FROGGS | @array.push: &some-sub would push a reference to that sub to the array | 09:34 | |
| but if you forget to type the ":", you make a junction | |||
| r: say (@array.push &some-sub).WHAT | |||
| camelia | rakudo 802574: OUTPUTĆĀ«[31m===[0mSORRY![31m===[0mâ¤Variable '@array' is not declaredâ¤at /tmp/eEk6TNwbsi:1â¤------> [32msay (@array.push[33mĆ¢[31m &some-sub).WHAT[0m⤠expecting any of:⤠method arguments⤠postfixâ¤ĆĀ» | ||
| FROGGS | r: my @array; sub some-sib { }; say (@array.push &some-sub).WHAT | ||
| camelia | rakudo 802574: OUTPUTĆĀ«[31m===[0mSORRY![31m===[0mâ¤Undeclared routine:⤠some-sub used at line 1. Did you mean '&some-sib'?â¤â¤ĆĀ» | 09:35 | |
| FROGGS | r: my @array; sub some-sub { }; say (@array.push &some-sub).WHAT | ||
| camelia | rakudo 802574: OUTPUTĆĀ«(Junction)â¤ĆĀ» | ||
| FROGGS | like: array & some-sub() | ||
| felher | FROGGS: ah, a junction, of course. Thanks. | 09:38 | |
| lizmat | this was part of pushing a callback to a queue | 09:52 | |
| I should have used parens: | 09:53 | ||
| rn: my @a; sub foo {...}; @a.push(&foo) | |||
| camelia | rakudo 802574, niecza v24-37-gf9c8fc2: ( no output ) | ||
|
10:05
atroxaper joined
10:08
atroxaper left
|
|||
| cognominal | r: my @array; sub some-sub { }; say (@array.push &some-sub).perl | 10:25 | |
| camelia | rakudo 802574: OUTPUTĆĀ«all([], Nil)â¤ĆĀ» | ||
| cognominal | r: say(a&b).perl | 10:27 | |
| camelia | rakudo 802574: OUTPUTĆĀ«[31m===[0mSORRY![31m===[0mâ¤Undeclared routines:⤠a used at line 1⤠b used at line 1â¤â¤ĆĀ» | ||
| cognominal | r: sub a{}; sub b {}; say(a&b).perl | ||
| camelia | rakudo 802574: OUTPUTĆĀ«all(Nil, Nil)â¤ĆĀ» | ||
| GlitchMr | r: my @array; sub some-sub { }; say (@array.push: &some-sub).perl | 10:42 | |
| camelia | rakudo 802574: OUTPUTĆĀ«Array.new(sub some-sub() { ... })â¤ĆĀ» | ||
|
11:29
Spamchecker16 joined
11:39
Spamchecker16 left
12:04
dmol joined
12:58
ajr joined
13:12
spider-mario joined
13:16
udprakash joined
|
|||
| udprakash | anyone here ? | 13:16 | |
| moritz | just us bots | 13:17 | |
| udprakash | cool | 13:18 | |
| masak is not here | 13:19 | ||
| udprakash: something on your mind? :) | |||
| udprakash | this is the learn python study group rite ? | 13:22 | |
| PerlJam is not here either | |||
| masak | udprakash: do you have an URL saying that it is? I'm curious. | 13:23 | |
| udprakash: (because it isn't) | |||
| PerlJam | udprakash: If by "python" you mean "perl", then yes. | ||
| :) | |||
| udprakash | i was pointed here | ||
| but never mind, thanks :) | |||
| masak | udprakash: no, no, please tell us more! who pointed you, and how? | 13:24 | |
| PerlJam | masak: you probably need to offer a python lesson in exchange :) | ||
| udprakash | why the curiosity Sir ? I am curious | 13:25 | |
| moritz | it's not often that people come to perl events and expect there to be python | ||
| so if that happens, that's curious, don't you think? | |||
| felher | /topic Python changed its syntax quite a bit for Python 4.0. Learn more aboute the new Python and its features at perl6.org ;) | ||
| udprakash | by all means :) | 13:26 | |
| PerlJam | felher: heh! | ||
|
14:01
cognominal joined
|
|||
| masak | I swear, the next person who comes in asking for Python, I'm actually gonna teach some Python. :P | 14:02 | |
| timotimo | how much python do you know actually? | 14:03 | |
| masak | I'm not sure. I guess we'll find out. | ||
|
14:08
bern joined
|
|||
| geekosaur | came here asking for python? *looks at channel name, goes hmmm* | 14:10 | |
| masak | hmmm! | 14:11 | |
| geekosaur | (pythonista self-awareness?) | ||
| :) | |||
| GlitchMr | I want JavaScript lessons... | ||
| timotimo | the channel name says nothing about python *or* perl | 14:12 | |
| masak | GlitchMr: do the PROMISE exercise! :P | ||
| GlitchMr | In JavaScript? | ||
| masak | GlitchMr: sure, why not. | ||
| GlitchMr | I wasn't serious, but whatever ;-). | 14:13 | |
| gtodd | how about in perl6 but that outputs jscript | ||
| timotimo | make it compatible to perlito6 perhaps? | 14:14 | |
| gtodd | Hmm the oneliners task Program 5 -- print everything between START and END ... | 14:15 | |
| PerlJam | sounds like a good meta-topic for the next #masakism lesson--writing a compiler :) | ||
| GlitchMr | HQ9+? Or something more complex than that? | 14:16 | |
| PerlJam | Whatever masak thinks he can muster. | 14:18 | |
| But the presentation should probably be like; do this little task. do that little task. put them together. oh, btw, you're just written a compiler :) | 14:19 | ||
| gtodd | the solutions are so different | ||
| perl6 -e '$*IN.slurp.comb(/<?after \\n?START\\n> .*? <?before \\nEND\\n?>/)>>.say' | |||
| perl6 -e for lines() { last if m:i/^end$/; next if m:i/^start$/; .say; } | |||
| perl6 -e '.say if /^ START/ ff /^END/ for lines' | |||
| masak | PerlJam: sounds attractive. I'll think about it. | 14:20 | |
| gtodd: fwiw, I had that last one in mind. | |||
| gtodd | it's the closest to perl5 perl -ne 'print if /START/../END/' | ||
| masak | yeah. | ||
| and TimToady++ speculated that we should perhaps change infix:<ff> et al. to smartmatching. | 14:21 | ||
| gtodd | mind you there that infernal dot >.<say | ||
| masak | which, to the extent I can predict the implications, I think sounds like a good idea. | ||
| gtodd: yeah. the infernal dot is one of the Perl 6 cleanups. I like it, because I agree with the cleanup. YMMV. | |||
| gtodd | :-) | 14:22 | |
| it reminds me that say is method being used on an object :-) | 14:24 | ||
| masak | if you don't like that, you can always do `say $_ if /^ START/ ff /^END/ for lines' | 14:26 | |
| gtodd | yeah that's what I ended up putting | 14:28 | |
| but ... it took me several hours :-D | |||
| pmichaud | ehhh, writing a compiler isn't so hard. I've done tons of them. | ||
| PerlJam | pmichaud: so ... you're volunteering to run the next #masakism lesson? ;) | 14:29 | |
| gtodd | pmichaud: did you get tricked in any of them by doing small tasks ? | ||
| pmichaud: wait don't answer that | |||
| PerlJam | gtodd: I think he was "tricked" into writing 2 perl6 compilers :) | 14:30 | |
| pmichaud | step 1: reinforce the walls of your office and/or building to be able to better sustain your head beating against them. | ||
| gtodd | :) | ||
| pmichaud | actually, 3 or 4 perl 6 compilers. and quite a number of regex engines. | ||
| PerlJam | yeah, 2 was just least upper bound | 14:31 | |
| pmichaud | ...which might actually indicate unsuitability for the task, now that I think of it. :-) | ||
| "Still haven't gotten it right after the 5th try, eh?" | |||
| afk again (housework... sigh :-/ ) | 14:32 | ||
| masak | pmichaud++ # your regex engines and Perl 6 compilers keep coming out better and better, that's gotta count for something :) | 14:36 | |
| ok, decommuting. if someone turns up asking for Python, be nice to them ;) | 14:37 | ||
| FROGGS | we will | 14:38 | |
|
14:41
swuecho_ joined
|
|||
| PerlJam | masak: I'm almost offended that you feel the need to remind us to be nice ;) | 14:42 | |
|
14:56
ajr joined
14:57
ajr_ joined
|
|||
| GlitchMr | masak, gist.github.com/GlitchMr/5502814 | 14:58 | |
| masak | PerlJam: I was talking to everyone else, not you :P | 15:30 | |
| tadzik | "you insensitive clod" | 15:31 | |
| masak | GlitchMr: nice! | ||
| GlitchMr: except for one thing. I see you're writing JavaScript in semicolon-less style. stop that immediately. ;) | |||
| GlitchMr | Why not? I like semicolon-less style. | ||
| tadzik | it's like Go | ||
| masak | GlitchMr: then you simply don't know enough about it. | 15:32 | |
| it was a big mistake. it creates horrible logical bugs. it shouldn't be done, ever. | |||
| GlitchMr | The only thing that could really happen is paren interpreted as method call. | ||
| masak | no, that's not the only thing. | ||
| PerlJam | .oO( <@masak> GlitchMr: YOU'RE WRONG! ) |
15:33 | |
| masak | but this is not the place to try to convince you. | ||
| PerlJam | ;) | ||
| GlitchMr | Besides, I have semicolons. | ||
| for (i = 0, length = this.onFulfilled.length; i < length; i++) | |||
| masak | ;) | 15:34 | |
| GlitchMr | I also write Python, Ruby, CoffeeScript, and AWK without semicolons. | 15:35 | |
| Well, and +/- interpreted as operators, but you wouldn't begin code lines with numbers... | 15:37 | ||
| moritz | 42 == $answer or die "Wrong answer!" | 15:38 | |
| GlitchMr | I never liked "or die" idiom - I only use it for file handle operations in Perl 5. But that's probably just me. | ||
| FROGGS | I dont like them either | 15:39 | |
| and I'd like to omit the last semicolon in a statementlist in PHP | |||
| blkcat | oh god semicolon-less javascript. | ||
| just. say. no. | |||
| FROGGS | *cough*, computer said "no" | 15:40 | |
| GlitchMr | Hey, my compiler accepts it | ||
| ajr_ | s/semicolon-less// ? | ||
| GlitchMr | Spec says it's allowed too. | ||
| allowed.* | |||
| With exception for JavaScript I've contributed to other projects, every single line of JS code I've wrote doesn't use semicolons. | 15:43 | ||
| Semicolons are noise anyway. | 15:45 | ||
| FROGGS | just the last one :o) | ||
| GlitchMr | std: gist.github.com/GlitchMr/5503150 | 15:47 | |
| camelia | std 316b40b: OUTPUTĆĀ«[31m===[0mSORRY![31m===[0mâ¤Whitespace is not allowed in an operator at /tmp/XI40PtVL_P line 1:â¤------> [32msub infix:["\\n"][33mĆ¢[31m($, $) {}[0mâ¤Parse failedâ¤FAILED 00:00 42mâ¤ĆĀ» | ||
| GlitchMr | huh? | ||
| I cannot add ASI to Perl 6? | |||
| Actually, where is that error message in STD, anyway? | 15:49 | ||
| n: gist.github.com/GlitchMr/5503150 | 15:50 | ||
| camelia | niecza v24-37-gf9c8fc2: OUTPUTĆĀ«Potential difficulties:⤠&infix:<â¤> is declared but not used at /tmp/L6vR9qqMnu line 1:â¤------> [32msub infix:["\\n"][33mĆ¢[31m($, $) {}[0mâ¤â¤84â¤Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object⤠atĆ¢ā¬Ā¦ | ||
| GlitchMr | CursorBase.pmc... ok | 15:51 | |
| masak | GlitchMr: semicolons are useful delimiters, decoupling "lines" from "statements". | ||
| GlitchMr: the JavaScript intuiting of missing semicolons is fundamentally broken. writing in semicolon-less style is, to put it bluntly, irresponsible. | 15:52 | ||
| GlitchMr | std: gist.github.com/GlitchMr/5503150 | 15:53 | |
| camelia | std 316b40b: OUTPUTĆĀ«[31m===[0mSORRY![31m===[0mâ¤Null operator is not allowed at /tmp/hMTaySxMHH line 1:â¤------> [32msub infix:<>[33mĆ¢[31m($, $) {}[0mâ¤Other potential difficulties:⤠Pair with <> really means an empty list, not null string; use :('') to represent the null string,â¤âā¬Ā¦ | ||
| GlitchMr | std: gist.github.com/GlitchMr/5503150 | ||
| masak recommends GlitchMr do his exploration of whitespace operators over at #perl6 or in privmsg | |||
| camelia | std 316b40b: OUTPUTĆĀ«[31m===[0mSORRY![31m===[0mâ¤Null operator is not allowed at /tmp/pRuIFyYUqE line 1:â¤------> [32msub infix:[''][33mĆ¢[31m($, $) {}[0mâ¤Parse failedâ¤FAILED 00:00 42mâ¤ĆĀ» | ||
| timotimo | masak: can you make this channel color-compatible or something? :| | 16:21 | |
|
16:21
dmol joined
16:31
FROGGS joined
16:34
mohij joined
|
|||
| masak | timotimo: I may have the powers to do so (as registered channel owner), but I don't have the know-how. | 16:39 | |
| geekosaur | toxin.jottit.com/freenode_channel_modes see +/-c | 16:41 | |
|
16:42
snearch joined
|
|||
| masak looks | 16:47 | ||
| geekosaur likes toxin as a general reference for IRC stuff, btw | |||
| masak | timotimo: we already have +c in here. is there any other action I can take to make your life more color-compatible? | 16:48 | |
| geekosaur | backwards, +c is the problem | 16:49 | |
| masak | oh. | ||
| geekosaur | +c is what strips escape and other control chars to disable colors | ||
| masak | [freenode] -!- #masakism c ntcslk MODE cannot be set due to channel having an active MLOCK restriction policy | 16:50 | |
| I'm new at this. what should I do? | |||
| timotimo | privmsg chanserv for "help" and find the help for the "mode" command, i think | ||
| masak | ok. | ||
| geekosaur | /msg chanserv set #masakism mlock +nt-slk | 16:52 | |
| masak | done. | 16:53 | |
| I still see (+cnt) in the info line on irssi, though. | |||
| geekosaur | and then you should be able to issue that /mode command again | ||
| masak | indeed. geekosaur++ | ||
| geekosaur | right, that doesn't chaneg the mode, just changes what irc will let you do | 16:54 | |
| masak | do I need to revert the MLOCK setting now? should I? | ||
| geekosaur | no, you probably want to leave it | ||
| masak | ok. | ||
| geekosaur | if you'd moved the c to the other side, it might have taken immediate effect (since that would then be a forced turn off) | ||
| if you tell it to force back on, chanserv would probably set +c again immediately | 16:55 | ||
| masak | ok. | ||
| timotimo | r: 1 + + + + + + + + + | 16:58 | |
| camelia | rakudo 639d7f: OUTPUTĆāĆĀ«[31m===[0mSORRY![31m===[0mĆ¢ï¿½Ć¤Preceding context expects a term, but found infix + insteadĆ¢ï¿½Ć¤at /tmp/0w4eKNyPN1:1Ć¢ï¿½Ć¤------> [32m1 + + + + + + + + +[33mĆ¢ï¿½ï¿½[31m<EOL>[0mĆ¢ï¿½Ć¤ĆāĆĀ» | ||
| timotimo | that looks better | 16:59 | |
| masak | \\o/ | 17:00 | |
|
17:35
Cybelechild joined,
Cybelechild left
18:21
gco joined
|
|||
| gtodd | masak: Since it took me all day and errm I have only one gist for the oneliners I am somewhat reticent to put it up :-) | 18:47 | |
| masak | no, go ahead. | ||
| gtodd | especially since I was **so** close to solving number the lines in a perl6 ish way | 18:48 | |
| and then I saw the other solutions and copied ... but only one comma :-) | |||
| PerlJam | gtodd: never be embarassed about your code or the time it took. Everyone is on the same journey, just at different places and maybe taking different routes. :) | ||
| gtodd | I had: | 18:49 | |
| perl6 -e 'my $num; say "{$num++} $_" for $*IN.lines' < file.txt | |||
| but wanted to figure out how to use "state" better (I have used it a bit in perl5 but ...) | |||
| perl6 -e 'say (state $num)++ " $_" for $*IN.lines' < file.txt | 18:50 | ||
| :-\\ | |||
| missing the damn comma for an hour :\\ | |||
| moritz_ | r: say (state $num)++ " $_" for $*IN.lines | 18:51 | |
| camelia | rakudo 639d7f: OUTPUTĆāĆĀ«[31m===[0mSORRY![31m===[0mĆ¢ï¿½Ć¤Two terms in a rowĆ¢ï¿½Ć¤at /tmp/0HoH47Twmr:1Ć¢ï¿½Ć¤------> [32msay (state $num)++ [33mĆ¢ï¿½ï¿½[31m" $_" for $*IN.lines[0mĆ¢ï¿½Ć¤ expecting any of:Ć¢ï¿½Ć¤ postfixĆ¢ï¿½Ć¤ infix stopperĆ¢ï¿½Ć¤ infix or meta-infixĆ¢ï¿½Ć¤ statement endĆ¢ï¿½Ć¤ statemenĆ¢âā¬Ć¦ | ||
| moritz_ | it points you exactly to the right spot :-) | ||
| PerlJam | gtodd: note that you don't even need a named variable | 18:52 | |
| moritz_ | but I know how hard it is to find such stuff sometimes | ||
| PerlJam | huh ... "my" works too. That's a tad surprising as I'd think it would recreate the var on each iteration. | 18:56 | |
| timotimo | well, there's no curlies. is that what decides it? | 18:57 | |
| gtodd | yeah two terms in a row :-) | 18:58 | |
| masak | PerlJam: nope. | ||
| PerlJam: there's no block in that for loop. | |||
| masak: and so the var is declared once, and incremented many times. | |||
| gtodd | I'm ruining my mind by trying to make perl5 and perl6 seem similar! | ||
| masak | er, talking to myself :/ | ||
| PerlJam | yeah, it's just how my brain is wired to think of "my" in loops. | ||
| gtodd | and embarassing private exercise :-) | 18:59 | |
| masak | thunks are explicitly not blocks :) | ||
| PerlJam | gtodd: in any case, say (my $)++ ~ " $_" for lines()' < file.txt | 19:00 | |
| masak | r: say "$(my $a = 42) frogs!"; say $a | 19:01 | |
| camelia | rakudo 639d7f: OUTPUTĆĀ«42 frogs!â¤42â¤ĆĀ» | ||
| masak | Perl 6 is weeeeeird. | ||
|
19:02
dmol joined
|
|||
| tadzik | :) | 19:03 | |
| moritz_ | actually it's very linear :-) | ||
.oO( strangely linear ) |
19:04 | ||
.oO( in first approximation, everything is linear ) |
|||
| gtodd | perl6 -e 'say (state $num)++, " $_" for $*IN.lines' < file.txt <-- how does one write a similar oneliner using "state" in perl5? | ||
| perl5 -pe '$_ = "$. $_"' < file.txt is easier :-) | 19:05 | ||
| if more cryptic/idiomatic | |||
| PerlJam: say (my $)++ ~ " $_" for lines()' < file.txt yes much better and closer to perl5 -pe '$_ = "$. $_"' < file.txt :-) | 19:08 | ||
| GlitchMr | coffeescript.org/#try:console.log%2...le.log%20a | 19:09 | |
| CoffeeScript | |||
| Works like in Perl 6. | 19:10 | ||
| But unlike Perl 5. | 19:11 | ||
| PerlJam | gtodd: note that rakudo (at least) also has a -p option | ||
| gtodd: perl6 -p -e 'print (my $)++ ~ " "' < file.txt | |||
| GlitchMr | I'm not even sure which behavior is valid. Declaring lexical variable inside quotes is something you shouldn't have to do ;-). | 19:12 | |
| gtodd | PerlJam: yeah ... I wondered if -p was cheating :-) I never think to use "~" when I want to match everything | ||
| GlitchMr | I did it that way | ||
| perl -pe'print"$.. "' | 19:13 | ||
| Surprise. It works! | |||
| PerlJam | gtodd: another version that's even closer to what you wrote: perl6 -p -e '$_ = "{(state $)++} $_"' file.txt | 19:14 | |
| gtodd | PerlJam: that almost works in perl5 | 19:18 | |
| PerlJam | and if there were a way to define and use your own setting, you could write one such that: perl6 -SLN -e '' # does what you want (where -S would be how you switch settings and LN would be the name of the setting (LN == line numbers)) | 19:19 | |
| (I'm 1/2 expecting moritz_ or someone to pipe up with "you can do that, but like this instead") | |||
| masak | ...or just load a module that overrides &say... :P | 19:20 | |
| or wraps it, more like. | 19:21 | ||
| PerlJam | oh, good point | ||
| (I still like the provide-my-own-setting idea though) | |||
| masak | r: &say.wrap: -> *@x { callwith ++state $ , ". ", |@x }; say "OH"; say "HAI" | 19:23 | |
| camelia | rakudo 639d7f: OUTPUTĆĀ«1. OHâ¤2. HAIâ¤ĆĀ» | ||
| masak | would be nice if the effects of that .wrap undid themselves at the end of the block. I think that can be arranged, using LEAVE or something. | 19:24 | |
| PerlJam | maybe with temp? | ||
| masak | r: { my $h = &say.wrap: -> *@x { callwith ++state $ , ". ", |@x }; LEAVE { $h.restore }; say "OH"; say "HAI" }; say "out of it!" | 19:25 | |
| camelia | rakudo 639d7f: OUTPUTĆĀ«1. OHâ¤2. HAIâ¤out of it!â¤ĆĀ» | ||
| masak | \\o/ | ||
| lizmat | according to spec, temp should do that: S06:2906 | 19:27 | |
| gtodd | this one I wanted to get to print unless it was Nil: | ||
| perl6 -n -e '.split(" ")[2].say' file.txt | |||
| PerlJam | though, masak's version is lexical, and temp would not be. | 19:28 | |
| gtodd | anyway here's my one entry for the oneliners ... I will finish all the other problems over the coruse of my life :-) | 19:29 | |
| gist.github.com/opendevnet/5504709 | |||
| PerlJam | (maybe) | ||
| gtodd | well I guarantee I won't even finish the easy ones :-) | 19:30 | |
| PerlJam | no, masak's would be the same as with temp | ||
| PerlJam is just crazy today | |||
| gtodd++ | 19:31 | ||
| masak | my version is not lexical. the effects of wrapping &say would survive calling into other blocks. | ||
| gtodd: lookings | |||
| looking* | |||
|
19:32
diakopter left
|
|||
| masak | gtodd: using the -p switch is definitely not cheating :) | 19:32 | |
| gtodd: "Is the eskimo operator ("}{") a perl5-ism?" yes. | |||
| gtodd: I wrote some blog posts about why it doesn't work in Rakudo. | 19:33 | ||
| gtodd: I'm surprised that 5d works. | 19:34 | ||
| (are you sure it does?) | 19:35 | ||
| same deal with 5f. | |||
| anyway, adding you to the list :) | |||
| gtodd++ | |||
|
19:40
ajr joined
|
|||
| PerlJam isn't sure what /START/ .. /END/ does there even | 19:41 | ||
| masak | right, exactly. | 19:42 | |
| it feels bogus. | |||
|
19:46
ajr_ joined
19:52
ajr_ joined
|
|||
| labster | Oh masak, just wanted to thank you for mentioning the Seven Stages of a Perl Programmer. I hadn't seen that before. | 20:30 | |
| pmichaud | I haven't seen it yet. Where can I see it? | 20:31 | |
| labster | jwenet.net/notebook/2005/1075.html | ||
| pmichaud | labster++ masak++ # reference | ||
| masak | I've known about it for years and I think it's great. :) | 20:32 | |
| pmichaud | I guess I'm at Wizard level by now. | ||
| Guru #4: Writes code that gives even Larry pause. # HAHAHAHAHAHAHAHA | 20:33 | ||
| labster | I seem to have gone from User to Expert in the last 6 months. I think a lot of that is Perl 6 magic though -- the language seems inherently easier to understand. | ||
| pmichaud | there needs to be a level for "has actually (re)written the regex engine", though. :) | 20:34 | |
| several people qualify for that these days. | |||
| okay, I'm afk again. busy day today. :-/ | 20:35 | ||
| PerlJam | Add a level above. Deity maybe? (what would be above wizard?) | ||
| (well, below depending on how you look at it) | 20:36 | ||
| labster | Archmage would be above Wizard. | 20:38 | |
| Well, in magic terms. But programming is magic. | |||
| masak | it is. a controllable kind of magic. | 21:00 | |
| labster | Just as D&D has illusionists and enchanters, there are OOPers, functionalists, and whatever Lisp is. | 21:03 | |
| troydm | labster: lol | 21:17 | |
|
22:33
ohh joined
23:47
KvH_ joined
|
|||