juan_gandhi: (Default)
 https://vpatryshev.wordpress.com/2017/01/11/three-popular-fp-myths-2

That's James and Saunders bashing (in a generalized monoidal sense).
juan_gandhi: (Default)
 A finite monoid can be decomposed to a bunch of simple finite groups (afaik, there are 26 kinds of them) and a parallel array of flip-flops.
Since an FSM is basically a monoid, an FSM can be decomposed the same way.

And I wonder, regexes, they can be decomposed/classified the same way.

Anybody here familiar with all this? I just found it.
juan_gandhi: (VP)
People started assuring me that Haskell streams may be empty. Meaning, not a comonad at all.
So, wtf, are they even monads? They also say a list can be infinite; well, any proof that it's still a monad? Not what you get if you build a free monoid (that's what a list is).

Or? Do they mean we actually need σ-algebras?!
juan_gandhi: (VP)
  def retrieveAllPatients(listOfProps: Seq[Props]): Result[Traversable[PatientInfo]] = {
    val listOfMaybePatients = listOfProps.zipWithIndex map (retrievePatientInfo _).tupled
    val maybeListOfPatients = Result.traverse(listOfMaybePatients)
    suspiciousError(s"Now we have all the patients, right?\n$maybeListOfPatients")
    maybeListOfPatients
  }


Шутки шутками, а Патерсон и МакБрайд как бы тут непосредственно вписываются.
Научите меня HoTT, и я у меня в коде будут торсоры и группы когомологий.
Смешно, конечно.
juan_gandhi: (Default)
Explained wtf a closed monoidal category is, then introduced π-calculus, then showed how to interpret π-calculus in monoidal categories, then, using Feynman diagrams, showed isomorphic transformations of concurrent code. Feynman diagrams applied to π-calculus. Not a dog's penis eh.
juan_gandhi: (Default)
В разных там WriterMonad требуется, чтобы внутре был моноид, и возникает иной раз такое ощущение, что и везде нужен моноид. Ан нет, бывает и полугруппы достаточно.

Скажем, Option[T], где Т - полугруппа, можно считать моноидом - к полугруппе присоединяется внешний нуль.

def sum(maybeX; Option[T])(maybeY: Option[T]) = maybeX match {
  case Some(x) => maybeY match {
    case Some(y) => Some(x+y)
    case None    => Some(x) }
  case None => maybeY
}

Так получается, что тот нуль, что был в T раньше, теперь не будет нулём.

Та же фигня и с мапредьюсом - в качестве типа накапливаемых значений берётся полугруппа, а нуль присоединяется внешний.

Это, заодно, ответ на мой старый вопрос - шо за моноид в мапредьюсе. Да вот этот, с присоединённым нулём.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

May 2025

S M T W T F S
    1 2 3
456 7 8 9 10
11 121314151617
18192021222324
25262728293031

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 15th, 2025 02:26 pm
Powered by Dreamwidth Studios