[02:02] *** m_athias left [02:02] *** m_athias joined [02:19] *** frost joined [03:30] *** Guest35 left [05:16] *** Util left [05:16] *** Util joined [05:34] *** zacts joined [05:34] *** zacts left [06:09] https://paste.c-net.org/NachosBeijing [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 [13:31] where do IO::Path objects get their :CWD parameter from? [13:31] because apparently not from $*CWD... [13:31] *** Guest35 joined [13:41] or wait, how many $*CWD's are there? [14:02] *** frost left [14:55] @deadmarshal: you need to use `for` rather than `while` there [14:56] 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:57] 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` [14:58] (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.) [15:00] 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] *** guifa left [15:02] 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:14] yw, yeah I have similar concerns :d [15:14] the other day I stumbled upon this: `sub fun(List) {}; fun 2...8;` [15:15] it gives: `Internal error: inconsistent bind result`! [15:15] I think that's what they call a "Less Than Awesome" error [15:16] but I guess that's because a sequence is not a list [15:18] still, `sub fun(List) {}; fun 7;` tells me this: [15:18] ``` [15:18] ===SORRY!=== Error while compiling: [15:18] Calling fun(Int) will never work with declared signature (List) [15:18] ``` [15:22] 7 is not a list [15:22] 7, *is* [15:22] m: sub fun(List) {}; fun 7,; [15:22] rakudo-moar 530e17848: OUTPUT: «===SORRY!=== Error while compiling ␤Calling fun(Int) will never work with declared signature (List)␤at :1␤------> sub fun(List) {}; ⏏fun 7,;␤» [15:23] m: sub fun(List) {}; fun 7, [15:23] rakudo-moar 530e17848: OUTPUT: «===SORRY!=== Error while compiling ␤Calling fun(Int) will never work with declared signature (List)␤at :1␤------> sub fun(List) {}; ⏏fun 7,␤» [15:23] hmmm [15:23] m: sub fun(List) {}; fun (7,) [15:23] rakudo-moar 530e17848: ( no output ) [15:23] m: sub fun(List) {}; fun( 7,) [15:23] rakudo-moar 530e17848: OUTPUT: «===SORRY!=== Error while compiling ␤Calling fun(Int) will never work with declared signature (List)␤at :1␤------> sub fun(List) {}; ⏏fun( 7,)␤» [15:25] yes; I gave that as an example to show the differences in the error messages :d [15:26] 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 [15:26] m: sub fun(List) {}; fun 2...8; [15:27] sub fun(List) {}; fun 7 [15:27] m: sub fun(List) {}; fun 7 [15:28] you ask the sub to accept a List, yet you give it an Int? [15:28] *** MasterDuke left [15:28] 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 [15:28] and the error is very explanatory [15:28] but then I try passing a Sequence and... [15:29] it said "Internal error: inconsistent bind result" [15:30] that is an interesting one :-) [15:31] m: dd List ~~ Seq [15:31] rakudo-moar 530e17848: OUTPUT: «Bool::False␤» [15:31] which leads me to think it should actually be a compile time error [15:35] please make an issue for this: this is going wrong in the binder somewhere [15:51] okay I did, thanks for your interest [16:03] *** dakkar left [16:09] *** zacts left [16:42] 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 :/ [16:43] 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 [17:06] 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. [17:06] 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(). [17:06] A Seq can become an Array simply by binding/assignment. [17:10] "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: https://docs.raku.org/syntax/multi [17:10] so they are treated differently dependent upon whether they have "multi" in front of them [17:12] *** razetime left [17:12] https://docs.raku.org/syntax/multi#only [17:13] 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. [17:13] `multi sub` can be shortened to just `multi`, for a better fit when your code design is mostly multis. [17:14] all subs have an implicit "only" in front of them unless otherwise specified [17:14] Oh, stevied#8273++ ; I missed that bit completely while typing [17:16] 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 [17:18] 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:20] so maybe multi is a way of telling the compiler, "yes, I really want to do this" [18:02] great thanks [18:06] *** discord-raku-bot left [18:06] *** 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 [22:02] *** n1to left [22:44] 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.