Mar. 29th, 2010

juan_gandhi: (Default)
Кто-нибудь заметил ещё? Плавная такая волна прошла, и ещё, и ещё.
juan_gandhi: (Default)
blogger entry

  trait Functor[X] { 
    def map[Y](f: X => Y): Functor[Y]
  }
  
  def loop[X,Y](f: Functor[X], a: X=>Y) = for (x <- f) yield a(x)


Update: see recent blog entry on monads by Luc Duponchel for a lot more details.

Update: did you get it? for() can be applied to any class that has map(); and, roughly speaking, if you have several variables in your for loop, you will need flatMap (to flatten the result, aka, apply monadic multiplication.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

September 2025

S M T W T F S
 1 2345 6
78 9 10 111213
14151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 12th, 2025 10:36 am
Powered by Dreamwidth Studios