Newbie Question about Seq.Projection

View: New views
2 Messages — Rating Filter:   Alert me  

Newbie Question about Seq.Projection

by Brett Morgan :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

I'm wandering through the library source code to start getting a feel
for scala, and i'm trying to puzzle my way through Seq.

I'm staring at a definition of a trait, specifically

trait Projection[+A] extends Seq[A] with Iterable.Projection[A]

and i'm trying to understand what Projection means in this context.
I'm assuming it's a FP thing?

brett

Re: Newbie Question about Seq.Projection

by Arrgh :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Brett Morgan wrote:

> I'm wandering through the library source code to start getting a feel
> for scala, and i'm trying to puzzle my way through Seq.
>
> I'm staring at a definition of a trait, specifically
>
> trait Projection[+A] extends Seq[A] with Iterable.Projection[A]
>
> and i'm trying to understand what Projection means in this context.
> I'm assuming it's a FP thing?
>  
http://en.wikipedia.org/wiki/Projection_%28mathematics%29 is a bit
opaque (at least to me), but in layman's terms I understand a projection
to be a view of a collection that offers some subset of it.

For example, in SQL, when you say "select foo, bar from table" you're
getting  a projection of the table containing a subset of its columns.  
Similarly, a projection of a List is a view of some subset (not
necessarily a proper subset) of the list.

-0xe1a