Jul. 21st, 2010

juan_gandhi: (Default)
If you ask me where I first heard about functional programming, it was from [livejournal.com profile] sguez, and it was about year 1984.

So there.

I had no clue what it was; all our code was in Fortran, and the functionalness was that, thanks to certain features of Fortran compiler, we could write a one-liner that scans a file looking for certain records and returning those records.

And so it goes.

It was fun.
juan_gandhi: (Default)
  def product[X, T[_] <: Iterable[_]](xss:T[Set[X]]): Set[T[X]] =
      if (xss.isEmpty) {
        Set(T())
      } else {
        product(xss.first, xss.tail) map cat
      }


Not sure if it'll work. What happens here, we take type T, which is at least an Iterable, and build a product of T of sets; so it will be a set of Ts (kind of like monadic transformer, no? To me, it is a commutator), Set.T -> T.S; what I need from T is an empty constructor and a cat.

Will see.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

June 2025

S M T W T F S
1 2345 6 7
8 9 10 11 121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 16th, 2025 11:16 am
Powered by Dreamwidth Studios