🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
Xliff How can I get the magnitude of a Complex? 01:10
Oh! That's spelled .abs! LOL 01:11
SmokeMachine I was thinking if something like this would make sense: logic Beers { has Str $.drinker; has Str $.bar; has Str $.beer; has Rat $.price; relation frequents(:$drinker, :$bar); relation likes(:$drinker, :$beer); relation sells(:$bar, :$beer, :$price); logic-rule happy(Str $drinker) { $.frequents(:$drinker, :$!bar) && $.likes(:$drinker, :$!beer) && $.sells(:$!bar, :$!beer, :$drinker) } }; my Beers $b .= new; $b.facts: { .frequents: 01:36
:drinker<SomeOne>, :bar<bar1>; .likes: :drinker<SomeOne>, :beer<beerBrand>; … }; say $b.happy; # guifa
(Example gotten from: infolab.stanford.edu/~ullman/fcdb/a.../dlog.pdf) 01:37
librasteve i read this recently … $ is for $calar, @ is for @rray, % is for key/value 12:04
so I like £ is for £ogic, plus it’s easy to type on my keyboard :-) 12:05
antononcube Hmm... unfortunately that sigil interpretation does not "scale": - & is for &unction, because it represents a function or subroutine - * is for *bject, as it signifies an object or reference in the code - # is for #ash, symbolizing a hash or hash table data structure - ~ is for ~tring, it represents text manipulation - ^ is for ^ower, it denotes exponentiation operations 12:20
> so I like £ is for £ogic, plus it’s easy to type on my keyboard 🙂 The currency symbols do scale though 🙂 : - ¥ is for ¥ield, representing the return value of a function - € is for €xpression, denoting a mathematical or logical operation - ₽ is for ₽rocess, indicating a specific process or thread within a program - ₹ is for ₹esult, showing the outcome of a computation or operation - ¢ is 12:22
for ¢onstant, used for fixed values or variables that do not change
notna hi @all. whom to talk to about rakudo/docker and the outdated Star docker container? would be great if someone gets in touch at github.com/Raku/docker/issues/57 14:40
tellable6 2023-01-19T21:52:33Z #raku-dev <patrickb> notna: I seem to recall, that rba once built the DMG images. (Or was it Coke?)
antononcube I would like to have readily available a few Web page importing functions and text statistics functions. For example, a sub import that imports content of web page or a file. If a 14:46
If the first argument to import is URL, then properties like <html xml plaintext> can be additionally specified. If the first argument is a file path, then the content of the file is slurped. Etc. 14:48
Does a Raku package/module with similar mission or functionalities exist? If not, what is a good name for such module? 14:49
I consider "Data::Import" -- seems generic enough.
lizmat not sure about the distribution name, but maybe it should just export "slurp" candidates ? 14:51
antononcube @lizmat Hmm... very interesting idea... 14:52
My motivation is getting inputs for LLMs faster, be those (plain-)text, images, JSON- or CSV data. Is having "slurps" for all of those be considered confusing? 14:54
*Would...
@lizmat "Data::Slurps" sounds good. 🙂 14:55
ugexe github.com/Raku/old-design-docs/bl...bleencoded 14:59
antononcube @ugexe I am somewhat ignorant about full spectrum of the "IO::*" hierarchies and functionalities, so, for me, "IO::Streamable" and "IO::Readable::Encoded" are "just" role designs. 15:08
So, if I "just want concrete file or URL content at hand", function names like "import", "import-url", "import-image" are much clearer of what I would get if I use them. 15:10
I would say that utilizing and acting upon a design like "IO::Readable::Encoded" will require much more understanding and implementation effort that what I am currently inclined to do. 15:16
guifa X operator is lazy right? 16:52
antononcube It is crossy for sure. 16:53
lizmat m: ((1,2,3) X (4,5,6)).iterator.is-lazy.say
camelia False
lizmat m: ((1,2,3 ... *) X (4,5,6 ... *)).iterator.is-lazy.say 16:55
camelia True
lizmat depends on the underlying iterators
guifa ah dang
For something I'm doing I wanted to have a big giant loop
lizmat m: ((1,2,3).lazy X (4,5,6)).iterator.is-lazy.say 16:56
camelia True
lizmat add .lazy ?
guifa ah that might work
antononcube @lizmat I want to be sure what you proposed earlier -- like the following right? slurp('pypi.org/project/ChernoffFace/', 'plaintext')
guifa m: my @a = <a b c>; my @b = 1,2,3; my @c = [@a,@b]; ([X] |@c).iterator.is-lazy.say 16:57
camelia False
guifa m: my @a = <a b c>; my @b = 1,2,3; my @c = [@a,@b]; ([X] |@c).say
camelia ((a 1) (a 2) (a 3) (b 1) (b 2) (b 3) (c 1) (c 2) (c 3))
lizmat antononcub yes, but with the 'plaintext' arg as a named: slurp('pypi.org/project/ChernoffFace/', :plaintext)
antononcube Or for an image file: slurp('~/Downloads/scene.png')
guifa m: my @a = <a b c>; my @b = 1,2,3; my @c = [@a,@b]; ([X] |@c).lazy.is-lazy.say
camelia True
antononcube @lizmat I currently have it is named and positional. I think I prefer to have a more general named argument ":$prop". (That can be "plaintext" or "html" or Whatever.) 16:59
lizmat :format<plaintext>
guifa nope just tagging on .lazy doesn't work =/ 17:00
I guess [X] forcibly consumes
antononcube Yeah, :$format is better. 17:01
guifa m: my @a = lazy 0, { say "^{$_ + 1}"; $_ + 1 } ... 3; my @b = lazy 'a', { say "+{$_.succ}"; $_.succ } ... 'd'; my @c = [@a,@b]; ([X] |@c).lazy.is-lazy.say;
camelia True
guifa or wait did this get changed?
oooooh
my @a = lazy 0, { say "^{$_ + 1}"; $_ + 1 } ... 3; my @b = lazy 'a', { say "+{$_.succ}"; $_.succ } ... 'd'; my @c = [@a,@b]; ([X] |@c).say; 17:02
evalable6 (...)
guifa okay sweet. this will make my logical programming go MUCH nicer
lizmat :-) 17:03
guifa (after all,that's basically all it does)
guifa drills through all of the candidates and moves to the next combination as soon as something doesn't fit 17:04
antononcube So, I am deciding the create a package "Data::Slurps", but I want to keep it (relatively) lightweight. For example, I do not want its installation to depend on "Text::CSV" or "PDF::Extract", but if those packages are installed already they would be used. Is this, generally speaking, a good idea? 17:05
Maybe, users would find it misleading.
guifa I think it's fine. Just present a warning if you encounter a file you can't handle, and explain options for opening it 17:06
lizmat antononcube App::Rak has optional dependencies, and there is an App::Rak::Complete dist that will also install all of the optional dependencies
antononcube @lizmat Ok. If someone complains, I will point "App::Rak" to them. 17:07
And, yes, "Data::Slurps::Complete" is a very good idea! 17:08
SmokeMachine guifa: have you seen my suggestion? 18:46
ab5tract bisectable: (a => 1).kv.WHAT ~~ List 22:03
bisectable6 ab5tract, Will bisect the whole range automagically because no endpoints were provided, hang tight
ab5tract, ¦6c (77 commits): «»
ab5tract, Nothing to bisect!
ab5tract bisectable: (a => 1).kv.WHAT ~~ Seq 22:04
bisectable6 ab5tract, Will bisect the whole range automagically because no endpoints were provided, hang tight
ab5tract, ¦6c (77 commits): «»
ab5tract, Nothing to bisect!
ab5tract well that doesn't seem right :/
bisectable: (a => 1).kv[0] eq "a" 22:05
bisectable6 ab5tract, Will bisect the whole range automagically because no endpoints were provided, hang tight
ab5tract m: (a => 1).kv[0] eq "a"
camelia WARNINGS for <tmp>:
Useless use of "eq" in expression "[0] eq \"a\"" in sink context (line 1)
bisectable6 ab5tract, ¦6c (77 commits): «WARNINGS for /tmp/BT41UnosFm:␤Useless use of "eq" in expression "[0] eq \"a\"" in sink context (line 1)␤»
ab5tract, Nothing to bisect!
ab5tract m: my $a = a => 1; say $a.kv[0] eq "a" 22:06
camelia True