|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
Thoughts on scala.Zero, and algebraic structures in the scala librarySpotted this in the recent scala additions:
http://lampsvn.epfl.ch/trac/scala/changeset/19291/scala/trunk/src/library/scala/Zero.scala My thoughts: - To call something a 'Zero' on a particular type, doesn't make much sense (and isn't much use) without the context of a (typically associative) binary operation on that set which it's a zero of - 'Identity' is a better term than 'zero' in this general context, in particular it may be a left identity or a right identity or both - There's a name for sets with an identity and an associative binary operation - a Monoid - Monoids would actually be pretty useful to have in the library, and I think each of these implicit Zero instances should rather be a Monoid instance, supplying the binary operation as well as its identity Found an example of a monoid class (and implicit monoids) mentioned here: http://www.scala-lang.org/node/114 So yeah, just wondering what the rationale here was, and more generally, what the philosophy is about modelling algebraic structures in the scala library. Personally I'd love to see a really well-engineered set of classes for algebraic structures made available, and it pains me a bit to see odds and ends of mathematical structure done in the library in a rather ad- hoc way which could be quite hard to make really consistent / coherent further down the road once everyone's relying on them. This is what happened with haskell, which is rather a sad tale. There are a few alternative Preludes available for haskell now which 'do it right', but at the cost of replacing the core of the standard library everyone else is using. Happy to help out here if anyone feels code would speak louder than words :) -Matt |
|
|
Re: Thoughts on scala.Zero, and algebraic structures in the scala libraryOn Wed, Nov 04, 2009 at 01:58:05AM +0000, Matthew Willson wrote: > Spotted this in the recent scala additions: You'll be happy to know that as is the rule more than the exception with me lately, I'll be reverting it in the near future. -- Paul Phillips | These are the climbs that apply men's soles. Everyman | Empiricist | pp: i haul pills |----------* http://www.improving.org/paulp/ *---------- |
|
|
Re: Thoughts on scala.Zero, and algebraic structures in the scala libraryOn Wed, Nov 4, 2009 at 12:58 PM, Matthew Willson
<matthew.willson@...> wrote: > So yeah, just wondering what the rationale here was, and more generally, > what the philosophy is about modelling algebraic structures in the scala > library. > > Personally I'd love to see a really well-engineered set of classes for > algebraic structures made available, and it pains me a bit to see odds and > ends of mathematical structure done in the library in a rather ad-hoc way > which could be quite hard to make really consistent / coherent further down > the road once everyone's relying on them. I agree with the above. I'd like to see the Scala library design ruthlessly mine Haskell for its ideas and wisdom, especially with respect to algebraic structures. For an example of Haskell Wisdom, see the Typeclassopedia in: http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf -Ben |
|
|
Re: Thoughts on scala.Zero, and algebraic structures in the scala libraryScala 2.8 has some other Type relate to algebraic structures in my opinion, e.g. Fractional, Integral, Numeric ,(Addable ?)..
My scala solutions for Project Euler problems: Click here |
|
|
Re: Thoughts on scala.Zero, and algebraic structures in the scala libraryThe good news is that you can layer these on top of Scala with the Scalaz library. Runar and Tony describe the relationship here, in response to an earlier message from Ben: http://groups.google.com/group/scalaz/browse_thread/thread/b686d161d9e5cd78/35ecff815569a2a1?hl=en&lnk=gst&q=implicit#35ecff815569a2a1
The limited resources of the core team may be better applied to the compiler rather than the contentious task of 'haskell-ification' of the standard lib. -jason On Wed, Nov 4, 2009 at 4:04 AM, Ben Hutchison <brhutchison@...> wrote: I'd like to see the Scala library design ruthlessly mine Haskell for |
|
|
Re: Thoughts on scala.Zero, and algebraic structures in the scala libraryThis is all fine and dandy, but how about Money?
On Wed, Nov 4, 2009 at 8:11 AM, Jason Zaugg <jzaugg@...> wrote: The good news is that you can layer these on top of Scala with the Scalaz library. Runar and Tony describe the relationship here, in response to an earlier message from Ben: http://groups.google.com/group/scalaz/browse_thread/thread/b686d161d9e5cd78/35ecff815569a2a1?hl=en&lnk=gst&q=implicit#35ecff815569a2a1 -- Viktor Klang | "A complex system that works is invariably | found to have evolved from a simple system | that worked." - John Gall Blog: klangism.blogspot.com Twttr: viktorklang Code: github.com/viktorklang |
|
|
Re: Thoughts on scala.Zero, and algebraic structures in the scala libraryIf you think Paul was in any way pursuing a "haskell-ification" of anything, I have some bottom land you might be interested in...
AFAIK, the whole purpose of his Zero was being able to generalize the implementation of certain parameterized classes.
On Wed, Nov 4, 2009 at 5:11 AM, Jason Zaugg <jzaugg@...> wrote: The good news is that you can layer these on top of Scala with the Scalaz library. Runar and Tony describe the relationship here, in response to an earlier message from Ben: http://groups.google.com/group/scalaz/browse_thread/thread/b686d161d9e5cd78/35ecff815569a2a1?hl=en&lnk=gst&q=implicit#35ecff815569a2a1 -- Daniel C. Sobral Veni, vidi, veterni. |
|
|
Re: Thoughts on scala.Zero, and algebraic structures in the scala libraryFor the record, I used the term "haskell-ification" in reference to Ben's suggested direction, not in specific reference to the all-to-brief appearance of Zero, of which I was rather fond. :)
-jason On Wed, Nov 4, 2009 at 11:59 AM, Daniel Sobral <dcsobral@...> wrote:
If you think Paul was in any way pursuing a "haskell-ification" of anything, I have some bottom land you might be interested in... |
|
|
Re: Thoughts on scala.Zero, and algebraic structures in the scala library> AFAIK, the whole purpose of his Zero was being able to generalize
> the implementation of certain parameterized classes. Perhaps something like scala.Monoid could fill the same role? a generalised zero is a whole lot more useful if there's a generalised 'plus' to use with it... although: > The limited resources of the core team may be better applied to the > compiler rather than the contentious task of 'haskell-ification' of > the standard lib. Certainly. I wasn't suggesting that the standard library necessarily needs these things in it. Merely that, where the standard library DOES choose to implement algebraic abstractions, it takes some care to get them right, so they can be built upon cleanly by others. In particular I wasn't suggesting borrowing wholesale from haskell - haskell gets quite a few things wrong, eg its 'Num' class. Cheers -Matt |
| Free embeddable forum powered by Nabble | Forum Help |