Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
b2gills
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
20 ms
·
121.
▲
by
b2gills
8y ago
Some points of note: Parrot was intended as a more universal VM, and was started before the Perl6 design solidified. So in the end it didn't actually fit that well with Perl6. NQP is a small subset of Perl6 that is used for bootstrappi
122.
▲
by
b2gills
8y ago
You avoided the Python 2.x/3.x problem because Perl6 isn't intended to replace Perl5 in the same way Python3 is intended to replace Python2. Perl6 would replace Perl5 in the same way Go is a replacement for Python. This was perhap
123.
▲
by
b2gills
8y ago
`_-1` is an invalid variable name. The `-` must be followed by an alphabetic character (or `_`) for it to be seen as part of an identifier. So `_-1` is the same as `_ - 1` { my \_ = 4; say _-1; # 3 } { sub
124.
▲
by
b2gills
8y ago
If you want to improve your coding skills you should read “Higher Order Perl”. (made available for free online by the author) If you want to improve your Perl code read “Modern Perl”. (There is more than one version, and I know the first ve
125.
▲
by
b2gills
8y ago
Well Perl is a real language, so of course it makes it more difficult to say “screw it, I'm redoing this in a real language”. That said the Perl that you write in a one-liner should be different than the Perl that you write when the co
126.
▲
by
b2gills
8y ago
Actually Perl6 does enforce it if you tell it to. The following fails to match. 'abc' ~~ m:ratchet/ .* c / The `.*` gobbles everything up, which means there is nothing left for `c` When writing grammars, use `to
127.
▲
by
b2gills
8y ago
Part of the point of this compression algorithm is for the designer to alter the image so that it can be better compressed. So the amount of compression really depends on how much the designer is willing to compromise their vision. I would
128.
▲
by
b2gills
8y ago
That is slightly wrong; `:qq` implies `:q:b:c:s:a:h`, so `qq:s:c` is the same as just `qq`. You probably wanted to use either `q:s:c` or `Q:s:c`. You can turn off features using the exclamation mark `qq:!a`
129.
▲
by
b2gills
8y ago
I would have written the sort differently %bag.sort({ -.value, .key })
130.
▲
by
b2gills
8y ago
As a minor nit, it may be better to use `@list.keys` to get a Sequence of indices. Especially if you want it to work when `@list` is `lazy`.
131.
▲
by
b2gills
8y ago
Indexing into a List sub lookup ( List \xs, Int \index ){…} Make sure the index is valid. sub lookup ( List \xs, Int \index where 0 ..^ xs.elems ){…} The `where` clause gets attached to the `Int` typecheck. --- I think it
132.
▲
by
b2gills
8y ago
It also seems like all of the changes in Python are all changes that Perl5 has done over the years without breaking backwards compatibility. Unfortunately this does mean you often have to opt-in to the new functionality. use v5.24;
133.
▲
by
b2gills
8y ago
You are sort-of right. It should have used a different word. A similar example would be the word `length`. There is no `length` in Perl 6 because it is ambiguous. Instead there is `.elems` and `.chars`. It is perhaps even a worse because th
134.
▲
by
b2gills
8y ago
Right it was late, and I was writing the code in different ways when writing here and writing in the REPL.
135.
▲
by
b2gills
8y ago
Note that there was no need to actually create an infix operator, as you can use any code as an infix operator if you surround it with `[&( )]`. say $filter «[&( -> $l, $r { $l and $r } )]» $source Golfing it down a b
136.
▲
by
b2gills
8y ago
The following doesn't do what you think it does * > 10 && * %% 2 That is two WhateverCode objects which each take one argument. Since both are definite it gives you the second one. my &a = * > 10; m
137.
▲
by
b2gills
8y ago
The critical person behind the Haskell implementation of Perl 6 got ill. It had nothing to do with funding.
138.
▲
by
b2gills
8y ago
You can always add `is ro` trait modifier. multi sub trait_mod:<is> (Attribute:D $attr, :$ro!) { # no need to do anything, because this is the default } class Pointer { has $.x is ro; has $.y is rw
139.
▲
by
b2gills
8y ago
People keep saying that Perl 6 is too late, but they don't say that about other new languages. I mean nobody says the same about Julia, which has been in development for the better part of a decade. The only way it could be too late is
140.
▲
by
b2gills
8y ago
You don't understand what the following means 1 ^..^ 5 It means a Range of values from 1 to 5 excluding 1 and 5. 1 ~~ 1^..^5; # False 5 ~~ 1^..^5; # False 1.000001 ~~ 1^..^5; # True 4.999999 ~~ 1^
141.
▲
by
b2gills
8y ago
Someone once posted Perl 6 code and C/C++ code that were equivalent. They said that the Perl 6 version was faster than the C version. My guess is that the C/C++ was copying strings where MoarVM didn't.
142.
▲
by
b2gills
8y ago
There is a perfectly reasonable (and slightly less than serious) explanation from brrt. https://brrt-to-the-future.blogspot.com/2018/07/perl-6-on-mo... 1. All problems in computer science can be solved with a laye
143.
▲
by
b2gills
8y ago
Perl 6 regexes attempt improve upon this situation by making regexes more like a regular programming language. That is it errs on the side of error detection rather than encoding efficiency. (It also adds features that would be difficult to
144.
▲
by
b2gills
8y ago
The way Perl 6 makes this more manageable is with grammars. (See previous post for an example) Since a grammar is just a special type of class you can put regexes into roles and compose them together. You can even inherit from another gramm
145.
▲
by
b2gills
8y ago
I like the way Perl 6 handles this with the grammar feature. (A grammar is just a special type of class, with a regex as just a special type of method.) It could be simpler, but I want the resulting data structure to be easier to use. g
146.
▲
by
b2gills
8y ago
Someone once posted code that they had written in both Perl 6 and C/C++. The Perl 6 code was shorter, arguably easier to understand, and they said it was also faster for their data. My guess would be that the strings had to be copied m
147.
▲
by
b2gills
8y ago
MoarVM has recently gotten the ability to write optimization plugins in higher level code. This should make it easier to create certain optimizations as they will have access to the syntax tree. So it may be that the rate at which it gets f
148.
▲
by
b2gills
8y ago
It used to have monthly releases. The last release was from more than two years ago. If it isn't dead yet, it certainly is feeling its age. If someone were willing, they are more than welcome to start a fresh Parrot port of Rakudo.
149.
▲
by
b2gills
8y ago
Perl 6 was designed in part to allow PDL (Perl Data Language) type features to be added easily. In fact some things that you would do in PDL have already been added, they just currently aren't as fast as they could be. (1,2,3; 4,
150.
▲
by
b2gills
8y ago
I'm very confident it would not be very good at optimizing Perl 6 code. On the first page of the documentation for libjit is this: “Only a very small proportion of the work is concerned with language specifics.” The thing is t
More ›