View counter.html
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Counter</title> | |
<link rel="stylesheet" href="/r/screen.css" media="screen"> | |
<meta name="description" content="An HTML5 counter"> |
View Makefile
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
all: pingcat.c | |
gcc -o pingcat pingcat.c |
View Makefile
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
all: var_len_arrays.c | |
gcc -O1 var_len_arrays.c -S |
View Makefile
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
run: fib | |
./fib | |
fib: fib.ml | |
ocamlfind ocamlopt nums.cmxa fib.ml -o fib |
View mat_mult.ml
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
(** Run: | |
corebuild -pkg core_bench mat_mult.native && sleep 1 && ./mat_mult.native | |
*) | |
open Core.Std | |
open Core_bench.Std | |
module Array_mat = struct | |
type mat3 = float array array | |
type vec3 = float array |
View existential.ml
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
(** Run: | |
coretop existential.ml | |
*) | |
open Core.Std | |
type ('a, 'b) entity = { | |
id : unit -> string; | |
step : 'b -> 'b some_entity; | |
to_string : unit -> string; |
View poly_compare.ml
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
(** A circular doubly-linked list in OCaml. See: | |
https://en.wikipedia.org/wiki/Doubly_linked_list#Circular_doubly-linked_lists | |
*) | |
module Doubly_linked_list = struct | |
type 'a doubly_linked_node = { | |
data : 'a; | |
mutable prev : 'a doubly_linked_node; | |
mutable next : 'a doubly_linked_node; | |
} |
View PrintfString2.hs
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
{-# LANGUAGE OverloadedStrings, FlexibleInstances, UndecidableInstances #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-type-defaults #-} | |
module Main where | |
import Data.String ( IsString(..) ) | |
-------------------- | |
-- Custom printf that takes '%s' for `Show` values. |
View PrintfString.hs
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
{-# LANGUAGE OverloadedStrings, FlexibleInstances, UndecidableInstances #-} | |
{-# OPTIONS_GHC -fno-warn-orphans #-} | |
import Data.String ( IsString(..) ) | |
import Text.Printf ( PrintfType, printf ) | |
instance (PrintfType a) => IsString a where | |
fromString s = printf s | |
main :: IO () |
View prec.c
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
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
printf("1 << 1 + 2 = %d\n", 1 << 1 + 2); | |
printf("1 << 1 * 3 = %d\n", 1 << 1 * 3); | |
printf("1 << 1 + 1 << 1 = %d\n", 1 << 1 + 1 << 1); | |
return 0; | |
} |
NewerOlder