Re: Production Ready Perl 6?
I see things differently. I think that the question is Perl 6 production ready? is a meaningful and fairly important question. Can I reasonably expect to use Perl 6 in a production environment? The question has as much (or more) to do with implementations than the spec, but that doesn't make the question unimportant. I can use C90 and Fortran 95 in a production environment they are supported by stable, robust compilers that produce good quality code. I can use most of C99 and Fortran 2003 in production if I control the compiler. It is entirely legitimate to ask whether Perl 6 is ready for use in a similar sense. Is there at least one implementation that covers enough of Perl 6, with enough quality and speed, that one can reasonably expect it to work well in production? The feeling that I get from the discussions in this forum, and I mean no offence by this, is that people try to divert the question because they do not like the answer. If Perl 6 + implementations had a support comparable to C99 or Fortran 2003, I strongly suspect that most people would have answered with yes, it is production ready. Daniel. On 11/22/2011 10:09 PM, B. Estrade wrote: Well said. Also, the OP shouldn't confuse Perl 5 (the interpreter-defined language) with Perl 6 (a language definition for interpreters/compilers). The latter benefits from the fact that Perl 5 is whatever perl says it is - for better or worse. So, asking if Perl 6 is production ready is like asking if HPF, C++11, ECMA-262 is production ready. It just doesn't make sense even if the spirit of the question is mostly understood to mean a production implementation. Language designing and drafting is a funny thing, and history is wrought with *many* very interesting languages being designed, but failing to gain enough traction to elicite a production or (fully implemented) compiler/interpreter. The exercise itself is still extremely valuable and beneficial to all involved. Brett On Wed, Nov 23, 2011 at 12:38:15AM +0400, Richard Hainsworth wrote: Yet again this thread starts up. Yet again it will end with no one changing their opinions, their expectations, or the time-span of their vision. Personally, I use perl6 in my professional analytical work. I can express solutions to problems elegantly and with a minimum of work. I am not entirely concerned with the speed for most things, but that is the nature of what I do. When I am concerned with speed, I fall back on perl5 and especially perl5 routines that interface to optimised libraries. But I am really frustrated when I go back to perl5 because it feels so clunky compared to perl6. Ruby and Python overtaking Perl? So what? Neither of them have as much coverage as javascript or java, and every time I have to deal with either of those, I recoil in loathing. Truly I just cannot see why they should have SO much attention. (No need for a flame war about javascript or java - it's the way I react to them.) There are things that are worth doing, and doing well. Implementing Perl6 belongs to that category of things that have value in themselves. That is why there are still people still working on Perl6. But if you cant see the beauty in it, or the progress that has been made, you wont ever see it. Shame, but that's life. I have followed Perl6 from the first discussions, the RPCs, the Apocalypses, Exegeses, Synopses, played with pugs, and rakudo. I have helped it along with some bug reports and occasional questions and patches. Sure it's frustrating to be waiting for something and it not to be there. I waited for Rothfuss's Wise Man's Fear, after reading Name of the Wind. Now I am waiting for the end of the trilogy and it's frustrating because Rothfuss hasnt finished it. He is taking the time to make it what he wants it to be. I want to see how the plots get resolved. Frustrating, but that's life! Lets stop asking about 'production ready' releases. And making snarky remarks when the expected replies come back. It's like asking a republican about a tax increase. No I am not suggesting a flame war on politics, but it's another example of asking the wrong question to someone who already views the world with a different perspective. Nothing good comes from it, no new light on a subject done to death already, no change of heart or view by anybody involved. So why do it? Regards, Richard Hainsworth On 11/22/2011 08:26 PM, Wendell Hatcher wrote: Thanks, so it isnt production ready like a release which would be an official release of a new version of perl 5? I have the feeling after well over 5 years this will never happened. I hope Perl 6 doesnt get seen as a novelty or toy and people simply never use it if this hasnt already happened. Ruby is passing Perl by like Python did. -Dell On Nov 22, 2011, at 9:08 AM, Tadeusz So??nierz wrote: On Tuesday, November 22, 2011 16:59:52 Wendell Hatcher wrote: Are there people using Perl 6 in production at this time? Is Perl 6 production ready?
Re: Production Release - was Re: Questions for Survey about Perl
On Thu, Jan 6, 2011 at 3:32 PM, Guy Hulbert gwhulb...@eol.ca wrote: On Thu, 2011-06-01 at 14:53 +0100, Daniel Carrera wrote: I would be very interested to see something that allowed Rakudo to talk to Fortran 95. I am going to use Fortran 95 for my thesis work, and maybe I could write a module to give Rakudo a basic array language. Nothing fancy Is there anything like this for perl5 ? Yes, PDL. That's the Perl Data Language. And NumPy is the same thing for Python. The algorithm was the ruelle-takens algorithm (ca 1979, iirc) to compute the fractal dimension of a series. Application was bioinformatics and the journal was a political science one. Very weird mix. Never had a chance to get back to it but I was thinking that an array module for perl5 would be useful. I probably still have the code stashed somewhere. If the algorithm can be expressed largely as array operations, then PDL should give a speed more in the ballpark of the C version. Daniel. -- No trees were destroyed in the generation of this email. However, a large number of electrons were severely inconvenienced.
Re: Things to Implement for Rakudo
Is it possible to explain briefly wht the Rulle-Takens algorithm is? That web page seems to mainly explain how some fractals like the Mandelbrot set and the Julia set are generated. Is there a specific, simple algorithm that we can try to implement in PDL, Perl 5 and Perl 6? On Thu, Jan 6, 2011 at 3:36 PM, Guy Hulbert gwhulb...@eol.ca wrote: Changed the subject so people don't complain ;-) On Thu, 2011-06-01 at 09:32 -0500, Guy Hulbert wrote: The algorithm was the ruelle-takens algorithm (ca 1979, iirc) to compute the fractal dimension of a series. Google ( http://www.google.com/search?q=ruelle+takens+algorithm ) found: http://www.emayzine.com/infoage/math/math2.htm Looks like 1979 is about right. -- --gh -- No trees were destroyed in the generation of this email. However, a large number of electrons were severely inconvenienced.
Re: Can't download Rakudo Dec 2010 without git
That's rather annoying. Isn't there a way to fix that? On Tue, Jan 4, 2011 at 8:25 AM, Moritz Lenz mor...@faui2k3.org wrote: On 01/04/2011 03:19 AM, gvim wrote: Does this mean I have no option but to install git in order to keep my Perl 6 up to date? No. You can download and install a release tarball of parrot, and then point rakudo's Configure.pl to the installed parrot. Only if you use the --gen-parrot option, git needs to be available. Cheers, Moritz -- No trees were destroyed in the generation of this email. However, a large number of electrons were severely inconvenienced.
Re: Can't download Rakudo Dec 2010 without git
On Tue, Jan 4, 2011 at 9:38 AM, Jan Ingvoldstad frett...@gmail.com wrote: On Tue, Jan 4, 2011 at 09:30, Daniel Carrera dcarr...@gmail.com wrote: That's rather annoying. Isn't there a way to fix that? Yes, install Rakudo Star instead, that bundles a suitable version of Parrot. Oh, gvim wasn't talking about Rakudo Star? I assumed he was because I figure that the alternative to Rakudo Star is pull the Rakudo dev branch with Git. Daniel. -- No trees were destroyed in the generation of this email. However, a large number of electrons were severely inconvenienced.
Re: Questions for Survey about Perl
On Mon, Jan 3, 2011 at 8:13 AM, Gabor Szabo szab...@gmail.com wrote: I think it largely depends on who do you ask and I believe there will be a huge gap between private people and company people. Or between people who are involved in open source development and in-house developers. I don't see the open source vs in-house point you are trying to make, but I still agree with the general point that production partly depends who you ask and what they need it for. For example, I expect that most companies would tolerate more bugs in a program for internal use than in a program intended for paying customers. That said, I tried to give a vague notion in my earlier post. Production means that the developers have given me some sort of verbal assurance that the product is reasonably stable and can be relied on to reasonably work as documented. Some kind of an official blessing is needed by most of us. This can be Larry for Perl or Patrick for Rakudo or having it supplied by our vendor (e.g. Ubuntu, Red Hat or ActiveState). Yeah, something like that. Daniel. -- No trees were destroyed in the generation of this email. However, a large number of electrons were severely inconvenienced.
Re: Questions for Survey about Perl
On Mon, Jan 3, 2011 at 8:27 AM, Gabor Szabo szab...@gmail.com wrote: So I'd change that to after a production release of a Perl 6 compiler I think I'll include both answers. If we learn that people desperately need a 1.0 numbering then the Rakudo developers can make up their mind to either change the numbering scheme or invest more in education of the users. Maybe pointing out that after releasing 2011.01 you can't release 1.0. :) Not much chance of educating users. Release numbers have more or less established standard meanings. It is impossible or impractical for someone to be educated about the idiosyncratic numbering scheme of every product they use. That's why there are standards, even if they are informal. The 1.0 = ready standard is well established in the FOSS world (it even gets a paragraph in ESR's The Cathedral and The Bazaar). People are not wrong to expect that 1.0 is the sign that the product is ready and that 0.x means that it's still in a state of flux. FOSS numbering standards go further than that. It is extremely common that products be numbered X.Y.Z where Y even indicates stable version and Y odd indicates development version. Perl 5 switched to this numbering scheme years ago precisely because people were familiar with it and understood it. ps. In Padre I try to stick to the increase by 0.01 and not jump to 1.00. It is surprising how many people tell us I'll use Padre once 1.0 is released. I can't even imagine how many people think the same but don't tell us. Look at it from my point of view: I don't have time or energy to join the Padre development list and track its progress in order to decide for myself if it is ready for use. I certainly don't have the time or energy or inclination to do that for every single software product I use. I will make exceptions for software that has a very long history. I have no doubt that Emacs and Vi are stable, so I don't care what their numbering scheme is. But for stuff that is new enough to make me wonder, I will tend to wait for 1.0. Daniel. -- No trees were destroyed in the generation of this email. However, a large number of electrons were severely inconvenienced.
Re: Questions for Survey about Perl
On Sun, Jan 2, 2011 at 5:27 PM, Patrick R. Michaud pmich...@pobox.com wrote: Out of curiosity (because I think it will illuminate some of the difficulty Rakudo devs have in declaring something to be a production release): - What constitues a production release? The developers judge that the software is reasonably feature complete, and more importantly, it is robust enough to use in a production environment such as a school or company website, where customers will experience it. It does not mean that it is perfect, or fast. But the programmer should have a reasonable expectation that it will work correctly (aka as documented). - What was the first production release of Perl 4? I never saw Perl 4, but I suspect 4.0. - What was the first production release of Perl 5? I suspect 5.0. - What was the first production release of Linux? I suspect 1.0 - At what point was each of the above declared a production release; was it concurrent with the release, or some time afterwards? IMO, concurrent. Daniel. -- No trees were destroyed in the generation of this email. However, a large number of electrons were severely inconvenienced.
Re: Questions for Survey about Perl
On Sun, Jan 2, 2011 at 6:05 PM, Guy Hulbert gwhulb...@eol.ca wrote: I think freezing a subset of what you eventually want to have and then getting as close as you can on a fairly tight schedule is the best way to get buy-in from users. That is generally what I expect to see in a production release, yes. I don't think it's a rule, but I expect to see a feature freeze, and a period where you just look for bugs for the existing feature set, and then comes the production release. Daniel. -- No trees were destroyed in the generation of this email. However, a large number of electrons were severely inconvenienced.
Re: Questions for Survey about Perl
On Sat, Jan 1, 2011 at 10:15 AM, Gabor Szabo szab...@gmail.com wrote: It would be nice to figure out what is the percentage of people who don't yet look at Perl 6 because there was not official Perl 6.0 release or in more general what are the blocking issues for them. I just would like to make sure that by asking the question we don't strengthen the belief that there ever will be an official Perl 6.0 release. ... So for example: I'll start learning Perl 6 (select one or more that fits your opinion) *) when Larry Wall declares that Perl 6.0 is ready *) after Rakudo 1.0 is released *) when the default running perl -v in my Linux distribution will say it is version 6.0 or later *) After the Learning Perl 6th edition will be published *) After DBI and DBD::Mysql is ported *) never *) I have already started to learn Other: What do you think? I think that's pretty good. Though personally, I can imagine the first two not being mutually exclusive. That is, if Rakudo 1.0 is released but Larry Wall hasn't said that Perl 6.0 is ready, I'd scratch my head and wonder. In turn, if Perl 6.0 is ready and Rakudo hasn't released a 1.0 I might figure that they still need more time. Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Questions for Survey about Perl
On Sat, Jan 1, 2011 at 12:36 PM, Moritz Lenz mor...@faui2k3.org wrote: Given the current version number scheme (year.month), it's highly unlikely that we'll ever see a Rakudo 1.0. So I'd change that to after a production release of a Perl 6 compiler People might be expecting that when Rakudo is ready it would have a 1.0 release. I sure did. Using year + month is nice in a way, but it means that you don't immediately know if the release is production vs devel, or whether it's a major vs minor release. Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Announce: Rakudo Star 2010.12 released
Out of curiosity, is it possible to get Rakukdo to talk to C, C++ or Fortran? On Thu, Dec 30, 2010 at 8:04 PM, Patrick R. Michaud pmich...@pobox.com wrote: On behalf of the Rakudo and Perl 6 development teams, I'm happy to announce the December 2010 release of Rakudo Star, a useful and usable distribution of Perl 6. The tarball for the December 2010 release is available from http://github.com/rakudo/star/downloads. Rakudo Star is aimed at early adopters of Perl 6. We know that it still has some bugs, it is far slower than it ought to be, and there are some advanced pieces of the Perl 6 language specification that aren't implemented yet. But Rakudo Perl 6 in its current form is also proving to be viable (and fun) for developing applications and exploring a great new language. These Star releases are intended to make Perl 6 more widely available to programmers, grow the Perl 6 codebase, and gain additional end-user feedback about the Perl 6 language and Rakudo's implementation of it. In the Perl 6 world, we make a distinction between the language (Perl 6) and specific implementations of the language such as Rakudo Perl. The December 2010 Star release includes release #36 of the Rakudo Perl 6 compiler [1], version 2.11.0 of the Parrot Virtual Machine [2], and various modules, documentation, and other resources collected from the Perl 6 community. This release of Rakudo Star adds the following features over the previous Star release: * New .trans algorithm * Configuration improvements * More bug fixes There are some key features of Perl 6 that Rakudo Star does not yet handle appropriately, although they will appear in upcoming releases. Thus, we do not consider Rakudo Star to be a Perl 6.0.0 or 1.0 release. Some of the not-quite-there features include: * nested package definitions * binary objects, native types, pack and unpack * typed arrays * macros * state variables * threads and concurrency * Unicode strings at levels other than codepoints * pre and post constraints, and some other phasers * interactive readline that understands Unicode * backslash escapes in regex [...] character classes * non-blocking I/O * most of Synopsis 9 * perl6doc or pod manipulation tools In many places we've tried to make Rakudo smart enough to inform the programmer that a given feature isn't implemented, but there are many that we've missed. Bug reports about missing and broken features are welcomed at rakudo...@perl.org. See http://perl6.org/ for links to much more information about Perl 6, including documentation, example code, tutorials, reference materials, specification documents, and other supporting resources. An updated draft of a Perl 6 book is available as docs/UsingPerl6-draft.pdf in the release tarball. The development team thanks all of the contributors and sponsors for making Rakudo Star possible. If you would like to contribute, see http://rakudo.org/how-to-help, ask on the perl6-compi...@perl.org mailing list, or join us on IRC #perl6 on freenode. Starting with the January 2011 release, Rakudo Star releases will be created on a three-month cycle, or as needed in response to important bug fixes or improvements. The next planned release of Rakudo Star will be on January 25, 2011. [1] http://github.com/rakudo/rakudo [2] http://parrot.org/ -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Questions for Survey about Perl
On Fri, Dec 31, 2010 at 7:17 PM, Paul Makepeace pa...@paulm.com wrote: On Tue, Dec 28, 2010 at 23:02, Gabor Szabo szab...@gmail.com wrote: We will have questions about usage of Perl 5 and we think there should be also questions about Perl 6. Should Perl 6 be called something else? * No * Yes, not sure what * Yes, [] Maybe a question on perceived benefits for an alternative name. (It's quite apparent this is a very different language at the very least syntactically I'm inclined to join others I've read in saying Yes) That would suggest that Larry Wall is soliciting ideas for a name change, which is not the case. I would not that it is not unheard of for a language to change significantly but keep the name. If you look Fortran 2008 (just to pick an example I'm familiar with) it looks *nothing* like FORTRAN II. I'm no expert, but I believe KR's original C language was noticeably different from C99. For amusement, below I include the same program in FORTRAN II and Fortran 90. The program uses Heron's formula for finding the area of a triangle (http://en.wikipedia.org/wiki/Heron's_formula): 1) FORTRAN II (note that all the indentations are significant!!!) C READ FROM CARD READER UNIT 5 READ INPUT TAPE 5, 501, IA, IB, IC 501 FORMAT (3I5) C COMPUTE AREA 799 S = FLOATF (IA + IB + IC) / 2.0 AREA = SQRT( S * (S - FLOATF(IA)) * (S - FLOATF(IB)) * + (S - FLOATF(IC))) C OUTPUT TO LINE PRINTER UNIT 6 WRITE OUTPUT TAPE 6, 601, IA, IB, IC, AREA 601 FORMAT (4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2, +13H SQUARE UNITS) STOP END 2) Fortran 90: program heron integer :: a,b,c real :: s, area ! Read from stdin. read (*,*) a,b,c ! Compute the area. s = ( a + b + c)/2 area = sqrt( s * (s-a) * (s-b) * (s-c) ) write (*,*) a,b,c,area end program -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Questions for Survey about Perl
On Sat, Jan 1, 2011 at 1:26 AM, Chas. Owens chas.ow...@gmail.com wrote: On Wed, Dec 29, 2010 at 21:39, Xue, Brian brian@amd.com wrote: I want to adding one more answer about what are people waiting for before they start using Perl 6. There hasn't an official release of PERL6.0, just Rakudo. I'm afraid of Rakudo is cancelled, I don't want to make my product based on an uncertainty matter. snip This shows a fundamental misunderstanding of what Perl 6 is. As far as I know there will never be a release of Perl 6.0 (it definitely won't be PERL6.0). Perl 6 is a specification and a set of tests. Any program that can pass the test suite and conforms to the specification IS a Perl 6. Right now the program that passes the most tests and conforms most closely to the specification is Rakudo. But Xue still has a valid point that even the Perl 6 spec doesn't exist yet. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Questions for Survey about Perl
On Wed, Dec 29, 2010 at 10:02 AM, Richard Hainsworth rich...@rusrating.ru wrote: Gabor, there is a big gap between 'i wrote snippets' to 'i wrote modules'. How about 'i have written programs to solve real problems' ? I agree. Although I don't use Perl 6 in production yet, for Perl 5 I can say that I've never written a module, but I've used it a lot in production. In fact... I might even suggest dropping the modules one, because you might have used Perl 6 in production without ever writing a module (as I have done for Perl 5). Unless you include toy modules that are better categorized as code snippets for learning the language, in which case they rank lower than used Perl to solve real problems. So I vote for removing the modules one. I have another question: If you use Perl 6 for your research (e.g. Masters thesis, PhD thesis, or university research), does that count as production environment or just real problems? Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Questions for Survey about Perl
On Wed, Dec 29, 2010 at 10:16 AM, Gabor Szabo szab...@gmail.com wrote: So in relation to what Katherine wrote earlier we should have a question trying to figure out what are people waiting for before they start using Perl 6. That's an excellent question. Possible answers: * I'm waiting for a specific feature to be implemented in Rakudo. * Rakudo is too slow. * I didn't realize Rakudo was ready for use. * Other [ fill in the blank ] Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Q: Is there a reason why I can't do this?
On Tue, Dec 28, 2010 at 5:27 AM, yary not@gmail.com wrote: On Mon, Dec 27, 2010 at 8:50 PM, Daniel Carrera dcarr...@gmail.com wrote: So TTIR just means that any two terms must be separated by something, like an operator (2+5). Which basically is common sense and I'm actually surprised to hear that in Perl 5 you could have two terms one after the other with nothing in between. Very common example from Perl 5: print $filehandle Here is a line that goes to some file; Note that there is no operator between $filehandle and the string. Thanks. It's funny... I've done that a thousand times and I didn't think of it. I just Googled and found the Perl 6 way to print to a file handle: $filehandle.print(Hello world\n); $filehandle.say(Hello world); Looks good. Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Various questions
Hello, I have a few miscellaneous questions: 1) Does anyone know what a Parcel is? 1 2 3 4.WHAT = Parcel() 1 2 3 4 ; 2 3 4 ; 5.WHAT = Parcel() 2) How do you figure out the length of an array? The scalar function is gone. I tried len, length and size without success. 3) More generally, is there a way to find out what methods are available? I'm thinking of something like @foo.METHODS and it'd give me a list of all the methods available in arrays. That would be useful. Cheers, Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Various questions
Thanks. On Wed, Dec 29, 2010 at 12:51 AM, Will Coleda w...@coleda.com wrote: On Tue, Dec 28, 2010 at 6:32 PM, Daniel Carrera dcarr...@gmail.com wrote: 1) Does anyone know what a Parcel is? 1 2 3 4.WHAT = Parcel() 1 2 3 4 ; 2 3 4 ; 5.WHAT = Parcel() Here's a link to some docs on Parcel: http://perlcabal.org/syn/S08.html#Capture_or_Parcel You can use: http://perlcabal.org/syn/ and do a google search in the upper RHS (which is what I did just now.) Regards. -- Will Coke Coleda -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Q: Code example in Using Perl 6 - methods and spaces.
Hello, After a long absence (been busy) I'm trying to re-learn Perl 6. I'm reading the book Using Perl 6, from Jonathan S, Moritz, Mäsak, PM and Jonathan W.: http://github.com/downloads/perl6/book/2010.08.a4.pdf I tested the first program using the latest release of Rakudo Star. The first program has the following: my @sorted = @names.sort({ %sets{$_} }).sort({ %matches{$_} }).reverse; This works correctly, but it's long and I'd rather format this line like this: This works correctly, but I was surprised that this doesn't: my @sorted = @names.sort({ %sets{$_} }) .sort({ %matches{$_} }) .reverse; I was surprised when this didn't work. Does anyone know if this is a bug in Rakudo, or if Perl 6 is really not supposed to have methods separated by white space like this? The message from Rakudo was not very informative. It just says Confused at line 28, near my @sorted. Cheers, Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Q: Code example in Using Perl 6 - methods and spaces.
On Mon, Dec 27, 2010 at 8:37 PM, Darren Duncan dar...@darrenduncan.netwrote: A relevant reading would be http://perlcabal.org/syn/S02.html#Whitespace_and_Comments I think; what you are trying to do may not directly be allowed, though there may be workarounds such as by using unspace. Thanks. The blacklash unspace works. my @sorted = @names.sort({ %sets{$_} })\ .sort({ %matches{$_} })\ .reverse; Though I'm a bit sad that you need that and you can't just separate methods with spaces. Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Q: Is there a reason why I can't do this?
On Mon, Dec 27, 2010 at 9:49 PM, Chas. Owens chas.ow...@gmail.com wrote: The [conditional operator][1] is now spelled test ?? true !! false not test ? true : false. Thanks! Now the following code works: %matches{ $r1 $r2 ?? $p1 !! $p2 }++; I'm still having trouble with the other alternative: $r1 $r2 ?? { %matches{$p1}++ } !! { %matches{$p2}++ }; Now the problem is that %matches is empty. I'm not sure why. Maybe you can't have code blocks inside ?? ... !! ... Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Q: Is there a reason why I can't do this?
On Mon, Dec 27, 2010 at 10:03 PM, Chas. Owens { } by itself creates a lambda (i.e. an anonymous function), so it may be that you are returning an anonymous function that never gets executed. Try using parentheses instead of braces. Or better yet, don't use anything. Since ++ has higher precedence than ??!!, it doesn't need to any parentheses: $r1 $r2 ?? %matches{$p1}++ !! %matches{$p2}++ ; Ah. That makes sense. I hadn't realized that squiggly brackets were lambdas. Very cool. To prove that they are lambdas, I confirmed that the following works: $r1 $r2 ?? {%matches{$p1}++}() !! {%matches{$p2}++}(); So, in this needlessly complex code, I basically create an anonymous function and immediately execute it. Cheers, Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Q: Is there a reason why I can't do this?
On Mon, Dec 27, 2010 at 10:03 PM, Moritz Lenz wrote: or my $closure = $r1 $r2 ?? { %matches{$p1}++ } !! { %matches{$p2}++ }; # invoke it $closure(); That's very cool. Perl 6 is a functional language with lambdas and everything. Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Q: Is there a reason why I can't do this?
On Tue, Dec 28, 2010 at 12:38 AM, Mason Kramer mason.kra...@gmail.comwrote: One method-like thing that's come in handy for me as I've tinkered with the language is .WHAT. { ... }.WHAT Block() AFAIK, you can use .WHAT on *any* term, because every term in Perl6 is an object that is implemented by a class, and every class has a corresponding type object (which is what .WHAT returns for you). That's cool. Thanks. I notice it works on numbers and string literals: hello.WHAT # Str() 3.WHAT # Int() 3.3.WHAT # Rat() pi.WHAT# Num() (1+3i).WHAT# Complex() But it seems to give very inconsistent results when applied to functions: print.WHAT # Bool() say.WHAT# [blank] sin.WHAT# [error] This might not have helped you had you not realized that {%matches{$p1}++} is a term. However, if you keep in mind that TTIAR is always a syntax error in Perl6, then if your code is compiling, whatever is between ?? and !! must be a single term. It's really the TTIAR thing that makes reading Perl6 so incredibly predictable, I think. What is TTIAR? Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Q: Is there a reason why I can't do this?
On Tue, Dec 28, 2010 at 1:21 AM, Mason Kramer mason.kra...@gmail.comwrote: Sorry. TTIAR = Two Terms In A Row. It's always a syntax error in Perl6, unlike Perl 5. print, say, and sin as you've used them are not terms, actually. They're expressions which happen to be function calls. You're calling .WHAT on their return values. This is predictable going forward from TTIAR: Hmm... I think this will only make sense to me if I ask you to define what a term is, but I am sure that this term (pun intended) is difficult to define. In particular, if a number like 5 is a term, then I would think that the following expression contains four terms: 2 3 ?? 5 !! 6 I figure that 2, 3, 5 and 6 are all terms. Or how about: print 5 if 4; I'd think that if 5 is a term, then so is 4. The return value of print is True, which has the Bool type. The return value of say is also True, but I think there's some kind of special casing thing going on in the repl, where the return value of say is suppressed. There's no valid dispatch for sin() with no arguments, so that one gives you an error. Indeed, it is. Strange. I would have thought that print, with no arguments, would give me an error like with sin. And why does print return True? What's True about it? If you want the noun form of these subs, prefix with . print.WHAT Multi() say.WHAT Multi() sin.WHAT Multi(). Interesting. I imagine that Multi() means that the function has multiple definitions. For example, I expect that sin has one implementation for floats and another for complex numbers. But seriously, congrats on breaking .WHAT in 60 seconds flat ;) :-) Thanks for helping me learn Perl 6. It's a very neat language. Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: Q: Is there a reason why I can't do this?
On Tue, Dec 28, 2010 at 2:06 AM, Chas. Owens On Mon, Dec 27, 2010 at All of your examples are in fact terms. A term is a thing that is considered one unit. So, numbers, strings, and variables are all obviously terms. A function or method call that includes parentheses is also a term. But parentheses can create terms out of expressions, so, for instance, (5 + 4) is a term (that happens to contain a term, an operator, and a another term). In the [order of operations][1] you will find that terms have the highest precedence, this is why (5+5)*2 is 20, not 15. You know what I just realized? When you say two terms in a row you don't mean two terms in the same line but rather, two terms, one right after the other. Sounds obvious in hindsight - a line is not a row - but it caught me off guard, and that's why I got confused. I was thinking of course you can have two terms in the same line. So TTIR just means that any two terms must be separated by something, like an operator (2+5). Which basically is common sense and I'm actually surprised to hear that in Perl 5 you could have two terms one after the other with nothing in between. Yes, Multi() means it is a multimethod. Multimethods [are routines that can have multiple variants that share the same name, selected by arity, types, or some other constraints.][3] Thanks. Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.
Re: RPN calculator in Perl 6
Daniel Ruoso wrote: TIMTOWTDI ;) The objective of the blog was more about the learning + teaching experience than anything else. http://sial.org/pbot/37075 % perl rpn.pl 2 2 + Semicolon seems to be missing at rpn.pl line 2. String found where operator expected at rpn.pl line 13, near where '+' (Do you need to predeclare where?) Array found where operator expected at rpn.pl line 14, near ] (Missing operator before ?) Scalar found where operator expected at rpn.pl line 14, near @($a (Missing operator before $a?) String found where operator expected at rpn.pl line 17, near where '-' (Do you need to predeclare where?) Array found where operator expected at rpn.pl line 18, near ] (Missing operator before ?) Scalar found where operator expected at rpn.pl line 18, near @($a (Missing operator before $a?) String found where operator expected at rpn.pl line 21, near where '*' (Do you need to predeclare where?) Array found where operator expected at rpn.pl line 22, near *] (Missing operator before ?) Scalar found where operator expected at rpn.pl line 22, near @($a (Missing operator before $a?) Semicolon seems to be missing at rpn.pl line 24. String found where operator expected at rpn.pl line 25, near where '/' (Do you need to predeclare where?) Semicolon seems to be missing at rpn.pl line 28. String found where operator expected at rpn.pl line 30, near fail 'Error parsing expression near ' (Do you need to predeclare fail?) Array found where operator expected at rpn.pl line 33, near ] (Missing operator before ?) Bareword found where operator expected at rpn.pl line 33, near @*ARGS (Missing operator before ARGS?) Operator or semicolon missing before *ARGS at rpn.pl line 33. Ambiguous use of * resolved as operator * at rpn.pl line 33. syntax error at rpn.pl line 1, near \. Missing right curly or square bracket at rpn.pl line 34, at end of line Execution of rpn.pl aborted due to compilation errors.
Re: RPN calculator in Perl 6
Daniel Carrera wrote: http://sial.org/pbot/37075 % perl rpn.pl 2 2 + Tee hee... that should have been perl6. :-) Ok, try again: % perl6 rpn.pl 2 2+ 2 2
Re: the file slurping is not working
Carl Mäsak wrote: Aruna (): I tested the below code on parrot-1.1.0 and it read all the lines in the file and tested same code on the latest git update (4th June 2009), it outputs only the first line. That's what C$file.get does -- it gives you one line per default. You want C$file.lines. Then why is it that .get works fine for $*IN? while $*IN.get - $line { say $line }
Re: the file slurping is not working
Leon Timmermans wrote: Then why is it that .get works fine for $*IN? while $*IN.get - $line { say $line } Because you're using a while loop instead of a for loop ;-) Worse. The code I wrote has a subtle but horrible error. The condition will fail as soon as you hit a blank line!! Daniel.
Re: rakudo-current loop 2-3 orders of magnitude slower than perl 5?
Fagyal Csongor wrote: I very much agree with Patrick: an order-of-magnitude speed difference compared to Perl5 is kind of the point where many will just stop caring about performance and start using Rakudo/Perl6. Actually I expect a significant increase in the number of new Perl6ers at around 100x slower. (That, and the 10 most important Perl5 CPAN modules ported to Perl6 :)) When C bindings are available, you can rewrite the bottlenecks in C. We know that 80% of the time is spent in 20% of the code. I suspect that that would suffice for early adopters. I think it would be nice to have some sort of a performance-tracking page, with just some very basic Perl5 / Perl6 code and very rough measurements. If noone will do that, I will :) Help me port the Debian shoot out benchmarks to Perl 6. Then you'll have the benchmarks you need for your page. If the benchmarks are well designed, your page will be not only nice but also useful. Daniel.
Re: rakudo-current loop 2-3 orders of magnitude slower than perl 5? (Benchmarking Tool?)
Joshua Gatcomb wrote: I know these benchmarks have their value, but I am more interested in real practical code that I have previously written to solve a problem. I know that the Rakudo code will be slower than the perl 5. The point of the benchmark is not oh look, it's slower than Perl 5. The benchmarks are good for testing a specific aspect of the language, so it is easier to isolate *where* the problem is. This is harder on a real application. Benchmarks help you see where the biggest gains are to be found. Additionally, they help measure improvement. When Patrick fixed the bug with the ++ operator, the K-Nucleotide benchmark went from being the slowest (2000x slower than P5) to being the fastest (200x slower). In fact, I would expect it to be slower by a consistent factor unless there is some aspect of that program with a major optimization flaw. And your expectation would be wrong. In the real world some things are faster than others. Remember the 80/20 rule. Benchmarks help you locate the 20% of the code that needs the most attention. As of this moment I have four benchmarks written, and each benchmark gives wildly different factors. I am interested in a tool that can benchmark both perl 5 and perl 6 natively. If you write such a tool, I'd like to try it. Daniel.
Re: rakudo-current loop 2-3 orders of magnitude slower than perl 5? (Benchmarking Tool?)
Joshua Gatcomb wrote: I think you are confusing profiling with benchmarking. Profiling helps you identify where a problem is. Benchmarking helps you compare two different versions of the same routine. Whatever. I have a series of programs that test the speed of various aspects of the language and these programs are useful for finding the places where the most gains are to be found. Picking at one word does not alter the value of these programs versus writing a practical application like you suggested. Only true profiling will find it but if I can show 30 programs where Rakudo consistently performs 3 to 5 times slower than perl 5 and one program that is 30 times slower - which one do you think @Patrick will be interested in? I look forward to seeing your profiling code. The approach I am looking at looks at a wider cross section of the language where you would expect things to even out. I look forward to seeing your code. Daniel.
Submission for Perl 6 examples
Hello, I thought it would be a good idea to take the benchmarks from the Debian language shootout and port them to Perl 6. That would test several aspects of the language and later in the future they could be useful locate performance problems. I have only done *one* benchmark so far. The regex-dna benchmarks. You use regexes to analyze DNA code. Currently Rakudo is very slow at it, but that's not surprising at this stage. http://daniel.carrera.bz/_2009/perl/shootout-perl6-2009.05.27.tgz Cheers, Daniel.
Re: Submission for Perl 6 examples
Daniel Carrera wrote: http://daniel.carrera.bz/_2009/perl/shootout-perl6-2009.05.27.tgz To run the benchmark: perl6 regex-dna.p6.pl regex-dna.input On my computer it takes about 99s to run on Rakudo, compared to 0.18s for Perl 5 (the Perl 5 benchmark is included in the .tgz file). Cheers, Daniel.