🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:00 reportable6 left 00:01 reportable6 joined 01:01 benchable6 left, tellable6 left, statisfiable6 left, greppable6 left, nativecallable6 left, evalable6 left, linkable6 left, shareable6 left, notable6 left, sourceable6 left, committable6 left, squashable6 left, reportable6 left, quotable6 left 01:02 greppable6 joined, tellable6 joined, nativecallable6 joined, notable6 joined 01:03 reportable6 joined, quotable6 joined, committable6 joined, evalable6 joined 01:04 shareable6 joined, sourceable6 joined, statisfiable6 joined, linkable6 joined, benchable6 joined, squashable6 joined
Util Xliff: raku.land/zef:finanalyst/GTK::Simple . 48 stars on Raku.Land. 01:40
I tried the first example on MacOS, after running `brew install gtk-3`, 01:41
but still had to invoke it with `DYLD_LIBRARY_PATH=/opt/homebrew/lib raku gui_sample_01.raku`.
For most of my work, HTML+CSS+JS frontend with Perl|Raku backend does fine.
01:41 jpn joined 01:45 coleman left 01:47 coleman joined 01:59 jpn left 02:26 tea3po left 02:27 tea3po joined 02:28 teatwo joined 02:31 tea3po left 02:37 jpn joined 02:41 jpn left 02:46 xinming_ left 02:48 xinming_ joined
Xliff Util: github.com/Xliff/p6-GtkPlus 02:54
And mine won't be much easier.
I started in 2018 and I've ported most of GNOME's libraries to Raku
1,000,000 lines and counting.
Here's the spreadsheet I use to track all of my projects: github.com/Xliff/p6-GLib/raw/main/...Counts.ods 02:57
My stuff was developed on Ubuntu, so getting it to work for MacOSX would take a slight bit of work. For one thing, I would need to know the locations and names of: libglib, libgio, libgobject, libgdk, libpango, libcairo and libgtk3+ 02:58
Actually, if you have timo's excellent cairo-p6, you can drop libcairo from that list. 02:59
My stuff remains unreleased due to some issues I am having with packaging. Mainly that my stuff is SO. FRICKING. LARGE. 03:00
03:20 rf joined 03:31 jpn joined 03:36 jpn left 04:36 shareable6 left, committable6 left, squashable6 left, benchable6 left, sourceable6 left, unicodable6 left, bloatable6 left, statisfiable6 left, bisectable6 left, greppable6 left, releasable6 left, notable6 left, coverable6 left, evalable6 left, nativecallable6 left, reportable6 left, quotable6 left, linkable6 left, tellable6 left, unicodable6 joined 04:37 evalable6 joined, squashable6 joined, releasable6 joined, committable6 joined, statisfiable6 joined, notable6 joined, greppable6 joined 04:38 benchable6 joined, sourceable6 joined, nativecallable6 joined, reportable6 joined, tellable6 joined, shareable6 joined, linkable6 joined 04:39 coverable6 joined, bloatable6 joined, quotable6 joined, bisectable6 joined 04:55 rf left, rf joined 05:02 rf left, jpn joined 05:07 jpn left 05:44 Xliff left 06:00 reportable6 left 06:02 reportable6 joined 06:50 jpn joined 06:55 jpn left 07:55 greppable6 left, nativecallable6 left, quotable6 left, reportable6 left, linkable6 left, coverable6 left, bisectable6 left, sourceable6 left, releasable6 left, evalable6 left, bloatable6 left, statisfiable6 left, shareable6 left 07:56 sourceable6 joined, nativecallable6 joined, greppable6 joined, quotable6 joined 07:57 linkable6 joined, evalable6 joined, reportable6 joined, coverable6 joined, bloatable6 joined 07:58 statisfiable6 joined, shareable6 joined, releasable6 joined, bisectable6 joined 08:12 jpn joined 08:16 sena_kun joined 08:35 jpn left 09:35 benchable6 left, reportable6 left, tellable6 left, unicodable6 left, committable6 left, squashable6 left, notable6 left, bisectable6 left, sourceable6 left, evalable6 left, shareable6 left, statisfiable6 left, greppable6 left, linkable6 left, nativecallable6 left, bloatable6 left, quotable6 left, releasable6 left, coverable6 left 09:36 tellable6 joined, coverable6 joined, shareable6 joined, evalable6 joined, bisectable6 joined, notable6 joined, statisfiable6 joined 09:37 quotable6 joined, greppable6 joined, benchable6 joined, reportable6 joined, squashable6 joined 09:38 releasable6 joined, unicodable6 joined, linkable6 joined, bloatable6 joined, sourceable6 joined, committable6 joined 09:39 nativecallable6 joined
xinming_ gfldex: Thanks, use :$a instead of :$!a gives me the idea of the acceptable version for me. 09:41
09:43 Sgeo left 09:47 sena_kun left
xinming_ What is the best way to subclass an Array, Just before the array creation, We check the value of the array. 10:01
Let's say, (('1d', ...), ('4h', ...), ('2h', ...)) For this list of list, I need to ensure that each element's first element is larger than the later ones. 10:02
lizmat what do you want to do if the values do not match ? 10:03
xinming_ What I do now is something like, class MyArray is Array { submethod new (*@values) { 'check values here'; return Array.new(|@values) }; 10:04
lizmat: I actually wish to make it a type.
I wrote the code already, But want it to look more natural in raku way. 10:05
lizmat m: subset A of List where { [>] @_ }; dd (3,2,1) ~~ A 10:07
camelia Bool::True
lizmat xinming_ ^^ something like that ?
m: subset A of List where { [>] @_ }; dd (3,2,2) ~~ A 10:08
camelia Bool::False
xinming_ m: subset A of List where { [>] @_ }; my A @a = (3, 2, 1); @a.raku.say; 10:09
camelia Type check failed for an element of @a; expected A but got Int (3)
in block <unit> at <tmp> line 1
xinming_ m: subset A of List where { [>] @_ }; my @a is A = (3, 2, 1); @a.raku.say;
camelia You cannot create an instance of this type (A)
in block <unit> at <tmp> line 1
xinming_ lizmat: We can't enfore the subset on an @array container. :-)
I'm not trying my version yet, What I wish to do is something like, my @a is A = (...); This way, We can have @a automatically validated 10:10
lizmat subset A of List where { [>] @_ }; my A @a = $(3,2,2)
m: subset A of List where { [>] @_ }; my A @a = $(3,2,2) 10:11
camelia Type check failed for an element of @a; expected A but got List ((3, 2, 2))
in block <unit> at <tmp> line 1
lizmat m: subset A of List where { [>] @_ }; my A @a = $(3,2,1)
camelia ( no output )
lizmat m: subset A of List where { [>] @_ }; my A @a = $(3,2,1); dd @a
camelia Array[A @a = Array[A].new($(3, 2, 1))
lizmat looks ok to me?
xinming_ lizmat: It's now become array of array. 10:12
lizmat no, it's an Array of lists ?
xinming_ @a itself should be (3,2,1)
:-)
lizmat ah
xinming_ Yes, it's array of lists, But it's each array in the list's first element will be checked.
Actually, My sollution is trying to subclass Array, to make it a real type. 10:14
in docs, IIRC subset is just a constraint, Not a real type
lizmat m: subset A of List where { [>] @_ }; class B is Array { method STORE(A $list) { nextsame } }; my @a is B = 3,2,2 10:15
camelia Constraint type check failed in binding to parameter '$list'; expected A but got List ((3, 2, 2))
in method STORE at <tmp> line 1
in block <unit> at <tmp> line 1
lizmat m: subset A of List where { [>] @_ }; class B is Array { method STORE(A $list) { nextsame } }; my @a is B = 3,2,1
camelia ( no output )
xinming_ m: subset A of List where { [>] @_ }; class B is Array { method STORE(A $list) { nextsame } }; my @a is B = 3,2,1; @a;
camelia WARNINGS for <tmp>:
Useless use of @a in sink context (line 1)
lizmat m: subset A of List where { [>] @_ }; class B is Array { method STORE(A $list) { nextsame } }; my @a is B = 3,2,1; dd @a
camelia [3, 2, 1]
lizmat if you want @a to be immutable: 10:16
xinming_ Thanks, will check docs about the STORE method.
lizmat m: subset A of List where { [>] @_ }; class B is List { method STORE(A $list) { nextsame } }; my @a is B = 3,2,1; dd @a
camelia (3, 2, 1)
xinming_ thanks, actually, STORE method name is what I'm looking for. :-) 10:17
lizmat there you go!
nemokosch sadly, the typing of literals is not very clever 10:24
10:31 jpn joined 10:36 jpn left
xinming_ It's been a while not seeing lwall, How is he recently? Anyone knows? :-) 10:40
lizmat not really, I think... 10:44
I also think: no news is good news
xinming_ Ok, thanks. 10:45
the `Defaults on compound attribute types not yet implemented. Sorry` The subclass List can not be used on class attributes. 10:46
can not be used in attributes defaults.
We'll have to use TWEAK method, But it's good enough 10:47
I think I found a bug in class attribute with customized Array declration, Will narrow it down. 10:53
lizmat: subset A of List where { ... }; <-- in this case, Is it possible to do something like, subset A of (Array|List) where { ... } ? 11:02
lizmat Array isa List, so List will cover both
m: say Array ~~ List
camelia True
xinming_ lizmat: So, I think this is a bug then. termbin.com/idfc 11:15
When we change the Array to List, the code is running fine, 11:16
tested with Welcome to Rakudo™ v2023.06. 11:17
And we can also replace 'Array' to something like 'Positional' in subset declaration, But the @_ in the subset code block will cause @_ to be flatten 11:21
lizmat the problem is in your code 11:22
11:22 saint- left
lizmat subset A of Array expects an Array 11:22
but in @!t = #test data, you're feeding it a List
if you do the #test data with [ ], then it works 11:23
morale: make the subset of List, I'd say
xinming_ Ok, It's quite subtle for () vs [] in this case. 11:28
will think more on this
But I still don't get the idea, why with list, in subset, It'll flatten the array. 11:29
m: subset A of List where { @_.raku.say; True }; class B is Array { method STORE (A $v) { $v.raku.say; nextsame } }; my @a is B = ((1,), (2,), (3,)) 11:32
camelia [1, 2, 3]
$((1,), (2,), (3,))
xinming_ m: sub a (*@_) { @_.raku.say; }; my @t = ((1,), (2,), (3,)); @t.raku.say; a(|@t); 11:35
camelia [(1,), (2,), (3,)]
[(1,), (2,), (3,)]
xinming_ just now checked signature for the where block, it's also (*@_) 11:36
lizmat m: dd { @a }.signature 11:37
camelia ===SORRY!=== Error while compiling <tmp>
Variable '@a' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> dd { ⏏@a }.signature
lizmat m: dd { @_ }.signature
camelia :(*@_)
lizmat @_ is like a special case of $^a, aka placeholder
xinming_ lizmat: So in where block, array should be flattened with List? 11:38
lizmat I guess you want to make a specific signature in the where block, like -> @_ { } 11:39
that would not be slurpy
xinming_ actually, I want to know why in this case, the where will flatten all things in the list. 11:40
tried with another level, It's still being flatten in where block in subset
lizmat m: subset A of List where -> @_ { @_.raku.say; True }; class B is Array { method STORE (A $v) { $v.raku.say; nextsame } }; my @a is B = ((1,), (2,), (3,)) 11:42
camelia ((1,), (2,), (3,))
$((1,), (2,), (3,))
lizmat note the -> @_ { ... } in the where
xinming_ m: subset A of List where { @_.raku.say; True }; class B is Array { method STORE (A $v) { $v.raku.say; nextsame } }; my @a is B = ((1,(1,(1,),), (2,(2,(2,)))), (3,(3,(3,))))
camelia [1, 1, 1, 2, 2, 2, 3, 3, 3]
$((1, (1, (1,)), (2, (2, (2,)))), (3, (3, (3,))))
lizmat xinming_ : not { @_ } but: -> @_ { } 11:43
xinming_ lizmat: Yea, I know, I just get quite confused in slurp arg this time
lizmat m: subset A of List where -> @_ { @_.raku.say; True }; class B is Array { method STORE (A $v) { $v.raku.say; nextsame } }; my @a is B = ((1,(1,(1,),), (2,(2,(2,)))), (3,(3,(3,))))
camelia ((1, (1, (1,)), (2, (2, (2,)))), (3, (3, (3,))))
$((1, (1, (1,)), (2, (2, (2,)))), (3, (3, (3,))))
xinming_ what operator do we use for slurpy arg in this case? 11:44
I mean behave like where
lizmat the where just takes a Callable
where doesn't do anything special
it takes a callable, calls it with the arguments it gets, and accepts if the Callable returns True 11:45
xinming_ for now, it's unstandable. 11:46
m: my $t = { @_.raku.say; }; my \a = ((1,(1,(1,),), (2,(2,(2,)))), (3,(3,(3,)))); $t(a); 11:47
camelia [1, 1, 1, 2, 2, 2, 3, 3, 3]
lizmat m: my $t = -> @_ { @_.raku.say; }; my \a = ((1,(1,(1,),), (2,(2,(2,)))), (3,(3,(3,)))); $t(a); 11:48
camelia ((1, (1, (1,)), (2, (2, (2,)))), (3, (3, (3,))))
xinming_ Now, I successfully repeat it, Still need to re-think on what I know
thanks for your time.
lizmat m: dd ({ @_ }).signatiure
camelia No such method 'signatiure' for invocant of type 'Block'. Did you mean
'signature'?
in block <unit> at <tmp> line 1
lizmat m: dd ({ @_ }).signature
camelia :(*@_)
lizmat m: dd (-> @_ { @_ }).signature
camelia :(@_)
lizmat see the difference?
see the difference? 11:49
and you're welcome :-)
xinming_ m: my $t = { @_.raku.say; }; my \a = ((1,(1,(1,),), (2,(2,(2,)))), $(3,(3,(3,)))); $t(a); 11:50
camelia [1, 1, 1, 2, 2, 2, (3, (3, (3,)))]
xinming_ m: my $t = { @_.raku.say; }; my \a = ((1,(1,(1,),), (2,(2,(2,)))), [3,(3,(3,))]); $t(a); 11:51
camelia [1, 1, 1, 2, 2, 2, 3, (3, (3,))]
xinming_ m: my $t = { @_.raku.say; }; my \a = ((1,(1,(1,),), (2,(2,(2,)))), $[3,(3,(3,))]); $t(a); 11:52
camelia [1, 1, 1, 2, 2, 2, [3, (3, (3,))]]
lizmat that's because the array stores the list in a container, making them itemized
m: my @a = (1,2),(3,4); dd $_ for @a 11:53
camelia List @a = $(1, 2)
List @a = $(3, 4)
xinming_ lizmat: yea, I'm still thinking on this. () $() $[] are now totally different, For quite a while, I think $() is the same as $[], and $() is just a force scaller to ()
lizmat ? 11:54
xinming_ I read docs several times on List
Now I know there are differences between () $() $[]
lizmat good! 11:55
12:00 reportable6 left 12:01 reportable6 joined 12:20 jpn joined 12:24 jpn left 12:32 jpn joined 13:32 linkable6 left, evalable6 left, evalable6 joined 13:33 linkable6 joined 13:58 jpn left
tbrowder__ g'day. i just tried the raku REPL on a host and was suggested to use Readline or Linenoise. i opted for Readline since it was suggested first and it failed testing. then i installed Linenoise successfully. i vaguely remembered going through the same provess before. 14:02
is seems to me the repl msg ought to suggest Linenoise before Readline.
or fix the late Jeff's Readline 14:05
i think a bug report should be made, which i will gladly do 14:07
lizmat please do 14:13
14:29 tea3po joined 14:32 teatwo left 14:37 euandreh left
antononcube @lizmat Thanks for mentioning StrDistance -- I did not know about it. 14:38
@lizmat (That was more than a week ago -- you mentioned it and went "AFK.") 14:39
lizmat yeah, I do go afk every now and then :-) 14:40
14:40 euandreh joined 14:41 tea3po left, tea3po joined
antononcube @lizmat Ok. That habit might be a suitable preparation to start AFvi ("away from vi.") 14:49
lizmat :-) 14:50
antononcube @lizmat Actually, I just generated a few 12 step lists how to quit vi addiction. It is entertaining, enough... 🙂 Unfortunately the generated lists of quiting Perl5 do not include Raku. (So far...) 14:55
lizmat I'd rather see Raku on the "quitting Python" list :-) 14:58
antononcube Where is the default or conventional place to put documentation in Raku packages/modules -- "./doc" or "./docs" ?
[Coke] I don't think we have a default/recommended place at the moment. 14:59
antononcube @Coke thanks!
[Coke] let's say "doc" because that' what raku/doc uses.
lizmat fwiw, if a module of mine has a separate .rakudoc file, I put it in the /doc dir 15:00
antononcube @lizmat Thanks -- good to know!
15:20 jpn joined
@lizmat Any examples repositories / modules with that? ("Acme::Text::UpsideDown" and "App::Rak" do not have it.) 15:24
I tried a few other modules too...
15:24 jpn left
lizmat App::Rak dist has a doc dir ? 15:25
with an App-Rak.rakudoc file in it?
antononcube @lizmat Yes. Sorry, I might have clicked on the "wrong" "App::Rak", you have several at raku.land. (Meaning, it is your fault...) 15:27
lizmat there's an App::Rak::Complete and there's a rak 15:28
did I miss one?
antononcube Well, "App::Raku::Log" might also count for misguided clicking... 15:29
lizmat I guess... 15:30
antononcube @lizmat Yes, I see only two app-raks : "App::Rak" and "App::Rak::Complete". 15:31
lizmat the ::Complete one will install all of the optional dependencies
antononcube Ok. I am currently processing the "App::Rak" documentation with LLMs... 15:38
lizmat oh dear
antononcube @lizmat LOL! Thanks for the encouragement! 15:39
As for Python->Raku 12 step program, here is one : i.imgur.com/L8CIhCk.png 15:42
lizmat :-) s/pro ject/project/ I guess ? 15:43
antononcube @lizmat Good observation! That shows how tokens are used to generate the text. 15:45
This might be also of interest: i.imgur.com/y7SsVGa.png 15:46
15:59 rf joined
Also -- for the record -- here are the generated "no more vi" 12 steps: i.imgur.com/7dH5716.png 16:02
tbrowder__ most of my modulez 16:30
modules have a /docs directory an App::Mi6 generates Markdown docs from that. /docs are pure Rakupod, no ambient code. 16:31
lizmat tbrowder__: but that's because you instructed App::Mi6 to look in the "docs" rather than the "doc" directory, no ? 16:33
tbrowder__ if you aren't yet using App::Mi6, my Mi6::Helper eases the pain for a new module. if nothing else, you can create a new, template module that will help you convert an old module. 16:34
now, yes. but i think i'm the one who suggested the capability. i used to use a Makefile to convert to other desired Markdown files. 16:37
i'm happy to make helper change to docs if it becomes recommended practice.
to *doc if so 16:38
lizmat maybe this should be discussed on #raku-doc :-) 16:40
tbrowder__ antononcube: love the link on leaving python, thnx! 16:43
antononcube @tbrowder Well, lizmat requested it… 🙂 16:45
tbrowder__ btw, rakudo.org has rakudo/docs
lizmat yeah, and then there's docs.raku.org 16:46
tbrowder__ as does raku/nqp/docs 16:47
those are why i started using docs
in my modules
lizmat yet: github.com/raku/doc 16:48
tbrowder__ is the 12-step gonna be in the "docs?" oughtta be 16:49
lizmat hehe... PRs welcome
tbrowder__ but the raku/doc i think was thought of originally as a single document or project (that used to bother me, but i got over it) 16:51
16:59 evalable6 left, linkable6 left 17:00 evalable6 joined 17:01 linkable6 joined 17:15 Ekho left
xinming_ m: my $t = { @_.raku.say; }; my \a = ((1,(1,(1,),), (2,(2,(2,)))), $(3,(3,(3,)))); $t(a); 17:15
camelia [1, 1, 1, 2, 2, 2, (3, (3, (3,)))]
17:16 jpn joined
xinming_ hmm, Restart the example. 17:16
m: my $t = { @_.raku.say; }; my \a = ((1,(1,(1,),), (2,(2,(2,)))), [3,(3,(3,))]); $t(a);
camelia [1, 1, 1, 2, 2, 2, 3, (3, (3,))]
xinming_ m: my $t = { @_.raku.say; }; my \a = ((1,(1,(1,),), (2,(2,(2,)))), $[3,(3,(3,))]); $t(a);
camelia [1, 1, 1, 2, 2, 2, [3, (3, (3,))]]
xinming_ lizmat: the array will be flatten once in example 1, right? 17:17
lizmat it won't flatten, as it has been itemized? 17:18
xinming_ m: my $t = { @_.raku.say; }; my \a = ((1,(1,(1,),), (2,(2,(2,)))), [3,(3,(3,))]); $t(a); 17:20
camelia [1, 1, 1, 2, 2, 2, 3, (3, (3,))]
17:20 euandreh left
xinming_ I mean this one, I'm still a bit confused, Why will the [] be flatten 17:20
17:21 jpn left
lizmat because it's a slurpy @ will flatten anything Array / List like, unless it has been itemized 17:21
and in an array, lists are automatically itemized, because they're in a container 17:22
tbrowder__ lizmat: ref the 12-step article by antononcube, where on the raku.org should it be put? would it be better in or accompanied by an article about why Raku should be preferred over Python? 17:32
17:32 jpn joined
lizmat tbrowder__: actually, I think the humour of the list will quickly backfire when placed in an "official" location 17:33
xinming_ lizmat: So, List in List, doesn't have any scalar container around them, right
tbrowder__ probably
lizmat xinming_: well, you *can* create a List with containers in it, but that would require "hard" work 17:34
m: dd (1,2,my $ = 3,4)
camelia (1, 2, 3, 4)
lizmat m: dd (1,2,(my $ = 3),4)
camelia (1, 2, 3, 4)
lizmat m: dd (1,2,(my $ = 3),4)[2] = 42
camelia Int $ = 42
tbrowder__ but a good, technical article on benefits of Raku over Python would be very good to have imho.
xinming_ ((1,), (2,)) <--- (1,) (2,) doesn't have scalar container, that's why they'll be flatten, But in array, there is scalar container around each element, That's why they'll be kept from flatten 17:35
lizmat agree
xinming_: indeed, but also you *can* create Arrays that have elements without containers
xinming_ this is what I understand
lizmat m: my @a = 1,2,3; @a[1] := 42; 17:36
camelia ( no output )
lizmat m: my @a = 1,2,3; @a[1] := 42; @a[1] = 666
camelia Cannot assign to an immutable value
in block <unit> at <tmp> line 1
lizmat xinming_
xinming_ lizmat: Ok, got it, I just trying to understand the $() $[] [] differences.
lizmat so it's really about the actual situation, rather than saying Array does this and List does that
17:38 jpn left 17:40 sena_kun joined 18:00 reportable6 left 18:02 reportable6 joined 18:06 jpn joined, samebchase6 joined 18:07 samebchase left, samebchase6 is now known as samebchase 18:29 jpn left 18:41 jpn joined 18:46 Chris41 joined
Chris41 Hello :) 18:47
18:50 Chris41 left 18:57 Sgeo joined
tbrowder__ Chris41: howdy! 19:00
tellable6 tbrowder__, I'll pass your message to Chris41
19:11 ab5tract joined 19:51 jpn left 20:51 evalable6 left, linkable6 left, coverable6 left, reportable6 left, notable6 left, shareable6 left, bloatable6 left, sourceable6 left, bisectable6 left, nativecallable6 left, unicodable6 left, releasable6 left, statisfiable6 left, benchable6 left, squashable6 left 20:52 coverable6 joined, evalable6 joined, squashable6 joined, nativecallable6 joined, shareable6 joined 20:53 statisfiable6 joined, releasable6 joined, reportable6 joined, linkable6 joined, benchable6 joined, sourceable6 joined 20:54 notable6 joined, unicodable6 joined, bisectable6 joined, bloatable6 joined 20:56 deoac joined 21:14 Vyrus left 21:31 Vyrus joined 21:51 shmup left 22:21 Xliff joined
Xliff \o 22:21
22:44 ab5tract left 22:48 jpn joined 22:56 jpn left 23:51 squashable6 left 23:53 squashable6 joined