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
@Gabrielgtx
Gabrielgtx / PKGBUILD duolingo
Last active November 6, 2021 17:54
Unofficial release of Duolingo for Linux / Learn languages by playing a game. It's 100% free, fun, and scientifically proven to work. / https://www.duolingo.com/
pkgname=duolingo
pkgver=0.3.1
pkgrel=1
pkgdesc="Unofficial release of Duolingo for Linux / Learn languages by playing a game. It's 100% free, fun, and scientifically proven to work."
url="https://www.duolingo.com/"
arch=('x86_64')
license=('custom')
install=duolingo.install
source=("https://github.com/mikethedj4/duolingo-linux/raw/master/${pkgname}-linux.tar.gz"
"duolingo.desktop")
@claymcleod
claymcleod / pycurses.py
Last active April 28, 2025 17:11
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@bishboria
bishboria / springer-free-maths-books.md
Last active May 10, 2025 04:28
Springer made a bunch of books available for free, these were the direct links
@jonschlinkert
jonschlinkert / markdown-toc_repeated-headings.md
Created December 15, 2015 19:42
Example table of contents generated by markdown-toc, correctly links repeated headings.
@xlab
xlab / bytes_split.go
Last active April 4, 2022 17:21
Golang split byte slice in chunks sized by limit
func split(buf []byte, lim int) [][]byte {
var chunk []byte
chunks := make([][]byte, 0, len(buf)/lim+1)
for len(buf) >= lim {
chunk, buf = buf[:lim], buf[lim:]
chunks = append(chunks, chunk)
}
if len(buf) > 0 {
chunks = append(chunks, buf[:len(buf)])
}
@m0neysha
m0neysha / pylist-to-markdown.py
Last active August 15, 2024 18:36
Python lists to markdown table
def make_markdown_table(array):
""" Input: Python list with rows of table as lists
First element as header.
Output: String to put into a .md file
Ex Input:
[["Name", "Age", "Height"],
["Jake", 20, 5'10],
["Mary", 21, 5'7]]
@yurydelendik
yurydelendik / !wasmllvm.md
Last active December 7, 2024 18:08
Using WebAssembly in LLVM

NOTE: the content is out-of-date. All development is moved to the https://github.com/yurydelendik/wasmception

Using WebAssembly in LLVM

Compiling

# locations, e.g.
export WORKDIR=~/llvmwasm; mkdir -p $WORKDIR
export INSTALLDIR=$WORKDIR
@jthmiranda
jthmiranda / unmaskdocker.sh
Created September 29, 2015 19:15
to enable again when docker daemon is masked... yet don't know why happen
# when you try to start docker
# sudo systemctl start docker
# and the output is: Failed to start docker.service: Unit docker.service is masked.
#
#
# ls -la /etc/systemd/system | grep docker
# see for /dev/null if there is
systemctl unmask docker.service
systemctl unmask docker.socket
systemctl start docker.service
@brookhong
brookhong / wf.txt
Last active April 19, 2023 13:24
Top 2000 Vocabulary Words
the 9243 (definite article,adverb)
of 5220 (preposition,auxiliary verb)
and 5196 (conjunction)
to 4951 (preposition,adverb)
a 4506 (indefinite article,noun,preposition)
in 2822 (preposition,adverb)
is 2699 (verb)
you 2041 (pronoun,noun)
are 1843 (verb)
for 1752 (preposition,conjunction)