Re: how do I do this index in p6?

2018-09-13 Thread JJ Merelo
Of course, you can also use Math::Constants use Math::Constants; say "We are flying at speed ", .1c; -- JJ

Re: how do I do this index in p6?

2018-09-13 Thread Brad Gilbert
On Thu, Sep 13, 2018 at 11:52 PM Todd Chester wrote: > > >> Le jeu. 13 sept. 2018 à 23:12, ToddAndMargo >> > a écrit : > >> > > > >> $ p6 'constant c=299792458; say c ~" metres per second";' > >> 299792458 metres per second > >> > >> Hm. Now I am

Re: how do I do this index in p6?

2018-09-13 Thread Todd Chester
Le jeu. 13 sept. 2018 à 23:12, ToddAndMargo > a écrit : $ p6 'constant c=299792458; say c ~" metres per second";' 299792458 metres per second Hm. Now I am wondering how to format the commas into the say. On 09/13/2018 02:43 PM, Laurent

Re: how do I do this index in p6?

2018-09-13 Thread ToddAndMargo
On 09/13/2018 12:10 PM, Parrot Raiser wrote: https://docs.perl6.org/language/terms#Identifier_terms On 9/13/18, ToddAndMargo wrote: On 09/12/2018 07:14 AM, Parrot Raiser wrote: Built-in constants: pi, tau, e, i Do you know where I can find the list ?

Re: how do I do this index in p6?

2018-09-13 Thread Parrot Raiser
https://docs.perl6.org/language/terms#Identifier_terms On 9/13/18, ToddAndMargo wrote: > On 09/12/2018 07:14 AM, Parrot Raiser wrote: >> Built-in constants: >> pi, tau, e, i > > Do you know where I can find the list ? > > https://duckduckgo.com/?q=perl6+built+in+constants=ffab=web > > is no

Re: how do I do this index in p6?

2018-09-13 Thread ToddAndMargo
On 09/12/2018 07:14 AM, Parrot Raiser wrote: Built-in constants: pi, tau, e, i Do you know where I can find the list ? https://duckduckgo.com/?q=perl6+built+in+constants=ffab=web is no help

Re: how do I do this index in p6?

2018-09-12 Thread Parrot Raiser
Neat. The answer's round about right. On 9/12/18, Fernando Santagata wrote: > Patched :-) > say (e**(i*pi)+1).round(10⁻¹²) > > On Wed, Sep 12, 2018 at 4:28 PM Parrot Raiser <1parr...@gmail.com> wrote: > >> Just for giggles, say e**(i*pi) + 1 prints 0+1.2246467991473532e-16i >> which isn't

Re: how do I do this index in p6?

2018-09-12 Thread Fernando Santagata
Patched :-) say (e**(i*pi)+1).round(10⁻¹²) On Wed, Sep 12, 2018 at 4:28 PM Parrot Raiser <1parr...@gmail.com> wrote: > Just for giggles, say e**(i*pi) + 1 prints 0+1.2246467991473532e-16i > which isn't exactly right, but close enough for government work. > (You could call it really right, the

Re: how do I do this index in p6?

2018-09-12 Thread Parrot Raiser
Just for giggles, say e**(i*pi) + 1 prints 0+1.2246467991473532e-16i which isn't exactly right, but close enough for government work. (You could call it really right, the error is imaginary. :-)* ) On 9/12/18, Parrot Raiser <1parr...@gmail.com> wrote: > Built-in constants: > pi, tau, e, i > >

Re: how do I do this index in p6?

2018-09-12 Thread Parrot Raiser
Built-in constants: pi, tau, e, i perl6 -e 'say pi ~ " " ~ tau ~ " " ~ e ~ " " ~ i'; 3.141592653589793 6.283185307179586 2.718281828459045 0+1i (tau is 2pi, useful if you want to calculate the circumference of your tuits. Pi and tau can also be accessed as the Unicode characters.

Re: how do I do this index in p6?

2018-09-11 Thread ToddAndMargo
On 09/11/2018 07:08 PM, Vadim Belman wrote: Of course constants! constant ACONST = pi; constant $SCONST = "aaa"; Even constant @a = [1,2,3]; though it doesn't affect the actual array content making '@a = []' possible due to the way '=' works in the array context. But constant @a = <1 2 3>;

Re: how do I do this index in p6?

2018-09-11 Thread Vadim Belman
Of course constants! constant ACONST = pi; constant $SCONST = "aaa"; Even constant @a = [1,2,3]; though it doesn't affect the actual array content making '@a = []' possible due to the way '=' works in the array context. But constant @a = <1 2 3>; works as expected. I could leave it as a

Re: how do I do this index in p6?

2018-09-11 Thread ToddAndMargo
On 09/11/2018 08:11 AM, yary wrote: "Nil... it's a constant, so you have to use =:= to check for equality." Constants? I thought we did not have constants! Am I mixing Perl 5 with Perl 6, again?

Re: how do I do this index in p6?

2018-09-11 Thread Larry Wall
Oh, I guess Timo suggested .defined. I should relearn to read, now that I can see again... Larry

Re: how do I do this index in p6?

2018-09-11 Thread Larry Wall
On Tue, Sep 11, 2018 at 02:42:20AM -0700, ToddAndMargo wrote: : How do I clean this up for use with Perl 6? : : $ perl -E 'say index("abc", "z") == -1 ? "False" : "True"' : False I'm a little bit surprised nobody suggested the most basic method: say index("abc", "z").defined ?? "True" !!

Re: how do I do this index in p6?

2018-09-11 Thread yary
"with"... with 'apple'.index('a') { say "Found at position $_" } else { "Not here" } # Found at position 0 with 'apple'.index('b') { say "Found at position $_" } else { "Not here" } # Not here -y On Tue, Sep 11, 2018 at 8:16 AM, Timo Paulssen wrote: > On 11/09/18 17:11, yary wrote: > >

Re: how do I do this index in p6?

2018-09-11 Thread Timo Paulssen
On 11/09/18 17:11, yary wrote: > "Nil... it's a constant, so you have to use =:= to check for equality." > > Can you elaborate on that requirement? == works for an equality checks > with numeric constants- must be more than Nil's constant-ness that > makes one use =:= - perhaps that Nil doesn't

Re: how do I do this index in p6?

2018-09-11 Thread JJ Merelo
El mar., 11 sept. 2018 a las 17:12, yary () escribió: > "Nil... it's a constant, so you have to use =:= to check for equality." > > Can you elaborate on that requirement? == works for an equality checks > with numeric constants- must be more than Nil's constant-ness that makes > one use =:= -

Re: how do I do this index in p6?

2018-09-11 Thread yary
"Nil... it's a constant, so you have to use =:= to check for equality." Can you elaborate on that requirement? == works for an equality checks with numeric constants- must be more than Nil's constant-ness that makes one use =:= - perhaps that Nil doesn't numify to anything?

Re: how do I do this index in p6?

2018-09-11 Thread ToddAndMargo
On 09/11/2018 02:57 AM, JJ Merelo wrote: perl6 -e 'say "abc".index("z") =:= Nil  ?? "False" !! "True"' -e runs the script from the CL https://github.com/rakudo/rakudo/wiki/Running-rakudo-from-the-command-line "abc" is on front (but it could be in the same way) index return Nil if it does not

Re: how do I do this index in p6?

2018-09-11 Thread ToddAndMargo
On 09/11/2018 03:11 AM, Simon Proctor wrote: Why not use contains though? Because I am torturing myself. I am trying to learn what all this does. I love contains, start-with, and ends with. I need to learn this other stuff too.

Re: how do I do this index in p6?

2018-09-11 Thread Simon Proctor
Why not use contains though? perl6 -e 'say "abc".contains("z")' False Use index if the index is important. Use contains if you just want to know if it's there. On Tue, 11 Sep 2018 at 10:57 JJ Merelo wrote: > perl6 -e 'say "abc".index("z") =:= Nil ?? "False" !! "True"' > > -e runs the script

Re: how do I do this index in p6?

2018-09-11 Thread JJ Merelo
perl6 -e 'say "abc".index("z") =:= Nil ?? "False" !! "True"' -e runs the script from the CL https://github.com/rakudo/rakudo/wiki/Running-rakudo-from-the-command-line "abc" is on front (but it could be in the same way) index return Nil if it does not found (more logical than -1)

how do I do this index in p6?

2018-09-11 Thread ToddAndMargo
Hi All, How do I clean this up for use with Perl 6? $ perl -E 'say index("abc", "z") == -1 ? "False" : "True"' False Many thanks, -T -- Yesterday it worked. Today it is not working. Windows is like that.