This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Exercises from "Introduction to programming with shift and reset" by Kenichi Asai and Oleg Kiselyov | |
http://pllab.is.ocha.ac.jp/~asai/cw2011tutorial/main-e.pdf *) | |
(* Exercise 1: Identify the next expression to be evaluated, its type, and result type of the continuation. | |
(1) 5 * (2 * 3 + 3 * 4) | |
next expression to be evaluated is [2 * 3], type is int, continuation result is int | |
(2) (if 2 = 3 then "hello" else "hi") ^ " world" | |
next expression [2 = 3], type bool, continuation result type string | |
(3) fst (let x = 1 + 2 in (x, x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# faking pass-by-reference in R by manipulating environments | |
swap <- function(x, y) { | |
xname <- deparse(substitute(x)) | |
yname <- deparse(substitute(y)) | |
xval <- x | |
yval <- y | |
# dynamic scope is more useful so can't use parent.env(environment()) | |
parent <- parent.frame() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module M : | |
sig | |
type smaller = [ `X ] | |
type larger = [ `X | `Y ] | |
type 'a t | |
val with_smaller : (smaller t -> 'a) -> 'a | |
val with_larger : (larger t -> 'a) -> 'a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Assuming new features are supposed to be pushed to origin/master. | |
Aims: | |
* keep history simple (linear if possible, but make it easy to see | |
multi-commit features) | |
* use pull requests for review (but person making request is responsible | |
for merging/pushing) | |
* try to minimize branch shuffling during the process | |
1) Make sure you are up to date: |