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
(* master *) | |
type 'e expr = [ | |
| `Var of string | |
| `Ctr of string * 'e list | |
] | |
type pure = pure expr | |
let string_of_expr string_of_e = function |
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
Object merge2_(Object ctr, Object hda_, Object tla_) { | |
struct { | |
struct RootsBlock header; | |
Object gcall_cnd; | |
Object gcall_merge2; | |
Object gcall_merge2_1; | |
Object gcall_lss; | |
Object ctr_Cons; | |
Object ctr_Cons_1; | |
Object ctr_Cons_2; |
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 "module_prolog.c" | |
enum { | |
Cons_, | |
F_, | |
N_, | |
Nil_, | |
S_, | |
T_, | |
Z_, |
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 "module_prolog.c" | |
enum { | |
S_, | |
Z_, | |
SllNumofCtrs = 2 | |
}; | |
char const *const constructor_names[] = { | |
"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
Ребята, тут такая история. | |
У меня улучшился (я на это надеюсь) io. | |
И вот в каком смысле. | |
Из соображений производительности внутреннее представление конструкторов было выбрано таким: | |
+--------+------+------+-----+------+ | |
| header | arg1 | arg2 | ... | argN | | |
+--------+------+------+-----+------+ | |
где header имеет вид |
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
#!/usr/bin/env python | |
text = raw_input().split(", Cons(C") | |
text = text[0].split("Cons(C")[1:] + text[1:-1] + text[-1].split(",")[0:1] | |
translated = [] | |
for char in text: | |
if len(char) == 1: | |
translated.append(char) | |
else: | |
translated.append(chr(int(char[1:], 16))) |
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 Main where | |
data Tree a = | |
Empty | |
| Node (Tree a) a (Tree a) | |
treeFromList :: (Ord a) => [a] -> Tree a | |
treeFromList = foldl insert Empty | |
where | |
insert Empty x = Node Empty x Empty |
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
CAMLC = ocamlopt.opt | |
INCLUDE = \ | |
-I ../../src/sll | |
LIBS = \ | |
sll.cmx \ | |
arithm.cmx | |
CAMLC_FLAGS = \ |
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 <iostream> | |
#include <sys/time.h> | |
double now() { | |
timeval tv; | |
gettimeofday(&tv, NULL); | |
return tv.tv_sec * 1.0e6 + tv.tv_usec; | |
} | |
void factorial_helper(long n) { |
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
exception Result of int | |
let factorial n = | |
let rec factorial_helper = function | |
| 0 -> raise (Result 1) | |
| n -> | |
try | |
factorial_helper (n - 1) | |
with Result prev -> raise (Result (prev * n)) | |
in |