Re: is there an AI on the beginner chat line?

2023-10-27 Thread Andinus via perl6-users

ToddAndMargo via perl6-users @ 2023-10-27 03:19 -07:

> On 10/27/23 00:10, Andinus via perl6-users wrote:
>> ToddAndMargo via perl6-users @ 2023-10-26 21:19 -07:
>>
>>> [...]
>>> They have someone called "discord-raku-bot".  Some of the responses
>>> sound a bit off.  By chance, is discord-raku-bot an AI robot?
>>
>> That's the discord bridge, connects discord & irc channels.
>
> Is there something actually manning that or is it computer generated?
> Some of the responses are really bizarre and can be characterized a
> nonsequiturs. Nothing offensive, just out of place as if he was
> addressing someone else that you can not see.

Oh, they're actually addressing someone else.

Those messages include the discord username before the message like so:

discord-raku-bot:  ...
discord-raku-bot:  ...

"MyName" & "OtherName" are different users.


signature.asc
Description: PGP signature


Re: is there an AI on the beginner chat line?

2023-10-27 Thread Andinus via perl6-users

ToddAndMargo via perl6-users @ 2023-10-26 21:19 -07:

> Hi All,
>
> Over onthe beginner's chat linbe:
>
> https://kiwiirc.com/nextclient/irc.libera.chat/#raku-beginner
>
> They have someone called "discord-raku-bot".  Some of the responses
> sound a bit off.  By chance, is discord-raku-bot an AI robot?

That's the discord bridge, connects discord & irc channels.


signature.asc
Description: PGP signature


Re: BEGIN {} question

2022-09-01 Thread Andinus via perl6-users

ToddAndMargo via perl6-users @ 2022-09-01 10:30 -07:

> On 9/1/22 00:45, Richard Hainsworth wrote:
>> Treat the regexes as data for a program. Compile the program once.
>> Run the regexes as often as you need.
>
> Please elucidate.  That could save me boat loads
> of time.

You could take the regex string from an environment variable or read
from a file. The program is compiled only once and you can test regexes
without re-compilation.

Thanks Richard, this is going to save me a lot of time.


signature.asc
Description: PGP signature


Re: sprintf and print question

2022-09-01 Thread Andinus via perl6-users

ToddAndMargo via perl6-users @ 2022-09-01 19:37 -07:

> Is there a cleaner way to do this?
>
> $ raku -e 'print( (sprintf "%.4s", "andefghi" ) ~ "\n";)'
> ande
>
> I want to print the first four letter s to STDOUT.

You can use substr,

  | put "andefghi".substr(0, 4)
  ande


signature.asc
Description: PGP signature


Re: trouble returning a value from sub

2022-06-16 Thread Andinus via perl6-users

Here is the code:

...
} else {
return factors($q, @f);
}
...

Return the values during recursive calls too.

Output:
[2 2 5]
2
2
5

Simon Proctor @ 2022-06-16 19:07 +01:

> I think, and I don't have my computer to hand to double check but I
> think you want a return before your recursive.call to factors passing
> in @f.
>
> When dealing with recursive functions you need to make sure what
> you're returning back up the stack.
>
> On Thu, 16 Jun 2022, 18:10 Rick Bychowski, 
> wrote:
>
> Hi Everyone,
>
> I've been lurking quite a while, this will be my first post to
> perl6
> users. I've written a lot of short scripts in perl5 for system
> admin
> type stuff at home and work. Lately I'm playing with Raku, which
> is a
> lot of fun. Error reporting is excellent, as is the online
> documentation.
>
> To the point. I recently started the perl weekly challenge. Lots
> of
> math/primes stuff. I wrote an algorithm to list all the prime
> factors of
> an integer, using a recursive subroutine. I'm able to print the
> result
> from the subroutine, but it always returns Nil. What am I missing?
>
> #!/usr/bin/env raku
>
> sub MAIN($n = 20) {
> .say for factors($n); # Nil
> }
>
> sub factors($n, @factors?) {
>  my @f = @factors.elems ?? @factors !! ();
>  my $q;
>  for 2 ..^ $n -> $i {
>  if $n %% $i {
>  $q = Int($n / $i);
>  @f.push($i);
>  if $q.is-prime {
>  @f.push($q);
>  say @f;# [2 2 5]
>  return @f;
>  } else {
>  factors($q, @f);
>  }
>  last;
>  }
>  }
> }
>
> Returns
> [2 2 5]
> Nil
>
> --
> Rick Bychowski
>
> The information in this email is confidential and may be legally
> privileged. It is intended solely for the addressee(s). Access to
> this
> e-mail by anyone else is unauthorized.


signature.asc
Description: PGP signature


Re: how do I turn a real into and array of Integers?

2021-10-31 Thread Andinus via perl6-users

ToddAndMargo via perl6-users @ 2021-10-30 23:57 -07:

> Without going into why (it is a secret), how do I turn
>
>> my $x = sqrt 2
> 1.4142135623730951
>
> into an array of integers?
> @y[0] = 1
> @y[1] = 4
> @y[2] = 1
> @y[3] = 4
> @y[4] = 2
> @y[5] = 1

put 2.sqrt.comb.grep(*.Int)>>.Int[^10].raku # 10 digits

(1, 4, 1, 4, 2, 1, 3, 5, 6, 2)


signature.asc
Description: PGP signature


Re: Font used for raku welcome message

2021-08-27 Thread Andinus via perl6-users

Norman Gaywood @ 2021-08-27 11:20 IST:

> On Linux (various versions), if I ssh to another system and start the raku
> REPL , I am  greeted with:
>
> Welcome to 퐑퐚퐤퐮퐝퐨™ v2021.08.
> Implementing the 퐑퐚퐤퐮™ programming language v6.d.
>
> On some systems, this is displayed as (embedded graphic):
>
> [image: image.png]
>
> While others:
>
> [image: image.png]
>
> Does anyone know what font package provides the required font here?
>
> Pretty sure I have to install this font on the system I'm ssh'ing FROM.
> It's correctly displayed ssh'ing from Windows 10.

Does changing the locale fix it?

- https://wiki.debian.org/Locale#Standard

``
andinus@ ~> echo $LANG
en_US.UTF-8
``


signature.asc
Description: PGP signature