Re: Name of calling program

2022-12-07 Thread Gianni Ceccarelli
On Wed, 7 Dec 2022 08:58:19 -0800 ToddAndMargo via perl6-users wrote: > When I am in a module (pm6), is there one of those > fancy system variables that will tell me the > name of calling (pl6) program? https://docs.raku.org/language/variables#index-entry-$*PROGRAM -- Dakkar -

Re: shorter way to set states in -n?

2022-07-02 Thread Gianni Ceccarelli
On 2022-07-02 Marc Chantreux wrote: > AFAIK about raku -n, I need 2 lines to setup a > state with a default value > > seq 2| raku -ne ' > state (@o, @f); > BEGIN @o = 0 xx 3; > @o.push: "ok"; > say @o; > ' > > but is there a sho

Re: Removing ' characters

2022-01-10 Thread Gianni Ceccarelli
On Mon, 10 Jan 2022 15:41:04 + Richard Hainsworth wrote: > Using REPL I got > > > my $s = '\'\'' > '' > > $s.subst( / \' ~ \' (.+) /, $0) > Use of Nil in string context >   in block at line 1 That error message (which is a bit LTA) refers to the `$0`. As https://docs.raku.org/routi

Re: Depreciated code????

2021-07-27 Thread Gianni Ceccarelli
On 2021-07-27 Elizabeth Mattijsen wrote: > So the deprecation logic is pointing at the wrong line. > > Where does this RunNoShellLib.pm6 live? It's must be something > inside that. Given the error message says: > Please use exitcode and/or signal methods (status is to be > in 2022.06) instead.

Re: File::Find using a junction with exclude

2021-05-25 Thread Gianni Ceccarelli
On Tue, 25 May 2021 15:16:03 + Andy Bach wrote: > > However I had to use "Int" instead of "int": > Ah, "int" is the "lower" level, native integer and "Int" is the raku. > An "int" is immutable or something? It's a bug in the REPL. The example from the documentation works when fed to the comp

Re: File::Find using a junction with exclude

2021-05-24 Thread Gianni Ceccarelli
On 2021-05-24 William Michels via perl6-users wrote: > Daniel: Thank you for your confirmation on EVAL. Also, I tried parsing > the ATOM SYMBOL character to look at classification, and this is the > best I could do (in the Raku REPL): > > > say "⚛".uniprop > So Not-terribly-human-friendly abbrev

Re: Weird! When legal?

2021-02-24 Thread Gianni Ceccarelli
On 2021-02-24 rir wrote: > It is just an odd puzzle for me that "UnknownBareId KnownClassId" > is accepted has the start of a valid statement. How would such > a statement be completed? Let's go through a few examples:: raku -e 'foo 1' ===SORRY!=== Error while compiling -e Undeclared rou

Re: ^methods doesn't show all methods

2021-02-16 Thread Gianni Ceccarelli
On 2021-02-16 Joseph Brenner wrote: > But I don't see them in the list from .^methods: > > say $s.^methods; > > say so $s.^methods.gist.grep(/<>/); # False ``say`` calls ``.gist``, which produces a *truncated* string representation for long lists:: $ raku -e 'say (^1000).List' (

Re: LTA documentation page

2021-01-06 Thread Gianni Ceccarelli
On 2021-01-06 yary wrote: > I have been going through quite a few contortions to look at the > source code for installed modules in raku, and would very much like > rakudoc to have an option similarly to perldoc -l showing the cached > path and hashed local file names of installed modules. zef d

Re: Nested `whenever` (was Re: Help with bug)

2021-01-05 Thread Gianni Ceccarelli
On 2021-01-05 David Emanuel da Costa Santiago wrote: > > so the inner ``whenever`` really sets up a separate tap every time > > it's executed. > Is this behaviour expected? It kinda looks weird to me, specially > when looking to the output... Well, it's what *I* expected: a ``whenever`` sets

Re: LTA documentation page

2021-01-05 Thread Gianni Ceccarelli
On 2021-01-05 William Michels via perl6-users wrote: > Raiph's suggestion works for me (on rakudo-2020.10). I mean, p6doc > installs Oh, that points to new, different, problems. https://modules.raku.org/search/?q=p6doc links to https://github.com/Raku/doc which does not contain a ``p6doc`` scrip

Re: LTA documentation page

2021-01-05 Thread Gianni Ceccarelli
On 2021-01-05 Brad Gilbert wrote: > There really shouldn't be that much difference between what the > documentation says and how your version works. I've worked on machines stuck with perl 5.8 when the online documentation was for 5.26 I'd like to live in a world where: * raku is popular and wi

Re: LTA documentation page

2021-01-05 Thread Gianni Ceccarelli
On 2021-01-05 JJ Merelo wrote: > Gianni is basically right. rakudoc has not really been released yet > into the ecosystem, and p6doc will get you the documentation itself, > which you will have to build then. So LTA is true, and there's some > work to be done. There's probably an issue already cre

Nested `whenever` (was Re: Help with bug)

2021-01-05 Thread Gianni Ceccarelli
On 2020-12-30 Gianni Ceccarelli wrote: > Also, my understanding of ``whenever`` is that it's adding a hook into > the event loop, and only leaving the surrounding ``react`` (or > ``supply``) will remove that hook (people who understand this better > than I do: please correct me!

LTA documentation page

2021-01-05 Thread Gianni Ceccarelli
https://docs.raku.org/programs/02-reading-docs says to use ``rakudoc`` to read the documentation of installed modules. I don't have it installed:: $ rakudoc -bash: rakudoc: command not found Not a problem, that same page says to use zef:: $ $ zef install rakudoc ===> Searching for: raku

Re: Help with bug

2020-12-30 Thread Gianni Ceccarelli
On 2020-12-30 David Santiago wrote: > Thanks! It's indeed much clearer. However i have a question, why the > react on line 24? > > The react there isn't required right? I think it is ☺ The code, without the debugging bits:: react { whenever $channel -> $val { $conn.prin

Re: Help with bug

2020-12-30 Thread Gianni Ceccarelli
Liz is, as usual, correct: there's no reason to wait until our write buffers are flushed (``await $conn.print``) before ``react``ing to what's in our *read* buffers. In https://github.com/dakkar/raku-socket-test-from-demanuel I've removed all ``await`` but one (the ``await .connect``), and the pro

Re: Help with bug

2020-12-29 Thread Gianni Ceccarelli
On 2020-12-29 David Santiago wrote: > i don't want it to exit, i want it to keep reading from the socket > until a "200" code happens. Sorry, I had mis-understood the protocol. I've put the code on Github so it's easier to look at it https://github.com/dakkar/raku-socket-test-from-demanuel (thos

Re: Help with bug

2020-12-29 Thread Gianni Ceccarelli
On 2020-12-29 David Santiago wrote: > I need some help in debugging my script. Sometimes it hangs and i > don't know why. I'm pretty sure it hangs in the inner ``react``:: if $line ~~ /^340/ { await $conn.print("[$consumer]: value $val\r\n"); } else { done; } Notice

Re: spurt and array question

2020-11-14 Thread Gianni Ceccarelli
On 2020-11-13 ToddAndMargo via perl6-users wrote: > Hi All, > > I am writing out an array of text lines to a file. > I just can't help but thinking I am doing it the > hard way. > > unlink( $Leafpadrc ); > for @LeafpadrcNew -> $Line { spurt( $Leafpadrc, $Line ~ "\n", > :append ); } >

Re: Junctions wrapped in singleton lists

2020-11-14 Thread Gianni Ceccarelli
On 2020-11-13 Sean McAfee wrote: > I just tried making a sequence of junctions and found that each one > ended up wrapped in a singleton list somehow: > > > ({ 1 | -1 } ... *)[^3] > ((any(1, -1)) (any(1, -1)) (any(1, -1))) oh, that's weird:: > ({ 'a' } ... *)[0].^name Str >

Re: How to unbuffer $*IN

2020-09-26 Thread Gianni Ceccarelli
On 2020-09-26 David Santiago wrote: > I'm trying to capture key presses in the terminal and according to > raku's documentation i need to have $*IN unbuffered. You have to tell the terminal to stop buffering (AFAIK Raku doesn't buffer its inputs), which is not exactly trivial. You may be better

Re: Extended identifiers in named attributes

2020-08-26 Thread Gianni Ceccarelli
On Wed, 26 Aug 2020 14:31:06 +0200 Marcel Timmerman wrote: > I was experimenting with extended identifiers and found that it is > not possible to use it in named attributes. E.g. > > > sub a (:$x:y) { say $x:y; } > ===SORRY!=== Error while compiling: > Unsupported use of y///. In Raku please us

Re: subs and the type system

2020-07-20 Thread Gianni Ceccarelli
On Mon, 20 Jul 2020 14:00:33 +0200 Tobias Boege wrote: > You cannot write `Walkable &w` in the signature of &walker because the > combination of a type and the &-sigil apparently means that `&w` > should be Callable and return a Walkable. That's why I use the > $-sigil. Aha! That's the bit I got

Re: subs and the type system

2020-07-20 Thread Gianni Ceccarelli
On Mon, 20 Jul 2020 12:37:33 +0200 Theo van den Heuvel wrote: > The situation: I have a function, let's call in 'walker', whose first > parameter is a callback. > I wish to express that only callbacks with a certain Signature and > return type are acceptable. > Let's say the callback should foll

Re: proto and multi

2020-06-29 Thread Gianni Ceccarelli
On 2020-06-29 Richard Hainsworth wrote: > a) I don't understand why the white space matters, but clearly it > does. So the token is '{*}' and not braces around a Whatever-star. Yep. Weird, but it's a special token. > Not sure why the List:D is not being matched to Positional. Is the > List:D re

Re: Help with grammar

2020-05-21 Thread Gianni Ceccarelli
On 2020-05-21 David Santiago wrote: > Can someone explain me why my grammar isn't working? Unfortunately i > can't figure it out :-( Mixing ``rule``, ``token``, and ``regex`` apparently at random doesn't make for a good grammar… The text at https://docs.raku.org/language/grammar_tutorial#The_tec

Re: More questions on the "-pe" one-liner flag: in conjunction with s/// and tr///

2020-05-07 Thread Gianni Ceccarelli
On 2020-05-06 William Michels via perl6-users wrote: > Are there any other "operators that modify their operands" in > Raku/Perl6 that don't require an initializing "." (dot)? The dot is used to call a method on an object. > I checked the "subst" command and it requires an initial ".=" when > us

Re: More questions on the "-pe" one-liner flag: in conjunction with s/// and tr///

2020-05-06 Thread Gianni Ceccarelli
On 2020-05-06 William Michels via perl6-users wrote: > Can anyone answer why--in a one-liner using the "-pe" flag--the s/// > and tr/// functions do not require a "." (dot) preceding the function > call? Because they're not function calls, but *mutating* operators. As the documentation says https

Re: Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-06 Thread Gianni Ceccarelli
On 2020-05-06 William Michels via perl6-users wrote: > So if the following code does useless work: > > perl6 -pe '.chop' demo1.txt > > why doesn't it fail with an error, "Useless use of ... in sink context > (line 1)"? That's a very good question! My best attempt at an answer: * subroutines t

Re: Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-05 Thread Gianni Ceccarelli
On 2020-05-05 William Michels via perl6-users wrote: > If the only difference between the "-n" and "-p" flags is really that > the second one autoprints $_, I would have expected the "-pe" code > above to work identically to the "-ne" case (except "-ne" requires a > print, put or say). Presumably

Re: Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-05 Thread Gianni Ceccarelli
On 2020-05-05 William Michels via perl6-users wrote: > mbook:~ homedir$ perl6 -ne 'put .chop' demo1.txt > this is a test > I love Unix > I like Linux too > mbook:~ homedir$ perl6 -pe '.chop' demo1.txt > this is a test, > I love Unix, > I like Linux too, The ``.chop`` method does not mutate its ar

Re: split to walk into an HoH ?

2019-11-22 Thread Gianni Ceccarelli
On 2019-11-22 Marc Chantreux wrote: > ";" to walk in the hoh is really awesome but i don't know even know > from where i know it and what's the object underneath. > it isn't listed in the list of operators It's mentioned in the page about subscripts: https://docs.perl6.org/language/subscripts#Mul

Re: Variable character class

2019-09-05 Thread Gianni Ceccarelli
On Wed, 4 Sep 2019 21:44:29 -0700 William Michels via perl6-users wrote: > Hi Gianni, I'm not sure of the Perl5 case, but what you're saying is, > if your target string is backslashed, be sure to "quote-interpolate > it" in Perl6? (see below): Re-reading what I wrote, I realise it was really not

Re: Variable character class

2019-09-03 Thread Gianni Ceccarelli
On Tue, 3 Sep 2019 09:15:54 -0700 William Michels via perl6-users wrote: > Just a short note that Eirik's array-based code seems to work fine, > with-or-without backslash-escaping the first input string (minimal > testing, below): Oh, sure. But when the target string contains backslashes, it wil

Re: Variable character class

2019-09-02 Thread Gianni Ceccarelli
On 2019-09-02 The Sidhekin wrote: > To have the (1-character) strings used a literals, rather than > compiled as subrules, put them in an array instead of a block wrapped > in angle brackets: > > sub contains( Str $chars, Str $_ ) { > my @arr = $chars.comb; > m:g/@arr+/ This looks to be th

Re: Modulino in Perl 6

2017-05-02 Thread Gianni Ceccarelli
On Tue, 2 May 2017 17:02:40 +0200 Gabor Szabo wrote: > Is there some way in Perl 6 to tell if a file was executed directly or > loaded into memory as a module? One way that seems to work: define a ``sub MAIN``; it will be invoked when you execute the file as a program, but won't be touched if you

Re: Is there another way to define a regex?

2016-01-18 Thread Gianni Ceccarelli
On 2016-01-17 Tom Browder wrote: > My question: Is there a way to have Perl 6 do the required escaping > for the regex programmatically, i.e., turn this: > > my $str = '/home/usr/.cpan'; > > into this: > > my regex dirs { > \/home\/usr\/\.cpan > } > > automatically? Yes! And it's also sim