This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html Set by lizmat on 8 June 2022. |
|||
00:57
librasteve_ left
01:16
kjp left
01:17
kjp joined
01:20
kjp left,
kjp joined
|
|||
thowe | I was able to do some pretty fancy collating of some data at work for a weird report I needed to do using splice. It totally got built faster than I thought it would with very little code. Always fun to play with Raku. | 02:16 | |
04:32
cleo joined
|
|||
ng0177 | Unrelated: under Arch Linux, "perl-mojolicious" ran out of virtual memory during an update. Question: is this tool related to raku. Another question: does discord have a list of shortcuts for markdown? | 04:50 | |
05:00
jmcgnh left
05:07
jmcgnh joined
06:50
topnep_ joined
06:53
topnep left
08:00
swaggboi left
08:01
swaggboi joined
08:10
dakkar joined
|
|||
thowe | Mojolicious is a Perl thing, not a Raku thing. Curious that a Mojo app could be running without you knowing it, but I never ran Arch... | 08:35 | |
mojolicious.org/ | |||
aur.archlinux.org/packages/perl-mojolicious | 08:36 | ||
08:54
topnep_ left
08:55
topnep joined
|
|||
nahita3882 | for markdown here support.discord.com/hc/en-us/artic...-Underline | 10:42 | |
itsrakanott | Hello, people. i have a little question. For fun, i was defining this circumfix: raku sub circumfix:<<div> </div>>($content) { "<div> $content </div>" } But when i tried say <div> "hell yeah" </div>;, it threw error 'Syntax: Two terms in a row ' So, i assume that there is no way to create a syntactical workaround without replacing lessthan and morethan with other symbols? | 12:22 | |
lizmat | yeah... that's getting close to DIHWIDT | 12:27 | |
perhaps alternately: | |||
m: sub circumfix:<DIV DIV>($content) { "<div> $content </div>" }; say DIV 42 DIV | |||
camelia | <div> 42 </div> | ||
itsrakanott | Well yeah, I was thinking the same thing. I guess Raku parser already works overtime. Thanks for clarifying! | 12:28 | |
lizmat | the thing is: longest token match should really work there | 12:29 | |
however, the expression handling is pretty complex already, and it looks like it is not applying LTM semantics there :-( | |||
so when you use infix operators as delimiters, it looks like it gets confused | 12:30 | ||
without looking at the EXPR code in the grammar in depth now, I figure that's the most likely explanation atm | 12:31 | ||
itsrakanott | I guess that suffices. I really wanna get into sort of "upper-intermediate" raku. I decided that making my own toy web-framework would be a good place to start | 12:32 | |
lizmat | m: sub prefix:Ā«<div>Ā»($content) { "<div> $content </div>" }; say <div> 42 # looks like prefix works as intended | 12:34 | |
camelia | <div> 42 </div> | ||
lizmat | but yeah, this is probably slang country... | 12:35 | |
12:47
ACfromTX left
13:00
ACfromTX joined
13:02
librasteve_ joined
13:04
topnep left
13:06
topnep joined
|
|||
librasteve | @itsrakanott I think you can get your original circumflex thing to work, but you need to backslash all the gts and lts like crazy | 13:08 | |
oh - lizmats idea of french quotes looks better | |||
have you tried Air::Functional? | 13:09 | ||
(curious what you think?) | |||
btw always happy to have help if you would like to contribute ;-) | |||
timo | github.com/pmurias/p6-jsx - you could try modernizing this using the Slangify module and seeing what exactly needs to be changed for that to work, if you're up for some "deeper" hacking :) | 13:17 | |
itsrakanott | I would like to know a lil bit of technical stuff about Raku classes. Are they "memory efficient"? By that i mean mostly "Is this a good practice to instantiate a lot of classes, and use them in the same context where i would use a struct" | 13:52 | |
lizmat | itsrakanott "to instantiate a lot of classes" if you'd only instantiate one of each of the classes, then I'd say using classes would be memory inefficient, but code development very efficient | 13:57 | |
itsrakanott if you meant instantiate a lot of a few classes, then that would be the most memory efficient | 13:58 | ||
but really, that shouldn't be a matter of concern when you're starting with Raku: remember that premature optimizations are the root of all evil! :-) | |||
itsrakanott | Yeah, honestly, you are right. Thanks! | 14:10 | |
To clear out some misunderstandings, i was talking about, say, a "Entity" class. If my program holds a lot of entities, then would that be a good practice? Or does Raku do things differently when it comes to data definitions? | 14:15 | ||
lizmat | that would be a good practice | 14:17 | |
differently from what ? | |||
itsrakanott | I come from systems level languages, my main one is C, and i currently am dabbling in Zig. So, i grew accustomed to structs being the status quo. I know comparing Raku to C is apples-to-oranges, but i really wanted to know that it's not like in C#, where you have both classes and structs | 14:32 | |
lizmat | well... the NativeCall interface allows you to define class representations of C structs... | 14:34 | |
SmokeMachine | itsrakanott: Iāve done something like that here: github.com/FCO/p6-react | ||
lizmat | but other than that, I'd say that Raku only has classes (and instantiations of them) | ||
everything in Raku is an object | |||
(so an instantiation of a class) | 14:35 | ||
itsrakanott | i think you are right in a sense that i worry about something that i shouldn't worry about. Raku is not about memory efficency and performance. | ||
So, i'll just go along with it, at least for now. | 14:36 | ||
lizmat | good to hear... if you have any questions, you can ask them here, or on SO or on Bluesky or Mastodon (tag with #rakulang) | ||
timo | classes in Raku use the memory representation "P6Opaque" by default, which acts a lot like a struct. however, attributes that are other objects will be pointers. you can have multiple int8 in a row in your class and they will be packed tightly like they would in a struct, and there is alignment constraints that may leave you with holes if for example you put pointer, int8, pointer, int8, | 14:40 | |
pointer, you would have a hole after all of these int8 attributes | |||
14:46
jgaz joined
15:10
topnep left
15:11
topnep joined
15:21
librasteve_ left
|
|||
thowe | Array.splice let me do something so cool yesterday I have to almost assume it was an intentional feature. | 15:38 | |
lizmat | thowe: OOC, what ? | 15:39 | |
timo | oh, is it that you can pass the array itself when calling splice on it, maybe? | ||
antononcube | @itsrakanott C is much more prickly than an orange. And Raku is more like grapes, than an apple. | 16:11 | |
thowe | Sorry, got distracted at work. So, I have this list of stuff from a database that I need to give to someone as a flat list. But the database has these as child/parent relationships. I was able to easily migrate the parents from one array to another, then insert each child at the exact correct spot so that they would be grouped in the list. Saved me time and I was so relieved. | 16:19 | |
this one line does the heavy lifting... @sorted.splice($si + 1, 0, @services.splice($skey, 1)[0]); | 16:20 | ||
that's just in a while loop | 16:21 | ||
what does "OOC" mean? | 16:22 | ||
That removes it from the source array and inserts it in at the correct spot in the other and I was like "Hot Dang, that worked." | 16:23 | ||
lizmat | Out Of Curiosity | ||
thowe | Anyway. Just my excuse to play with Raku this quarter. At this rate I will manage to squeeze a year of learning in to 10 years. | 16:33 | |
16:34
dakkar left
|
|||
antononcube | Letting work distract you from you Raku quests is deplorable!! | 16:37 | |
17:15
topnep left
17:16
topnep joined
|
|||
thowe | antoncube, Raku Quest. I like it. Let's Quest! | 17:17 | |
17:24
librasteve_ joined
19:20
topnep left
19:21
topnep joined
19:58
habere-et-disper joined
21:25
topnep left
21:27
topnep joined
21:46
librasteve_ left
|
|||
itsrakanott | That's actually exactly what i wanted to know. Thanks a lot! | 21:50 | |
22:56
habere-et-disper left
|