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"> |
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 |
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 |
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 |
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 |
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; |
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; | |
} |
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. |
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 () |
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