02:02 m_athias left, m_athias joined 02:19 frost joined 03:30 Guest35 left 05:16 Util left, Util joined 05:34 zacts joined, zacts left
deadmarshal paste.c-net.org/NachosBeijing 06:09
07:13 dakkar joined 09:35 Manifest0 left 09:40 frost left 09:41 Manifest0 joined 09:45 frost joined 10:25 wingfold joined 10:36 zacts joined 11:58 zacts left 12:06 frost left 13:12 frost joined 13:28 zacts joined
Nemokosch where do IO::Path objects get their :CWD parameter from? 13:31
because apparently not from $*CWD...
13:31 Guest35 joined
or wait, how many $*CWD's are there? 13:41
14:02 frost left
Nahita @deadmarshal: you need to use `for` rather than `while` there 14:55
also, then it should become `for ^@arr.elems` because otherwise it's like you literally only iterate over the 1-element list `[@arr.elems,]`. 14:56
But better yet, you can use `.kv` to get both index ($i) and the value (@arr[$i]) at the same time 14:57
i.e., `for @arr.kv -> $i, $val`
(and due to `while`, whose loop is executed as long as its condition (@arr.elems in your case) is Truthful. Since array is nonempty, it'll forever loop therefore.) 14:58
With the change, I get 3 as the output but I'm not sure if it is desired because i don't really understand what equilibrium-index is supposed to be :d 15:00
15:00 guifa left
deadmarshal thanks it works. I realy don't yet understand how arrays,lists, or sequences are passed to functions in Raku. I'm used to Perl's @_ :D 15:02
Nahita yw, yeah I have similar concerns :d 15:14
the other day I stumbled upon this: `sub fun(List) {}; fun 2...8;`
it gives: `Internal error: inconsistent bind result`! 15:15
I think that's what they call a "Less Than Awesome" error
but I guess that's because a sequence is not a list 15:16
still, `sub fun(List) {}; fun 7;` tells me this: 15:18
===SORRY!=== Error while compiling:
Calling fun(Int) will never work with declared signature (List)
lizmat 7 is not a list 15:22
7, *is*
m: sub fun(List) {}; fun 7,;
camelia ===SORRY!=== Error while compiling <tmp>
Calling fun(Int) will never work with declared signature (List)
at <tmp>:1
------> sub fun(List) {}; ⏏fun 7,;
lizmat m: sub fun(List) {}; fun 7, 15:23
camelia ===SORRY!=== Error while compiling <tmp>
Calling fun(Int) will never work with declared signature (List)
at <tmp>:1
------> sub fun(List) {}; ⏏fun 7,
lizmat hmmm
m: sub fun(List) {}; fun (7,)
camelia ( no output )
lizmat m: sub fun(List) {}; fun( 7,)
camelia ===SORRY!=== Error while compiling <tmp>
Calling fun(Int) will never work with declared signature (List)
at <tmp>:1
------> sub fun(List) {}; ⏏fun( 7,)
Nahita yes; I gave that as an example to show the differences in the error messages :d 15:25
to the signature `List`, passing a Sequence vs passing an Int, seeing them both fail, but with different error messages 15:26
also one in compile time, one in run time I guess
m: sub fun(List) {}; fun 2...8;
sub fun(List) {}; fun 7 15:27
m: sub fun(List) {}; fun 7
lizmat you ask the sub to accept a List, yet you give it an Int? 15:28
15:28 MasterDuke left
Nahita thanks, yes; I gave that as an example to show the differences in the error messages :d 15:28
yes I realize that's an error
and the error is very explanatory
but then I try passing a Sequence and...
it said "Internal error: inconsistent bind result" 15:29
lizmat that is an interesting one :-) 15:30
m: dd List ~~ Seq 15:31
camelia Bool::False
lizmat which leads me to think it should actually be a compile time error
please make an issue for this: this is going wrong in the binder somewhere 15:35
Nahita okay I did, thanks for your interest 15:51
16:03 dakkar left 16:09 zacts left
deadmarshal why does Raku needs this many list container thingies anyways? Perl only has an array and it's fine. I can understand that seq is for lazy list so it's needed. but why having List? because it's difference with Array is immutability. which could be also done with array with a modifier or something 16:42
no need for a separate class :/
also multi keyword. why does it exist? aren't functions signatures enough to make out which one to call by the compiler? 16:43
seems reduntant
16:58 razetime joined
Util deadmarshal: Not redundant, because each has important use cases. 17:06
List vs Array are Immutable and Mutable. We have I&M versions of lots of things, like Set & SetHash. Immutability is important in Functional Programming (FP), which is a style/paradigm that Raku needed to support better than Perl did. Mutability needs to remain a clear option, otherwise you *only* can do FP.
Seq is (mostly) a List that you can iterate (receive one element at a time), but cannot "rewind" to a prior index. *Very* efficient, and Seq is the natural output of FP things like map() and grep().
A Seq can become an Array simply by binding/assignment.
stevied "Please note that a non-multi sub or operator will hide multi candidates of the same name in any parent scope or child scope. The same is true for imported non-multi candidates." 17:10
from: docs.raku.org/syntax/multi
so they are treated differently dependent upon whether they have "multi" in front of them
17:12 razetime left
docs.raku.org/syntax/multi#only 17:12
Util The `multi` in `multi sub` and `multi method` *could* have been inferred. There may have been internal performance reasons. 17:13
From the human programmer, the current design helps catch errors and provide cues to a reader to expect multiple versions of the routine they are reading.
`multi sub` can be shortened to just `multi`, for a better fit when your code design is mostly multis.
stevied all subs have an implicit "only" in front of them unless otherwise specified 17:14
Util Oh, stevied#8273++ ; I missed that bit completely while typing
stevied i have a hunch that they set it up so you can create a sub on the fly that overrides an existing multi 17:16
that's just a guess
or it could just be an aid to the developer so they don't accidentally give a sub the same name when they didn't mean to 17:18
so maybe multi is a way of telling the compiler, "yes, I really want to do this" 17:20
deadmarshal great thanks 18:02
18:06 discord-raku-bot left, discord-raku-bot joined 18:17 wingfold left 18:48 MasterDuke joined 19:23 ajr joined 19:37 n1to joined 20:27 ajr left 21:19 ajr joined 21:25 ajr left 21:54 ajr joined 21:58 ajr left 22:00 Manifest0 left 22:02 ajr joined, n1to left
gfldex deadmarshal: The difference between sub and multi sub comes into play when you write modules. When I use your module that exports an only sub, I know that I wont have to deal with a multi and can assume a stable interface. A multi is by design a flexible interface. Both are fine, but I need to know the difference. There is also performance. A only sub is easier to inline. 22:44