What is the syntax of a reference pointer in p6?

2018-10-05 Thread ToddAndMargo via perl6-users
What is the syntax of a reference pointer in p6?

Re: flatten?

2018-10-05 Thread Brandon Allbery
Turns out I misspoke anyway; << >> isn't enough by itself. $ p6 'my @x=; my @y=<<1 2 @x 3 4>>; say @y; dd @y;' @y will contain (1, 2, '@x', 3, 4). (Actually, the numbers will be things that are simultaneously numbers and strings, showing up as IntStr.new(1, '1') and such.) '@x' is a two-character

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
On 10/5/18 6:28 PM, Brandon Allbery wrote: You can't with that, because < ... > acts like single quotes; '@x' there is a string literal, not the list @x. If you use << ... >> then it act like double quotes, and will use the list instead. I am sorry. With the top posting, I can't tell what you

Re: flatten?

2018-10-05 Thread Brandon Allbery
You can't with that, because < ... > acts like single quotes; '@x' there is a string literal, not the list @x. If you use << ... >> then it act like double quotes, and will use the list instead. On Fri, Oct 5, 2018 at 9:23 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 10/5/1

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
On 10/5/18 6:09 PM, Brandon Allbery wrote: That's where the | comes in. If you say     my @b = (1, |@a, 2); then you get (1, 'a', 'b', 'c', 2) like in Perl 5. But you can specify what gets flattened, so you can choose to flatten some arrays but not others if you need to for some reason:  

Re: flatten?

2018-10-05 Thread Brandon Allbery
That's where the | comes in. If you say my @b = (1, |@a, 2); then you get (1, 'a', 'b', 'c', 2) like in Perl 5. But you can specify what gets flattened, so you can choose to flatten some arrays but not others if you need to for some reason: my @b = (1, |@b, 2, @b, 3); gives you (1, 'a',

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
On Fri, Oct 5, 2018 at 7:44 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: On 10/5/18 3:15 PM, Ralph Mellor wrote: > Well I guess my first way of explaining it was a complete bust. :) > > It's not going to be worth me discussing your reply to my first

Re: flatten?

2018-10-05 Thread Brandon Allbery
You know how in perl 5, if you do: my @a = qw(a b c); my @b = (1, @a, 2); @b will be (1, 'a', 'b', 'c', 2)? That's flattening. $b[1] will be 'a'. Perl 5 doesn't really understand nested data structures, so you have to simulate them with refs. If you use [@a] instead, $b[1] will contain an a

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
On 10/5/18 3:15 PM, Ralph Mellor wrote: Well I guess my first way of explaining it was a complete bust. :) It's not going to be worth me discussing your reply to my first attempt. Hi Ralph, Thank you! I am going to have to save it for later and read it over REAL SLOW! :-) -T

Re: bitwise or?

2018-10-05 Thread Timo Paulssen
Yes, there is an absolutely tiny mention of it on the page: Metaoperators Metaoperators can be parameterized with other operators or subroutines in the same way as functions can take functions as parameters. To use a subroutine as a parameter, prefix its name with a &. Perl 6 will generate the ac

Re: bitwise or?

2018-10-05 Thread Trey Harris
On Fri, Oct 5, 2018 at 8:33 AM Timo Paulssen t...@wakelift.de wrote: It's important to point out that inside metaoperators ("composed > operators", "combined operators", ...) the [ ] are just for bracketing > things together — sometimes it's needed to disambiguate,

Re: flatten?

2018-10-05 Thread Ralph Mellor
Well I guess my first way of explaining it was a complete bust. :) It's not going to be worth me discussing your reply to my first attempt. List context means that something appears in the context of a list. For example, given the list of characters A, A appears in the context of a list

Re: bitwise paper?

2018-10-05 Thread ToddAndMargo via perl6-users
On 10/2/18 9:15 PM, David Green wrote: On 2018-10-02 9:57 pm, ToddAndMargo wrote: Does anyone know of a paper out in web land showing how to do bitwise operations? $ p6 'my $v = 32 & 16; say $v;' If you search docs.perl6.org for "bitwise" you will find "+&": https://docs.perl6.org/language/op

Re: <> thank you

2018-10-05 Thread ToddAndMargo via perl6-users
On 10/5/18 5:24 AM, Brad Gilbert wrote: <> is part of the quoting sub-language Hi Brad, Thank you! I copied it into my keeper file on <> -T

Re: Could this be any more obscure?

2018-10-05 Thread ToddAndMargo via perl6-users
On 10/2/18 9:38 PM, David Green wrote: https://www.apress.com/gp/book/9781484228982 Is this something that better fits the way you think? Hi David, I really don't do well with such. Thank you for the tip anyway. -T

Re: Could this be any more obscure?

2018-10-05 Thread ToddAndMargo via perl6-users
On 10/2/18 5:52 PM, David Green wrote: On 2018-10-02 6:28 pm, ToddAndMargo wrote: Question: in Perl syntaxland, is "postfix" short for "postcircumfix"? Again, search for "postcircumfix" in docs.perl6.org, and you will get this: https://docs.perl6.org/language/operators#index-entry-postcircumfi

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
On 10/5/18 2:10 PM, ToddAndMargo via perl6-users wrote: On 10/2/18 5:31 PM, Tony Ewell wrote: Hi All, I have been using "flatten" for a while.  I kinda-sotra know what it means.  From the following, https://docs.perl6.org/routine/[%20]#language_documentation_Operators    The Array constr

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
On 10/2/18 5:31 PM, Tony Ewell wrote: Hi All, I have been using "flatten" for a while.  I kinda-sotra know what it means. From the following, https://docs.perl6.org/routine/[%20]#language_documentation_Operators   The Array constructor returns an itemized Array that does not   flat

Re: Could this be any more obscure?

2018-10-05 Thread David Green
On 2018-09-30 9:31 pm, ToddAndMargo wrote: >By the way, schools have books.  Why is it do you suppose that that schools also have teacher? Well, why is it, do you suppose, that hiring a tutor costs so much more than buying a book? Certainly, some people learn better aurally than visually.  T

Re: bitwise paper?

2018-10-05 Thread David Green
On 2018-10-02 9:57 pm, ToddAndMargo wrote: Does anyone know of a paper out in web land showing how to do bitwise operations? Trying to AND 0010 with 0001 $ p6 'my $v = 32 & 16; say $v;' If you search docs.perl6.org for "bitwise" you will find "+&": https://docs.perl6.org/language/op

Re: Could this be any more obscure?

2018-10-05 Thread David Green
On 2018-09-30 9:31 pm, ToddAndMargo wrote: >By the way, schools have books.  Why is it do you suppose that that schools also have teacher? Well, why is it, do you suppose, that hiring a tutor costs so much more than buying a book? Certainly, some people learn better aurally than visually.  T

Re: bitwise paper?

2018-10-05 Thread David Green
On 2018-10-02 9:57 pm, ToddAndMargo wrote: Does anyone know of a paper out in web land showing how to do bitwise operations? $ p6 'my $v = 32 & 16; say $v;' If you search docs.perl6.org for "bitwise" you will find "+&": https://docs.perl6.org/language/operators#infix_+&; And sure enough, 'say

flatten?

2018-10-05 Thread Tony Ewell
Hi All, I have been using "flatten" for a while.  I kinda-sotra know what it means. From the following, https://docs.perl6.org/routine/[%20]#language_documentation_Operators   The Array constructor returns an itemized Array that does not   flatten in list context. What exactly do they

Re: Could this be any more obscure?

2018-10-05 Thread David Green
On 2018-10-02 6:28 pm, ToddAndMargo wrote: Question: in Perl syntaxland, is "postfix" short for "postcircumfix"? Again, search for "postcircumfix" in docs.perl6.org, and you will get this: https://docs.perl6.org/language/operators#index-entry-postcircumfix_operator >>term++  postfix >>

Re: routine declaration line question

2018-10-05 Thread Trey Harris
On Fri, Oct 5, 2018 at 2:10 PM Brandon Allbery wrote: > Haskell supports it via typeclass resolution, which is mostly a source of > confusion to newcomers who assume (read :: Read a => String -> a) must be > deciding what to produce based on the String because they're not expecting > return type

Re: routine declaration line question

2018-10-05 Thread Timo Paulssen
You're probably thinking of ;; in a signature. On 05/10/2018 20:02, Trey Harris wrote: > But right now we have a situation where “everything within the > signature /except for/ the return constraint can participate in multi > dispatch”, which does feel weird. But is that actually true? > Something

Re: routine declaration line question

2018-10-05 Thread Brandon Allbery
Haskell supports it via typeclass resolution, which is mostly a source of confusion to newcomers who assume (read :: Read a => String -> a) must be deciding what to produce based on the String because they're not expecting return type polymorphism. It doesn't seem to be a problem otherwise. (Multip

Re: routine declaration line question

2018-10-05 Thread Trey Harris
On Fri, Oct 5, 2018 at 1:13 PM Brandon Allbery wrote: > My problem with it being in the signature is still that it doesn't say > which part of the contract it applies to; it appears to be claiming it's > part of dispatch, when it's not. > Explicit argument polymorphism has been shown to be usefu

Re: routine declaration line question

2018-10-05 Thread Brandon Allbery
My problem with it being in the signature is still that it doesn't say which part of the contract it applies to; it appears to be claiming it's part of dispatch, when it's not. On Fri, Oct 5, 2018 at 12:01 PM Larry Wall wrote: > On Thu, Oct 04, 2018 at 09:35:08PM +0200, JJ Merelo wrote: > : El j

Re: routine declaration line question

2018-10-05 Thread JJ Merelo
Hi, El vie., 5 oct. 2018 a las 18:01, Larry Wall () escribió: > On Thu, Oct 04, 2018 at 09:35:08PM +0200, JJ Merelo wrote: > : El jue., 4 oct. 2018 21:21, Brandon Allbery > escribió: > : > : > I don't think we've reached the point of such conventions yet. And > there's > : > some history here, i

Re: routine declaration line question

2018-10-05 Thread Larry Wall
On Thu, Oct 04, 2018 at 09:35:08PM +0200, JJ Merelo wrote: : El jue., 4 oct. 2018 21:21, Brandon Allbery escribió: : : > I don't think we've reached the point of such conventions yet. And there's : > some history here, in --> not having done anything in the early days except : > possibly slow thi

Re: routine declaration line question

2018-10-05 Thread Larry Wall
On Thu, Oct 04, 2018 at 03:13:15PM -0400, Trey Harris wrote: : Right; that's what I meant by "stylistically" — a `--> Mu` can highlight : that something is being returned (and that side-effects are not the primary : purpose), while nothing indicates that the return value, though it exists, : is inc

Re: bitwise or?

2018-10-05 Thread Timo Paulssen
It's important to point out that inside metaoperators ("composed operators", "combined operators", ...) the [ ] are just for bracketing things together — sometimes it's needed to disambiguate, but you can put it in anyway to make things clearer. This has nothing to do with [+] 1, 2, 3, which is a

Re: bitwise or?

2018-10-05 Thread Brad Gilbert
Note that = is actually a meta operator that can take an infix operator as an argument So $a += 1 is really short for $a [+]= 1 On Fri, Oct 5, 2018 at 1:02 AM Todd Chester wrote: > > > > On 10/4/18 12:13 PM, Brandon Allbery wrote: > > It's fine syntactically, but I think has no effect

Re: <> thank you

2018-10-05 Thread Brad Gilbert
<> is part of the quoting sub-language It is short for q:w' a b c d ' which is short for q:words' a b c d ' Note that you can add spaces q :words ' a b c d ' Even this is short. I'm going to show you various ways of writing the exact same thing q :w(1) ' a b c d ' q :w(T

Re: <> thank you

2018-10-05 Thread Todd Chester
On 10/5/18 4:51 AM, Laurent Rosenfeld via perl6-users wrote: You don't even need the quotes: > say [3,1]; (Nil cd) > Hi Laurent, A thing of beauty! Not to ask to stupid a question (when has that ever stooped me), but since [] is considered a subroutine, is <> also considered a subroutin

Re: <> thank you

2018-10-05 Thread Laurent Rosenfeld via perl6-users
You don't even need the quotes: > say [3,1]; (Nil cd) > Le ven. 5 oct. 2018 à 10:15, Todd Chester a écrit : > > > On 10/5/18 1:12 AM, Todd Chester wrote: > >>> Le ven. 5 oct. 2018 à 08:30, Todd Chester >>> > a écrit : > >>> > >>> Hi All, > >>> > >>> I we

Re: <> thank you

2018-10-05 Thread Ralph Mellor
That was me. Sending off list was a mistake. And you're welcome. :) -- raiph On Fri, Oct 5, 2018 at 7:30 AM Todd Chester wrote: > Hi All, > > I went to reply to someone, I think it was Brandon for sending me > an eMail to my private address and the stinker disappeared! > > Anyway whoever sent

Re: <> thank you

2018-10-05 Thread Todd Chester
On 10/5/18 1:12 AM, Todd Chester wrote: Le ven. 5 oct. 2018 à 08:30, Todd Chester > a écrit :     Hi All,     I went to reply to someone, I think it was Brandon for sending me     an eMail to my private address and the stinker disappeared!     Anyway whoever se

Re: <> thank you

2018-10-05 Thread Todd Chester
Le ven. 5 oct. 2018 à 08:30, Todd Chester > a écrit : Hi All, I went to reply to someone, I think it was Brandon for sending me an eMail to my private address and the stinker disappeared! Anyway whoever sent me $ p6 'say [0,2];'

Re: Feedback requested on playlist of 200 Perl 6 videos

2018-10-05 Thread Laurent Rosenfeld via perl6-users
This list is quite useful, thank you Raiph for it. I've found some that I did not know about. Cheers, Laurent. Le jeu. 4 oct. 2018 à 01:03, Ralph Mellor a écrit : > On Wed, Oct 3, 2018 at 6:16 AM David Green < > david.gr...@pl-comme.ci-comme.ca> wrote: > >> There are quite a few recorded P6 pr

Re: <> thank you

2018-10-05 Thread Laurent Rosenfeld via perl6-users
Yeah, Todd, the angle brackets operator in produces a list of three words which you can access individually with an index, whereas quotes in "a b c d" creates a single string. But to come back to the start of a very long thread of discussion over the last days, if you want to access individual wo