| 12 Jan 2026 | |||
| disbot11 | <antononcube> Of course, the next logical task is to make that movie in Raku. | 18:18 | |
| [Coke] | If you want to use my module, please let me know if there's anything I can do to make it useful and not just a toy! | 18:24 | |
| disbot11 | <antononcube> @Coke Ok. Please implement the Dual Zeckendorf representation: resources.wolframcloud.com/Functio...sentation/ | 18:28 | |
| [Coke] | I... have to figure out what the even is, adding to my homework. :) | 19:16 | |
| lucs | Problem having a subroutine attribute in a class: | 20:50 | |
| gist.github.com/lucs/251df56a1c890...bd17d83208 | |||
| ugexe | call with $baz.func.(42) | 20:58 | |
| lucs | ! | ||
| Thanks! | |||
| Um, anywhere I should read up in the docs about this? | 20:59 | ||
| Seriously, that was the shortest modification I've ever had to make to code I couldn't make work. | 21:03 | ||
| Period. | |||
| tbrowder | why not use a method? | 21:05 | |
| ugexe | i dunno where you'd read about. maybe `($baz.func)(42)` makes it more clear | ||
| lucs | tbrowder: Um, the way I was coding led up to having it like that, maybe it could have been a method. | 21:08 | |
| Looking... | |||
| tbrowder: Hmm... Not sure how I could make it into a method. | 21:10 | ||
| Each Baz instance could have a different &func. | |||
| ugexe | public attributes create public methods | 21:11 | |
| tbrowder | actually the docs i think addresses something like that but it’s hard to find in current version | ||
| over my head but interesting | 21:13 | ||
| lucs | ugexe: Aha, yeah, clearer when seen as `($baz.func)(42)`. | ||
| ugexe | m: class Foo { has $.bar = 42; }; my $foo = Foo.new; my $method = $foo.^find_method("bar"); say $method($foo) | 21:19 | |
| camelia | 42 | ||
| tbrowder | yes that is in docs hard to find | 21:20 | |
| in one of the sections showing the ^ operator on an object | 21:21 | ||
| ugexe | if you want to avoid the indirect syntax you can use a private attribute and a separate method to avoid the ambiguity of $baz.func(42) as well | 21:25 | |
| m: class Foo { has &!cb; submethod BUILD(:&!cb) {}; method cb(|c) { &!cb.(|c) } }; my $foo = Foo.new: cb => sub ($n) { say "n: $n" }; $foo.cb(42) | |||
| camelia | n: 42 | ||
| ugexe | it uses a private attribute to store the callback so there is no public method created for it. instead we create our own public method and dispatch to the attribute using the e.g. (self.func)(42) syntax. but consumers of the class can use e.g. $foo.func(42) | 21:26 | |
| lucs | I'm noting down all this, but it's a bit too advanced for my understanding and for my current need. | 21:30 | |
| [Coke] | .^ is mentioned near the top of docs.raku.org/language/mop | 21:41 | |
| ugexe | m: class Foo { has $.abc = 42 }; say Foo.new.abc(); say Foo.new.abc(123); | 21:42 | |
| camelia | 42 Too many positionals passed; expected 1 argument but got 2 in method abc at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
| ugexe | as you can see there is no `method abc` yet we can call .abc() (including the parens) | 21:43 | |
| the .abc(123) has the same error you were running into | |||
| because the public method that is automatically create for public attributes does not take any arguments | |||
| you can either disambiguate the call via ($foo.func)(42) / $foo.func.(42), or you can store your func in a private attribute instead (no public methods are created for public attributes) and then create your own public method | 21:45 | ||
| the later means callers of your code don't have to do that disambiguation | |||
| lucs | Interesting. I'm starting to see how it all hangs together. | 21:50 | |
| [Coke] | m: my @asdf=<1 2 3>; for @asdf.kv -> ($key, $value) { say $value } | 23:42 | |
| camelia | Cannot unpack or Capture `0`. To create a Capture, add parentheses: \(...) If unpacking in a signature, perhaps you needlessly used parentheses? -> ($x) {} vs. -> $x {} or missed `:` in signature unpacking? -> &c:(Int) {} in block <unit> at … |
||
| [Coke] | Would be nice if the error there suggested removing the breaking parens. | 23:43 | |
| ... DAMMIT | |||
| he said, reading the FULL error. | |||
| [Coke] goes to crawl back in his hole. | |||
| ugh. there is trailing whitespace on the default LICENSE file. :| | 23:47 | ||
| antononcube - done | 23:51 | ||
| github.com/coke/math-zeckendorf/issues/1 | 23:52 | ||
| Will wait a bit before cutting a release, since the last time I did it immediately, I missed something obvious. :) | |||
| 13 Jan 2026 | |||
| disbot11 | <antononcube> @Coke Ok, good. I prefer to have longer desriptive names for these kind of functions. For example, zeckendorf-representation and dual-zeckendorf-representation. | 00:13 | |
| <antononcube> I can file an issue on GitHub, where that can be debated. | |||
| [Coke] | Sure. It's an easy change, and I don't mind. | 00:17 | |