Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-03-26

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:00 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!)
00:00 timotimo i wish somebody would champion an API to give more FDs to spawned processes ...
00:01 vendethiel- joined #perl6
00:01 geekosaur also if you are dealing with a Solaris old enough to need that...
00:01 Voldenet legacy reasons
00:01 geekosaur I think that's Solaris *1*
00:01 geekosaur (aka SunOS 4 late releases)
00:02 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
00:02 Voldenet some people never gave up the habit :D
00:03 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 geekosaur SVR4 is how old now?
00:03 Voldenet 34
00:04 timotimo 1934, or 34 years old? :P
00:04 geekosaur um, that'd be System V itself, not R4
00:04 geekosaur 34's about as long as I've been in computing
00:04 geekosaur whioch would be right for SVR1
00:04 timotimo i haven't been in anything for that long …
00:05 Voldenet well, due to ugly old standards i'll be reimplementing half of unix in perl6
00:09 Sound joined #perl6
00:15 vendethiel joined #perl6
00:27 SCHAAP137 joined #perl6
00:27 Belial joined #perl6
00:30 Belial Any notable projects in Perl 6?
00:33 sftp joined #perl6
00:44 cyphase joined #perl6
00:45 raschipi Went away.
00:47 AlexDaniel joined #perl6
00:58 aborazmeh joined #perl6
00:58 aborazmeh joined #perl6
01:03 AlexDani` joined #perl6
01:11 pelevesque joined #perl6
01:11 lucs pelevesque: Welcome :)
01:18 Voldenet eh, too bad I can't use filehandle with IO::Handle or IO::Pipe
01:19 Voldenet because it internally uses MVMOSHandle which uses uv_pipe_t
01:21 gdonald joined #perl6
01:21 mr-foobar joined #perl6
01:26 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 Voldenet and not reimplementing half of the mvm's features
01:27 Voldenet why can't i just do that (`Д´)ノ︵ ┻━┻
01:27 BenGoldberg joined #perl6
01:30 raschipi ┬─┬ノ(ಠ_ಠノ)
01:39 BenGoldberg . o O (You have been flipped by the table)
01:48 ilbot3 joined #perl6
01:48 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
01:49 u-ou flip ME
01:49 Voldenet no-n
01:53 AlexDaniel m: say flip ‘me’
01:53 camelia rakudo-moar b01d7e: OUTPUT: «em␤»
01:53 AlexDaniel m: say flip %*ENV<ME>
01:53 camelia rakudo-moar b01d7e: OUTPUT: «leinaDxelA␤»
02:07 Cabanossi joined #perl6
02:09 xtreak joined #perl6
02:26 jeek joined #perl6
02:38 obfusk joined #perl6
02:43 noganex_ joined #perl6
02:46 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:48 Voldenet yeah, I've noticed
02:48 Voldenet tbh, I'm chasing other thread
02:48 Voldenet MVM_proc_spawn_async actually holds process data
02:49 Voldenet the returned object from MVM_proc_spawn_async is MVMOSHandle
02:52 Voldenet int get_pid () { MVMOSHandle *handle; MVMIOAsyncProcessData data = handle->data; uv_process_t *uv_handle = data->handle; return uv_handle->pid }
02:53 Voldenet basically something like this should work (add the ugliness of C syntax)
02:54 Voldenet so theoretically I could use nqp::spawnprocasync() to get what I want
02:58 Voldenet my $msvmos-handle = nqp::getattr(nqp::decont($proc-async), IO::Proc::Async, '$!process_handle')
02:59 Voldenet or rather: my $msvmos-handle = nqp::getattr(nqp::decont($proc-async), Proc::Async, '$!process_handle')
03:07 Cabanossi joined #perl6
03:08 Cabanoss- joined #perl6
03:15 adu joined #perl6
03:39 cpage__ joined #perl6
03:41 cyphase joined #perl6
04:08 gdonald joined #perl6
04:13 Cabanossi joined #perl6
04:16 skids joined #perl6
04:28 aindilis joined #perl6
04:38 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:40 xtreak joined #perl6
04:42 TimToady if linux, alias bl='xbacklight -set'
04:43 TimToady oh wait, that's keyboard
04:43 TimToady dunno 'bout that
04:43 samcv maybe there's no way to do it variably... idk
04:44 TimToady I've only seen those three levels on mine
04:44 samcv this will allow you to control it from the OS https://gist.github.com/hadess/6847281 but 0 1 and 2 are insufficient!
04:44 samcv oh well
04:45 * TimToady never has any keyboard light after suspend anyway
04:45 TimToady helps to be a touch typist though :)
04:45 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
04:46 samcv there's plenty of room on this laptop for a 7 row keyboard :(
04:51 TimToady it turns off slowly, so you could maybe continuously turn it on and off to get something in between :)
04:52 samcv heh
04:52 samcv i'm sure that c program could be sufficiently abusably depending on how the hardware acts
04:52 samcv i should try setting it on a loop
04:52 * TimToady hates capacitive function key strips...
04:53 ZzZombo joined #perl6
04:53 samcv well maybe if we are lucky lenovo will release a throwback thinkpad that has an older style keyboard
04:53 samcv they say they are going to for the 25th anniversary (hopefully)
04:58 TimToady hmm, I wonder if there's some similar way to turn the function strip back on after a suspend...
04:59 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)
05:00 samcv and it makes me sad that i can't shop around to other manufacturers cause others don't have trackpoints
05:12 Tonik joined #perl6
05:13 Cabanossi joined #perl6
05:14 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:19 TimToady joined #perl6
05:20 wamba joined #perl6
05:20 bjz_ joined #perl6
05:29 araujo joined #perl6
05:29 xtreak joined #perl6
05:32 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:38 araujo joined #perl6
05:38 samcv once it gets fast enough it just looks like it's smothely flickerig up and down. quite distracting
05:38 bjz joined #perl6
05:42 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 xtreak joined #perl6
05:54 moritz \o
06:00 hobbs dell used to have trackpoints made by ALPS. Maybe under license? Guess it has been a while though
06:01 hobbs 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 hobbs but they break, and I've run out of stock, and can't find them on eBay anymore
06:01 hobbs except for the terrible Lenovo ones that are just the bottom half of a ThinkPad
06:03 samcv can't find what? keyboards?
06:03 hobbs ones with a proper TrackPoint on them, yes
06:03 samcv for thinkpad?
06:03 samcv or you mean for PC's like external
06:04 samcv those are harder to find
06:04 hobbs yes, external
06:04 samcv i want one :3
06:04 hobbs and yes, they've gone from hard to impossible lately
06:06 hobbs this is the one that I've been using: https://4.bp.blogspot.com/-PX5z6ZON75I/V3R​rrZ0FKrI/AAAAAAAAAlg/K9VipXhOvpo9lcLBLxuK3​s-8gXDvYgZKQCLcB/s1600/IBM%2BKPD8923-1.jpg
06:07 hobbs last made in the late 90s, but there were always some on ebay
06:07 hobbs until the past year or two, all the old stock must have dried up
06:07 hobbs I got my hands on a couple SpaceSavers but they're not as good
06:08 bjz joined #perl6
06:13 Cabanossi joined #perl6
06:14 nadim_ joined #perl6
06:16 u-ou i think i will get brian d foys perl 6 book when it arrives
06:20 u-ou hi
06:21 u-ou http://examples.perl6.org/categories/cookbo​ok/03dates-and-times/03-01-todays-date.html
06:21 u-ou I like how simple that is
06:25 Voldenet phew, I finally figured out how to get pid of the process, look how easy it is http://ix.io/pgy :>
06:26 Voldenet *cough intensely*
06:29 rburkholder joined #perl6
06:31 Voldenet oh, I forgot http://ix.io/pgA and http://ix.io/pgB
06:44 rindolf joined #perl6
07:04 zxvcd joined #perl6
07:38 darutoko joined #perl6
07:40 domidumont joined #perl6
07:44 domidumont joined #perl6
08:01 RabidGravy joined #perl6
08:02 xtreak joined #perl6
08:03 gdonald joined #perl6
08:12 Cabanossi joined #perl6
08:22 u-ou what's the idiomatic way to just create a file?
08:23 u-ou like without writing anything to it?
08:25 samcv u-ou, i mean you colud do `spurt "newfile.txt", ""`
08:25 samcv that would work
08:25 u-ou yeah
08:25 samcv not sure of other ways to do it though.
08:25 u-ou true
08:25 u-ou thanks
08:26 samcv that will overwrite a file if it already exists though
08:28 samcv my $IO = "newfile.txt".IO; $IO.spurt("") unless $IO.e
08:28 samcv that would be safer
08:28 u-ou ok
08:29 skids just open "/tmp/foo", :rw does it.
08:29 samcv it will create a file just by opening it?
08:29 skids Yes.
08:30 samcv worked
08:30 samcv 'blah'.IO.open(:rw) that did it
08:30 skids You can't open something that doesn't exist, after all :-)
08:30 samcv well it could throw
08:30 samcv idk.
08:30 samcv you are right :)
08:30 samcv heh
08:31 samcv .o(wonders do we need to close filehandles if we don't store them in valiables after they are opened?)
08:31 samcv idk if there's garbage collection for filehandles lol
08:31 cygx joined #perl6
08:32 cygx samcv: files are closed in the destructor, but you should not rely on it
08:32 samcv kk
08:33 cygx also, if you want to open a file in rw mode, but not create it implicitly, there's :update
08:33 cygx if you want to fail on preexisting files, there's :rx
08:34 skids File::Temp is instructive on proper handling of destruction.
08:35 cygx or rather, :rx will fail on preexisting already opened files
08:36 sftp joined #perl6
08:39 Sound joined #perl6
08:43 u-ou i ended up writing my script in perl 5 :(
08:44 u-ou but only because I needed glob which is unimplemented?
08:47 moritz yes, that sucks, but often you can use dir().grep(some regex) instead
08:51 u-ou ah, thanks
08:58 nadim_ morning. can I define a method inside a method?
08:59 nadim_ that's a yes. I guess that it is only visible in the parent method scope, right?
09:03 skids m: class A { method foo { method bar { 42.say; }; self.bar(); }; }; A.new.bar(); A.new.foo();
09:03 camelia rakudo-moar 55abc6: OUTPUT: «42␤42␤»
09:04 skids m: class A { method foo { my method bar { 42.say; }; self.bar(); }; }; A.new.bar()
09:04 camelia rakudo-moar 55abc6: OUTPUT: «No such method 'bar' for invocant of type 'A'␤  in block <unit> at <tmp> line 1␤␤»
09:06 u-ou night
09:20 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:28 Cabanossi joined #perl6
09:28 Voldenet timotimo: I just copied the pattern used in other method related to MVM_REPR_ID_MVMOSHandle
09:29 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:30 Begi joined #perl6
09:35 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 Voldenet or can it?
09:39 timotimo the point is what happens if you don't instantiate it
09:39 timotimo try nqp::pidprocasync(BOOTIO)
09:47 geekosaur joined #perl6
10:05 domidumont joined #perl6
10:10 lukaramu joined #perl6
10:11 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:15 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 http://pl6anet.org ?
10:16 stmuk_ that is fixed :)
10:22 rburkholder joined #perl6
10:39 geekosaur joined #perl6
10:42 El_Che ah, my
10:42 El_Che silly me
10:43 El_Che thx, stmuk_
10:58 Cabanossi joined #perl6
11:03 grumble joined #perl6
11:19 geekosaur joined #perl6
11:26 araujo joined #perl6
11:32 ZzZombo joined #perl6
11:38 espadrine joined #perl6
11:39 geekosaur joined #perl6
11:40 geekosaur joined #perl6
11:47 bjz_ joined #perl6
11:52 geekosaur joined #perl6
11:54 geekosaur joined #perl6
11:58 Cabanossi joined #perl6
12:00 geekosaur joined #perl6
12:05 geekosaur joined #perl6
12:11 rburkholder joined #perl6
12:12 geekosaur joined #perl6
12:15 geekosaur joined #perl6
12:21 geekosaur joined #perl6
12:27 geekosaur joined #perl6
12:28 Cabanossi joined #perl6
12:38 MasterDuke joined #perl6
12:44 RabidGravy tadzik, I've added a test to JSON::Unmarshal fot the shaped associative case which was just fixed in rakudo
12:44 RabidGravy https://github.com/tadzik/JSON-Unmarshal/pull/25
12:47 geekosaur joined #perl6
12:49 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:58 Sound joined #perl6
12:58 kurahaupo__ joined #perl6
12:59 geekosaur joined #perl6
13:03 geekosaur joined #perl6
13:04 geekosaur joined #perl6
13:08 geekosaur joined #perl6
13:10 RabidGravy Not that I know of
13:11 DrForr Mumble.
13:13 pmurias joined #perl6
13:13 Cabanossi joined #perl6
13:14 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 #perl6
13:18 aborazmeh joined #perl6
13:20 bjz joined #perl6
13:23 pmurias maybe having the tests for is_approx in a deprecated test?
13:25 DrForr Yeah, I'd move them into a separate file so they're easy to delete when the deprecation period is over.
13:27 geekosaur joined #perl6
13:32 geekosaur joined #perl6
13:35 lukaramu_ joined #perl6
13:37 geekosaur joined #perl6
13:38 geekosaur joined #perl6
13:48 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:50 xtreak joined #perl6
13:58 Cabanossi joined #perl6
14:03 gdonald joined #perl6
14:06 Ven joined #perl6
14:07 geekosaur joined #perl6
14:07 Skycry joined #perl6
14:08 mr-foobar joined #perl6
14:16 geekosaur joined #perl6
14:19 Tonik joined #perl6
14:23 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 pecastro joined #perl6
14:25 timotimo you need to | a %
14:25 lizmat use a sigilles capture
14:25 timotimo |@ will always give positionals
14:25 El_Che ic
14:25 lizmat m: sub a(|c) { dd c }; a foo => 42, 666
14:25 camelia rakudo-moar 4fdebc: OUTPUT: «\(666, :foo(42))␤»
14:28 El_Che I like the |% solution
14:28 El_Che it does not touch the sub
14:28 El_Che thx lizmat and timotimo
14:28 timotimo well, you can also use \(...) to construct a capture
14:28 timotimo and | that into your call
14:31 Ven_ joined #perl6
14:33 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:34 lizmat .oO( Perl 6 Oneliners )
14:36 El_Che method count-words-in-text(Str $text, -->Int) { return $text.words.elems; }
14:36 El_Che priceless
14:36 El_Che :)
14:36 El_Che it's more interesting when the user passes several files at once and want a specific format like csv in return
14:37 lizmat method count-words-in-text(Str $text, --> Int() ) { $text.words }
14:37 lizmat aka, coerce the return value to an Int
14:38 lizmat 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
14:38 El_Che more magic
14:38 El_Che who needs harry potter :)
14:38 lizmat method count-words-in-text(Str $text, -->Int) { +$text.words }   # less magic
14:39 El_Che that's better
14:39 El_Che although good to know about the -->Type() coercion
14:41 lizmat m: sub a(Int() $a) { dd $a }; a "42"
14:41 camelia rakudo-moar 4fdebc: OUTPUT: «Int $a = 42␤»
14:41 El_Che :)
14:41 lizmat not only works for return arguments
14:43 Cabanossi joined #perl6
14:43 El_Che and lizmat=
14:43 El_Che my $*MAIN-ALLOW-NAMED-ANYWHERE = True;
14:43 El_Che \o/
14:43 El_Che that made me happy
14:44 lizmat you were not the only one  :-)
14:44 Peter_R joined #perl6
14:44 El_Che most of the time it's like: "ah that's nice" or "pretty cool"
14:44 El_Che this was really a huge smile on my face
14:45 El_Che Notpick: "--switch arg" would be nice, but "--switch=args" is certainly ok
14:46 El_Che The first because you can use shell expansion
14:46 El_Che --files *
14:46 El_Che --file ~/Code/foo.txt
14:46 lizmat I think there was a reason for that, but I forget right now
14:46 lizmat afk for a few hours&
14:52 geekosaur if your shell is recent enough it should do expansion after =
14:53 geekosaur (zsh might need a setting tweak)
14:55 bjz joined #perl6
14:58 zakharyas joined #perl6
15:05 drrho_ joined #perl6
15:09 El_Che geekosaur: the latest ubuntu has GNU bash, version 4.3.46(1)-release. $deity knows how much older stuff centos runs
15:11 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:12 timotimo and how come Supply.min uses &by for a comparator, but Any.min uses &by as a transformator?
15:13 AlexDaniel joined #perl6
15:20 Ven joined #perl6
15:26 rindolf joined #perl6
15:32 Peter_R joined #perl6
15:33 yqt joined #perl6
15:35 khw joined #perl6
15:42 Cabanossi joined #perl6
15:46 setty1 joined #perl6
15:53 DrForr Hrm. Is there a split() variant that would give me an even-length list for "a;b;;c".split(";",:adverb) # ?
15:54 DrForr Note that 'c' doesn't have a subsequent split() token.
15:56 pecastro joined #perl6
15:57 kurahaupo__ joined #perl6
16:14 xtreak joined #perl6
16:28 Cabanossi joined #perl6
16:28 skids joined #perl6
16:29 TeamBlast joined #perl6
16:35 xtreak joined #perl6
16:36 sjn-mo joined #perl6
16:37 SmokeMachine $*MAIN-ALLOW-NAMED-ANYWHERE doesn't work with "--"... :(
16:37 SmokeMachine https://www.irccloud.com/pastebin/BgBVwEJn/
16:38 gfldex m: dd "a;b;;c".split(";",:k)[0,2 … *]
16:38 camelia rakudo-moar 4fdebc: OUTPUT: «("a", "b", "", "c")␤»
16:39 gfldex DrForr: ^^^
16:39 DrForr Chose a different way, but thnak you, I'll remember that.
16:40 gfldex m: say ("f,,b,c,d".split: /","/             ).perl;
16:40 camelia rakudo-moar 4fdebc: OUTPUT: «("f", "", "b", "c", "d").Seq␤»
16:40 sjn-mo joined #perl6
16:41 dogbert17 joined #perl6
16:41 dogbert17 o/
16:41 yoleaux 16 Mar 2017 00:35Z <AlexDaniel> dogbert17: https://irclog.perlgeek.de/​perl6/2017-03-16#i_14272417
16:42 xtreak joined #perl6
16:44 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:45 sjn-mo joined #perl6
16:45 DrForr That's somewhat unusual. I'd look at forward references, assuming those are still in p6.
16:46 * DrForr almost has indentation working in ::Tidy.
16:46 sjn-mo joined #perl6
16:47 dogbert17 DrForr, are you referring to '<?before pattern>'
16:47 AlexDaniel m: say ‘aabbbc’.comb(/(.)$0*/)
16:47 camelia rakudo-moar 4fdebc: OUTPUT: «(aa bbb c)␤»
16:47 dogbert17 oops, AlexDaniel++
16:47 AlexDaniel you have to define the problem other way round
16:51 dogbert17 nifty solution
16:53 BenGoldberg joined #perl6
17:00 El_Che can a bag be appended/merged to an other bag?
17:01 El_Che or HashBag
17:01 timotimo sure, you want (+) for that
17:02 El_Che you are sh*tting me. That simple?
17:02 timotimo well, you may want (+)= instead of just (+)
17:02 El_Che hehe
17:03 AlexDaniel or, you know, ⊎
17:04 El_Che I guess creating the bags with bag is out of the question and I need a HashBag explicitly?
17:05 AlexDaniel hmm not necessarily
17:06 AlexDaniel m: my $a = bag <1 2 3>; my $b = bag <a b c>; my $c = $a ⊎ $b; say $c
17:06 camelia rakudo-moar 4fdebc: OUTPUT: «bag(1, 3, b, a, c, 2)␤»
17:06 AlexDaniel m: my $a = bag <1 2 3>; $a ⊎= bag <a b c>; say $a
17:06 camelia rakudo-moar 4fdebc: OUTPUT: «bag(1, 3, b, a, c, 2)␤»
17:08 El_Che incredible
17:09 AlexDaniel but maybe if you're dealing with huge bags, then perhaps ⊎ is not going to work that great
17:09 AlexDaniel but I'm not sure
17:09 El_Che we'll see when we hit that by now. By now my main source is small (700 pages book)
17:10 El_Che using bags for finding word frequencies
17:10 AlexDaniel wouldn't call that small :D
17:10 AlexDaniel but yeah, you'll see
17:11 El_Che well, the simple poc code worked
17:11 El_Che and then I stared refactoring :)
17:11 Sound joined #perl6
17:12 TimToady m: say ‘aabbbc’.split(/<!same>/)  # this also works
17:12 camelia rakudo-moar 4fdebc: OUTPUT: «( aa bbb c )␤»
17:12 SmokeMachine Sorry, I was wrong...
17:12 TimToady well, except that leaves nulls at the end
17:12 geekosaur joined #perl6
17:13 SmokeMachine m: say ‘aabbbc’.comb(/<?same>+/)
17:13 SmokeMachine :(
17:13 camelia rakudo-moar 4fdebc: OUTPUT: «(timeout)»
17:13 tojo joined #perl6
17:13 TimToady m: say ‘aabbbc’.comb(/.[<same>.]*/)
17:13 camelia rakudo-moar 4fdebc: OUTPUT: «(aa bbb c)␤»
17:14 masak SmokeMachine: shouldn't ever quantify zero-width assertions...
17:14 SmokeMachine masak: makes sense... thanks!
17:14 AlexDaniel huh, <same> ?
17:15 TimToady it's a 0-width assertion about its surrounding chars
17:18 AlexDaniel ok… https://github.com/perl6/doc/issues/1259
17:18 AlexDaniel SmokeMachine: where did you find it?
17:19 AlexDaniel m: dd ‘aabbbc’.split(/<!same>/)
17:19 camelia rakudo-moar 4fdebc: OUTPUT: «("", "aa", "bbb", "c", "").Seq␤»
17:19 AlexDaniel SmokeMachine: interestingly, you can also do this ↑, except that you get these empty strings on the sides
17:20 dogbert17 TimToady, thx for the snippet, didn't know about 'same'
17:21 dogbert17 m: dd ‘aabbbc’.split(/<!same>/, :skip-empty)
17:21 camelia rakudo-moar 4fdebc: OUTPUT: «("aa", "bbb", "c").Seq␤»
17:21 AlexDaniel right
17:23 dogbert17 TimToady: still there or hiding behind a cricket?
17:25 dogbert17 does P6 have anything like this (which someone pointed out a couple of days ago)? https://medium.com/rubyinside/the-new-absent-ope​rator-in-ruby-s-regular-expressions-7c3ef6cd0b99#.5m5y0opr2
17:28 AlexDaniel ruby is now supporting curly quotes, huh?
17:29 AlexDaniel or these were mangled by the website itself?
17:30 TeamBlast joined #perl6
17:35 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:42 El_Che For a 130056
17:42 El_Che oops
17:43 El_Che For a 130056 word corpus, the bag based word frequency counter finishes in 45sec. Nice
17:44 domidumont1 joined #perl6
17:45 domidumont joined #perl6
18:12 dct joined #perl6
18:51 setty1 joined #perl6
18:58 chsanch joined #perl6
18:58 Cabanossi joined #perl6
18:59 cognominal joined #perl6
19:04 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:05 pochi joined #perl6
19:05 labster joined #perl6
19:10 timotimo chsanch: at what point do the errors appear?
19:10 timotimo it's impossible to build the rakudo core setting with only half a gig of ram
19:11 timotimo that's the one that tells you "please be patient" and it'll output "start", "parse", and then crash
19:14 chsanch Yes, it's at the parse stage: "Stage parse      : Makefile:470: recipe for target 'CORE.setting.moarvm' failed"
19:15 timotimo yup
19:15 timotimo out of ram, and crash
19:15 timotimo you can make a swap file, of course
19:17 chsanch Ok, I'll try that then
19:21 domidumont joined #perl6
19:30 MasterDuke joined #perl6
19:47 bjz joined #perl6
19:54 El_Che chsanch: cross compiling? qemu + emulated arm and more memory?
19:58 RabidGravy fwiw, it will build on a Raspberry Pi B with 512MB
19:58 var_somebody joined #perl6
20:00 timotimo oh?
20:01 RabidGravy I haven't got one plugged in right now, but it did a month or so ago
20:01 Peter_R joined #perl6
20:01 RabidGravy took like forever but hey
20:03 var_somebody joined #perl6
20:06 mr-foobar joined #perl6
20:06 dct joined #perl6
20:12 AlexDaniel chsanch: what OS are you using?
20:12 AlexDaniel chsanch: I'd just take a package and use that
20:13 Cabanossi joined #perl6
20:17 timotimo do we actually have arm packages?
20:19 gfldex timotimo: https://packages.debian.org/sid/rakudo-lib
20:19 gfldex timotimo: so, not really
20:27 bitrauser joined #perl6
20:34 chsanch AlexDaniel: I'm using Debian
20:35 AlexDaniel chsanch: there's rakudo 2016.12 in debian testing
20:35 AlexDaniel not exactly the latest but possibly good enough
20:36 chsanch there's a rakudo version, but it's 2014.07
20:36 AlexDaniel *testing*
20:36 chsanch oh, well, I'm using stable
20:36 chsanch yah, maybe I should upgrade it
20:36 AlexDaniel chsanch: you can pull rakudo package only, I don't think it has many dependencies
20:36 timotimo yeah, with "pinning"
20:37 gfldex there where quite a few bugs fixed since december last year
20:37 gfldex building it by hand may be worth it even if it takes the whole night
20:37 AlexDaniel well, then you can get 2017.02 from experimental…
20:38 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:41 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 chsanch Thanks!
20:46 timotimo joined #perl6
20:47 rindolf joined #perl6
20:47 Geth ¦ doc: 1f08eaacd9 | (Aleks-Daniel Jakimenko-Aleksejev)++ | doc/Type/Proc.pod6
20:47 Geth ¦ doc: Remove method pid
20:47 Geth ¦ doc:
20:47 Geth ¦ doc: It does nothing, there are no tests, and there is a rakudo PR to
20:47 Geth ¦ doc: remove it completely.
20:47 Geth ¦ doc: review: https://github.com/perl6/doc/commit/1f08eaacd9
20:48 nadim joined #perl6
20:52 nadim Hi,  I have this code https://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:53 lichtkind__ joined #perl6
20:54 timotimo nadim: watch out, >>.say doesn't guarantee that the says are executed in order
20:55 obarb joined #perl6
20:55 gfldex m: sub f(**@a, :$foo){ for @a { when Array { say 'Array' }; } }; my (@a, @b); f(@a, @b, :foo);
20:55 camelia rakudo-moar c3c849: OUTPUT: «Array␤Array␤»
20:55 gfldex nadim: ^^^
20:55 gfldex nadim: please not that **@a will slurp much more then just Array so you have to handle those cases with care
20:56 gfldex *note
20:56 jantore joined #perl6
20:56 vytas joined #perl6
20:58 nadim **@as is not in a method where anything else but arrays are passed, it works fine in that context
20:59 nadim good to know about >>.say  I guess that is because it can get threaded, right?
20:59 timotimo yup
20:59 timotimo we used to randomize the calling order to force folks to not rely on it
20:59 timotimo well, not random, just odd-patterned
20:59 timotimo it was removed due to performance trouble if i'm not mistaken
21:00 gfldex the randomisation was removed, not the threading
21:01 nadim ah I see what you mean with **@a, I am using that construct somewhere else I thought you were talking about it.
21:02 nadim 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:04 timotimo there never was threading for that, gfldex
21:04 gfldex i know, your statement about removal was ambiguous
21:05 gfldex or maybe I'm to tiered too
21:05 gfldex all clocks are wrong right now :(
21:05 nadim 2 mn an I will post the code I tried (in vain)
21:07 nadim https://nopaste.linux-dev.org/?1123017
21:08 nadim 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
21:09 gfldex (I'm guessing with halve a brain)
21:09 timotimo map is in order
21:09 timotimo you can .hyper.map or .race.map if you want it to be not-in-guaranteed-order
21:09 timotimo (of course, might want to wait for jnthn's hyper/race work to be in rakudo before working with it much)
21:10 nadim :)
21:11 raschipi joined #perl6
21:11 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:12 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:13 timotimo can you show how you're invoking it?
21:13 timotimo named parameters never get part of a *@ or **@, you're probably putting "" around the LHS of the =>
21:14 timotimo 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)) ;
21:15 nadim 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
21:15 timotimo oh, do you mean how you call $_.display_columns with "$compact" instead of ":$compact"?
21:15 nadim and
21:15 timotimo because that's not a named parameter at all
21:15 nadim haven't done P6 for a few months, I am rusty it seems
21:15 timotimo that's all right
21:16 nadim no I called it with :$compact
21:16 nadim the call above, that uses :width(20), is how the first call looks like
21:17 nadim should that call use :$foo ? as it seems to work just fine.
21:18 timotimo sorry, "foo"? or "width"?
21:18 timotimo :$foo is short for :foo($foo)
21:18 timotimo so if you're calling it with :width(20) that's already fine
21:19 timotimo 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 timotimo otherwise you're passing the array with arrays as a single positional
21:19 timotimo 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
21:20 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 rakudo-moar ca2a77: OUTPUT: «Int $foo = 42␤Array␤Array␤»
21:20 nadim here is the whole code  https://nopaste.linux-dev.org/?1123019
21:21 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
21:21 gfldex m: sub f(**@a, :$foo){ g(|@a, :$foo) }; sub g(**@a, :$foo){ dd @a, $foo }; my (@a, @b); f(@a, @b, :foo(42));
21:21 camelia rakudo-moar ca2a77: OUTPUT: «[[], []]␤Int $foo = 42␤»
21:21 gfldex m: sub f(**@a, :$foo){ g(@a, :$foo) }; sub g(**@a, :$foo){ dd @a, $foo }; my (@a, @b); f(@a, @b, :foo(42));
21:21 camelia rakudo-moar ca2a77: OUTPUT: «[[[], []],]␤Int $foo = 42␤»
21:21 nadim I find K&R unreadavle
21:21 dct joined #perl6
21:22 bjz joined #perl6
21:22 timotimo we'll soon have DrForr's ::Tidy
21:22 nadim :)
21:23 nadim the code you wrote is exactly what I wrote. but it does not work for me
21:24 timotimo is that the code gfldex wrote or what i wrote?
21:25 nadim I didn't even notice you were two :) this irc client gives the same color to both of you :)
21:25 nadim last code gfldex wrote
21:25 timotimo at least we have wildly different nick lengths :)
21:26 nadim indeed
21:26 nadim but you did not write code.
21:26 timotimo yeah, only parts
21:27 timotimo anyway
21:27 timotimo $._display_columns(@rs, $width, $compact)
21:27 nadim just spend 3 mn scrolling everywhere
21:27 timotimo line 8 or what it is
21:27 nadim ok, go on
21:27 timotimo that'll pass three positional parameters to the other function
21:27 timotimo with that call you'll never get $width nor $compact in the _display_columns set to anything
21:27 nadim yes I see
21:28 nadim a bug indeed
21:28 nadim I checked when you told me but I missed that one
21:28 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:30 nadim so how do I do that?
21:31 nadim 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 |()
21:31 * nadim is looking forward to the read
21:32 gfldex nadim: see https://docs.perl6.org/type/​Signature#Unflattened_Slurpy
21:32 gfldex and I stopped writing docs. I went back to file issues.
21:33 gfldex have a good *, I'm off to bed hoping the clocks will be a little less wrong tomorrow
21:34 nadim night
21:34 timotimo oh, nadim, you need to flatten it with |@rs
21:36 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:37 nadim I call method(list1, list2, list3, :foo)  that goes in method(**@list, :$foo)
21:37 nadim which needs to access list1, list2, ...
21:37 timotimo yeah, list1, list2, list3 will be reachable as @list[0], @list[1], and @list[2] in that case
21:39 timotimo 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?
21:39 timotimo not "before"
21:39 timotimo the call looks like method2 |@list
21:40 timotimo and then you pass on :$foo (not $:foo, that's something else)
21:42 nadim lyes I meant :$foo, that's a typo here, that not appearing in the code
21:42 nadim what is it btw?
21:42 timotimo it's like $^foo but for named instead of positional
21:42 timotimo so like { $:hello } is the same as -> :$hello { $hello }
21:43 timotimo just like { $^a } is the same as -> $a { $a }
21:48 nadim hmm flattening **@r does nothing.  my @r_flat = |@r  is the same as @r
21:49 timotimo yes
21:49 timotimo that's because |@r is syntax inside of calls
21:49 timotimo and list assignment will iterate over the RHS and assign it into containers on the LHS
21:50 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 }
21:50 camelia rakudo-moar ca2a77: ( no output )
21:50 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)
21:50 camelia rakudo-moar ca2a77: OUTPUT: «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"…»
21:51 timotimo that's a bit long
21:51 timotimo 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)
21:51 camelia rakudo-moar ca2a77: OUTPUT: «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")]␤»
21:51 timotimo now it fits
21:51 timotimo you see how $thing is a slip, but yother is an array?
21:51 timotimo in the first example, @other has an extra [ ] around it because i didn't call do_it with |@rs
21:52 timotimo in the second example it doesn't have the extra [ ] because i slipped it into multiple positional parameters using |
21:52 nadim OK
21:53 timotimo i hope that helps at all, instead of being more confusing
21:53 nadim it helps
21:53 nadim I dump the data so I see what happens.
21:54 nadim and calling with |@r did fix it, the code does what it is supposed to do.
21:54 nadim I will try a few more tests before being happy
21:59 timotimo i'm about to head towards bed
21:59 nadim all calls to method(**@) must |@
21:59 nadim works perfectly when I put them everywhere
22:00 nadim thank for the help, I'll push this tomorrow so we can get multiple Data::Dump::Trees in columns
22:00 nadim actually I should put that in Text::Columnize
22:01 dogbert17 AlexDaniel: btw, https://gist.github.com/dogbert17​/ea5855ab29c74b1b518a9f86c2f24f62
22:01 timotimo no
22:01 timotimo you got the wrong idea from that
22:02 AlexDaniel dogbert17: ooooh
22:02 nadim timotimo: the wrong idea?
22:02 timotimo if you had to always use | with **@, then we'd just make that the default
22:03 timotimo the thing is, **@ is about how incoming positional arguments are treated
22:03 timotimo whereas |@ is about pretending an array you have is actually many positional arguments rather than just one positional argument
22:03 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
22:04 timotimo the user isn't flattening there
22:04 timotimo or i'm misunderstanding how you mean that
22:04 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.
22:05 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
22:06 nadim tomorrow, after work, I'll post the whole thing
22:06 nadim I am at the airport waiting for my flight, I can keep everyone awake
22:06 nadim but won't
22:08 timotimo oh
22:08 timotimo have a safe trip!
22:08 timotimo i'll just try to wrap things up over in #moarvm and head to sleeps
22:09 nadim thank you, Beirut next. I wonder if there is a pm group there.
22:11 timotimo is that the international name of Bayreuth in germany?
22:11 raschipi It's Beirute in Portuguese.
22:11 timotimo ah, ok
22:12 Cabanossi joined #perl6
22:21 rburkholder joined #perl6
22:47 Voldenet joined #perl6
22:47 Voldenet joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo