This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
Dr.Doom hey does raku support vectorized operations ? 02:31
like 0..10 + 1 giving 1..11
nemokosch (0..10) + 1 does give 1..11 but I wouldn't call this vectorization and I actually don't even like this behavior 02:36
0..10 is a Range, defined by two endpoints, not really a vector or a list 02:37
and the fact that you can "numerically add" a Range and a number, and then obtain something that isn't even a number, seems quite crazy
m: (0..10) >>+>> 1 andthen .say # this is much more like a vectorized operation 02:38
Raku eval (1 2 3 4 5 6 7 8 9 10 11)
nemokosch m: (0..10) + 1 andthen .say 02:39
Raku eval 1..11
nemokosch docs.raku.org/type/Range#sub_infix:%3C+%3E this is why it works and it's tempting to open an issue for it 02:40
@Dr.Doom oh right, the illustration of the problem came handy while I was phrasing the issue... 03:00
if (0..10) + 1 is 1..11, what would you expect (0..10) + (1..1) to be? 03:01
Dr.Doom 1..11
nemokosch ||if your answer was 12, you have superhuman powers||
so yeah xD 03:02
Dr.Doom :m say (0..10) + 1
why is it so inconsistent 03:03
nemokosch the range + number case has been overloaded in both orders
but the range + range hasn't
frankly, the range + range case starts to fall apart for me 03:04
especially if we take multiplication or division
would range1 / range2 be start1 / start2 .. end1 / end2, and either way, why 03:05
so my point is actually that it would be better to get 12 for (0..10) + 1 as well 03:06
that would be transparent behavior: numeric coercion for the range
not sometimes this, other times that 03:07
05:08 stanrifkin joined
stanrifkin Is there an rakutidy? 05:09
05:42 CIAvash joined, stanrifkin left
Dr.Doom why can't it have behavior similar to apl or numpy? 06:29
07:17 CIAvash left 08:01 MasterDuke left
rcmlz Ah yes, that allows then for circular references ... nice feature. 08:47
Oh, just testet it and it does not work. m: # declare the existence of a class / role without defining it role Commutativity { ... } class Shape does Commutativity { ... } class Rectangle is Shape { ... } class Circle is Shape { ... } class Triangle is Shape { ... } 09:34
m: role Commutativity { ... } class Shape does Commutativity { ... } class Rectangle is Shape { ... } class Circle is Shape { ... } class Triangle is Shape { ... }
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku 'Rectangle' cannot inherit from 'Shape' because 'Shape' isn't composed yet (maybe it is stubbed) at /home/glot/main.raku:3
10:04 lizmat_ joined 10:06 RakuIRCLogger left 10:07 lizmat_ left, lizmat joined 10:09 RakuIRCLogger__ left 11:41 tea3po joined 11:44 teatwo left 11:58 tea3po left, tea3po joined 11:59 tea3po left, tea3po joined
nemokosch if you say what that behavior is, it gets easier 12:51
13:09 tea3po left, tea3po joined
rcmlz no behaviour, just ... as stub implementation. 13:35
ab5tract_ well, you do eventually have to define the thing :) 13:51
rcmlz I got it know. The issue is the "is Shape". If I first declare it without inheritment it works 14:01
m: m: role Commutativity { ... } class Shape does Commutativity { ... } class Rectangle { ... } class Circle { ... } class Triangle { ... } class Rectangle is Shape { "the real thing" } 14:02
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku 'Rectangle' cannot inherit from 'Shape' because 'Shape' isn't composed yet (maybe it is stubbed) at /home/glot/main.raku:7
15:01 tea3po left, tea3po joined
Dr.Doom $n,* ~~ s/1/10/,..* 15:16
why might this be giving an error?
anyone?
nemokosch what would this be? doesn't look like valid syntax 15:44
Dr.Doom thats why i am asking 15:45
i want to genrate a succesive list 1,10,100,1000....
nemokosch is 1, 10, 100 ... * not good enough?
geometric series can be inferred from three values 15:46
Dr.Doom no
$n can be any number 15:47
nemokosch then what is the definition again?
Dr.Doom 1st "1" is to be replaced with "10"
of every element of the array
for example 101,1001,10001,.... 15:48
nemokosch I think there are several bad ideas here, like generating "quasi numbers" as strings with string operation - but that in itself wouldn't make it not work 15:50
smartmatching to the s/// quoting structure is an in-place substitution that returns the match that got substituted 15:51
meaning, both the in-place mutation will probably fail (or cause damage to some variable even) and the return value will be problematic 15:52
the .subst method should work instead
m: 101, *.subst(1, 10) ... * andthen .[^10].say 15:53
Raku eval (101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001)
nemokosch of course these are strings, not numbers
m: 101.subst(1, 10).&dd 15:55
Raku eval "1001"
nemokosch there
17:59 MasterDuke joined 19:24 Nemokosch joined
librasteve m: 101, *.subst(1, 10) ... * andthen .[^10] .sum 21:29
Raku eval
librasteve 101, *.subst(1, 10) ... * andthen .[^10] .sum .say 21:30
m: (101, *.subst(1, 10) ... * andthen .[^10]).sum.say 21:31
Raku eval 111111111110
librasteve anyway my point is that in raku strings that contain numbers can be treated as numbers 21:32
22:04 Nemokosch left 23:41 teatwo joined 23:44 tea3po left