Skip to content

Instantly share code, notes, and snippets.

View albertnetymk's full-sized avatar

Albert Yang albertnetymk

  • Uppsala, Sweden
View GitHub Profile

Haskell lab

0. Warmup

Hoogle

Hoogle is the search engine for Haskell functions. It supports searching by function names and types.

For example, you plan to use parMap, but forget its type. You could just type parMap in Hoogle, and the search result would look like:

Racket lab

0 Background

General

DrRacket provides rudimentary features for Racket programming, you could experiment them by launch DrRacket directly. Some particularly interesting/useful ones are highlighted here:

Find the max and min of sum of all permutations of [1..9] satisfying the following condition:

    sum
    == a[1] + a[2] + a[3]
    == a[3] + a[4] + a[5]
    == a[5] + a[6] + a[7]
    == a[7] + a[8]
    where sum = a[0] + a[1]
// https://developers.google.com/edu/c++/getting-started
#include <iostream>
#include <cassert>
using namespace std;
static int a, b, c;
int new_sum(int sum, bool& terminated)
{

Region types in G1

Let's introduce the region types used in G1:

eden: for newly added objects from-survivor: for objects in to-survivor from previous young-GC to-survivor: live objects in eden/from-survivor are copied here if they have not lived long old: live objects in eden/from-survivor are copied here if they have lived long