Skip to content

Instantly share code, notes, and snippets.

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
@huydx
huydx / nvim.conf
Created January 12, 2018 13:47
~/.config/nvim/init.vim
call plug#begin('~/.vim/bundle')
" must
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
let b:commandDepends = ['Unite', 'UniteWithBufferDir',
\ 'VimFilerCurrentDir', 'VimFilerBufferDir']
Plug 'Shougo/unite.vim', {'on': b:commandDepends, 'for': ['unite']}
\ | Plug 'Shougo/vimfiler', {'on': b:commandDepends}
Plug 'tpope/vim-commentary' " use gcc to comment line, gc to comment capture
# Path to your oh-my-zsh installation.
export ZSH=/Users/jp20992/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="jnrowe"
# Uncomment the following line to use case-sensitive completion.
//go:noescape
//go:linkname memhash runtime.memhash
func memhash(p unsafe.Pointer, h, s uintptr) uintptr
type stringStruct struct {
str unsafe.Pointer
len int
}
// MemHash is the hash function used by go map, it utilizes available hardware instructions(behaves
@huydx
huydx / wordle_solver.go
Created January 28, 2022 14:23
wordle_solver.go
package main
import (
"bufio"
"fmt"
"github.com/umpc/go-sortedmap/desc"
"log"
"math/rand"
"os"
"strconv"