00:10
arkiuat joined
00:15
arkiuat left
00:24
arkiuat joined
00:29
arkiuat left
00:47
arkiuat joined
01:00
arkiuat left
01:11
arkiuat joined
01:17
arkiuat left
01:40
arkiuat joined
03:07
arkiuat left
03:14
arkiuat joined
03:18
arkiuat left
03:46
arkiuat joined
03:51
arkiuat left
04:12
arkiuat joined
07:50
lizmat left,
lizmat joined
09:14
arkiuat left
09:43
arkiuat joined
09:48
arkiuat left
10:17
arkiuat joined
10:22
arkiuat left
|
|||
disbot4 | <ng0177> throws an error... @antononcube : any hints? | 10:26 | |
<ng0177> cdn.discordapp.com/attachments/768...16fb7& | |||
10:51
arkiuat joined
10:58
arkiuat left
11:11
arkiuat joined
11:16
arkiuat left
11:29
librasteve_ left
|
|||
disbot4 | <antononcube> @ng0177 Most likely, because you are mixing numbers and strings in the data. | 11:29 | |
11:34
stanrifkin joined
11:36
arkiuat joined
11:40
arkiuat left
|
|||
ab5tract | @ng0177 you can use -> Int() $x { ... } to ensure coercion to an integer (Num(), Rat(), etc are also available) | 11:46 | |
11:51
msiism joined
11:56
arkiuat joined
|
|||
msiism | What's a good way to push hashes onto an array "by value" or create an anonymous copy and push that? | 11:57 | |
lizmat | are the hashes you push supposed to be mutable? | 11:59 | |
msiism | Yes. | 12:00 | |
Well, that would be nice. | |||
12:01
arkiuat left
|
|||
lizmat | so, would it matter that if you push the same hash more than once, that changes in one would be reflected in the other ? | 12:01 | |
msiism | Yeah, pushing the same hash more than once would matter. The hashes represent web bookmarks with an id, url, description etc. | 12:02 | |
I'm trying to build an array that holds each bookmark once. | 12:03 | ||
The loop fills a hash called %bookmark that is pushed to the array @bookmarks, when all the key-value pairs are in. | 12:04 | ||
lizmat | ok, why are you using a hash, and not create a Bookmark class? | 12:05 | |
msiism | Lack of knowlegde. :) | ||
ab5tract | :) | ||
One major goal of Raku is to make class definition syntax so streamlined that reaching for it for its use cases comes as second nature | 12:06 | ||
lizmat | class Bookmark { has $.id; has $.url; has $.description... } | ||
ab5tract | *reaching for it for the relevant use cases | 12:07 | |
msiism | Okay, so this is a bit like a struct, I see. | ||
I'll go read up on classes. | 12:09 | ||
It would still be nice to know how to actually create an array of hashes, in case I ever need that. | |||
lizmat | my @a = { a => 42 }, { b => 666 }, { c => 137 } | 12:12 | |
disbot4 | <nahita3882> maybe you can do @arr.push: %bm.clone; if you don't want later changes to %bm effect the array | 12:17 | |
<nahita3882> but if %bm gets renewed every iteration, then there is no risk of modification down the line? | |||
lizmat | that'd be one solution: if no changes should happen to the hash after you push, you can also coerce it to a Map | 12:18 | |
@arr.push: %bm.Map | |||
12:20
arkiuat joined
|
|||
ab5tract | @ng0177: on second glance, the issue appears to be that @data should be an array-of-hashes | 12:24 | |
12:25
arkiuat left
|
|||
disbot4 | <nahita3882> i think if they replace my @data = [ 'X', 'Sin(X)' ]; with my @data; it should work | 12:28 | |
<nahita3882> library seems to accept array of arrays as well | |||
<nahita3882> yet another unfortunate instance an LLM isn't helpful compared to the documentation itself | 12:29 | ||
msiism | ab5tract: Yeah, that was what I wanted it to be – an array of hashes. | 12:30 | |
disbot4 | <nahita3882> questions mixed up | 12:31 | |
msiism | Oh, right, my bad. | 12:32 | |
ab5tract | msiism: I think classes are a nice way to approach this. You can even create a Positional and override SET-POS to define the behavior your want to execute for duplicated entries | 12:41 | |
msiism | Interesting. | 12:42 | |
12:53
arkiuat joined
|
|||
disbot4 | <nahita3882> S/SET-POS/ASSIGN-POS/ | 12:58 | |
13:01
arkiuat left
13:11
DarthGandalf left
13:17
DarthGandalf joined
13:31
arkiuat joined
13:35
arkiuat left
13:58
arkiuat joined
14:02
arkiuat left
|
|||
disbot4 | <antononcube> @ng0177 After commenting out the first assignment to @data (i.e. my @data; # = [ 'X', 'Sin(X)' ];) and using the option format=>'html' I get this plot HTML file/plot: | 14:20 | |
<antononcube> cdn.discordapp.com/attachments/768...cb7fa& | |||
<antononcube> I am not sure why you put the first row of @data to be the array of strings ['X', 'Sin(x)'] -- this might be how Google Charts examples show plot data in their HTML/JavaScript code, or it can be "CSV thinking." There is no need in Raku for that and I consider it wrong. But if many people expect it to work I can make it a "guaranteed" functionality. | 14:30 | ||
14:32
arkiuat joined
14:36
Guest11 joined,
Guest11 left
14:37
arkiuat left
14:59
arkiuat joined
15:03
arkiuat left
15:16
msiism left
15:32
arkiuat joined
15:37
arkiuat left
16:00
arkiuat joined
|
|||
disbot4 | <ng0177> Thank you, the code compiles w/o problems. I guess, something is wrong with viewing the html? | 16:03 | |
<ng0177> cdn.discordapp.com/attachments/768...3ab5f& | |||
<ng0177> cdn.discordapp.com/attachments/768...95a7d& | |||
16:04
arkiuat left
|
|||
disbot4 | <ng0177> I let Gemini create the code. I agree that the first line is an overhead. | 16:06 | |
16:22
arkiuat joined
16:27
arkiuat left
16:41
arkiuat joined
17:23
arkiuat left
17:25
arkiuat joined
17:30
arkiuat left
17:50
librasteve_ joined
18:02
arkiuat joined
18:06
arkiuat left
18:29
arkiuat joined
20:20
arkiuat left
20:33
arkiuat joined
20:37
arkiuat left
20:59
arkiuat joined
21:05
arkiuat left
21:34
arkiuat joined
21:38
arkiuat left
22:02
arkiuat joined
22:06
arkiuat left
22:30
arkiuat joined
22:34
arkiuat left
23:02
arkiuat joined
|