Skip to content

Instantly share code, notes, and snippets.

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 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
Found: master for ujjwalkarn/Machine-Learning-Tutorials — machine learning and deep learning tutorials, articles and other resources — 93⭐️ — last updated today
🔎 Checking 476 links
⚪ http://karpathy.github.io/
⚪ http://colah.github.io/
⚪ http://andland.github.io/
⚪ http://karpathy.github.io/neuralnets/
⚪ https://apaszke.github.io/torch-internals.html
⚪ http://colah.github.io/posts/2014-07-NLP-RNNs-Representations/
⚪ http://karpathy.github.io/2015/05/21/rnn-effectiveness/
⚪ http://svail.github.io/
/*
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.stream
import java.io.{BufferedWriter, File, FileInputStream, FileWriter}
import java.nio.ByteBuffer
import java.util.concurrent.{ArrayBlockingQueue, TimeUnit}
@vy
vy / AllPairsShortestPath.scala
Created February 28, 2013 12:57
Floyd-Warshall all-pairs-shortest-path algorithm in Scala.
/**
* Returns shortest paths between all pairs using Floyd-Warshall algorithm.
* Nodes are assumed to be enumerated without any holes and enumeration
* starts from 0.
*
* @param nodes the set of vertices
* @param links the map of edges with costs
* @return shortest paths between all pairs, including the source and destination
*/
def allPairsShortestPath(nodes: Set[Int], links: Map[Int, Set[Int]]): Map[Int, Map[Int, Seq[Int]]] = {