Pure Functional Programming GroupBy
me: I write pure FP, yeah! users .groupBy(_.age) .view .mapValues(l => l.map(_.iq).sum / l.length) groupBy def groupBy[K, A, C](f: A => K): immutable.Map[K, C] = { val n = mutable.Map.empty[K, Builder[A, C]] val it = iterator while (it.hasNext) { val elem = it.next() val key = f(elem) val bldr = n.getOrElseUpdate(key, newSpecificBuilder) bldr += elem } var result = immutable.HashMap.empty[K, C] var mapIt = n.iterator while (mapIt.hasNext) { val (k, v) = mapIt.next() result = result.updated(k, v.result()) } result }
A man in formal clothing appears overwhelmed beneath a claim of writing pure functional programming code. The joke contrasts elegant-looking functional syntax with the complicated, imperative implementation hidden underneath, making it a reaction to overconfident programming claims or unexpectedly messy abstractions. EN: A man in formal clothing appears overwhelmed beneath a claim of writing pure functional programming code. The joke contrasts elegant-looking functional syntax with the complicated, imperative implementation hidden underneath, making it a reaction to overconfident programming claims or unexpectedly messy abstractions.
man in a suit / мужчина в костюмеwine glass / бокал винаwooden chair / деревянный стулornate interior / украшенный интерьерclassical painting / классическая картинаcode editor screenshot / скриншот редактора кодаScala code / код на Scalawhite background / белый фонblack text / чёрный текстbeard / бородаhand gesture / жест рукой
#functional programming#функциональное программирование#pure fp#чистый функциональный стиль#scala#скала#groupby#группировка#programming#программирование#coding#кодинг#developer#разработчик#overwhelmed#подавленность#ironic#ирония#reaction#реакция#programmer meme#мем программиста#code meme#мем про код#screenshot#скриншот
- @profunctor_io / 5234 2020-09-01
- @right_wing_dev_squads / 8370 2023-12-23
- Template
- Leonardo DiCaprio laughing and crying reaction
- Type
- image
- Size
- 500×632 · 53.5 KiB
- Mood
- sarcastic, overwhelmed
- Language
- en
- Added