juan_gandhi: (VP)
2013-10-08 01:44 pm

вот так вот пишу нынче

  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: (VP)
2013-10-07 08:41 am

programming masterpiece

(from [livejournal.com profile] code_wtf)

In JavaScript, calculate the sum of integers in a nested array.

i.toSource().replace(/\[|\]/g, '').split(', ').forEach(function(a){if(a.match(/^\d$/)) s -= -a})