Nil ?

2018-09-11 Thread ToddAndMargo
What am, I missing? $ p6 'my $x; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };' Not Nil $ p6 'my $x = Nil; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };' Not Nil

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: Please explain this to me

2018-09-11 Thread ToddAndMargo
On 09/11/2018 03:09 AM, ToddAndMargo wrote: multi method contains(Str:D: Cool:D $needle, Int(Cool:D) $pos) Okay, I know that    Str is a string    Cool is an object that can be treated as both a string and a number    $needle is the second optional parameter What is "D"? $needle is

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

!

2018-09-11 Thread ToddAndMargo
On 09/11/2018 10:14 AM, Larry Wall wrote: 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:

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: case insensitive "contains"?

2018-09-11 Thread ToddAndMargo
On 09/11/2018 03:53 PM, Trey Harris wrote: And my response to his response that also was unintentionally off-list. I got it. I will probably be writing it down later today in my documents. My failing was thinking rx was some kind of command I had not seen before. As soon as you showed me

Re: A comparison between P5 docs and p6 docs

2018-09-11 Thread ToddAndMargo
On 09/11/2018 08:17 AM, Laurent Rosenfeld via perl6-users wrote: Hi Todd, I fully agree with Tom B.'s message that you should really set out to read a Perl 6 book. Many of the things you asked are covered in most of the available books. And the available books are easier than the official

Re: A comparison between P5 docs and p6 docs

2018-09-11 Thread ToddAndMargo
On 09/11/2018 08:52 AM, Tom Browder wrote: On Tue, Sep 11, 2018 at 10:39 AM Parrot Raiser <1parr...@gmail.com> wrote: One of the paradoxes of documentation, and the teaching of many abstract topics, is that those with the most in-depth knowledge of the ... I agree with you for the most part.

Re: A comparison between P5 docs and p6 docs

2018-09-11 Thread ToddAndMargo
On 09/11/2018 04:53 AM, Tom Browder wrote: Todd, some free advice: 1. DOCUMENTATION The docs are a volunteer effort. You can help by contributing changes and submitting issues. Hi Tom, I have started contributing to this effort as well. One of the big hurdles is that those maintaining the

Re: case insensitive "contains"?

2018-09-11 Thread Trey Harris
And my response to his response that also was unintentionally off-list. (Todd, if you don't mind resending your last private response—since your other response was quoted below—in reply to this, please do.) On Mon, Sep 10, 2018 at 22:00 ToddAndMargo wrote: > So you get to iteratively pick what

Re: case insensitive "contains"?

2018-09-11 Thread Trey Harris
Oops— I sent the following yesterday and it somehow didn't go to the list: On Mon, Sep 10, 2018 at 19:02 ToddAndMargo wrote: > Question, what the heck is > > my $rx1 = rx:i/a/; > > Are they talking over beginner's heads again? > In the sense of "beginners to Perl", perhaps, since "rx" is

Re: Appropriate last words

2018-09-11 Thread Shlomi Fish
Hi all, On Mon, 3 Sep 2018 11:09:35 -0700 Larry Wall wrote: > On Mon, Sep 03, 2018 at 11:45:58AM -0500, Stephen Wilcoxon wrote: > : Why the change in die handling between Perl 5 and 6? Suppressing line > : numbers with newline was very handy. Alternatively, adding some sort of > : directive

Re: Please explain this to me

2018-09-11 Thread Curt Tilmes
There's a talk for that too: https://www.youtube.com/watch?v=7mkmZVIizFY 2016 - Basic OO in Perl 6‎ - Dave Rolsky On Tue, Sep 11, 2018 at 1:42 PM Brandon Allbery wrote: > I'd like to point out that Todd is from Perl 5, which doesn't distinguish > between subs and methods because its built-in

Re: Functions and subroutines?

2018-09-11 Thread Larry Wall
On Tue, Sep 11, 2018 at 03:47:46AM -0700, ToddAndMargo wrote: : In Perl, what is the proper terminology? We're not picky, since Perl has never made a hard and fast distinction between routines that return values and routines that don't. You can call them all functions or routines or procedures

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: A comparison between P5 docs and p6 docs

2018-09-11 Thread Parrot Raiser
One of the paradoxes of documentation, and the teaching of many abstract topics, is that those with the most in-depth knowledge of the topic,are the least suitable to explain it, precisely because of that knowledge. They can't remember what it felt like not to know something, and they've usually

Re: A comparison between P5 docs and p6 docs

2018-09-11 Thread Tom Browder
On Tue, Sep 11, 2018 at 10:31 AM Simon Proctor wrote: > > It's a very good read. :) Yes it is!

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: A comparison between P5 docs and p6 docs

2018-09-11 Thread Simon Proctor
It's a very good read. :) On Tue, 11 Sep 2018 at 16:19 Laurent Rosenfeld via perl6-users < perl6-users@perl.org> wrote: > Hi Todd, > > I fully agree with Tom B.'s message that you should really set out to read > a Perl 6 book. Many of the things you asked are covered in most of the > available

Re: Functions and subroutines?

2018-09-11 Thread Simon Proctor
There are also Blocks like : my $a = do { 5 }; say $a; (Gives 5); Blocks turn up all over the place big different between blocks and Routines (Sub or Method) is you can't return from them. They will return the last thing evaluated within them though. But a return statement inside one raises and

Re: Functions and subroutines?

2018-09-11 Thread yary
And looking at questions in other threads- there are subroutines declared with "sub", those get called without an invocant. sub i-am-a-sub() { say "Hi from subroutine land!" } i-am-a-sub; # says "Hi from subroutine land!" and methods are declared inside a class, and are called with an invocant

Re: A comparison between P5 docs and p6 docs

2018-09-11 Thread Laurent Rosenfeld via perl6-users
Hi Todd, I fully agree with Tom B.'s message that you should really set out to read a Perl 6 book. Many of the things you asked are covered in most of the available books. And the available books are easier than the official documentation for a beginner to start understand the basic underlying

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: Functions and subroutines?

2018-09-11 Thread yary
I would call them subroutines, since that's the long form of "sub" -y On Tue, Sep 11, 2018 at 3:47 AM, ToddAndMargo wrote: > Hi All, > > I use subs like ducks use water. It is about time > I learned what to properly call them. > > I come from Modula2 and Pascal (as well as bash), "functions"

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: Please explain this to me

2018-09-11 Thread Simon Proctor
Also Todd I gave a talk on signatures types and multi methods at The Perl Conference this year. https://www.youtube.com/watch?v=Sy-qb5nXKyc=8606s That should be just before the start. https://www.slideshare.net/SimonProctor8/perl6-signatures-types-and-multicall Slides are here. Hope this

Re: Please explain this to me

2018-09-11 Thread Simon Proctor
1) why is it a "method" and not a "function"? methods are all on instance of a Class (or Role) they can locally access the instances data via self or $ or ... see below. 1-1/2) why is there a color after a$? What happens to $a? You can as an extra option give your instance object a different

Re: A comparison between P5 docs and p6 docs

2018-09-11 Thread Tom Browder
Todd, some free advice: 1. DOCUMENTATION The docs are a volunteer effort. You can help by contributing changes and submitting issues. Try to use the docs first instead of using an internet search. That will help you submit issues if you don't find what you are looking for. You really need to

A comparison between P5 docs and p6 docs

2018-09-11 Thread ToddAndMargo
Hi All, Not to beat a dead horse, but Perl 6's docs are miserably hard to understand. Here is a comparison of Perl 5's perldocs and Perl 6's docs: Perl 5: $ perldoc -f index index STR,SUBSTR,POSITION index STR,SUBSTR The index function searches for one string within another,

Re: Please explain this to me

2018-09-11 Thread ToddAndMargo
On 09/11/2018 03:30 AM, JJ Merelo wrote: Also, "is no help whatsoever" is no help whatsoever. Saying what part of it is not clear enough, or could be explained better, is. Well now, > method ($a: @b, %c) {}; # first argument is the invocant 1) why is it a "method" and not a

Re: Please explain this to me

2018-09-11 Thread Timo Paulssen
On 11/09/18 12:50, ToddAndMargo wrote: > On 09/11/2018 03:09 AM, ToddAndMargo wrote: >> multi method contains(Str:D: Cool:D $needle, Int(Cool:D) $pos) > > What the heck (not my exact word) is "multi method"? > > What is wrong with calling it a "function"? Multi Methods are methods that do

Re: Please explain this to me

2018-09-11 Thread ToddAndMargo
On 09/11/2018 03:09 AM, ToddAndMargo wrote: multi method contains(Str:D: Cool:D $needle, Int(Cool:D) $pos) What the heck (not my exact word) is "multi method"? What is wrong with calling it a "function"?

Functions and subroutines?

2018-09-11 Thread ToddAndMargo
Hi All, I use subs like ducks use water. It is about time I learned what to properly call them. I come from Modula2 and Pascal (as well as bash), "functions" return a value outside the declared parameters and "(sub)routines" only can modify values through the declarations parameters. Sort of

Re: Please explain this to me

2018-09-11 Thread Timo Paulssen
On 11/09/18 12:38, Curt Tilmes wrote: > > On Tue, Sep 11, 2018 at 6:27 AM ToddAndMargo > wrote: > > method ($a: @b, %c) {};       # first argument is the invocant > > > I might say rather that $a is a parameter for the invocant.  The @b > parameter holds all the

Re: Please explain this to me

2018-09-11 Thread Curt Tilmes
On Tue, Sep 11, 2018 at 6:27 AM ToddAndMargo wrote: > method ($a: @b, %c) {}; # first argument is the invocant > I might say rather that $a is a parameter for the invocant. The @b parameter holds all the positional arguments, %c holds the named arguments. > class Foo { > method

Re: Please explain this to me

2018-09-11 Thread JJ Merelo
El mar., 11 sept. 2018 a las 12:26, ToddAndMargo () escribió: > On 09/11/2018 03:22 AM, Timo Paulssen wrote: > > On 11/09/18 12:18, JJ Merelo wrote: > >> > >> > >> El mar., 11 sept. 2018 a las 12:15, Timo Paulssen ( >> >) escribió: > >> > >> The colon at the end of

Re: Please explain this to me

2018-09-11 Thread ToddAndMargo
On 09/11/2018 03:22 AM, Timo Paulssen wrote: On 11/09/18 12:18, JJ Merelo wrote: El mar., 11 sept. 2018 a las 12:15, Timo Paulssen (>) escribió: The colon at the end of "Str:D:" signifies that it's a type constraint on what you call the method on. For

Re: Please explain this to me

2018-09-11 Thread ToddAndMargo
On 09/11/2018 03:14 AM, Timo Paulssen wrote: The colon at the end of "Str:D:" signifies that it's a type constraint on what you call the method on. For example: my Str $foo; $foo.contains("hello", 0); won't work because $foo is currently not defined, i.e. doesn't pass the :D constraint. The

Re: Please explain this to me

2018-09-11 Thread Timo Paulssen
On 11/09/18 12:18, JJ Merelo wrote: > > > El mar., 11 sept. 2018 a las 12:15, Timo Paulssen ( >) escribió: > > The colon at the end of "Str:D:" signifies that it's a type > constraint on what you call the method on. For example: > > > That, of course, is also in

Re: Please explain this to me

2018-09-11 Thread JJ Merelo
El mar., 11 sept. 2018 a las 12:15, Timo Paulssen () escribió: > The colon at the end of "Str:D:" signifies that it's a type constraint on > what you call the method on. For example: > That, of course, is also in the documentation:

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

Please explain this to me

2018-09-11 Thread ToddAndMargo
multi method contains(Str:D: Cool:D $needle, Int(Cool:D) $pos) Okay, I know that Str is a string Cool is an object that can be treated as both a string and a number $needle is the second optional parameter What is "D"? $needle is optional, why is it not stated as "$needle?" How is

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)

Re: Perl 6 Design specification?

2018-09-11 Thread JJ Merelo
> Hi JJ, > > Yes it helps a bunch. Thank you! > > Follow up: where would I find the design specifications for the functions? There's a search engine in design.perl.org, they should all be there. If you want to see how they work, use the search facility in the Roast repo. If you want to see how

Re: Perl 6 Design specification?

2018-09-11 Thread ToddAndMargo
On 09/11/2018 01:13 AM, JJ Merelo wrote: Short answer: if you look up "perl 6 design specification" in any search engine (Google or Baidu) the 3-4 first results make sense. Long answer: it's a bit more complicated than that. First, there's the synopsis: (first result in Baidu)

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.

Re: Perl 6 Design specification?

2018-09-11 Thread JJ Merelo
Short answer: if you look up "perl 6 design specification" in any search engine (Google or Baidu) the 3-4 first results make sense. Long answer: it's a bit more complicated than that. First, there's the synopsis: (first result in Baidu) http://design.perl6.org/ Those are the initial guidelines

Perl 6 Design specification?

2018-09-11 Thread ToddAndMargo
Hi All, Is the Perl 6 design specification (the one the developers use) out there somewhere on the web that I could look at? Many thanks, -T