🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
00:00 dogbert17 joined 00:02 rindolf left, dogbert11 left 00:48 maggotbrain left 00:49 maggotbrain joined 00:50 pecastro left 01:32 Doc_Holliwood left 01:37 guifa2 left 01:51 dogbert17 left, dogbert17 joined 01:56 mowcat left 02:09 gnufr33dom joined
codesections .ask lizmat I ran across a code comment you left that reads ` # 'hlfix`. Do you happen to know what that means/does it indicate that the line is in need of "fixing" in some way? (It was a few years ago, so no worries if you don't remember) 02:16
tellable6 codesections, I'll pass your message to lizmat
02:26 lucasb left 02:54 Garbanzo joined 02:55 kvw_5 joined 02:57 guifa2 joined 02:59 kvw_5_ left 03:10 vike left 03:19 vike joined 03:28 guifa2 left
summerisle i feel like i've asked this before, but i'm having a moment with Iterable/Iterator. if i have `class Something does Iterable` with a method `iterator` that returns something that `does Iterator`, given `my $something-instance = Something.new`, `.say for $something-instance` will emit 'Something.new' rather than calling `$something-instance.iterator`. 03:37
looking at the docs it appears I am doing this as intended
though it may be worth noting that this class has a different REPR (CStruct)
actually CPointer 03:38
03:57 guifa2 joined 04:11 rindolf joined 04:27 Doc_Holliwood joined
summerisle nope, still happening after it's been modified to be normal REPR 04:30
moon-child summerisle: try declaring it as @something-instance 04:46
summerisle: alternately, use $something-instance.map(&say)
summerisle well, that definitely invoked .iterator, though I would like to be able to hand off to `for`. I had also tried @$something to no end 04:48
(e.g. for @$something)
moon-child @$x
hmm 04:49
summerisle: not @$, just @
in the decl
summerisle nope, still treats it like a single-element list and complains if i try to bind instead of assign 04:50
moon-child ix.io/2PAo/perl6 this prints out 1 followed by 2 for me 04:54
05:03 aborazmeh joined
summerisle i realised that i was still treating it as a scalar in a helper method (from-file) which changed semantics of the `my @something = Something.from-file: $file`. With that having been said, there are some semantics with the array container i'll have to work around but this gets the job done more or less. 05:07
05:31 gnufr33dom left 05:50 aborazmeh left 06:04 sampersand joined
sampersand Oh boy im now getting the ssl cert too logn too fro the docs 06:05
guifa2 oh this is cool 06:13
say format-unit 45678.324, :unit<solar-radius-cubic-yottaliter-per-pound-square-millimeter>;
Result: 45,678.324 R☉⋅YL³/lb⋅mm²
(I have no idea why anyone would want to use that unit, but hey, it can be formatted!) 06:14
06:16 vrurg left 06:17 vrurg joined 06:19 cog joined, cog__ left
sampersand lol 06:20
So right now i have a list of functions defined as `my %FUNCS = ('R" => { (^0xffff_ffff).pick }, '+' => { $^a.run + $^b.run }, ...);` I thought it might be interesting to abstract this out, and instead have a `register` function that lets me add functions myself. However, `register 'R', { ... }` isn't ideal, as it looks kinda ugly. any suggestions? 06:22
guifa2 Looks okay to me. But maybe you could 06:23
register R => { … }
06:23 orinthe left
sampersand howd i do that 06:23
ie what would the signature look like
guifa2 foo => bar is just a Pair
06:23 orinthe joined 06:24 aborazmeh joined
sampersand sorry, still dont follow. in other languages, i would just take the equivalent of `*%x`, and then just raise an exception if not a single argument was given 06:25
guifa2 tio.run/##TY/LDoIwEEX3/Yq7EKME3InG...rv9eXgG@/f 06:27
take a look at that
sampersand (btw, why `so *` not `?*` ?) 06:28
guifa2 personal preference lol
sampersand hm that seems decent 06:29
ah
guifa2 so * and ?* are equivalent, but so has a looser precedence
sampersand kinda like `not`/`and` vs `!` and `&&`? 06:30
guifa2 exactly the same idea
sampersand nice
is there oen for string and integer conversions?
guifa2 nope. Just + and ~ as prefix 06:31
But………
You could make one :-)
sampersand lol yeah!
moritz well, .Numeric and and .Str
sampersand also, if a statement ends with `}`, is `;` not required? 06:32
eg `register A => { ... }`
moritz if it ends with }\n
sampersand should i add the `;` just to be safe? or should i not do that
guifa2 Totally up to you. 06:33
sampersand aight
moritz I haven't seen anybody who puts a ; after the closing curly of an `if` or `for` block
guifa2 If all of your registers are one liners, I probably would because it feels like actual statements, rather than control blocks
sampersand most of them are one lines, but not all 06:34
most of them are one lines, but not all 06:39
Is there an "identity" function? I couldn't find it anywhere on the docs 06:41
guifa2 identity as in?
sampersand `sub f(\x) { x }`
guifa2 I don't think. What would it be used for? 06:44
summerisle fp
sampersand ^ 06:45
Eg ruby has `.itself`
06:47 aborazmeh left 06:48 aborazmeh joined
sampersand Gotta say, i like `grammar` 06:50
guifa2 so the example I saw on ruby to use that was
[1,2,3,4,5,1,2,2,3].group_by(&:self)
In Raku, that'd be
m: say (1,2,3,4,5,1,2,2,3).categorize( * ) 06:51
camelia Doesn't make sense to categorize with itself
in block <unit> at <tmp> line 1
guifa2 ^_^
Most functions will let you use a Whatever to replace for the invocant in arguments
in this case though, Raku's being a bit too smart ;-)
sampersand it's more like one of the functions im registering is simply an identity function: `register 'B' => { $_ }`
guifa2 m: say (1,2,3,4,5,1,2,2,3).categorize( {$_} ) 06:52
camelia {1 => [1 1], 2 => [2 2 2], 3 => [3 3], 4 => [4], 5 => [5]}
sampersand is `$_` considered a perlism, and `$^a` should be preferred?
06:53 cog_ joined
guifa2 $_ is a topicalizer. It's quite useful to be able to do .foo without needing to put an explicit invocant 06:53
in your case, I'd probably use { $^self } 
or { $^identity } 06:54
Just for code clarity
sampersand fair
guifa2 oh well whaddaya know 06:55
docs.raku.org/type/Mu#method_self
m: say (1,2,3,4,5,1,2,2,3).categorize( *.self )
camelia {1 => [1 1], 2 => [2 2 2], 3 => [3 3], 4 => [4], 5 => [5]}
guifa2 TIL
sampersand so i could do `{ .self }` ?
06:56 ufobat_ joined
guifa2 Correct 06:56
sampersand nice
what about for `!$_`, is there a shortcut for that?
`.!` doesn't work
06:56 cog left
guifa2 But why use braces? You can also do 06:56
register A => *.self; 06:57
sampersand oh right. when i was doing the list version of it, things got weird with `=>`
guifa2 *.not or { .not }
sampersand eg `A => *.Str` didnt work but `A, *.Str` did. no idea
so let's say i have `register 'E', { Knight::run .Str };` . Is there a way to make this use whatevercode? 06:58
i tried `==>`, but i got some weird errors with `.push` not being defined or something 06:59
moritz .Str calls the Str method on $_ immediately 07:00
07:00 parabolize left
moritz *.Str returns a callable that will call the Str method on its argument 07:00
sampersand yeah, i realized that 07:01
I then thought it might be cool to do function composition, but at that point am i just doing too much and should just do what im doing now?
the reason i didnt use whatevercode is because it'd only be applicable in like two places
moritz so use it in those two placesß 07:03
s/ß/?/
sampersand Another question. Should i be using `:D` for my type definitions? eg `multi method eql(::?CLASS $rhs, --> Bool) { $.run.cmp: $rhs }` should i do `::?CLASS:D` and `--> Bool:D` ?
07:05 wamba joined
guifa2 Meh. I don't use it most of the time unless it's critical (or I need to have a multi that distinguishes the two) 07:05
sampersand wdym critical?
guifa2 Where I know a function should never, ever be called with the value being undefined. For class methods, that can happen more often than you might think, because if you have a typed array, an out of bounds access returns a type object 07:06
sampersand ah 07:07
yeah, raku's out of boundsness is a little weird for me, eg `.substr` dies whereas arary indexing does not
07:08 aborazmeh left
sampersand Weird. So for some reason `$rhs.Int` is working, whereas `+$rhs` is telling me my signatures dont match. is the `+` trick just for builtin types 07:09
guifa2 + calls .Numeric 07:10
which may or may not be an Int
moritz: you're a native German-speaker, ja?
sampersand ah ok that makes sense
moritz guifa2: yes 07:13
07:13 ufobat_ left
guifa2 moritz: okay. lesse see how unit formatting works in German. (it and French are the only ones to have fancy gender/declension information included so far by complex units) 07:14
^_^
ooof 07:15
definitely see abug
45.678,232 Sonnenradius⋅KubikYottaLiter pro Pfund⋅QuadratMilliMeter
moritz shouldn't that ben "Sonnenradien" (plural)? :D 07:16
sampersand So im getting this: `Type check failed in assignment to &!func; expected Callable[Callable] but got Block (-> $a, $b { #`(Block...)`. I thought blocks _were_ callable?
moritz *be
guifa2 That's odd. It should just be "Expected Callable". What's it paramterized/mixed in with? 07:18
moritz: perhaps… in theory it should be handling that. Lemme pick through the German rules they have
sampersand `has Callable &!func is built;` then just my register function
this: <github.com/sampersand/knight/blob/...od#L15> 07:19
guifa2 moritz: per the Unicode rules, it says that the Sonnenradius should be singular, and Kubikyottaliter should be plural 07:20
ah, it seems in German there's no number distinction for Liter in the nominative 07:21
moritz well, I can only offer you my intuition as a German speaker (who also happened to have a Physics master), but I haven't checked the rules
guifa2 Nice :-) The units with complex compounding is in a very early stage in CLDR 07:24
07:24 gnufr33dom joined
guifa2 They only just released the data in December so Raku will be very ahead of the curve. It just might be that the data has some issues 07:24
Unfortunately, they don't give much advice on how to handle capitalization, etc (they just say "lowercase if no space, but I know Irish and some Bantu languages happily put capital letters in the middle of words so …) 07:26
07:50 ufobat joined, squashable6 left 07:51 squashable6 joined 07:52 Garbanzo left 08:23 abraxxa left 08:24 abraxxa joined 08:26 mightypork_ joined 08:27 guifa2 left, Sgeo left 08:29 abraxxa left, Doc_Holliwould joined 08:30 abraxxa joined, mightypork left 08:32 Doc_Holliwood left 08:33 krkini joined 08:34 kini left 08:44 gnufr33dom left 08:46 krkini left 08:48 dakkar joined 08:52 kini joined 08:54 aluaces joined 08:57 wamba left 08:58 pecastro joined 08:59 jmerelo joined 09:14 sampersand left
jmerelo releasable6: status 09:33
releasable6 jmerelo, Next release in ≈4 days and ≈9 hours. 2 blockers. 22 out of 129 commits logged
tellable6 2021-02-15T18:45:05Z #raku <tonyo> jmerelo ty
releasable6 jmerelo, Details: gist.github.com/858af08ab0e77a0a9a...65f9a49355
09:33 Discipulus joined 09:44 Scimon joined 09:57 Discipulus_ joined 10:00 Discipulus_ left, Discipulus left 10:14 aluaces left 10:21 Kaiepi left 10:24 Kaiepi joined
lizmat clickbaits rakudoweekly.blog/2021/02/15/2021-07-easy-hard/ 10:40
tellable6 hey lizmat, you have a message: gist.github.com/040e6d88b9d4ac621a...9a4d6da8a3
lizmat .tell codesections 'hlfix indicates an extra ' to fix syntax highlighting in some editors 10:41
tellable6 lizmat, I'll pass your message to codesections
lizmat .tell it may be superfluous by now
tellable6 lizmat, I haven't seen it around, did you mean hi?
lizmat .tell codesections it may be superfluous by now
tellable6 lizmat, I'll pass your message to codesections
10:44 aluaces joined 10:59 ab5tract joined 11:16 Discipulus joined 11:25 Black_Ribbon left 11:27 rindolf left 11:57 kini left 11:59 kini joined 12:17 aluaces left 12:19 aluaces joined 12:36 Discipulus left 12:44 rindolf joined
tbrowder hi, folks. i want to add a wiki to one of my websites, and i want to make any edit access restricted to approved users. i want it to use raku or perl. any suggestions? 12:48
eseyman tbrowder: ikiwiki is the first thing that comes to mind 12:53
ikiwiki.info/
12:58 Discipulus joined
tbrowder eseyman: thanks! 13:20
13:34 jmerelo left
codesections thanks. I've definitely still run into cases where # 'hlfix or similar would have helped 13:39
tellable6 2021-02-16T10:41:12Z #raku <lizmat> codesections 'hlfix indicates an extra ' to fix syntax highlighting in some editors
2021-02-16T10:41:32Z #raku <lizmat> codesections it may be superfluous by now
13:59 Summertime joined 14:02 ingy joined 14:13 Ulti joined 14:14 yguillemot joined
yguillemot Hi all! I write a module for binding to Qt GUI and I wonder how to name it. 14:17
vrurg tbrowder: if not too late, look at foswiki.
yguillemot I hessitate between Qt::QtWidgets, RaQt::QtWidgets and Qt::RaQt::QtWidgets 14:18
Scimon I'd go with Qt::QtWidgets myself.
yguillemot Is it the rifht place to ask ?
Scimon Don't see why not.
moritz why not just Qt::Widgets? 14:19
tadzik if you're binding to Qt GUI, why not Qt::GUI? :)
moritz tadzik: too easy :-)
tadzik one day Qt is going to release Qt Widgets and the problem will be even funnier :P
Scimon That too. 14:20
moritz or you take extra care to build a cute API, and call it Qt::Cute :D 14:22
yguillemot Qt Widgets is the Qt name so Qt::Widgets seems the better but I read on CPAN hight level names should not be used
lizmat yguillemot: that is not so important for Raku 14:23
MasterDuke or figure out some backronym for PIE and call it Qt::Pie
lizmat as you can specify of which author you would like to use a module
yguillemot Qt::Cute was the reason of RaQt (like PyQt)
perry Cutie cute? 14:24
lizmat yguillemot: if it follows the PyQt API, then RaQt would be a good name as well
imho
yguillemot lismat: not sure it follows PyQt API. It follows Qt API and I presume PyQt is doing the same. 14:26
lizmat well, if you don't know for sure, I guess RaQt would not be a good name then :-) 14:27
yguillemot lismat: So if there is no problem I'll choose Qt::QtWidgets 14:28
Thanks everybody 14:29
Scimon Thanks for writing it :) 14:32
tadzik yguillemot: so why the double Qt? :) 14:34
yguillemot tadzik: Qt has several modules. QtWidgets is related to #include <QtWidgets> in Qt C++. Later Qt::Widget may be used for composite widgets written in Raku 14:38
tadzik yguillemot: so I may publish a Qt::Widget::Calendar myself? That doesn't conflict with Qt::Widgets though, or even with Qt::Widget afaik :) 14:39
ab5tract You could also use: Native::QtWidgets 14:40
yguillemot tadzik: exactly
tadzik the point of :: is namespacing. If you want things to be similar to C++ without taking advantage of namespacing you may as well publish a module called "QtWidgets"
ab5tract GUI::Qt would also be a decent option
naming things is often surprisingly difficult 14:41
codesections ab5tract: "two hard things", right? In theory, I like the GUI::Qt option, but none of the raku gtk libraries use GUI::*, so that seems confusing 14:44
ab5tract codesections, indeed. if names are hard, namespacing is far worse
14:45 ab5tract left
tadzik GUI::Qt would get awkward the moment you start binding the other, non-GUI-related Qt libraries 14:46
codesections m: dd my $f = True but False; 14:53
camelia Bool+{<anon|1>} $f = Bool::False
codesections that ^^^ is the same as False, right? (that is, the <anon|1> constraint isn't adding anything extra?) 14:54
camelia: welcome back! You were gone yesterday :D
14:55 Sgeo joined 14:56 ufobat left
MasterDuke m: my $f = True but False; say so $f  # looks like it 14:56
camelia False
codesections yeah, I knew to expect that much equivalence. Just wanted to make sure there wasn't something more subtle I was overlooking 14:58
tbrowder vrurg: thanks, i will 15:10
15:10 gnufr33dom joined 15:15 xinming_ left, xinming_ joined 15:26 ufobat joined 15:28 yguillemot left 15:33 leont joined
leont lizmat: it seems FOSDEM published your presentation mirror.as35701.net/video.fosdem.or...orders.mp4 15:36
lizmat leont++ # that is an URL I can tweet :-) 15:46
hmmm...... that URL doesn't have any video? 15:49
whereas the one I approved did?
*sigh*
15:51 dotdotdot joined
leont There's also a webm version, they both work for me 15:51
codesections Oh, mine is up too bofh.nikhef.nl/events/FOSDEM/2021/D...tware.webm 15:53
er, maybe video.fosdem.org/2021/D.perl/progr...tware.webm is the more official link? 15:56
15:56 jmerelo joined
vrurg lizmat: there is no you in the video, but the presentation is there. 15:58
Scimon I like the bit in Lizmat's talk about "Use Objects" I think that's a big thing to get into Perl devs heads. 16:00
16:00 gnufr33dom left
lizmat the webm version only allows me to download the video, not play it 16:05
codesections lizmat: try video.fosdem.org/2021/D.perl/raku_...orders.mp4 (or the same URL with .webm); both of those work for me 16:09
I think FOSDEM may be doing something funny with load-balancing and redirects, but that scheme seems to redirect to wherever they want me to be 16:11
lizmat as I said, on Safari, I only get audio with the .mp4 link 16:15
and the .webm link only allows me to download it
jmerelo It's been served as text/html
No, wait, it's redirected to video/mp4 16:16
codesections oh, ok. I thought the mirror.as35401.net link might have been part of the problem; I guess not. 16:17
lizmat the download *does* have the video
jmerelo Header contains this link bofh.nikhef.nl/events/FOSDEM/2021/D...orders.mp4
lizmat ah, but it opens it up in chromium
16:18 guifa2 joined
lizmat ok, I guess as Mac user, I'm persona non-grata at FOSDEM :-( 16:18
16:19 parabolize joined
vrurg lizmat: Big Sur Safari opens the video. 16:20
I just clicked the link on video.fosdem.org/2021/D.perl/ 16:21
Webm is offered for download. I guess it's Safari which doesn't support it natively. 16:22
codesections lizmat: that seems a *little* harsh -- yeah, it seems like they didn't do enough testing against Safari. But many Mac users don't use Safari, and I imagine the lack of safari support (in some versions?) was an oversight, not an intentional choice
(Also, I'm watching your talk now – I caught the end of it live, but missed the first bit. Great talk, just as I'd expect!) 16:24
tbrowder vrurg: foswiki is just the ticket! i remember looking at it years ago and pretty much decided to use it after i knew enough to be not too dangerous to my hosts ;-D
guifa2 That reminds me I need to OK my video — I had a lot of silence in the Q&A and wasn't sure if I should keep it all or just clip it out 16:39
jdv79 vrurg: ha. i wouldn't call not wanting to officially endorse something an "attitude" 16:42
jmerelo guifa2: IIRC, there's a small edition interface, although it only allows trimming at both ends. 16:43
guifa2 jmerelo: yeah, that's why I've been slow on deciding what to do :-) BAsically, I'd either need to killl the Q&A entirely or leave in lots of dead time. 16:44
tonyo jmerelo: you have access to logs on modules.raku.org? 16:45
ah nvm, seems to be working fine now 16:46
MasterDuke dead time is easy to skip through 16:47
perry Hey, Safari is my favorite browser :(
guifa2 went ahead and upped the whole thing so his video should be available soon 16:51
codesections yeah, not supporting (pre-Big Sur versions of?) Safari was definitely an error/testing failure on their end. But they've had to do so much with so little that I'm willing to cut them a bit of slack 16:53
jmerelo tonyo: I'm afraid not 16:54
tonyo: you probably want to talk to Roman Baumer, rba
16:56 mowcat joined
lizmat codesections: sorry if I seemed a bit harsh 16:57
I guess I have a hard time forgetting they managed to lose Larry's talk at FOSDEM 2015 where he announced the release of what is now Raku 16:58
codesections lizmat: no worries at all :) I understand the frustration
oh wow, I didn't know that backstory
lizmat fun fact:: they paid for Larry to be there 16:59
17:09 aborazmeh joined 17:12 [Sno] left 17:15 sno joined 17:16 domidumont joined 17:27 Discipulus left, dakkar left 17:28 dakkar joined 17:38 dakkar left 17:45 natrys joined 17:47 Scimon left 17:51 xinming_ left 17:52 xinming_ joined 17:57 m_athias2 left, m_athias joined 18:03 patrickb joined 18:06 cetjs2 joined
cetjs2 hello 18:06
I'm student interesred this gsoc project github.com/perl-foundation-outreac...ku/gRPC.md 18:07
how I do participate in this? 18:08
jmerelo, cast 18:09
guifa2 cetjs2: if jmerelo doesn't respond to you on here, definitely shoot him an e-mail — he's very good at responding to e-mails 18:10
18:12 aborazmeh left
cetjs2 guifa2,ok but I think walt a bit 18:13
18:15 aindilis left
lizmat cetjs2: if you do twitter, you can also contact JJ at @jjmerelo 18:18
18:19 dataangel left
cetjs2 lizmat, me not in twitter, 18:20
18:24 Maylay left, Maylay joined
guifa2 is finally getting to watch lizmat's presentation 18:25
leont cetjs2: this twitter thread may be relevant then: twitter.com/jjmerelo/status/1355948890500042762
jmerelo Hey
cetjs2: thanks for your interest. We're right now at the phase in which we're still asking Google for money. We don't know yet if we will be funded. 18:26
cetjs2: so it's probably wise to wait a bit. Anyway, if you send me an email (jjmerelo at gmail) we'll ping you when it's funded 18:27
18:27 Maylay left 18:31 Maylay joined 18:32 neshpion joined 18:36 Doc_Holliwould left
cetjs2 jmerelo, I sent mall 18:37
18:37 sortiz joined
sortiz \o #raku 18:37
cetjs2 sortiz, hi 18:38
18:41 tejr left, tejr joined
tyil cetjs2: I'm sure people will be willing to mentor you in here too on the project even if it doesn't go through gsoc, fwiw :> 18:59
19:01 Doc_Holliwould joined 19:02 xelxebar_ left, xelxebar joined
codesections cetjs2++ for not being on twitter :) 19:14
19:15 aindilis joined
guifa2 codesections: did you see my crazy unit format tests from last night? 19:16
codesections no, I missed that. Is it in the backlog here?
guifa2 Eh maybe. suffice it to say 19:17
format-unit 12345.6789 :unit<solar-radius-cubic-yottaliter-per-pound-square-millimeter>;
outputs '12,345.6789 R☉⋅Yl³/lb⋅mm²' 19:18
codesections ha! 19:19
reminds me of m.xkcd.com/687/
guifa2 but of course it's fancier than that :-) It can also spell out the units
format-unit 12345.6789, :unit<solar-radius-cubic-yottaliter-per-pound-square-millimeter>, :language<ar>, :length<long> 19:20
١٢٬٣٤٥٫٦٧٨٩ نصف قطر شمسي⋅يوتالتر مكعّب لكل رطل⋅ملّيمتر مربّع 19:21
Which I'm just going to have to take it from Unicode that that's accurate ;-)
codesections wow
19:23 domidumont left
guifa2 English yields "12,345.6789 solar radius-cubic yottaliter per pound-square millimeter" 19:23
neshpion i thought our numerals were already arabic
19:23 Garbanzo joined
guifa2 neshpion: There's three different sets of digits that called Arabic 19:23
codesections and the one most commonly called that, isn't 19:24
guifa2 Wikipedia has a good table here of the differences: en.wikipedia.org/wiki/Eastern_Arabic_numerals 19:25
If you include a country code, the formatter should handle that. 19:27
eg
format-unit 12345.6789, :unit<meter>, :language<ar-MA>
12.345,6789 متر
(Morocco prefers Western style digits) 19:28
codesections m: say عبّرم رتميلّم⋅لطر لكل بعّكم رتلاتوي + 0 19:35
camelia 5===SORRY!5=== Error while compiling <tmp>
Bogus postfix
at <tmp>:1
------> 3say عبّرم رتميلّم7⏏5⋅لطر لكل بعّكم رتلاتوي + 0
expecting any of:
infix
infix stopper
postf…
codesections wow, switching from LTA to RTL in a single line is confusing...
guifa2 Yup :-) 19:36
m: say 0 + ١٢٣٤٥٦٧٨٩ 19:37
camelia 123456789
guifa2 err, I guess I should have only dleeted the thousands separator, meh. You get the idea
codesections it's a bit tempting to start pointing to the previous line in IRC with ٨٨٨٨ 19:38
I guess I could just do ↑↑↑↑↑, but somehow that seems like less fun :D 19:39
guifa2 I had a few places in my dissertation where I quoted multiline RTL text. It's still kind of weird that you start from the left on one line in English, then when the quote starts, you skip to the end of the line, read toward the start quote, then for the NEXT line start on the right, read the whole line, then the NEXT line start at the end quote, read to the start of the line, then skip to the end quote, and continue reading to the end 19:40
the line
codesections oh. 19:41
guifa2 Even worse though is when I'm writing tests
If you include text in <> brackets
codesections I would be *very* tempted to turn those into block quotes
guifa2 Most operating systems will display <arabictext>. But what you see as < is actually probably internally encoded as >, and vice versa, and will change based on the surrounding text 19:42
19:42 Froogal joined, Black_Ribbon joined
codesections wonders whether Acme::Anguish could add RTL shenanigans 19:44
guifa2 I'm assuming yes, but accessing a Hash in multithreaded stuff shouldn't cause any problems, right? 19:47
MasterDuke reading should be fine. writing is not safe 19:48
Froogal hi!  I'm using the WWW module to grab data off the web, however I'm using the Json::Fast module for JSON parsing and processing but the data I get back is a Str.  The Str is [{"some_key": "some_value"}].  The JSON processor isn't working because of the leading and trailing square brackets i think.  How can I trim these off?
summerisle i think the bigger issue is that if it is actually the case that it's giving back a string, it's not handling valid JSON 19:49
conventionally you don't see bare arrays often, but afaik they are permissible
Froogal I checked the type its a Str
summerisle well, a quick fix would be to extract everything between the opening and closing brackets using a regex 19:50
but that's not ideal
Froogal XD Ive been trying to use regex to match the first and last bracket but I'm bad at them
summerisle if you are 100% certain that the brackets will always be there, you could trim the first and last chars off the str
well, there is docs.raku.org/type/Str#routine_substr 19:51
Froogal sweet thanks! 19:53
19:53 Froogal left 19:55 ufobat_ joined 19:59 ufobat left 20:32 Discipulus joined 20:36 rindolf left 20:39 xinming_ left, xinming_ joined 20:55 Discipulus_ joined, Garbanzo left 20:57 Discipulus left 21:21 patrickb left 21:41 aborazmeh joined 21:47 Garbanzo joined 21:55 Froogal joined
Froogal So would the Perl docs be a good place to get info on how to use s/// or tr/// for find and replace on a string? 21:56
It says they work pretty much the same on Raku.org
21:57 epony left
guifa2 To some extent. JUst be aware of course that Raku's regex language is different from Perl's 21:57
Froogal I see, guess I should start there. 21:59
guifa2 for s/// it's pretty straight forward. S/X/Y/ shorthand-ish for $string.subst(/X/, /Y/) 22:05
s/X/Y/ is shorthand is for $string .= subst(/X/, Y)
but s/// and S/// act on the topic ($_) 22:06
codesections Froogal: is there something missing from the raku docs on s///? docs.raku.org/language/regexes#Substitution 22:08
Froogal guifa2 thanks!
codesections I'm sure you know that sometimes docs just don't cut it.  You need actual input from other people with more experience or a fresher prospective than yours. 22:10
22:10 ufobat_ left 22:14 Froogal left 22:15 Froogal joined
codesections yeah of course :) I just was surprised to hear you mention resorting to the docs for a different language 22:18
Froogal codesections Gotcha lol so far so good with it I think lol.  Just getting used to the differences. 22:19
guifa2 And of course we're here for any other Qs 22:29
22:30 japhb joined
Froogal say S/R// with $catStr; doesn't seem to work/  R is a named regex obj.  $catStr is a Str, I want to replace the matched characters with nothing, essentially removing them.  Where am I going wrong? 22:32
I'm trying to use s/// and I"m following this ex:say S/o .+ d/new/ with 'old string';      # OUTPUT: «new string» 22:33
I bet its my regex since its different in Raku. 22:34
japhb Those of you who enter characters not directly on your keyboard, composed of a base character and a combining mark, what do you expect when you've just entered such a pair and now hit backspace? (I'm in the middle of writing a pure-Raku replacement for Linenoise because I'm frustrated with all the things it does wrong, and among those is basically anything having to do with any part of Unicode more complex
than needed for latin-1 emulation.)
guifa2 japhb: the norm is to delete the whole character 22:35
Generally even for languages where the composed character is made of several sub elements (like Korean)
japhb OK, so effectively as soon as you add a combining mark, the buffer is re-normalized and acts as if the combined character was input as a single unit? 22:36
OK, I can work with that, and it fits my intuitive expectation, but I don't have much experience with non-US keyboards. 22:37
So I figured I'd ask. ;-)
guifa2 correct. That's also how many libraries around text input work. When I wrote spell checking stuff, if someone used a dead key, I wouldn't get the letter until the next letter was hit
22:37 Discipulus_ left
japhb Yeah, I'm discovering all sorts of "interesting" bits -- like what happens when you use ^T to swap two characters and they're not the same visual width. 22:38
22:38 Froogal left
japhb Thanks, guifa2. 22:39
guifa2 The crazy ones would be something like Japanese 22:40
Whereas my Spanish keyboard will hold the dead key in a temporary buffer of sorts, it's possible for an entire sentence to be held onto 22:41
japhb guifa2: How so? You mean just multiple keystrokes to produce each character? ... Oh, yeah, that's ... huh.
guifa2 as they'll type it phonetically and then it'll try to break it down into the Kanji, and then when it's the right set, they "commit" it so to speak
japhb Why would it hold that much? Is there long-distance character agreement to worry about?
guifa2 yea. Every kanji has multiple readings, and since you type phonetically normally, there are multiple resolution paths 22:42
japhb Oh joy. Wait, how does e.g. xterm get this right? I can't imagine it has that complex input logic in it ....
guifa2 It might be handled by the OS's IME 22:43
and then dropped into xterm almost C&P style.
japhb (Though to be fair, they are pretty pedantic about compatibility with ancient hardware, so maybe they're pedantic about this too.)
Oh! That's an interesting case.
So for some languages, I may not actually get raw editing control. Hmmmm.
guifa2 I think if you treat things at a glyph level you should be okay. 22:44
codesections I wouldn't be sure about xterm. That codebase is big, and harry. I wouldn't be shocked if it handled some pretty obscure edge cases
japhb I think I basically need to do an NFG renormalization after each insert.
guifa2 I think languages like ones based on devanagari script split things into two glyphs, but then have the font do the ligaturing. I'd need to double check
japhb Hmmm. OK, I think if I can even get basic expectations right, it will already be strictly better than Linenoise is now, and by then I might even know the right questions to ask to figure out what else is LTA in my implementation. 22:47
guifa2: Something that you said: "dead key" -- do you mean that you enter combining marks *first*, before the base character, and it buffers the combining mark waiting for something to put it on? Or am I misunderstanding? 22:49
22:54 natrys left
guifa2 Correct. It comes from the old typewriter days. To do accents back then, you'd hit, e.g., ´ (acute), and then typewriter would slam down the metal with the acute accent on it, but it wouldn't move the printhead forward. Then when you typed a, it would type the a over top of the acute, and you'd have á. 22:54
22:54 natrys joined
guifa2 But it also depends on language. Some languages have the accented keys prebuilt onto the keyboard (like French) 22:54
Nonetheless, in Unicode, it's stored in the opposite direction. IIRC that's why in Raku you can't get a fully live buffer, because when someone enters in "E" it's theoretically possible for there to be 1 or more combining diacritics 22:56
japhb Hmmm, I wonder what happens when I NFG a buffer that has combining characters in it before the base characters.
guifa2 it should apply them to the next character 22:57
Not sure exactly your architecture, but perhaps you could place combiners on top of a PUA code point.
japhb guifa2: I meant, I wonder what MoarVM's Unicode handling will do with that. As you said, there seems to be an assumption of reading input in Unicode with marks after, but I haven't dived into the MoarVM code to look at it. 22:58
Huh, that's an interesting idea. 22:59
guifa2 I'm fairly certain most IMEs won't ever give you the raw combining diacritic, though, so you might be looking at an edge case to an edge case
japhb Basically (at the moment at least) I'm setting $*IN to raw mode using Term::termios, then reading bytes one at a time until I get a decodable character, and then interpreting that character as either (part of) a control sequence, or a request to insert/append the character to the result buffer. 23:00
I'm not stuck on that implementation, but I'm not sure what to replace it with (aside from our discussion above putting some constraints on it) 23:01
guifa2 Actually, the reason that an IME probably won't let you get a raw combining diacritic is because unless it's the first character in a string, by definition it will always combine with the nearest (going backwards) base character 23:02
if $*IN has A, B, C, E+acute -> ABCÉ. 23:03