»ö« 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 Zoffix on 25 May 2018.
hythm_ Im new to OO, my question is how to populate array of objects 03:51
p6: my %h; class A { has $.a = <a>}; class B { has A @.a }; %h<a>.push: A.new: a => "a"; %h<a>.push: A.new: a => "b"; my $b = B.new: |%h;
camelia Type check failed in assignment to @!a; expected A but got Array ($[A.new(a => "a"), A....)
in submethod BUILDALL at <tmp> line 1
in block <unit> at <tmp> line 1
lookatme hythm_, I know this caused by the array in hash has became a item, but don't know how to fix it 04:24
p6: my %h; class A { has $.a = <a>}; class B { has A @.a }; %h<a>.push: A.new: a => "a"; %h<a>.push: A.new: a => "b"; my $b = B.new: a => %h<a><>;
camelia ( no output )
lookatme p6: my %h; class A { has $.a = <a>}; class B { has A @.a }; %h<a>.push: A.new: a => "a"; %h<a>.push: A.new: a => "b"; my $b = B.new: a => %h<a><>; say $b;
camelia B.new(a => Array[A].new(A.new(a => "a"), A.new(a => "b")))
lookatme p6: my %h; class A { has $.a = <a>}; class B { has A @.a }; %h<a> = Array[A].new; %h<a>.push: A.new: a => "a"; %h<a>.push: A.new: a => "b"; dd %h; my $b = B.new: |%h; 04:25
camelia Hash %h = {:a(Array[A].new(A.new(a => "a"), A.new(a => "b")))}
Type check failed in assignment to @!a; expected A but got Array[A] (Array[A].new(A.new(a => "a"),...)
in submethod BUILDALL at <tmp> line 1
in block <unit> at <tmp> line 1
lookatme and the error message should be fix, I think 04:26
hythm_ lookatme: sorry for delay. I thing wht u suggested works for me, thanks. I also tried other way here: glot.io/snippets/f1s8lfo85f 04:56
Geth doc: 00cc1a48c7 | (Jack Kuan)++ | 3 files
Fix missing nodejs dependency in the Dockerfile.

Details:
   - It appears that the nodejs package no longer exists for the base image
   used by the Dockerfile, and since it's already using the `n` script to
   install the latest stable version of nodejs, I simply use `n` to
   install nodejs in the first place instead.
   - Also fixed a small code formatting issue in packages.pod6.
   - Corrected the instructions on running the built docker image in CONTRIBUTING.md.
05:08
doc: 78db2a32bb | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | 3 files
Merge pull request #2094 from kjkuan/fix-dockerfile

Fix missing nodejs dependency in the Dockerfile.
Xliff \o 05:12
jmerelo Hi
Xliff How do you set the seed value used by rand, .pick and .roll
jmerelo Xliff: good question. No idea. I'll have to look it up. 05:14
jmerelo Xliff: OK; that was easy. srand: docs.perl6.org/routine/srand 05:16
Geth doc/master: 4 commits pushed by (JJ Merelo)++ 05:53
Geth doc: c84fafeff8 | (JJ Merelo)++ | doc/Language/traits.pod6
Adds reference to P6Opaque, refs #1863, #1957
06:19
doc: 432c40984f | (JJ Merelo)++ | doc/Language/traits.pod6
Adds uninstantiable with examples.

This closes #1863. It advances #1957, but still some information on how to use traits in varibles and attributes is going to be needed.
synopsebot Link: doc.perl6.org/language/traits
Geth doc: 426890b3ba | (JJ Merelo)++ | doc/Language/structures.pod6
Setting introspection right
08:05
synopsebot Link: doc.perl6.org/language/structures
jmerelo Hi 08:05
moritz ho 08:16
jmerelo O/ 08:21
lookatme o| 08:31
Geth doc: b88200e4da | (JJ Merelo)++ | doc/Language/traits.pod6
Adds section on traits for subs
08:38
synopsebot Link: doc.perl6.org/language/traits
buggable New CPAN upload: Desktop-Notify-0.3.1.tar.gz by FRITH modules.perl6.org/dist/Desktop::Not...cpan:FRITH 09:04
Geth doc: c188d796a0 | (Elizabeth Mattijsen)++ | doc/Language/pragmas.pod6
Document "use isms <Perl5>"
09:18
synopsebot Link: doc.perl6.org/language/pragmas
Geth doc: 6335563c5b | (Elizabeth Mattijsen)++ | doc/Language/pragmas.pod6
Linkify 'use experimental' -> experimental features
09:21
mscha m: my @m = [1,2],[3,4]; my @n = @m.deepmap(*.clone); @m[1;1] = 42; dd @m; dd @n; # this works ... 09:24
camelia Array @m = [[1, 2], [3, 42]]
Array @n = [[1, 2], [3, 4]]
mscha m: my @m = [1,2],[3,4]; my @n = @m.deepmap(*.clone); @n[1;1] = 42; dd @m; dd @n; # ... but why doesn't this?
camelia Cannot assign to an immutable value
in block <unit> at <tmp> line 1
mscha Or is there a better way to make a deep copy of an array of arrays? 09:25
jkramer m: my @m = [1,2],[3,4]; my @n = @m.map(*.clone); @n[1;1] = 42; dd @m; dd @n 09:27
camelia Array @m = [[1, 2], [3, 4]]
Array @n = [[1, 2], [3, 42]]
jkramer But honestly I don't know why it doesn't work with deepmap :) 09:29
mscha Thanks, jkramer; that does the trick in my case. (I still don't understand what goes wrong with the deepmap, though.)
jkramer Maybe some of the core people here know :) 10:07
mscha m: my @m = [1,2],[3,4]; my @n = @m.deepmap(-> $a is copy { $a}); @n[1;1] = 42; dd @m; dd @n 10:17
camelia Array @m = [[1, 2], [3, 4]]
Array @n = [[1, 2], [3, 42]]
mscha This works generically for nested structures. But there must be a more elegant way to do this, right?
Ulti not detracting from this actual issue, just in general I've found its often a bad plan to want to deep copy datastructures if this is a real world thing you're wanting to do... its one of the few pathways to memory leaks in managed languages like if you deepcopy some session object on a db or that holds some opaque native thing that behaves a bit badly 10:36
which is probably why we dont have deepclone along with deepmap 10:37
moritz deep copying lazy lists can also have... unintended side effects 10:57
the next problem with generic deep copying is that you run into gotchas when you referenze outside objects 10:58
like file descriptors or sockets
mscha Perhaps generally, deep copying can be problematic, but in specific cases (like creating a copy of a matrix of numbers, like in my example) it isn't. 11:06
Geth doc: 40eb0cf379 | (JJ Merelo)++ | doc/Language/traits.pod6
Fixes errors indicated by @jnthn and reflows
11:30
synopsebot Link: doc.perl6.org/language/traits
tadzik tadzik.net/pub/cULJeIUeMx.png 14:12
tadzik wonders if this qualifies as an LTA UI :P
TimToady obvioulsy D.&prefix:<^> should exit :) 15:03
I guess it does exit, just with the wrong message :) 15:05
oh, no, it doesn't exit, so it's two bugs :)
jkramer How would I go about a sub that accepts a Str or an Int as parameter? I tried IntStr but it fails when I call it with an Int or Str 15:07
TimToady IntStr is both/and, not either/or 15:08
jkramer sub($foo where Int | Str) works, but isn't IntStr made for this?
TimToady where Str|Int
jkramer Hmm ok
Thanks
TimToady and we can't front that because | is a metachar prefix in sigs 15:09
TimToady (and can't use & for similar reasons) 15:09
jkramer And also I just realized that :foo<bar baz> turns into a list. Is syntax sugar for :foo('bar baz') too? 15:10
TimToady otoh, if the Str is supposed to be coercible to Int, then maybe Int() is what you want
or Str(), going the other way
jkramer Interesting, Str() might be what I need then 15:11
TimToady m: sub foo(Str() $s) { say $s.WHAT }; foo(42) 15:11
camelia (Str)
timotimo you get IntStr when you val() (directly or indirectly through angle bracket syntax, or sub MAIN) a string that looks like an int in some way, and we keep the string representation 15:12
TimToady m: sub foo(Str(Int) $s) { say $s.WHAT }; foo(42)
camelia (Str)
timotimo m: say 0x10.Str; say <0x10>.Str
camelia 16
0x10
timotimo m: say 0x10 + 1; say <0x10> + 1
camelia 17
17
TimToady yes, IntStr and friends are intended only for situations where people are forced to push numbers through a mandatory text interface 15:13
so it's another way in which Perl 6 tries to be lazy, and gets away with it mostly... 15:14
jkramer :)
geekosaur you can also view it as a number with a known string representation, as opposed to having to generate one 15:16
(more useful viewpoint for e.g. parsing, where you often want to know the source span of a token)
skids m: subset IntOrStr of Cool where Int|Str; sub f (IntOrStr $g) { $g.say }; f(4); f("foo"); f(now) # Or this if coerce/where is not wanted 15:16
camelia 4
Constraint type check failed in binding to parameter '$g'; expected IntOrStr but got Instant (Instant.from-posix(<23049342...)
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1

foo
TimToady that's some notational convenience, but it really just does the same thing 15:17
jmerelo m: say Instant.^mro
camelia ((Instant) (Cool) (Any) (Mu))
TimToady it can't do a nominal check for IntOrStr, so the where just carries over into the sig
jmerelo This probably has nothing to do with what you were talking about, but Instant is not an IntOrStr. It's Cool, but not related (see above) 15:18
TimToady Instant is supposed to be largely opaque
jmerelo m: subset IntOrStr of Cool where Int|Str; sub f (IntOrStr $g) { $g.say }; f(4); f("foo"); f(DateTime.new(now)) 15:19
camelia 4
Type check failed in binding to parameter '$g'; expected IntOrStr but got DateTime (DateTime.new(2018,6,8,15,19,3...)
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1

foo
jmerelo m: subset IntOrStr of Cool where Int|Str; sub f (IntOrStr $g) { $g.say }; f(4); f("foo"); f(DateTime.new(now).Str)
camelia 4
foo
2018-06-08T15:19:37.820809Z
skids ..oO(interesting camelia didn't say "foo")
locally it does.
TimToady DateTime is also supposed to be largely opaque, but differently :) 15:21
the whole point of DateTime is to handle cultural discontinuities, and the whole point of Instant is to avoid them :) 15:23
TimToady m: say (now - INIT now).WHAT 15:23
camelia (Duration)
TimToady and whenever people assume Duration is a cultural type, hilarity ensues 15:24
jmerelo TimToady: well, if is not cultural if you don't compute durations across calendar changes I guess. 15:27
TimToady 86400 seconds doesn't always mean one day
skids
.oO(OIC camelia's stderr is shuffled into its stdout differently, is all)
jmerelo TimToady: But "CalendarZones" are not regulated yet by any RFC, so if you want to compute the number of seconds between January 1st, 1900 and today you'll just have to assume we're not in Russia. 15:28
geekosaur tell me about it
skids Meh, those are the old problems. The new ones involve spacecraft. :-) 15:29
TimToady m: say (DateTime.now - DateTime.now).WHAT 15:30
camelia (Duration)
jmerelo skids: mmm, relativity...
TimToady that should arguably not be returning a Duration
a DateTimeDiff or some such
well, maybe if it actually is taking leap seconds into account, it can be a Duration 15:31
El_Che o/ 15:32
mahafyi in perl5 : $fh = \*STDIN if (!$fh); while (<$fh>) { do something }. In perl6 how do we get all the stdin input into an array, which are strings separated by \r\n ? 15:33
TimToady m: .say for lines() 15:35
camelia »Wann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Am Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
jmerelo TimToady: What's it reading? :-) 15:36
timotimo it's reading stdin :P
mahafyi TimToady : wow looks neat. i will try 15:37
timotimo jmerelo: it's the beginning of macbeth
TimToady m: .say for $*IN.lines
camelia »Wann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Am Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
TimToady more explicitly
jmerelo m: .say for $*IN.lines 15:41
camelia »Wann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Am Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
jmerelo timotimo: I must protest. Nothing short of El Quixote deserves to be the default input to the default input.
El_Che I completely agree 15:42
TimToady is El the brother of Don?
El_Che It's the first modern novel, after all
tadzik TimToady: maybe it's the next capital character ;) 15:43
jmerelo TimToady: Yep, the chivalry-high-school dropout brother :-)
TimToady tadzik: 'Kay 15:44
El_Che SO overflow with un undef value somewhere: "why does my code recite Shakespeare? Have I been hacked?"
Shakespeare, Cervantes, all good
jmerelo In Spain we call it "El Quijote", as in "The" book par excellence. Just a couple of books get the definite article in Spanish. You probably know which one is the other.
El_Che or Dante
"Best 100 paella recepts with real chorizo"? 15:45
TimToady
.oO(El Hobbit)
jmerelo But since this is Shakespeare in German, I guess it would have to be "En un lugar de la Mancha de cuyo nombre no quiero acordarme" in Danish or somesuch.
El_Che It turns out Sauron was a mill after all 15:46
TimToady </tilt>
jmerelo On this line, I've repeatedly used public domain works in Perl tutorials over the years. I used "La venganza de Don Mendo" here metacpan.org/pod/Don::Mendo to explain POE
jmerelo And "El diablo cojuelo", from the 18th century, in this tutorial geneura.ugr.es/~jmerelo/tutoriales/...resurados/ (which I wrote in DocBook, but that's another story...) 15:47
El_Che: that's a good one. 15:48
El_Che jmerelo: La Celestina
linked to the french works
jmerelo El_Che: good one too. Will have to use it for my next Perl 6 tutorial :-)
El_Che El lazarillo de tormes 15:49
El_Che you'll have to write lots of tutorials 15:50
jmerelo El_Che: as soon as I'm over with the Perl 6 documentation, which will happen sometime near 2034, I will do that :-)
El_Che jmerelo: yeah, devs keep adding stuff al the time 15:51
how inconsiderate
jmerelo El_Che: actually, I wish they would... everything has been kind of quiet lately...
araraloren :)
jnthn They're either adding stuff or making stuff faster. Can't believe it. :P
TimToady if you can wait till 2038, time might go negative, and then you'll have lots of it 15:52
jmerelo TimToady: :-) Or the singularity will happen and I'll have a bot herd writing stuff for me. Or me writing stuff for a bot herd. Whatever.
timotimo i'd hope after the singularity we'd be able to stop exploiting others for their labour to make ourselves richer, jmerelo :) 15:53
mahafyi i am trying to concat some text : .say for lines() "my string"~$_ ; but get an error Sorry!Two terms in a row
jnthn say "my string$_" for lines
evalable6 my string♥🦋 ꒛㎲₊⼦🂴⧿⌟ⓜ≹℻ 😦⦀🌵 🖰㌲⎢➸ 🐍💔…
jnthn, Full output: gist.github.com/9a501cd053c2a5352c...4866c73ab2
jmerelo timotimo: the robots will make us all behave like good humans, I'm sure :-) 15:54
jnthn ...what? :D
TimToady no m:
jnthn Yeah, and another bot picked it up, which is fine, its default input is just a little...interesting :-)
TimToady say slurp 15:55
araraloren say "I am robot"
evalable6 I am robot
TimToady say "" ~ slurp
evalable6 ♥🦋 ꒛㎲₊⼦🂴⧿⌟ⓜ≹℻ 😦⦀🌵 🖰㌲⎢➸ 🐍💔 🗭…
TimToady, Full output: gist.github.com/863ab61c1714a9d170...2be139135c
jmerelo Theoretically, Camelia is listening all the time and figuring out if we're calling her. When something starts with "say", it kicks in. It's got some weird heuristics, so it does not always happen. 15:56
TimToady say it ain't so 15:58
kurahaupo hums a lullaby to the ravenous bot herd
TimToady say 'taint so
say 'taint so'
evalable6 taint so
El_Che ''
TimToady say slurp()
evalable6 ♥🦋 ꒛㎲₊⼦🂴⧿⌟ⓜ≹℻ 😦⦀🌵 🖰㌲⎢➸ 🐍💔 🗭…
TimToady, Full output: gist.github.com/0982f2a579da4c33fd...0235005a96
jmerelo put 'it that way'
evalable6 it that way
TimToady say slurp; 15:59
evalable6 ♥🦋 ꒛㎲₊⼦🂴⧿⌟ⓜ≹℻ 😦⦀🌵 🖰㌲⎢➸ 🐍💔 🗭…
TimToady, Full output: gist.github.com/e4a446c43cd1e1e723...ae2c137073
TimToady say slurp!
jmerelo .say if so U
TimToady I suppose not parsing is one of the heuristics :)
jmerelo print "that" 16:00
evalable6 that
jmerelo (3.2 * ¾).say
evalable6 2.4
kurahaupo say 'twas time to ask the Joneses' for 1 or 2
TimToady take "that" 16:01
El_Che exit(0);
jmerelo kids, stop playing with Camelia.
You see, El_Che? You broke it
El_Che jmerelo: she started it
jmerelo loling
TimToady say "I am not Camelia"
araraloren camelia has exit :) 16:02
jmerelo El_Che: you _really_ broke it. Put it back together again now!
TimToady m: say "I am Camelia"
camelia I am Camelia
kurahaupo "it's alive, Igor!" 16:03
El_Che say 'that not, say yoda would'
evalable6 that not, say yoda would
jmerelo kurahaupo: :-)
jmerelo I'm going to be AFK in a few moments. A TV crew is coming to home so that I talk about people putting chips under their skin for no good reason. I'm going to leave this as background, because it looks hackerish. 16:04
El_Che I wonder who would ge a reference to the Great Cornholio
jmerelo I'll tell you if you are in national Spanish TV news tonight :-) Put on your best behavior, and don't break Camelia again.
El_Che I hope they don't use Praprika chips
(or crips as our british friends say)
TimToady behaves bestly 16:05
kurahaupo Crips is a very non-PC word for incapacitated persons
skids beastly?
El_Che kurahaupo: where? 16:06
Jonta2 Google Translates lewd things into Spanish
jmerelo I think he wanted to type crisps, as in potato chips.
kurahaupo While the TV crew is filming, we should just repeat "Television is the opiate of the masses"
skids More usefully for me, from Spanish, so I can figure out what that guy just yelled at you. 16:07
*me
kurahaupo El_Che: I guess "crippled" has fallen into disuse
jmerelo kurahaupo: :-) I think it's actually something people put on the background while they update twitter
TimToady Crips is as likely to be interpreted as the enemies of the Bloods, in LA 16:08
where kids are not allowed to wear either blue or red hats to certain schools
Jonta2 kurahaupo: Donde esta la biblioteca. Donde esta la biblioteca. Donde esta la biblioteca
kurahaupo consults Google Translate 16:09
skids The local college LARPers went around the neighborhood wearing colored bandanas to distinguish who had been zombified.... fortunatlely the local gang didn;t seem to notice.
timotimo jmerelo: be sure to have them film you using hackertyper 16:10
kurahaupo Jonta2: probably in /usr/lib somewhere
Jonta2 tyty
TimToady wonders whether he can have his 15 seconds of fame now...
kurahaupo Jonta2: or two blocks south east of here, depending on which sort of library you're talking about 16:11
skids
.oO(why do all the tourists always want to see the library so badly?)
16:12
Jonta2 It's all they can ask for 16:12
And then frantically hope there's beer there
skids The schoolbooks should just change that to donde esta la cerveza 16:13
kurahaupo Jonta2: goo.gl/maps/rQAKMB8nPDU2
skids What makes it ultimate... because it's where all the toursists end up? 16:14
Jonta2 Welcome to our special trap!
We've got skeletons on display at our library
Permanently. Prominently 16:15
kurahaupo Everyone in this channel needs to donate 62 milliseconds of fame to TimToady 16:17
TimToady is so needy...
kurahaupo Jonta2: you can check out books any time you like, but you can never leave 16:18
TimToady that's okay, if the books have leaves 16:19
Jonta2 That's why I'm only going to couchsurf or AirBnB if I ever visit the largest state in the USA
kurahaupo Welcome the library California, such a lovely place
El_Che kurahaupo: lol
TimToady largest GDP, anyway 16:20
kurahaupo Tx?
Jonta2 Population or GDPO
TimToady as the joke goes, if Texas keeps bragging how big they are, we'll cut Alaska into 4 pieces and then Texas will be the fifth largest
kurahaupo Lonely star state? 16:21
Jonta2 Are there any non-great states in the USA? 16:23
TimToady the deep state isn't very great 16:24
'course, that means something different depending on whether you say it in a red state or a blue state
El_Che TimToady is in trolling mode :) 16:25
I like it
jmerelo So I'm back 16:36
And this was permanently on screen. I'll send you a link to the video if it finally makes it to the weekend news. 16:37
Jonta2 Muuum! I'm on the telly!
jmerelo -)
Jonta2 A new ISP that offered 1TB data/month for ~€40's started calling customers asking them to take it easy with the traffic 16:38
TimToady m: constant D = [] but role { method elems { exit 0 }}; ^D 16:40
camelia ( no output )
kurahaupo The great states are Joy, Excitement, Passion, and Enthusiasm. The not-so-great states are Sorrow, Melancholy, Lethargy, and Oxford Commas. 16:41
jmerelo TimToady: trying to figure out that one.
kurahaupo: love that one too :-)
kurahaupo Jonta2: 1TB/month is a fairly standard offering around here. 16:42
Jonta2 kurahaupo: For mobile data? 16:43
TimToady thinks Lethargy and Oxford Commas are a bad state
Jonta2 Australia's been upgraded since last I checked
jmerelo Jonta2: to Australia++? Australia Prime? 16:44
TimToady would really prefer Lethargy or Oxford Commas
Jonta2 jmerelo: Auswiftia? Aussharp? Objective Aussies? Ausix? Prison Complex II? 16:45
jmerelo Jonta2: Australia 6?
jmerelo loling again... 16:46
Jonta2 One of these days, I'll fire off that email to an Aussie uni asking them what would happen if a north-south river through the middle of the country was constructed
s/Aussie uni/what-if.xkcd.com/ if you want 16:47
TimToady obviously it would evaporate halfway through, and then where would all the crocs go?
Jonta2 Why would it evaporate?
TimToady the resorts around Ayer's Rock would slurp it all up for golf courses 16:48
Jonta2 You'd have a continuous watersupply from the oceans though, surely?
TimToady Australia is probably dry enough to evaporate all of that too... 16:49
Jonta2 Sense. This picture makes none.
TimToady It is possible we will someday have the technology to terraform Australia, but currently even Elon Musk could not do it. 16:57
Jonta2 I'm not talking about possibly or practically. Just hypothetically 16:58
Jonta2 hides digging equipment 16:59
TimToady Mars is probably easier, 'cuz nobody is living there yet to complain about our dropping comets on it.
otoh, if you just wanna dig a river through the middle of it, Mars needs to have at least one ocean and one continent installed before you can do that...though perhaps if we install an ocean we can pick up a continent at a discount 17:06
Jonta2 Surely we can just apt-get install 17:08
TimToady git clone Pacific might be a more portable solution 17:10
though it might port too much solution, unless you want ocean-front property on Olympus Mons 17:12
Jonta2 Well. Who doesn't? 17:13
TimToady Well, there are always the carpers, but we must have our priorities; who cares about Martian paleontology anyway?
As long as we install a windmill on top, both the industrialists and the ecologists will be satisfied. 17:16
Jonta2 I think we're talking past each other. I'll focus on Australia, you take on Mars. Maybe we'll collaborate in the future 17:21
jmerelo Buying my ticket to fly to the Dutch Perl Workshop. Anyone else attending? 17:22
TimToady No. The Dutch terraformers are cheating—they started with ocean instead of dirt. 17:27
TimToady They'll probably show up on Mars after we've installed an ocean and try to turn large parts of it back to dirt. 17:30
Jonta2 TimToady: what-if.xkcd.com/53/ 17:33
TimToady That's an entirely different situation, since we're merely cloning the Pacific ocean, not draining it. 17:49
Jonta2 You still need biomass to build the clone though. What would you use? 17:51
TimToady Matter is just information, and information wants to be free. 17:52
El_Che hi
jmerelo: are we famous yet?
(for the one that are not famous atm, anyway ;) )
TimToady The chief failure mode of my what-is is when the Netherlands builds a submarine that can double as a spaceship, and then double again, and then double again... 17:54
*what-if 17:55
by the time we're done, half the Martian ocean might be Dutch biomass
I'm assuming the time to clone the ocean is large compared to the time to fly back from Mars here, but that seems consistent with usual github performance... 17:56
mahafyi pastebin.com/B3sFeB0p : To get the stdin from asterisn in a perl6 agi script, there is infinite loop if there is no condition check like the perl5 in the paste bin. Essentially : for lines() loop but exit when the string read from stdin has no length (i guess thats what perl5 is doing here).. 17:57
how to add a length condition inside the for loop? 18:00
TimToady last when "" 18:01
last if $_ eq ''
last unless $_
any of those should work
if you really want to test the length: 18:06
last unless $_.chars
but all the other implicitly test the length too
*others
(unlike in Perl 5, the string "0" is true, so you don't have to worry about a line consisting of only a zero) 18:07
mahafyi TimToady: thanks (and all these alternatives show you have a truly symbolic nick)
TimToady bows
jmerelo El_Che: I don't know it it will finally aired. I'll tell you! 18:14
mahafyi: Can you also ask in StackOverflow? Better SEO, and lots of people can benefit from it :-) 18:15
mahafyi jmerelo:oh ok. i will in a bit, i have to get it working first, lol. I do sloow work. Maybe time to try the new IDE, i haven't looked at it , but if it will drop down suggestions etc, it may be ideal in my case. 18:16
Zoffix mahafyi: note that `lines`, that was suggested to you, by default operates on $*ARGFILES, not $*IN. So if you're making this a method for some class, you probably want $*IN.lines instead of just `lines`. You can just use $*IN as a default for the file handle parameter in your method 18:18
mahafyi Zoffix: i believe thats it, with lines() , the script is trying to look for a file named /path/to/myarg1 18:19
Zoffix mahafyi: method ReallyReadParse (IO::Handle:D \fh = $*IN) { my %input = do for fh.lines { last unless $_; m/^ 'agi_' (\w+) \:\s+ (.*) / andthen |~«$_ } … 18:20
mahafyi: it treats command line arguments as filenames and if no command line arguments were given, then uses $*IN 18:21
mahafyi i dunno how to do a mthod, i am writing a procedural script. that was from perl5, which i went to try and read to figure what was going wrong
Zoffix mahafyi: the Perl 5 code you pasted looks to be for a method. 18:22
mahafyi: but that's irrelvant. You can have your sub set $*IN as default value to the filehandle param 18:23
mahafyi: sub ReallyReadParse (IO::Handle:D \fh = $*IN) { my %input = do for fh.lines { last unless $_; m/^ 'agi_' (\w+) \:\s+ (.*) / andthen |~«$_ } …
mahafyi: or in any regular code: my %input = do for $*IN.lines { last unless $_; m/^ 'agi_' (\w+) \:\s+ (.*) / andthen |~«$_ } … 18:24
That'
That'd be the equivalent to Perl 5's version which explicitly uses STDIN
mahafyi ok it is working at long last!! i was able to write to stdout and answer and control a telephony channel , but couldn't get the system variables passwed in stdin. 18:27
mahafyi and now the postgresql is also working like a a charm.. so maybe i will try and learn some OOP also to make a port of the perl5 AGI from metacpan 18:28
Zoffix sweet
Zoffix backlogs
FWIW `sub f ($g where Int|Str) {…}` is about 5 times faster than `subset IntOrStr of Cool where Int|Str; sub f (IntOrStr $g) { … }` so if you just have one place to use it in, may as well go for inline `where` 18:29
mahafyi when we put the * between the sigil $ and the variable name , like $*IN or $*ARGFILES, what is that called? so i can search the term.. 18:32
Zoffix mahafyi: dynamically-scoped variable
mahafyi Zoffix: ty
Zoffix mahafyi: docs.perl6.org/language/variables#The_*_Twigil 18:33
mahafyi: and $*IN is a special dynamic variable that by default is open to STDIN
geekosaur also docs.perl6.org/language/variables#..._variables 18:34
Zoffix And $*ARGFILES is also special and has an IO::CatHandle loaded with either args as filenames or just with $*IN
mahafyi i got the args like this -> my $string = @*ARGS.perl and in for lines() { say $string;} works ok. 18:36
Zoffix mscha: it doesn't work because you're receiving a containerized item, but returning a deconted value from your deepmap ( perl6advent.wordpress.com/2017/12/...oneandonly ). So in your result, the array's elements are no longer in writable containers, hence the writability error you're seeing. You can avoid it in this case by stuffing the clone's result into a scalar container: my @n = 18:37
@m.deepmap(*.clone R= $);
TimToady In the case of variables like $*IN, it's really a global that is looked up dynamically, but the global namespace is the last place it'll look, so you can always override it in a given dynamic scope
Zoffix hmm 18:38
I should test stuff before suggesting it :)
mscha: I meant .deepmap({ my $ = .clone })
m: my @m = [1,2],[3,4]; my @n = @m.deepmap({my $ = .clone}); dd @n[1;1] = 42; dd @n 18:39
camelia 42
Array @n = [[1, 2], [3, 42]]
Zoffix m: my @m = [1,2],[3,4]; my @n = @m.deepmap(*.clone R= my $); dd @n[1;1] = 42; dd @n
camelia 42
Array @n = [[42, 42], [42, 42]]
Zoffix I would've thought the two to be equivalent. Home come the WhateverCode version reuses the same container, but the block one doesn't?
TimToady the my is instantiated only once, since it's scoped to the surrounding {} 18:40
well, surrounding block without {}, in this case 18:41
whatevercodes are not blocks, syntactically speaking
Zoffix Thanks.
Too bad :) Was hoping to bag another useful use of `R` metaop :) 18:42
TimToady on that level they're more like thunks
parasites on their surrounding declarational scope
Zoffix m: my @m = [1,2],[3,4]; my @n = @m.deepmap(*.clone R= {my $}()); dd @n[1;1] = 42; dd @n 18:43
camelia 42
Array @n = [[1, 2], [3, 42]]
Zoffix ^_^
TimToady m: my @m = [1,2],[3,4]; my @n = @m.deepmap(*.clone R= do {{$}}); dd @n[1;1] = 42; dd @n 18:45
camelia 42
Array @n = [[1, 2], [3, 42]]
Zoffix hythm_, `has A @.a` means @.a is *parametarized* with `A`, not just "contains" A. So you'd need to pass parametarized arrays. To mean "contains only A", you'd write it as `has @.a where .all ~~ A` 18:46
mahafyi jmerelo: I got an account in stackoverflow, but i have asked so many questions today on different things I did not know about. Next time I will post there. 18:57
mahafyi perl6.org/whatever/ : which IDE can provide the dropdown suggestions as we type? 19:05
never mind, i had forgotten the name, i have it now commaide.com/ 19:06
AlexDaniel evalable6: stdin gist.github.com/AlexDaniel/583a251...4129ebfa0c 19:10
evalable6 AlexDaniel, No! It wasn't me! It was the one-armed man! Backtrace: gist.github.com/0097b9e973d46959b4...031dfee7d2 19:10
AlexDaniel evalable6: stdin gist.github.com/AlexDaniel/583a251...4129ebfa0c
evalable6 AlexDaniel, STDIN is set to «one␤two␤three␤four␤five»
AlexDaniel say slurp # :)
evalable6 one
two
three
four
five
19:11
TimToady You don't cheat fair! 19:12
caa51h Is irc.perl6.party down? 19:22
Geth perl6.org: d54a6fd939 | (Zoffix Znet)++ (committed using GitHub Web editor) | source/whatever/index.html
List CommaIDE in the list of IDEs
19:24
Zoffix caa51h: no 19:25
caa51h: why do you think it's down?
Zoffix looks like moritz made irclog.perlgeek redirect to irc.party 19:28
caa51h: IRC logs are at irc.perl6.org irc.perl6.party is just a hack to make old IRC links work. You're not to meant to use it to read new logs. 19:29
caa51h Zoffix: I see. Thank you. 19:39
mahafyi when parsing stdin, for $*IN.lines {say $_ ;} works but for $*IN.lines {say $_ .WHAT;} does not, it gives the same output in STDOUT as the former. 19:42
Zoffix mahafyi: they're entirely different things, so I'm not surprised. Also, don't think you can use a space before `.WHAT` as it's a fake method 19:43
mahafyi: what are you trying to do? 19:44
m: say 42 .WHAT 19:45
camelia ===SORRY!===
Method call must either supply a name or have a child node that evaluates to the name
mahafyi Zoffix: that was a typ, the space. the $_ contains a key and value separated by colon. i wanted to see if it is a string or can we directly treat it as hash 19:46
Zoffix mahafyi: but the answer will be (Str) and a better way to get the name of an object is using .^name methodcall, not .WHAT, which is to get the actual type object
mahafyi Zoffix: thanks.
i got it now, actually, i should not even have asked this. 19:48
Zoffix mahafyi: there's also a `dd` routine you can use to dump stuff. 19:48
m: dd 42; dd "42"
camelia 42
"42"
Zoffix Doesn't say the name, but once you get used to .perl output of stuff, it becomes obvious what the object is
Geth doc: 2e2f05d32c | (Will "Coke" Coleda)++ | doc/Language/pragmas.pod6
whitespace
20:02
doc: 71d8675858 | (Will "Coke" Coleda)++ | doc/Language/pragmas.pod6
avoid compilation error
synopsebot Link: doc.perl6.org/language/pragmas