develooper Front page | perl.perl6.language | Postings from March 2012

Re: N-dimensional arrays and compiler support

Thread Previous | Thread Next
From:
Stefan O'Rear
Date:
March 22, 2012 21:04
Subject:
Re: N-dimensional arrays and compiler support
Message ID:
20120323040447.GA806@localhost.localdomain
On Thu, Mar 22, 2012 at 11:14:54PM +0100, Daniel Carrera wrote:
> Hey,
>
> I have a few slightly related questions:
>
> 1. The semicolon operator would allow Perl 6 to support N-dimensional
> arrays... How would one iterate over that type of array?
> 
> my num @matrix[ 10 ; 10 ; 10 ];
>
> I ask because a natural extension is to add arithmetic operators and
> you have the beginnings of a Matlab-like array language.

I've started trying to implement S09 things this month, and this is
actually one of the big questions that came up for me.  I raised it
on IRC earlier (which is much more active than p6l, fwiw) and I don't
think we actually arrived at a definite answer.

There are three obvious choices for what 'for @matrix { }' means:

* Iterate over slices that fix the leftmost index

* Iterate over all elements in lexicographic order

* Die

I'm currently thinking of the first, because it allows
(map {$_}, @matrix)[0] to mean the same thing as @matrix[0].  But it's
likely there are other nice considerations.

> 2. Do you think Rakudo is likely to get support for N-dimensional
> arrays in... say... the next year or so?

No comment.  If pmichaud stays alive and well, anything is possible.

> 3. Does anyone here know much about Niecza? Can you compare it with
> Rakudo? I am already familiar with the feature support page
> (http://perl6.org/compilers/features) so I am leaving the question
> intentionally vague. I'd be interested in anything that you think is
> interesting (e.g. speed, development style, progress, whatever).

"For some reason it's much less suprising; I almost never have to guess
what niecza will do with a given piece of code."

Seriously, relative to Rakudo:

Performance: Uses less memory, compiles comparably fast, used to
be much faster at runtime but the gap has narrowed considerably.

Platform: Rakudo/Parrot requires a system with a C89 compiler and a
sufficiently 386-like processor (in particular, it wants a flat address
space and equal size code and data pointers).  Niecza requires a CLR
implementation (developed on Mono, tested on Microsoft .NET).

Rakudo can use C libraries, Niecza can use CLR libraries.

Features: Idiosyncratic variance.  Niecza is still generally ahead on
regex support and a few other odds and ends.  Rakudo currently has the
edge on macros, list behavior, native types, the MOP, and working
libraries.

> Cheers,
> Daniel.

-Stefan



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About