🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
00:00 Tirifto left 00:15 oddp left 00:16 oneeggeach left 00:18 tony-o_ joined 00:19 Petr37 left 00:43 leont left 00:51 _jrjsmrtn joined 00:52 __jrjsmrtn__ left 00:54 mowcat left 01:07 nebuchadnezzar left 01:42 jdjohnston joined
jdjohnston Why is the docker version of rakudocs different from the online version? Most noticeably, it still says "Perl 6" 01:43
Is there an easy way to update the docs in the container? 01:46
02:02 molaf left 02:03 cooper joined
jdjohnston Gotta go. I'll try again some other time. 02:04
02:04 jdjohnston left 02:05 Manifest0 left 02:06 Manifest0 joined
raku-bridge <勉人> how do i print a combining character as a noncombining character? 02:07
02:09 Jimbolli joined, Jimbolli left
raku-bridge <勉人> my $chars = "가 \x[302E] \x[302F]"; $chars .= split(" "); $chars».uniname».say; this just returns HANGUL SYLLABLE GA instead of all 3 characters that i wanted because the second 2 are combining characters 02:12
02:14 molaf joined
[Coke] guessing we haven't updated the docker container in ages. 02:20
ah, he's gone. 02:21
02:49 gnufr33dom joined 03:04 Xliff joined
Xliff o/ 03:04
03:12 k-man left
[Coke] \o 03:12
03:14 zacts joined 03:15 zacts left 03:38 k-man joined 03:42 melezhik joined
Xliff m: use NativeCall; my bool $a; 03:43
camelia ( no output )
03:44 melezhik left, zacts joined 03:46 zacts left
[Coke] try "uninames" to at least see the extra combining char info 04:00
m: my $chars = "가 \x[302E] \x[302F]"; $chars .= split(" "); $chars».uninames.say 04:01
[Coke] m: my $chars = "가 \x[302E] \x[302F]"; $chars .= split(" "); $chars.uninames.say
camelia Cannot resolve caller uninames(Seq:D); none of these signatures match:
(Str:D $str)
in block <unit> at <tmp> line 1
[Coke] m: my $chars = "가 \x[302E] \x[302F]"; $chars.NFC[2].uniname.say # convert it to NFC instead of NFG 04:07
04:10 Xliff left 04:12 xelxebar left 04:13 xelxebar joined 04:37 lucasb left
raku-bridge <勉人> thanks 04:38
04:44 andrzejku joined 04:52 nebuchadnezzar joined 05:14 aluaces joined 05:16 xinming left, xinming joined 05:25 bocaneri joined 05:27 zacts joined, xinming left 05:28 xinming joined 05:46 xelxebar left 05:50 xelxebar joined 06:05 zacts left 06:11 zacts joined 06:13 dolmen joined 06:16 hungrydonkey left, hungrydonkey joined 06:20 ufobat joined 06:24 dolmen left 06:36 wamba joined 06:43 gnufr33dom left 06:53 tejr left
Geth_ doc: fa676ce2be | (Daniel Sockwell)++ (committed using GitHub Web editor) | doc/Type/Pod/Block/Code.pod6
Remove documentation for (nonexistent) `allowed` method (#3528)

linkable6 Link: docs.raku.org/type/Pod::Block::Code
DOC#3528 [closed]: github.com/Raku/doc/pull/3528 Remove documentation for (nonexistent) `allowed` method
07:00 samcv left 07:02 kensanata joined
xinming $ ./rakudo-m -e 'say \() ~~ :(Int :$page)' 07:04
m: ./rakudo-m -e 'say \() ~~ :(Int :$page)'
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed postfix call
at <tmp>:1
------> 3.7⏏5/rakudo-m -e 'say \() ~~ :(Int :$page)'
xinming m: say \() ~~ :(Int :$page)
camelia True
xinming m: say \() ~~ :(Int() :$page)
camelia False
xinming This is a bug, should be reported. ;-)
07:05 aluaces left 07:06 rindolf joined 07:14 JJMerelo joined 07:19 xinming left, xinming joined 07:27 samcv joined 07:33 Sgeo left 07:48 dakkar joined 07:50 pecastro joined 08:00 kensanata left 08:01 leont joined 08:05 reach_satori left, reach_satori joined
cpan-raku New module released to CPAN! Random::Names (0.0.3) by 03ELIZABETH 08:27
08:29 xinming left 08:30 xinming joined 09:01 oddp joined 09:10 zacts left 09:13 markoong joined 09:17 xinming left, xinming joined 09:18 zacts joined 09:22 zacts left 09:31 aluaces joined 09:32 markoong left 09:35 markoong joined 09:36 schlaftier left 09:37 schlaftier joined 09:38 kktt007 joined, hungryd91 joined, hungrydonkey left 09:56 zacts joined, JJMerelo left 10:08 rbt left 10:14 zacts left
holyghost I'm doing ok with AI in scheme for language features (e.g. for raku), I chose several things from C++ STL, Java and Smalltalk 10:20
It's an actor based system
Now I have to learn Ada and Eiffel, still :-)
gnats == Ada on most systems 10:21
or gnat, I don't remember
Earlier, there was such Ada support in gcc
So I am working for raku in scheme, which is nice :-) 10:23
I chose scheme because of for AI, I might do something for raku in its implementation later on 10:25
nqp, AFAIK and raku itself 10:26
That way, we have some AI support, I'm doing several algorithms 10:27
guile extensions for nqp are probably out of the question, but do note it
I use scheme48 and scsh, as it's also a swiss army knife of UNIX, it was made on BSD 10:28
linux has guile more
Thing is, the revised scheme report (below 7) has portable scheme, guile and scsh are incompatible extensioned though 10:29
10:29 yangzq50 joined
holyghost so e.g. there's a vector-ref no list-ref 10:29
and so on :-) 10:30
I started with r3rs in 1995, until r6rs (revised scheme reports) evrything's a pretty good language system 10:31
r7rs is broken by compatibility IIRC
Again, it's based on actors which I can do magically in raku itself 10:35
we probably don't have the money and karma for actors in the nqp base 10:36
10:36 kktt007 left
holyghost in raku it's slower 10:36
Altreus What's the incantation to know if a number is an integer? 10:40
10:40 hungryd91 left
Altreus ~~ Int? 10:41
nar :(
tadzik m: say so 5.0.Int == 5 10:42
camelia True
tadzik does that work for you? I'm not sure if you mean a typecheck, or a logical "does it have something after the dot" 10:43
Altreus the latter - I was trying to avoid using it twice because then I have to get it into a variable
The XY problem is I'm trying to specify "power of 2"
therefore log($_, 2) is an int
tadzik m: subtype EffectivelyInt of Numeric where { $_.Int == $_ }; say so 5.0 ~~ EffectivelyInt; say so 5.1 ~~ EffectivelyInt 10:44
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3subtype EffectivelyInt of Numeric7⏏5 where { $_.Int == $_ }; say so 5.0 ~~ E
expecting any of:
infix stopper
tadzik grr
Altreus subset :D
tadzik oh yes :D 10:45
Altreus I just did the exact same
tadzik m: subset EffectivelyInt of Numeric where { $_.Int == $_ }; say so 5.0 ~~ EffectivelyInt; say so 5.1 ~~ EffectivelyInt
camelia True
Altreus yes I could do two and that would be simpler
lizmat use Bits; sub powerof2(Int:D $value) { $value > 1 && bitcnt($value) == 1 }; say powerof2 16 # True 10:46
Altreus 1 is a power of 2 :) 10:47
but 16 is the min for this function anyway apparently
lizmat use Bits; sub powerof2(Int:D $value) { $value > 0 && bitcnt($value) == 1 }; say powerof2 16 # True
10:48 xinming left
lizmat 16? 1 is 10:48
10:48 sena_kun joined
Altreus no I mean the function I'm writing 10:48
lizmat ah, ok *phew* :-)
Altreus to which the constraint is relevant
SmokeMachine m: say 42.WHAT =:= Int 10:49
camelia True
Altreus what is this magic 10:50
m: say so log(4,2).WHAT =:= Int 10:51
camelia False
Altreus :(
10:51 xinming joined 10:52 Xliff joined
SmokeMachine Hum!! you dont what the type! sorry I thought you wanted to differentiate Int from it's specialisations, sorry... 10:52
holyghost m: say so log(4,2).WHAT =:= # ?
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing required term after infix
at <tmp>:1
------> 3say so log(4,2).WHAT =:= # ?7⏏5<EOL>
expecting any of:
SmokeMachine *its 10:53
holyghost m: sy log(4,2).WHAT =:= Float
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
Float used at line 1. Did you mean 'Num'?
Undeclared routine:
sy used at line 1. Did you mean 'so'?
SmokeMachine m: say so log(4,2).WHAT =:= Num
camelia True
holyghost lol
An actor based system :-) 10:56
10:59 Xliff-con joined
Xliff-con \o 11:00
holyghost 'lo Xliff
Xliff-con Hi. I'm slumming from a console, ATM. Attempting to compile Rakudo on a Raspberry Pi. It's tied to my second monitor, which is where my GUI client exists. 11:01
Unfortunately, I can't get the damned thing to switch windows.
I'm assuming someone has attempted this on the latest Pi hardware?
OK. Compiling core.c -- This will be interesting. 11:03
htop 11:04
11:05 wamba left 11:07 xinming left
Xliff-con CORE.c.setting - 273 seconds! 11:08
Opotimize took another 33
11:09 xinming joined
Xliff-con Mast took another 57 seconds 11:09
timotimo woof 11:11
is it swapping at all?
though if it were swapping, the difference would be between 10x and 1000x i guess
Xliff-con No.
Core module install took another 55 seconds. 11:12
I knew I was in for it when the MoarVM compile took perceptibly long. My desktop compiles that in 5-10 seconds.
But build completed no problem!
Probably best, in this situation, to install from binaries. 11:13
Geth_ advent: cd41b55c51 | Altai-man++ (committed using GitHub Web editor) | 20th/README.md
Add an article mention for 20th anniversary advent
Xliff-con Still...decent enough once it's running. Now to install zef
....and.... we're off! 11:16
timotimo is this a pi 2 or 3? 11:18
Xliff-con Latest. I just bought it in June
Pi 4. 3 cores. 4GB 11:19
timotimo the performance is still a little bit sobering
Xliff-con Yes, it is.
Still, aside from the time it was a hassle free installation.
timotimo :)
Xliff-con Installing rakudo star is probably the recommended thing to do for this platform. 11:20
11:20 markong joined, markoong left
Xliff-con *I* wanted to install from sources because...well... I'm aparantly a masochist. 11:20
timotimo once we have a jit, things will be a little faster, but also there's a little bit of memory overhead to it, too
Xliff-con I thought we already had JIT!
timotimo parts of it 11:21
Xliff-con OK.
Xliff-con goes to install p6-GLibg
timotimo everything except the writing of native machine code on arm
Xliff-con First I need the deps. Oh, that will be fun!
Oh. ARM. Right. LOL
Altreus how do I define a subset that only runs the condition when the value is defined? 11:28
I feel like putting "not defined or" all the time is going to get old
I was kind of expecting only a defined type would be tested in the first place 11:29
er, a defined value
Since the type object ... doesn't have a value to test 11:30
lizmat m: dd 4 ~~ Int:D 11:31
camelia Bool::True
lizmat m: dd Int ~~ Int:D
camelia Bool::False
Altreus I mean that I want to constrain the value passed to the function, IF a value is passed 11:32
requiring that an undefined value passes the type checks of a subset is inconsistent with allowing an undefined value not to contain required properties of a class 11:33
11:38 wamba joined
Altreus In fact it seems all subsets implicitly expect definedness. 11:47
m: subset ReallyInt of Int where { $_.Int == $_ }; say so Int ~~ ReallyInt; say so Int ~~ Int;
camelia Invocant of method 'Bridge' must be an object instance of type 'Int',
not a type object of type 'Int'. Did you forget a '.new'?
in block <unit> at <tmp> line 1
Altreus well 11:48
m: subset ReallyInt of Int where { $_.Int == $_ }; say so Int ~~ Int; say so Int ~~ ReallyInt;
camelia True
Invocant of method 'Bridge' must be an object instance of type 'Int',
not a type object of type 'Int'. Did you forget a '.new'?
in block <unit> at <tmp> line 1
Altreus m: say Int.Int ~~ Int 11:49
camelia True
Altreus The actual condition should survive the test...
timotimo github.com/raku-community-modules/...set-Helper 11:51
11:52 xinming left, xinming joined
timotimo Altreus: did you see this module? 12:08
Altreus no :o
12:12 molaf left 12:13 Altai-man_ joined
holyghost JJMerelo : I would like to upload a package to CPAN, since you blocked my account, just this once 12:13
JJMerelo : It's on github.com/theholyghost2/p6-Random-...-Boltzmann 12:14
Altreus timotimo: hey it covers my use case! 12:15
holyghost JJMerelo, it needs 1 test, the rand function in BoltzmannFunction.pm6, then one can upload, it compiles
.seen JJMerelo
tellable6 holyghost, I saw JJMerelo 2020-07-22T11:38:09Z in #raku-dev: <JJMerelo> Please propose yourself with a PR or directly if you've got the privs.
12:16 sena_kun left
Altreus ah good old zoffix 12:16
holyghost JJMerelo : wait a minute, I dunno where to do a pull request PR
JJMerelo : I cannot login into CPAN 12:18
I don't know where to propose :-)
timotimo why is $.kB rw when it's a constant? 12:19
Altai-man_ holyghost, just leave it at github. 12:20
timotimo holyghost: Int.rand, like it's used in method rand, will give you a warning and return 0, so you're immediately using a division by zero in your code
$!T = 1.227 * 10,* -23; # <- this line from HawkingTemperature.pm6 seems like it has a typo 12:21
holyghost: definitely do write that test before you consider pushing it up to cpan 12:23
holyghost timotimo : a random number in the positive integer range does get close to a 0 in a long time :-) 12:24
Altreus when people start blocking you, that's an opportunity to re-evaluate your home truths
tadzik m: my $a = Int.rand; say $a
camelia Invocant of method 'Bridge' must be an object instance of type 'Int',
not a type object of type 'Int'. Did you forget a '.new'?
in block <unit> at <tmp> line 1
Altreus what is this Bridge that I also saw? 12:25
timotimo m: say Int.rand
camelia Invocant of method 'Bridge' must be an object instance of type 'Int',
not a type object of type 'Int'. Did you forget a '.new'?
in block <unit> at <tmp> line 1
Altreus I feel like Raku has a lot of complexity inside it, and the high-level programmer needs to know it
timotimo Altreus: it's how many types can be made to conform to Real (i think?) for calculation?
holyghost: it would have been good to first confirm if it actually does what you think 12:26
m: say Int.Range.rand
camelia Can not get a random value from an infinite range
in block <unit> at <tmp> line 1
timotimo you can't use this more correct form either
and also, you weren't even asking for the positive range of int, the code would, if it had been correct this way, have given you negative values as well
holyghost Altreus : oy, I'm getting rusty :-) 12:27
12:27 yangzq50 left
holyghost m: say Int.new.rand 12:28
camelia 0
holyghost m: say Int.rand 12:29
camelia Invocant of method 'Bridge' must be an object instance of type 'Int',
not a type object of type 'Int'. Did you forget a '.new'?
in block <unit> at <tmp> line 1
holyghost The above compiled on the server
timotimo of course it compiles
compiling correctly is the absolute bare minimum 12:30
you can write a lot of BS that compiles that's still useless
tadzik yeah, the language is not "static" enough for compilation to mean much 12:31
no language is, really. But especially not something as dynamic as Raku :)
Xliff-con cd..cd .. 12:32
holyghost .tell Xliff, if you'd like to update the perl6 compiler on the server, Int.rand compiles whereas AFAIK it doesn't in raku. It'd be nice to keep the old compiler also by naming the new one raku on the command line, if that's doable *gnolly bows to the priest*"
tellable6 holyghost, I'll pass your message to Xliff
holyghost Int.rand is as clear as my fucking ass in OOP :o| 12:33
Altreus sure it is, means give me a random number between 0 and undefined
tadzik not sure what OOP has to do with it 12:34
holyghost tadzik : class method
tadzik what about it?
Altreus The existence of a class method is not sufficient to determine what it does
holyghost right
tadzik the error tells you exactly that this is *not* a class method
holyghost sure
Altreus So you've said you understand that you can run a class method, but you've not said that you've understood that your example is not one 12:35
holyghost unhails his python code
Altreus Int.rand is python?
tadzik I can imagine an Int.rand meaning "give me something between min- and maxint", but that doesn't make much sense when your ints auto-upgrade to bigints
Altreus I can imagine what it does *with arguments*
absolutely 12:36
tadzik yes, those make it quite a lot clearer :)
moritz Int.rand is a design smell to me
why would an Integer class know how to create a random number?
holyghost *drink! girls!*
Altreus m: say 4.rand
camelia 0.36316631285077294
holyghost father Ted
Altreus roflmao
tadzik m: say 4.Int.rand 12:38
camelia 1.6837977401117348
tadzik *blink*
Altreus m: say 4.rand 12:39
camelia 3.8379443138531912
holyghost m: say Int.Int.0.rand
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed postfix call
at <tmp>:1
------> 3say Int.Int.7⏏050.rand
tadzik that's not something I'd expect out of Int.rand :P
[Coke] m: say 4.rand.Int
camelia 2
Altreus tadzik: you mean not-an-int?
tadzik Altreus: yeah, going back to what moritz++ said
if it's in the context of an Integer I'd expect to roll a random Integer
Altreus Presumably it's inherited
[Coke] docs.raku.org/routine/rand - "Returns a pseudo-random Num" 12:40
Altreus Yeah but how do you know it's in context of an integer?
holyghost moritz : a random number is positive definite between [0+, Inf[
Altreus It's just as likely to be an accident that it was an Int than any other Numeric
holyghost in python you have such a method IIRC also randint(0,10)
[Coke] m: say ^100.pick
camelia Potential difficulties:
Precedence of ^ is looser than method call; please parenthesize
at <tmp>:1
------> 3say ^1007⏏5.pick
holyghost the last is raku one
[Coke] m: say (^100).pick
camelia 35
[Coke] ^^ there's a different way to approach that 12:41
tadzik that smells of just bad Liskov to me
or not
tadzik hurt himself in his confusion
holyghost [Coke] I need a float random [0,Inf[, 1/ Int.new.rand
m: say Int.new.rand
camelia 0
holyghost which is stupid ^^
Altreus random numbers in computing are usually considered to be between 0 and 1, not 0 and inf 12:42
holyghost I don't need interval limits for it
Altreus cos inf is big and 1 is not
tadzik Int narrows down a Numeric, and so the inherited .rand does no longer make much sense, is what I'm trying to say
[Coke] I don't understand your syntax.
moritz IMHO the best design would be:
holyghost Altreus : ANSI C
moritz * a Random class that can be initialied with a seed
holyghost tadzik : right, so I was right too, see Xliffs message 12:43
moritz * the random class can generate random Ints and Nums
Altreus tadzik: but rand uses the number to define the upper bound; this should not affect the type of number returned
rand is always defined as Rat, or whatever
moritz * a dynamic variable $*RANDOM or so that is pre-initialized
holyghost no moritz, again, I'm talking ANSI C : rand, srand
moritz holyghost: yes, that's horrible, because it keeps global state
Altreus Changing method rand(Rat --> Rat) to method rand(Int --> Int) seems ... bad
If you did rand(4.Int) and rand(4.Rat) would you expect the former to return an int? 12:44
holyghost Altreus: AFAIK rand should have no args, srand has a seed
didn't know about Rat
Altreus basically, rand doesn't change its behaviour and that seems more correct to me 12:45
12:45 aluaces left
holyghost exagerating, if you cannot use libc class wise, some could get confused 12:45
tadzik Altreus: right, I understand. I just don't like it :)
holyghost I'm not saying raku syntax is dumb, but I used a lot of random number generating functions in python 12:46
tadzik I'm with moritz here
holyghost and arc4random() on macs in objc
tadzik it's a different responsibility entirely, and the awkwardness becomes apparent when you consider seeding
Altreus So you want a new language to behave like old languages?
Just use those ones
This one is doing things differently and this is one of those things
holyghost no Altreus, just for fast hacking's sake
moritz if you make PRNGs explicitly instantiatble, you can do very coll things with that 12:47
Altreus just learn the behaviour
moritz like, have different threads with the PRNG seed
or several asynchronnously running simulations with different seeds in the same thread
holyghost arc4random is non-pseudo random for example, and does not take arguments, neither does /dev/urandom or /dev/random 12:48
Altreus but those things don't give you ints, they give you bytes 12:49
they don't even give you numbers
just bytes
typless things
unformatted 12:50
holyghost but as the name says they're randoms
Altreus They're random but they're not structured
holyghost a float modulus and your on (I know it's int based)
Altreus We're talking about structured random
holyghost then shift
moritz holyghost: that's the beauty of putting the generator into a dynamic variable: you can replace it withn one of your choice, as long as it keeps interface compatiblitiy 12:51
Altreus you can't use /dev/urandom without knowing how much you want and waht you want to treat it as
But you *can* use rand(x) without knowing those things
what you actually know is what you want the max to be
And the rest is done for you: you get a Numeric value
This defines how big it is and what its structure is 12:52
It's like you want a high-level language to be a low-level language
holyghost sure, I wrote way too many lines of python 10 years ago, for pygame games and I used randint(X,Y) for a Quest For Glory character sheet system
Altreus but this isn't python
this is raku
holyghost indeed 12:53
Altreus So it works like this, not like that
holyghost randint(X,XX) uses the same things as in raku, so there :o)
problem is mostly the float randoms 12:54
therefor 1 / Int.new.rand(0,1000000), SFY
or something similar which compiles
0,Inf I guess
Altreus why create an object to marshal this routine? 12:55
12:55 |oLa| joined
Altreus m: rand(1,3) 12:55
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of rand(N). In Raku please use: N.rand for Num or
(^N).pick for Int result.
at <tmp>:1
------> 3rand7⏏5(1,3)
Altreus It even tells you what to do 12:56
holyghost WAM
m: Inf.rand
camelia ( no output )
holyghost m: Int.rand(Inf)
camelia Too many positionals passed; expected 1 argument but got 2
in block <unit> at <tmp> line 1
holyghost m: Inf.new 12:57
camelia ( no output )
holyghost m: rand
camelia ( no output )
holyghost m: rand(Inf)
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling rand(Num) will never work with signature of the proto (*%)
at <tmp>:1
------> 3<BOL>7⏏5rand(Inf)
holyghost botcherous
12:58 kensanata joined
tadzik ....what do you expect rand(Inf) to return? 12:58
m: say Inf.rand
camelia Inf
tadzik looks correct %) 12:59
Altreus I'm pretty sure a random number bounded by Inf runs into the halting problem :P
holyghost rand is a C function for perl5 and raku I guess
Altreus ? 13:00
holyghost TMTOWTDI
Altreus It's a raku function for raku
holyghost ok
Altreus a perl5 function for perl5
a C function for C
there aren't very many names for things ... languages tend to share
holyghost I just need some different things for my random code
m: rand(0,Inf) 13:01
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of rand(N). In Raku please use: N.rand for Num or
(^N).pick for Int result.
at <tmp>:1
------> 3rand7⏏5(0,Inf)
holyghost you see, that was python
use pick, ok
Altreus ok and python has the same chance of picking inf than any other number?
holyghost s/different/several
Altreus as
holyghost I meant randint(0,5) Inf is not in python AFAIK 13:02
Altreus And that wasn't the Inf you input, that was the number just before the Inf that you input, because rand's return value will never equal the upper bound
holyghost indeed
Altreus So don't say it :P
an upper bound of inf is impossible with 2 seconds of thought
[Coke] m: my @a = gather for ^10000 { take Inf.rand} ; @a.unique.say # hey, it... works... 13:04
camelia (Inf)
holyghost if only I didn't have to type 100000000000.rand :-) 13:07
even if it's a Rat
13:09 |oLa| left
timotimo m: say int64.Range.rand 13:10
camelia 8.04785272651649e+18
timotimo m: say int64.Range.rand