Skip to content

Instantly share code, notes, and snippets.

@daewon
daewon / gist:5790362
Last active December 18, 2015 13:29
Euler 프로젝트 실습 10번
def isPrime(n: Long) = (2L to math.sqrt(n).toInt).forall(n % _ != 0)
// val sum = (2L to 2000000L).filter(isPrime).sum
val sum = 2 + (3L to 2000000L by 2).filter(isPrime).sum
assert(sum == 142913828922L)
@daewon
daewon / jargon.md
Last active August 29, 2015 14:26 — forked from cb372/jargon.md
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x