»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
Voldenet there's the same problem with running exec with Inline::Perl5, not surprising 00:00
geekosaur only reason I can think of is Solaris portability and even there you're asking for trouble (reads that would block return 0/EWOULDBLOCK, and you need to clear and check errno to determine it doesn't mean EOF!)
timotimo i wish somebody would champion an API to give more FDs to spawned processes ...
00:01 vendethiel- joined
geekosaur also if you are dealing with a Solaris old enough to need that... 00:01
Voldenet legacy reasons
geekosaur I think that's Solaris *1*
(aka SunOS 4 late releases)
Voldenet FIONBIO used to be the only way to deal with sockets 3┐4(5 ̄6ー7 ̄8)9┌ 00:02
geekosaur yes, in the 4BSD days
Voldenet some people never gave up the habit :D
00:02 vendethiel left
geekosaur O_NDELAY was badly specced on BSDs, and the System Vs that picked up the BSD APIs, which is why O_NONBLOCK. but still. 00:03
SVR4 is how old now?
Voldenet 34
timotimo 1934, or 34 years old? :P 00:04
geekosaur um, that'd be System V itself, not R4
34's about as long as I've been in computing
whioch would be right for SVR1
timotimo i haven't been in anything for that long …
Voldenet well, due to ugly old standards i'll be reimplementing half of unix in perl6 00:05
00:09 Sound joined 00:11 vendethiel- left 00:15 vendethiel joined 00:16 SCHAAP137 left 00:27 SCHAAP137 joined, Belial joined 00:29 AlexDaniel left
Belial Any notable projects in Perl 6? 00:30
00:32 rburkholder left, sftp left 00:33 sftp joined 00:38 Belial left 00:44 cyphase joined
raschipi Went away. 00:45
00:47 AlexDaniel joined 00:49 cyphase left 00:52 lukaramu_ left 00:58 aborazmeh joined, aborazmeh left, aborazmeh joined 01:03 AlexDani` joined 01:06 AlexDaniel left 01:11 pelevesque joined
lucs pelevesque: Welcome :) 01:11
Voldenet eh, too bad I can't use filehandle with IO::Handle or IO::Pipe 01:18
01:19 mr-foobar left
Voldenet because it internally uses MVMOSHandle which uses uv_pipe_t 01:19
01:20 AlexDani` is now known as AlexDaniel 01:21 gdonald joined, mr-foobar joined
Voldenet hm, it appears the fastest way of getting pid of the spawned process, would be... eh, fixing MVM_proc_spawn and/or MVM_proc_shell 01:26
and not reimplementing half of the mvm's features
why can't i just do that (`Д´)ノ︵ ┻━┻ 01:27
01:27 BenGoldberg joined
raschipi ┬─┬ノ(ಠ_ಠノ) 01:30
01:39 Sound left
BenGoldberg . o O (You have been flipped by the table) 01:39
01:46 araujo left 01:47 ilbot3 left, araujo joined, araujo left, araujo joined 01:48 Sound joined, ilbot3 joined, ChanServ sets mode: +v ilbot3
u-ou flip ME 01:49
Voldenet no-n
AlexDaniel m: say flip ‘me’ 01:53
camelia em
AlexDaniel m: say flip %*ENV<ME>
camelia leinaDxelA
02:05 Cabanossi left 02:07 Cabanossi joined 02:09 xtreak joined 02:22 Sound left 02:26 jeek joined 02:38 obfusk left, obfusk joined 02:43 noganex_ joined
BenGoldberg Voldenet, Take a look at MoarVM/src/io/procops.c ... after uv_spawn( ..., process, ... ) is called, notice that nothing fetches the ->pid out of the 'process' variable. 02:46
02:46 noganex left
Voldenet yeah, I've noticed 02:48
tbh, I'm chasing other thread
MVM_proc_spawn_async actually holds process data
the returned object from MVM_proc_spawn_async is MVMOSHandle 02:49
int get_pid () { MVMOSHandle *handle; MVMIOAsyncProcessData data = handle->data; uv_process_t *uv_handle = data->handle; return uv_handle->pid } 02:52
basically something like this should work (add the ugliness of C syntax) 02:53
so theoretically I could use nqp::spawnprocasync() to get what I want 02:54
my $msvmos-handle = nqp::getattr(nqp::decont($proc-async), IO::Proc::Async, '$!process_handle') 02:58
or rather: my $msvmos-handle = nqp::getattr(nqp::decont($proc-async), Proc::Async, '$!process_handle') 02:59
03:04 Cabanossi left 03:07 Cabanossi joined 03:08 Cabanoss- joined 03:12 Cabanossi left, Cabanoss- is now known as Cabanossi 03:15 adu joined 03:35 khw left 03:39 cpage__ joined 03:40 cpage left, cpage__ is now known as cpage 03:41 cyphase joined 03:45 cyphase left 03:46 adu left 03:49 BenGoldberg left 03:58 pelevesque left 04:08 gdonald left, gdonald joined 04:12 Cabanossi left 04:13 Cabanossi joined 04:14 AlexDaniel left 04:15 raschipi left 04:16 skids joined 04:17 xtreak left 04:27 aindilis` left 04:28 aindilis joined
samcv ugh i want to control this thinkpads keyboard brightness with more than two levels of brightness. off, medium and full are insufficient numbers of settings 04:38
04:40 xtreak joined 04:41 dwarring left
TimToady if linux, alias bl='xbacklight -set' 04:42
oh wait, that's keyboard 04:43
dunno 'bout that
samcv maybe there's no way to do it variably... idk
TimToady I've only seen those three levels on mine 04:44
samcv this will allow you to control it from the OS gist.github.com/hadess/6847281 but 0 1 and 2 are insufficient!
oh well
TimToady never has any keyboard light after suspend anyway 04:45
helps to be a touch typist though :)
samcv yeah. sometimes you want to see i guess. idk this keyboard is different than my x220 and the function keys i can't tell what they are by feel
there's plenty of room on this laptop for a 7 row keyboard :( 04:46
TimToady it turns off slowly, so you could maybe continuously turn it on and off to get something in between :) 04:51
samcv heh 04:52
i'm sure that c program could be sufficiently abusably depending on how the hardware acts
i should try setting it on a loop
TimToady hates capacitive function key strips...
04:53 ZzZombo joined
samcv well maybe if we are lucky lenovo will release a throwback thinkpad that has an older style keyboard 04:53
they say they are going to for the 25th anniversary (hopefully)
TimToady hmm, I wonder if there's some similar way to turn the function strip back on after a suspend... 04:58
samcv or maybe they won't but there's no compelling reason to buy their newer products and the only reason i'm currently using this t540 is i repaired my mother's broken work laptop they let her take home after taking the HD out (bsically t was a writeoff for them. drink was spilled all inside it) 04:59
and it makes me sad that i can't shop around to other manufacturers cause others don't have trackpoints 05:00
05:10 Cabanossi left 05:12 Tonik joined 05:13 Cabanossi joined
samcv though i heard their patent expires the end of this year? not sure. that doesn't mean anything will come of it, but you never know 05:14
05:18 TimToady left 05:19 TimToady joined 05:20 wamba joined, bjz_ joined 05:22 aborazmeh left, bjz left 05:27 araujo left 05:29 araujo joined, xtreak left, xtreak joined
samcv timotimo, well now i have it cgoing on and off on loop. sleeping 1 sec between every change. time to see how fast i can make it go 05:32
05:34 araujo left 05:38 araujo joined
samcv once it gets fast enough it just looks like it's smothely flickerig up and down. quite distracting 05:38
05:38 bjz joined 05:39 xtreak left, bjz_ left
samcv could play with the hex values though. three levels are 0x03 0x43 and 0x83 in hex at offset 0xd in specific linux /sys file 05:42
05:42 xtreak joined
moritz \o 05:54
05:54 bjz left
hobbs dell used to have trackpoints made by ALPS. Maybe under license? Guess it has been a while though 06:00
I'm in bad shape because I've been using trackpoint keyboards on my home and work PCs for the past 10 years straight 06:01
but they break, and I've run out of stock, and can't find them on eBay anymore
except for the terrible Lenovo ones that are just the bottom half of a ThinkPad
samcv can't find what? keyboards? 06:03
hobbs ones with a proper TrackPoint on them, yes
samcv for thinkpad?
or you mean for PC's like external
those are harder to find 06:04
hobbs yes, external
samcv i want one :3
hobbs and yes, they've gone from hard to impossible lately
this is the one that I've been using: 4.bp.blogspot.com/-PX5z6ZON75I/V3R...8923-1.jpg 06:06
last made in the late 90s, but there were always some on ebay 06:07
until the past year or two, all the old stock must have dried up
I got my hands on a couple SpaceSavers but they're not as good
06:08 bjz joined 06:11 Cabanossi left 06:13 Cabanossi joined 06:14 nadim_ joined 06:15 Xliff_ left
u-ou i think i will get brian d foys perl 6 book when it arrives 06:16
hi 06:20
examples.perl6.org/categories/cookb...-date.html 06:21
I like how simple that is
Voldenet phew, I finally figured out how to get pid of the process, look how easy it is ix.io/pgy :> 06:25
*cough intensely* 06:26
06:29 rburkholder joined
Voldenet oh, I forgot ix.io/pgA and ix.io/pgB 06:31
06:44 rindolf joined 07:04 zxvcd joined, zxvcd left 07:38 darutoko joined 07:40 domidumont joined 07:44 domidumont left, domidumont joined 07:48 domidumont left 08:01 RabidGravy joined 08:02 xtreak left, xtreak joined 08:03 gdonald left, gdonald joined 08:05 rburkholder left 08:11 Cabanossi left 08:12 Cabanossi joined 08:19 dct left
u-ou what's the idiomatic way to just create a file? 08:22
like without writing anything to it? 08:23
samcv u-ou, i mean you colud do `spurt "newfile.txt", ""` 08:25
that would work
u-ou yeah
samcv not sure of other ways to do it though.
u-ou true
thanks
samcv that will overwrite a file if it already exists though 08:26
my $IO = "newfile.txt".IO; $IO.spurt("") unless $IO.e 08:28
that would be safer
u-ou ok
skids just open "/tmp/foo", :rw does it. 08:29
samcv it will create a file just by opening it?
skids Yes.
samcv worked 08:30
'blah'.IO.open(:rw) that did it
skids You can't open something that doesn't exist, after all :-)
samcv well it could throw
idk.
you are right :)
heh
.o(wonders do we need to close filehandles if we don't store them in valiables after they are opened?) 08:31
idk if there's garbage collection for filehandles lol
08:31 cygx joined
cygx samcv: files are closed in the destructor, but you should not rely on it 08:32
samcv kk
cygx also, if you want to open a file in rw mode, but not create it implicitly, there's :update 08:33
if you want to fail on preexisting files, there's :rx
skids File::Temp is instructive on proper handling of destruction. 08:34
08:35 sftp left
cygx or rather, :rx will fail on preexisting already opened files 08:35
08:36 sftp joined 08:39 Sound joined
u-ou i ended up writing my script in perl 5 :( 08:43
but only because I needed glob which is unimplemented? 08:44
moritz yes, that sucks, but often you can use dir().grep(some regex) instead 08:47
u-ou ah, thanks 08:51
08:52 cygx left 08:54 xtreak left
nadim_ morning. can I define a method inside a method? 08:58
that's a yes. I guess that it is only visible in the parent method scope, right? 08:59
skids m: class A { method foo { method bar { 42.say; }; self.bar(); }; }; A.new.bar(); A.new.foo(); 09:03
camelia 42
42
skids m: class A { method foo { my method bar { 42.say; }; self.bar(); }; }; A.new.bar() 09:04
camelia No such method 'bar' for invocant of type 'A'
in block <unit> at <tmp> line 1
u-ou night 09:06
09:07 skids left 09:16 Sound left
timotimo Voldenet: i recommend also checking handle_obj for concreteness, lest you access bogus memory when it's an undefined object, and maybe give a different error when the process is null vs when it's not an MVMOSHandle 09:20
09:26 Cabanossi left 09:28 Cabanossi joined
Voldenet timotimo: I just copied the pattern used in other method related to MVM_REPR_ID_MVMOSHandle 09:28
timotimo OK, maybe some of those want changed, too. should try if putting in the OSHandle class we use makes any of them crash 09:29
09:30 Begi joined
Voldenet timotimo: only if you passed it a undefined process handle, but then process handle is BOOTIO so it can't really by instantiated anyhow 09:35
or can it?
timotimo the point is what happens if you don't instantiate it 09:39
try nqp::pidprocasync(BOOTIO)
09:47 geekosaur left, geekosaur joined 10:05 domidumont joined 10:10 lukaramu joined
El_Che I was so in love with the MAIN cli params flexibility and so extremely annoyed by weird switches-before-params, that I started to look in the src to see how to changed and I met $*MAIN-ALLOW-NAMED-ANYWHERE. How can it be enabled? It's a read only var. 10:11
stmuk_ my $*MAIN-ALLOW-NAMED-ANYWHERE = True; 10:15
yoleaux 21 Mar 2017 08:35Z <lizmat> stmuk_: is there a reason why the P6W is no longer syndicated to pl6anet.org ?
stmuk_ that is fixed :) 10:16
10:22 rburkholder joined 10:38 geekosaur left 10:39 geekosaur joined
El_Che ah, my 10:42
silly me
thx, stmuk_ 10:43
10:48 rburkholder left 10:56 Cabanossi left 10:58 Cabanossi joined 11:02 grumble left 11:03 grumble joined 11:10 labster left 11:16 geekosaur left 11:19 geekosaur joined 11:21 araujo left 11:24 Tonik left 11:26 araujo joined 11:32 ZzZombo left, ZzZombo joined 11:37 geekosaur left 11:38 espadrine joined 11:39 geekosaur joined, geekosaur left 11:40 geekosaur joined 11:47 bjz_ joined 11:49 bjz left 11:50 geekosaur left 11:52 geekosaur joined, geekosaur left 11:54 geekosaur joined 11:56 Cabanossi left 11:57 geekosaur left 11:58 Cabanossi joined 12:00 geekosaur joined 12:03 geekosaur left 12:05 geekosaur joined 12:11 rburkholder joined, geekosaur left 12:12 geekosaur joined 12:13 geekosaur left 12:15 geekosaur joined 12:19 geekosaur left 12:21 geekosaur joined 12:26 geekosaur left, Cabanossi left 12:27 geekosaur joined 12:28 Cabanossi joined 12:32 rburkholder left 12:34 MasterDuke left 12:38 MasterDuke joined
RabidGravy tadzik, I've added a test to JSON::Unmarshal fot the shaped associative case which was just fixed in rakudo 12:44
github.com/tadzik/JSON-Unmarshal/pull/25
12:47 geekosaur left, geekosaur joined
DrForr Just out of curiosity, are any of the JSON modules able to round-trip a JSON file? (That is, preserve ordering and spacing in the data structure? Wasteful, I know...) 12:49
12:57 geekosaur left 12:58 Sound joined, kurahaupo__ joined 12:59 geekosaur joined 13:00 geekosaur left 13:03 geekosaur joined, geekosaur left 13:04 geekosaur joined 13:05 geekosaur left 13:08 geekosaur joined
RabidGravy Not that I know of 13:10
DrForr Mumble. 13:11
13:12 Cabanossi left 13:13 pmurias joined, Cabanossi joined
DrForr I was thinking about a Dist::Zilla-alike whose first and most important feature would be to keep the META file(s) up-to-date :) I wanted to keep the deltas on that file small. 13:14
pmurias should I upgrade t/01-sanity/99-test-basic.t to use 'is-approx' instead of the deprecated 'is_approx'?
13:18 aborazmeh joined, aborazmeh left, aborazmeh joined 13:20 bjz joined 13:21 bjz_ left
pmurias maybe having the tests for is_approx in a deprecated test? 13:23
DrForr Yeah, I'd move them into a separate file so they're easy to delete when the deprecation period is over. 13:25
13:27 geekosaur left, geekosaur joined 13:28 rindolf left 13:32 geekosaur left, geekosaur joined 13:35 geekosaur left, lukaramu_ joined 13:37 geekosaur joined 13:38 geekosaur left, geekosaur joined 13:39 lukaramu left 13:41 nadim_ left
ilmari if it issues a deprecation warning, there should be a test for that, while the actual use should be using the new form 13:48
13:50 xtreak joined 13:57 Cabanossi left 13:58 Cabanossi joined 14:01 bjz left 14:02 mr-foobar left 14:03 gdonald left, gdonald joined 14:05 geekosaur left 14:06 Ven joined 14:07 Ven is now known as Guest84346, geekosaur joined, Skycry joined, aborazmeh left, Skycry left 14:08 Sound left, mr-foobar joined 14:12 geekosaur left 14:16 geekosaur joined 14:19 Tonik joined 14:22 pecastro left
El_Che I want to pass positional and named paramter to a method. I thought something like: my @args = ("pos1", "post2", (name1 => 'foo'), (name2 => 'bar')); $foo.method(|@args). It does not work. Is there a way to do that? <== pass named parameters to the method only if they are defined? 14:23
14:23 pecastro joined
timotimo you need to | a % 14:25
lizmat use a sigilles capture
timotimo |@ will always give positionals
El_Che ic
lizmat m: sub a(|c) { dd c }; a foo => 42, 666
camelia \(666, :foo(42))
El_Che I like the |% solution 14:28
it does not touch the sub
thx lizmat and timotimo
timotimo well, you can also use \(...) to construct a capture
and | that into your call
14:28 Guest84346 left 14:31 Ven_ joined
El_Che I am converting small one liners and snippets of perl5, 6, shell code I use when analysing text into a small lib. So far silly things like frequency of words in a corpus, split text into different files by regex (e.g. chapters). Silly, but in the Human sciences, most people do it manually 14:33
lizmat
.oO( Perl 6 Oneliners )
14:34
El_Che method count-words-in-text(Str $text, -->Int) { return $text.words.elems; } 14:36
priceless
:)
it's more interesting when the user passes several files at once and want a specific format like csv in return
lizmat method count-words-in-text(Str $text, --> Int() ) { $text.words } 14:37
aka, coerce the return value to an Int
it will call elems for you :-) 14:38
El_Che Most of one liners I use are perl5, though. Consolidating them in p6 because I see lots of potential with the new regex
more magic
who needs harry potter :)
lizmat method count-words-in-text(Str $text, -->Int) { +$text.words } # less magic
El_Che that's better 14:39
although good to know about the -->Type() coercion
14:40 Cabanossi left
lizmat m: sub a(Int() $a) { dd $a }; a "42" 14:41
camelia Int $a = 42
El_Che :)
lizmat not only works for return arguments
14:43 Cabanossi joined
El_Che and lizmat= 14:43
14:43 Peter_R left
El_Che my $*MAIN-ALLOW-NAMED-ANYWHERE = True; 14:43
\o/
that made me happy
lizmat you were not the only one :-) 14:44
14:44 Peter_R joined
El_Che most of the time it's like: "ah that's nice" or "pretty cool" 14:44
this was really a huge smile on my face
Notpick: "--switch arg" would be nice, but "--switch=args" is certainly ok 14:45
The first because you can use shell expansion 14:46
--files *
--file ~/Code/foo.txt
lizmat I think there was a reason for that, but I forget right now
afk for a few hours&
geekosaur if your shell is recent enough it should do expansion after = 14:52
(zsh might need a setting tweak) 14:53
14:55 bjz joined 14:59 zakharyas joined 15:04 drrho_ left 15:05 drrho_ joined 15:06 pecastro left 15:09 Ven_ left
El_Che geekosaur: the latest ubuntu has GNU bash, version 4.3.46(1)-release. $deity knows how much older stuff centos runs 15:09
timotimo how come we can take a &by of 1-arity in method min, but not one with two to have it as a comparator? 15:11
and how come Supply.min uses &by for a comparator, but Any.min uses &by as a transformator? 15:12
15:13 AlexDaniel joined 15:20 Ven joined, Ven is now known as Guest99943 15:23 Guest99943 left 15:26 rindolf joined 15:28 bjz left 15:32 setty1 left, Peter_R left, Peter_R joined 15:33 yqt joined 15:35 khw joined 15:41 Cabanossi left 15:42 Cabanossi joined 15:46 setty1 joined
DrForr Hrm. Is there a split() variant that would give me an even-length list for "a;b;;c".split(";",:adverb) # ? 15:53
Note that 'c' doesn't have a subsequent split() token. 15:54
15:56 pecastro joined, kurahaupo__ left 15:57 kurahaupo__ joined 16:05 xtreak left 16:14 xtreak joined 16:26 Cabanossi left 16:27 TeamBlast left 16:28 Cabanossi joined, skids joined 16:29 TeamBlast joined 16:34 xtreak left 16:35 xtreak joined 16:36 ZzZombo left, sjn-mo joined
SmokeMachine $*MAIN-ALLOW-NAMED-ANYWHERE doesn't work with "--"... :( 16:37
www.irccloud.com/pastebin/BgBVwEJn/
16:38 xtreak left
gfldex m: dd "a;b;;c".split(";",:k)[0,2 … *] 16:38
camelia ("a", "b", "", "c")
gfldex DrForr: ^^^ 16:39
DrForr Chose a different way, but thnak you, I'll remember that.
16:40 sjn-mo left
gfldex m: say ("f,,b,c,d".split: /","/ ).perl; 16:40
camelia ("f", "", "b", "c", "d").Seq
16:40 sjn-mo joined 16:41 dogbert17 joined
dogbert17 o/ 16:41
yoleaux 16 Mar 2017 00:35Z <AlexDaniel> dogbert17: irclog.perlgeek.de/perl6/2017-03-16#i_14272417
16:42 xtreak joined, xtreak left
dogbert17 ok noob p6 question what's a good way to split a string where two characters differ, i.e. "aabbbc" => ("aa", "bbb", "c") ? 16:44
16:45 sjn-mo left, sjn-mo joined
DrForr That's somewhat unusual. I'd look at forward references, assuming those are still in p6. 16:45
16:46 sjn-mo left
DrForr almost has indentation working in ::Tidy. 16:46
16:46 sjn-mo joined 16:47 sjn-mo left
dogbert17 DrForr, are you referring to '<?before pattern>' 16:47
AlexDaniel m: say ‘aabbbc’.comb(/(.)$0*/)
camelia (aa bbb c)
dogbert17 oops, AlexDaniel++
AlexDaniel you have to define the problem other way round
dogbert17 nifty solution 16:51
16:53 BenGoldberg joined
El_Che can a bag be appended/merged to an other bag? 17:00
or HashBag 17:01
timotimo sure, you want (+) for that
El_Che you are sh*tting me. That simple? 17:02
timotimo well, you may want (+)= instead of just (+)
El_Che hehe
AlexDaniel or, you know, ⊎ 17:03
El_Che I guess creating the bags with bag is out of the question and I need a HashBag explicitly? 17:04
AlexDaniel hmm not necessarily 17:05
m: my $a = bag <1 2 3>; my $b = bag <a b c>; my $c = $a ⊎ $b; say $c 17:06
camelia bag(1, 3, b, a, c, 2)
AlexDaniel m: my $a = bag <1 2 3>; $a ⊎= bag <a b c>; say $a
camelia bag(1, 3, b, a, c, 2)
El_Che incredible 17:08
AlexDaniel but maybe if you're dealing with huge bags, then perhaps ⊎ is not going to work that great 17:09
but I'm not sure
El_Che we'll see when we hit that by now. By now my main source is small (700 pages book)
using bags for finding word frequencies 17:10
AlexDaniel wouldn't call that small :D
but yeah, you'll see
El_Che well, the simple poc code worked 17:11
and then I stared refactoring :)
17:11 Sound joined
TimToady m: say ‘aabbbc’.split(/<!same>/) # this also works 17:12
camelia ( aa bbb c )
SmokeMachine Sorry, I was wrong...
TimToady well, except that leaves nulls at the end
17:12 geekosaur left, geekosaur joined
SmokeMachine m: say ‘aabbbc’.comb(/<?same>+/) 17:13
:(
camelia (timeout)
17:13 tojo joined
TimToady m: say ‘aabbbc’.comb(/.[<same>.]*/) 17:13
camelia (aa bbb c)
masak SmokeMachine: shouldn't ever quantify zero-width assertions... 17:14
SmokeMachine masak: makes sense... thanks!
AlexDaniel huh, <same> ?
TimToady it's a 0-width assertion about its surrounding chars 17:15
AlexDaniel ok… github.com/perl6/doc/issues/1259 17:18
SmokeMachine: where did you find it?
m: dd ‘aabbbc’.split(/<!same>/) 17:19
camelia ("", "aa", "bbb", "c", "").Seq
AlexDaniel SmokeMachine: interestingly, you can also do this ↑, except that you get these empty strings on the sides
dogbert17 TimToady, thx for the snippet, didn't know about 'same' 17:20
17:21 zakharyas left
dogbert17 m: dd ‘aabbbc’.split(/<!same>/, :skip-empty) 17:21
camelia ("aa", "bbb", "c").Seq
AlexDaniel right
dogbert17 TimToady: still there or hiding behind a cricket? 17:23
does P6 have anything like this (which someone pointed out a couple of days ago)? medium.com/rubyinside/the-new-abse....5m5y0opr2 17:25
17:28 TeamBlast left
AlexDaniel ruby is now supporting curly quotes, huh? 17:28
or these were mangled by the website itself? 17:29
17:30 TeamBlast joined
El_Che I have a ton of work on the cualitative text analysis itself, but it has been fun working on the quantitative part with Perl 6 17:35
For a 130056 17:42
oops
For a 130056 word corpus, the bag based word frequency counter finishes in 45sec. Nice 17:43
17:44 domidumont1 joined, domidumont left 17:45 domidumont joined 17:48 domidumont1 left 18:12 dct joined 18:15 pochi left 18:37 mr-foobar left 18:47 setty1 left 18:51 setty1 joined 18:55 Cabanossi left 18:58 chsanch joined, Cabanossi joined 18:59 cognominal joined
chsanch Hi!, I'm trying to build Perl 6 on a Pocketchip (armv7l), I'm having some build errors, perhaps for not having enough RAM (512MB), I think more RAM it's not an option here, any advice or there is some documentation about it?. Thanks! 19:04
19:05 pochi joined, labster joined 19:09 darutoko left
timotimo chsanch: at what point do the errors appear? 19:10
it's impossible to build the rakudo core setting with only half a gig of ram
that's the one that tells you "please be patient" and it'll output "start", "parse", and then crash 19:11
chsanch Yes, it's at the parse stage: "Stage parse : Makefile:470: recipe for target 'CORE.setting.moarvm' failed" 19:14
timotimo yup 19:15
out of ram, and crash
you can make a swap file, of course
chsanch Ok, I'll try that then 19:17
19:20 domidumont left 19:21 domidumont joined 19:23 MasterDuke left 19:29 dct left 19:30 MasterDuke joined 19:46 domidumont left 19:47 bjz joined
El_Che chsanch: cross compiling? qemu + emulated arm and more memory? 19:54
RabidGravy fwiw, it will build on a Raspberry Pi B with 512MB 19:58
19:58 Peter_R left, var_somebody joined 19:59 var_somebody is now known as v1_
timotimo oh? 20:00
RabidGravy I haven't got one plugged in right now, but it did a month or so ago 20:01
20:01 Peter_R joined
RabidGravy took like forever but hey 20:01
20:03 v1_ left, var_somebody joined 20:04 var_somebody left 20:06 mr-foobar joined, dct joined 20:10 Cabanossi left
AlexDaniel chsanch: what OS are you using? 20:12
chsanch: I'd just take a package and use that
20:13 Cabanossi joined
timotimo do we actually have arm packages? 20:17
gfldex timotimo: packages.debian.org/sid/rakudo-lib 20:19
timotimo: so, not really
20:20 pecastro left 20:27 dct left, bitrauser joined 20:29 bitrauser left
chsanch AlexDaniel: I'm using Debian 20:34
AlexDaniel chsanch: there's rakudo 2016.12 in debian testing 20:35
not exactly the latest but possibly good enough
chsanch there's a rakudo version, but it's 2014.07 20:36
AlexDaniel *testing*
chsanch oh, well, I'm using stable
yah, maybe I should upgrade it
AlexDaniel chsanch: you can pull rakudo package only, I don't think it has many dependencies
timotimo yeah, with "pinning"
20:37 rindolf left
gfldex there where quite a few bugs fixed since december last year 20:37
building it by hand may be worth it even if it takes the whole night
AlexDaniel well, then you can get 2017.02 from experimental…
gfldex chsanch: you could try to take the source deps from experimental and pull recent changes 20:38
AlexDaniel if you spend 15 minutes on getting it to pin right, you'll never have to spend the whole night to upgrade it :)
20:39 tojo left
chsanch ok, I'll try the experimental option, but tomorrow, it's almost 11pm here .. I'll let you know how it goes. 20:41
Thanks!
20:44 bjz left 20:46 timotimo joined 20:47 rindolf joined
Geth doc: 1f08eaacd9 | (Aleks-Daniel Jakimenko-Aleksejev)++ | doc/Type/Proc.pod6
Remove method pid

It does nothing, there are no tests, and there is a rakudo PR to remove it completely.
20:47
20:48 nadim joined
nadim Hi, I have this code nopaste.linux-dev.org/?1123015 I want to have a method that takes any number of arrays and some extra named parameters. this takes text and puts it in columns. 20:52
20:53 lichtkind__ joined
timotimo nadim: watch out, >>.say doesn't guarantee that the says are executed in order 20:54
20:55 obarb joined
gfldex m: sub f(**@a, :$foo){ for @a { when Array { say 'Array' }; } }; my (@a, @b); f(@a, @b, :foo); 20:55
camelia Array
Array
gfldex nadim: ^^^
20:55 brabo left, vytas left, jantore_ left
gfldex nadim: please not that **@a will slurp much more then just Array so you have to handle those cases with care 20:55
*note 20:56
20:56 jantore joined, vytas joined 20:57 lichtkind_ left
nadim **@as is not in a method where anything else but arrays are passed, it works fine in that context 20:58
good to know about >>.say I guess that is because it can get threaded, right? 20:59
timotimo yup
we used to randomize the calling order to force folks to not rely on it
well, not random, just odd-patterned
it was removed due to performance trouble if i'm not mistaken
gfldex the randomisation was removed, not the threading 21:00
nadim ah I see what you mean with **@a, I am using that construct somewhere else I thought you were talking about it. 21:01
so back to (**@a, :$foo), I have tried but it really didn't want to work. if you say this is the way, I will insist, maybe I am just tired 21:02
timotimo there never was threading for that, gfldex 21:04
gfldex i know, your statement about removal was ambiguous
or maybe I'm to tiered too 21:05
all clocks are wrong right now :(
nadim 2 mn an I will post the code I tried (in vain)
nopaste.linux-dev.org/?1123017 21:07
and I guess .map can come in a different order too, is it jusr for loops that come in order? 21:08
gfldex try |@rs in line 3
(I'm guessing with halve a brain) 21:09
21:09 chsanch left
timotimo map is in order 21:09
you can .hyper.map or .race.map if you want it to be not-in-guaranteed-order
(of course, might want to wait for jnthn's hyper/race work to be in rakudo before working with it much)
nadim :) 21:10
21:11 raschipi joined, RabidGravy left
nadim the second code compiles and run but let's say that the results are not what I want. the :foo I pass becomes parts of the lists and ends up on the display, not what I want. 21:11
gfldex waiting for rakudo not being confused by walking with two legs before asking it to use 12 may be a good idea too :-> 21:12
nadim why crawl when you can warp through the galaxy ;)
21:12 Tonik left
timotimo can you show how you're invoking it? 21:13
named parameters never get part of a *@ or **@, you're probably putting "" around the LHS of the =>
or doing something else that passes a Pair object instead of flatening in a named parameter 21:14
nadim $d.display_columns(<line other_line>, $d.get_dump_lines([6..12]), $d.get_dump_lines([1..4]), :width(20)) ;
three lists am :width(20) 21:15
gfldex nadim: I am now certain that you have to .Slip a slurpy when forwarding it to another slurpy
timotimo oh, do you mean how you call $_.display_columns with "$compact" instead of ":$compact"?
nadim and
timotimo because that's not a named parameter at all
nadim haven't done P6 for a few months, I am rusty it seems
timotimo that's all right
nadim no I called it with :$compact 21:16
the call above, that uses :width(20), is how the first call looks like
should that call use :$foo ? as it seems to work just fine. 21:17
timotimo sorry, "foo"? or "width"? 21:18
:$foo is short for :foo($foo)
so if you're calling it with :width(20) that's already fine
i'm not sure if passing the @rs on like you do in the uppermost method is the right way, i think you'll want to |@rs 21:19
otherwise you're passing the array with arrays as a single positional
but you'll most probably want to pass on $width and $compact in a way that makes them not go into @rs, right? that's why you have to put a : there
gfldex m: sub f(**@a, :$foo){ g(:$foo); for @a { when Array { say 'Array' }; } }; sub g(:$foo){ dd $foo }; my (@a, @b); f(@a, @b, :foo(42)); 21:20
camelia Int $foo = 42
Array
Array
nadim here is the whole code nopaste.linux-dev.org/?1123019
timotimo i must say i find this indentation style really strenuous to read 21:21
nadim display_columns is one version, the one with **@rs, xdisplay_column is another implementation that doesn't take a variable amount of lists
gfldex m: sub f(**@a, :$foo){ g(|@a, :$foo) }; sub g(**@a, :$foo){ dd @a, $foo }; my (@a, @b); f(@a, @b, :foo(42));
camelia [[], []]
Int $foo = 42
gfldex m: sub f(**@a, :$foo){ g(@a, :$foo) }; sub g(**@a, :$foo){ dd @a, $foo }; my (@a, @b); f(@a, @b, :foo(42));
camelia [[[], []],]
Int $foo = 42
nadim I find K&R unreadavle
21:21 dct joined 21:22 bjz joined
timotimo we'll soon have DrForr's ::Tidy 21:22
nadim :)
the code you wrote is exactly what I wrote. but it does not work for me 21:23
timotimo is that the code gfldex wrote or what i wrote? 21:24
nadim I didn't even notice you were two :) this irc client gives the same color to both of you :) 21:25
last code gfldex wrote
timotimo at least we have wildly different nick lengths :)
nadim indeed 21:26
but you did not write code.
timotimo yeah, only parts
anyway 21:27
$._display_columns(@rs, $width, $compact)
nadim just spend 3 mn scrolling everywhere
timotimo line 8 or what it is
nadim ok, go on
timotimo that'll pass three positional parameters to the other function
with that call you'll never get $width nor $compact in the _display_columns set to anything
nadim yes I see
a bug indeed 21:28
I checked when you told me but I missed that one
timotimo on top of that, when you go from **@rs and pass @rs to another function with **@rs you'll end up with only one parameter the second time 'round
21:28 espadrine left 21:29 setty1 left
nadim so how do I do that? 21:30
I must admit that I need to understand ** better, couldn't find a doc 21:31
gfldex what reminds me that I wanted to write down that there a slight differences when returning a .Slip over returning |()
nadim is looking forward to the read
gfldex nadim: see docs.perl6.org/type/Signature#Unfl...ned_Slurpy 21:32
and I stopped writing docs. I went back to file issues.
21:33 bjz left
gfldex have a good *, I'm off to bed hoping the clocks will be a little less wrong tomorrow 21:33
nadim night 21:34
timotimo oh, nadim, you need to flatten it with |@rs
nadim ok, be nice, context, and where. I am old, my grand mother broke her leg, I got a hunch back, the IRS is after me, ... 21:36
I call method(list1, list2, list3, :foo) that goes in method(**@list, :$foo) 21:37
which needs to access list1, list2, ...
timotimo yeah, list1, list2, list3 will be reachable as @list[0], @list[1], and @list[2] in that case
and $foo will be True 21:39
nadim method call method2, which has signature **a, $:foo. do I need to |@list before calling the second method?
timotimo not "before"
the call looks like method2 |@list
and then you pass on :$foo (not $:foo, that's something else) 21:40
nadim lyes I meant :$foo, that's a typo here, that not appearing in the code 21:42
what is it btw?
timotimo it's like $^foo but for named instead of positional
so like { $:hello } is the same as -> :$hello { $hello }
just like { $^a } is the same as -> $a { $a } 21:43
nadim hmm flattening **@r does nothing. my @r_flat = |@r is the same as @r 21:48
timotimo yes 21:49
that's because |@r is syntax inside of calls
and list assignment will iterate over the RHS and assign it into containers on the LHS
m: my @foo = (<a b c>, <d e f>, <g h i>); sub do_it(**@r) { my $thing = |@r; dd $thing; my @other = |@r; dd @other } 21:50
camelia ( no output )
timotimo m: my @foo = (<a b c>, <d e f>, <g h i>); sub do_it(**@r) { my $thing = |@r; dd $thing; my @other = |@r; dd @other }; do_it(@foo); do_it(|@foo)
camelia Slip $thing = $(slip($[("a", "b", "c"), ("d", "e", "f"), ("g", "h", "i")],))
Array @other = [[("a", "b", "c"), ("d", "e", "f"), ("g", "h", "i")],]
Slip $thing = $(slip($("a", "b", "c"), $("d", "e", "f"), $("g", "h", "i")))
Array @other = [("a", "b"…
timotimo that's a bit long 21:51
m: my @foo = (<a b>, <d e>, <g h>); sub do_it(**@r) { my $thing = |@r; dd $thing; my @other = |@r; dd @other }; do_it(@foo); do_it(|@foo)
camelia Slip $thing = $(slip($[("a", "b"), ("d", "e"), ("g", "h")],))
Array @other = [[("a", "b"), ("d", "e"), ("g", "h")],]
Slip $thing = $(slip($("a", "b"), $("d", "e"), $("g", "h")))
Array @other = [("a", "b"), ("d", "e"), ("g", "h")]
timotimo now it fits
you see how $thing is a slip, but yother is an array?
in the first example, @other has an extra [ ] around it because i didn't call do_it with |@rs
in the second example it doesn't have the extra [ ] because i slipped it into multiple positional parameters using | 21:52
nadim OK
timotimo i hope that helps at all, instead of being more confusing 21:53
nadim it helps
I dump the data so I see what happens.
and calling with |@r did fix it, the code does what it is supposed to do. 21:54
I will try a few more tests before being happy
timotimo i'm about to head towards bed 21:59
nadim all calls to method(**@) must |@
works perfectly when I put them everywhere
thank for the help, I'll push this tomorrow so we can get multiple Data::Dump::Trees in columns 22:00
actually I should put that in Text::Columnize
dogbert17 AlexDaniel: btw, gist.github.com/dogbert17/ea5855ab...86c2f24f62 22:01
timotimo no
you got the wrong idea from that
AlexDaniel dogbert17: ooooh 22:02
nadim timotimo: the wrong idea?
timotimo if you had to always use | with **@, then we'd just make that the default
the thing is, **@ is about how incoming positional arguments are treated 22:03
whereas |@ is about pretending an array you have is actually many positional arguments rather than just one positional argument
nadim the first call, the one the user makes looks like method(list1, list2, listn, :foo(10)) so the user is flattening the first one
timotimo the user isn't flattening there 22:04
or i'm misunderstanding how you mean that
skids Anyone else getting some native int related spectest failures lately? Don't know if that's recent or due to me upgraded my build env.
AlexDaniel dogbert17: hm, so what does it mean? :) 22:05
nadim I meant that the user is putting the lists in the call, they get grouped together with **@r I need to do the ungrouping in my code, the user not
tomorrow, after work, I'll post the whole thing 22:06
I am at the airport waiting for my flight, I can keep everyone awake
but won't
timotimo oh 22:08
have a safe trip!
i'll just try to wrap things up over in #moarvm and head to sleeps
nadim thank you, Beirut next. I wonder if there is a pm group there. 22:09
timotimo is that the international name of Bayreuth in germany? 22:11
raschipi It's Beirute in Portuguese.
timotimo ah, ok
22:11 Cabanossi left 22:12 Cabanossi joined 22:16 nadim left 22:20 yqt left 22:21 rburkholder joined 22:27 wamba left 22:42 Voldenet left 22:47 Voldenet joined, Voldenet left, Voldenet joined 22:53 kent\n left 22:57 dct left 22:59 labster left 23:07 Sound left 23:08 kurahaupo__ left 23:15 rindolf left 23:29 agentzh joined, agentzh left, agentzh joined
agentzh hi guys, sorry if it's a newbie question, but i wonder if it's possible to avoid array copying in @lst in this p6 example: my @lst = <foo bar baz>; class A { has @.b}; my $o = A.new(b => @lst) 23:31
p6: my @lst = <foo bar baz>; class A { has @.b}; my $o = A.new(b => @lst); pop @lst; say $o; 23:32
camelia A.new(b => ["foo", "bar", "baz"])
agentzh i hope the `@.b` uses binding in the new() call.
is there any special p6 syntax sugar for this?
raschipi It's always by binding, the array is just marked read-only. 23:34
If you want to avoid marking it read-only, you need is rw. To pass a copy, you'd need is copy.
agentzh interesting 23:35
p6: my @lst = <foo bar baz>; class A { has @.b is rw }; my $o = A.new(b => @lst); pop @lst; say $o; 23:36
camelia A.new(b => ["foo", "bar", "baz"])
agentzh seems like "is rw" still incurs a copy here?
raschipi: any more hints?
raschipi No, you need "is rw" in the function signature, not i9n the class declaration. 23:37
agentzh i just want to use the @ sigil for the class attributes inside the class, which is nicer than $ while avoid paying for the array copying overhead for the class users.
raschipi: can i still use the new method? 23:38
raschipi It can be called "new", but it will have a different signature.
agentzh raschipi: will you give me an example? 23:39
it cannot be easily achieved without overriding new()?
since i have 46 pm6 classes, overriding new() just for this looks quite like a burden to me. 23:40
ideally it can be an easy flag or something. 23:41
raschipi The function signature is what determines what happens, if you use the default method, you'll get the default behavior.
You could define a class that defined a new new method and inherit from it. 23:42
That way every method would inherit your new method instead of the one defined in Mu. 23:43
Every class would inherit, I mean. 23:45
There's nothing magical about "new". 23:47
23:47 labster joined
agentzh raschipi: thanks for help. but i'm afraid inheritance might not work here without using MOP since each class has its own set of array-typed attributes. 23:49
raschipi The default "new" discovers the attributes, doesn't it? Have a look at the source code to see how it's done.
agentzh ideally maybe we could introduce a `is ref` trait for class attribute declarations?
just like the existing `is required` and `is rw` traits?
this is much more flexible. 23:50
raschipi I'm not sure how to make the bot bring the link.
There's no references in Perl6.
agentzh i'm not sure how rakduo works but a perl 6 compiler choose determine the attributes at compile time instead of at runtime using MOP.
the latter can be quite inefficient. 23:51
raschipi It's about what function calling does, not about how the classes are built.
agentzh *can choose to determine
raschipi Objects are all runtime by design.
It's inherent on how Object Orientation should work.
agentzh but the classes can be assumed to be "closed" if no open class operations are seen by the compiler in the current p6 program 23:52
i remember i read that in a synopsis before.
if all the classes are closed, then the compiler can do clever things in new methods, for example.
raschipi Well, but that's a job for the optimizer and the JIT. They should be transparent for the working of the langugage.
agentzh yeah, so it seems a good chance for the compiler to optimize things if the class attributes accept a "is ref" trait. 23:53
so that the user does not have to write such special new() method using MOP or something. 23:54
raschipi Anyway, method calling doesn't know about the structure of the objects. You need to change the signature of the method, not the structure of the object.
agentzh the latter would be hard to optimize.
raschipi Method calling doesn't know about object structure.
23:54 Ben_Goldberg joined, BenGoldberg left 23:55 Ben_Goldberg is now known as BenGoldberg
agentzh raschipi: but the compiler can definitely take advantage of the object structure if it finds that it is completely safe in doing so. 23:56
optimizers are all about specializations :) 23:57
raschipi It can. But it's transparent for the programmer.
Perl6 has even "deoptimization", when it optimizes for something and the assumptions change later.
agentzh true. i'm proposing the is ref trait for semantics which is open for optimization opportunities.
the latter is just a bonus :) 23:58
raschipi Well, you don't need the trait, the compiler can determine that on it's own.
agentzh but i still need to write special new() methods, which is a burden for the programmer.
and it would be much harder for the compiler to optimize my MOP code completely away than a simple trait hint. 23:59
raschipi That's object orientation for you.
agentzh i've found this very important and common for optimizations.