01:18 discord-raku-bot left, discord-raku-bot joined 01:23 discord-raku-bot left, discord-raku-bot joined
Nemokosch can I use dynamic variables as function arguments? 01:34
well, I managed to make it work, although I had to declare the dynamic variables "lexically" as well 02:00
```perl
#!/usr/bin/env raku
use experimental :cached;
my $*a, my $*b;
multi fibo-word(1) { $*a }
multi fibo-word(2) { $*b }
multi fibo-word($n where * > 2) is cached { fibo-word($n-2) ~ fibo-word($n-1) }
sub MAIN(
Str $*a, #= the first starting value of the Fibonacci Word sequence
Str $*b #= the second starting value of the Fibonacci Word sequence, having equal length to $a
where { $*a.chars == $*b.chars }
) {
my $first-long = (1..*).map(&fibo-word).first(*.chars >= 51);
say "The 51st digit in the first term having at least 51 digits '$_' is {.comb[50]}." given $first-long;
without the "my $*a, my $\*b", it didn't compile
Something else I started suspecting... so... how do you actually retrieve a character of a String? 02:12
02:14 discord-raku-bot left, discord-raku-bot joined 03:01 frost joined 03:03 frost left
stevied I recall reading in the docs that you can use dynamic variables for function arguments but that it's not useful 03:13
is it possible to include a grammar class within a regular class? 03:14
anyone know why this is throwing a ` Null regex not allowed Missing block` error: 03:48
```
grammar H1 {
token TOP { <h1> }
token h1 { \# }
}
```
had to do `'#'` 06:22
07:36 ychaouche joined
ychaouche hello rakus 07:36
in raku hashes, can keys be anything other than a string or an integer ?
for example, can objects be a hash key ?
or arrays ? 07:37
m_athias ychaouche: docs.raku.org/language/hashmap#Non...ject_hash) is this what you are looking for? 07:45
ychaouche m_athias: ah thanks, could be that, but too many new syntax to learn before applying any of that. 07:49
Does raku encourage you to use strings as keys though ? (By default keys in { } are forced to strings.) 07:50
m_athias it encourages you to use what you need. In most cases I prefer a string key since having objects as keys means you need the actual object around to perform a key/value lookup 07:52
if you just need a list of key/value pairs than a pair might me more appropriate docs.raku.org/type/Pair. 07:55
IIRC: for ( (foo => 'bar' ), (baz => 'qux') ) -> $pair { say $pair.key ~ ' -> ' ~ $pair.value} 07:56
ychaouche Do I need to import anything to call "put" ? 08:31
it says Undeclared routine; put used at line 1;
m: put "hi"
camelia hi
ychaouche strange
or maybe because I'm using a very old raku version ? 08:32
08:38 frost joined 08:42 frost left
gfldex m:``` 09:06
sub subby($a = $*a // 42) {
$a * 2;
}
say subby;
my $*a = 666.99; # retail number of the beast
say subby;
```
@Nemokosch#9980 ^^^
09:09 dakkar joined
Nemokosch I don't find this similar to my example 🤔 09:17
gfldex Using dynvars as a default value saves you the trouble to detect if the dynvar already exists somewhere in the lexical scope. 09:24
Which can be done ofc. see: gfldex.wordpress.com/2020/08/17/de...or-dynvar/ 09:25
10:16 dakkar left 10:18 dakkar joined 10:46 m_athias left 10:47 m_athias joined 10:51 dakkar left, dakkar joined 11:33 anight[m] left, CIAvash left 11:41 CIAvash joined 11:47 CIAvash left 12:01 CIAvash joined 12:02 CIAvash left 12:08 CIAvash joined 12:36 CIAvash left 12:42 anight[m] joined 13:31 jgaz joined, m6502 joined, m6502 left, jgaz left, jgaz joined 13:53 jgaz left 15:45 qorg11 left 15:49 qorg11 joined 16:13 ychaouche left 17:41 dakkar left 18:58 ajr joined 19:36 ajr left 19:54 ajr joined 19:58 ajr left 20:40 ajr joined 22:39 ajr left 22:52 guifa joined 23:03 ajr joined 23:09 ajr left 23:36 ajr joined 23:41 ajr left