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
type tree = | |
T of int * child list | |
and | |
child = unit -> tree | |
let rec mktree n = | |
let f i = fun () -> mktree i in | |
(T (n, [f (n * 2); f (n * 3); f (n * 5)])) | |
let less (T(v1, _)) (T(v2, _)) = v1 < v2 |
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
\linespace{\section{見出し}} % 自動で何行取るのか計算される | |
\linespace[3]{\section{見出し}} % 何行取るか手動で入れる |
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 perl | |
use strict; | |
use warnings; | |
use utf8; | |
use CGI; | |
use CGI::Carp qw(fatalsToBrowser); | |
use File::Copy; |
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
type cam_value = | |
| CAM_IntVal of int | |
| CAM_BoolVal of bool | |
| CAM_ClosVal of cam_code * cam_env | |
and cam_stack = cam_value list | |
and cam_env = cam_value list | |
and cam_instr = | |
| CAM_Ldi of int | |
| CAM_Ldb of bool | |
| CAM_Access of int |
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
\documentclass{standalone} | |
\usepackage{etex} | |
\usepackage{metalogo} | |
\usepackage{tikz} | |
\def\pTeX{p\TeX} | |
\def\epTeX{$\varepsilon$-\pTeX} | |
\def\upTeX{u\pTeX} | |
\def\eupTeX{$\varepsilon$-\upTeX} | |
\def\pdfTeX{\lower 2pt\hbox{pdf}\TeX} |
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
\makeatletter | |
\def\code{% | |
\@ifnextchar{|}% | |
{\code@sect}% | |
{\code@inline}% | |
} | |
\def\code@inline#1{% | |
\lstinline[style=ocaml, basicstyle=\small\tt, keywordstyle=\small\sl, columns={fullflexible,keepspaces}, mathescape]|#1| } |
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
(function () { | |
function textareaMap (lhs, rhs) { | |
let noremap = true, | |
silent = true, | |
urls = void 0; | |
rhs = mappings._expandLeader(rhs); | |
mappings.addUserMap( | |
[modes.TEXTAREA], |
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
void CalcLambertModel(float outColor[3], const float ViewDir[3], const float Normal[3]) | |
{ | |
float cos = Vec3Dot(g_LightDir, Normal) / ( Vec3Norm(g_LightDir) * Vec3Norm(Normal) ); | |
Vec3Set(outColor, | |
g_AmbientColor[0] + g_LightColor[0] * g_DiffuseColor[0] * cos, | |
g_AmbientColor[1] + g_LightColor[1] * g_DiffuseColor[1] * cos, | |
g_AmbientColor[2] + g_LightColor[2] * g_DiffuseColor[2] * cos); | |
} |
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
use strict; | |
use warnings; | |
my $l = <STDIN>; | |
chomp $l; | |
my ($item_num, $campaign_num) = split / /, $l; | |
my @items; | |
for (1..$item_num) { |
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
std::array<int, 5> a = {1, 2, 3, 4, 5}; | |
std::array<char, 5> b = {'a', 'b', 'c', 'd', 'e'}; | |
// 前に作ったzip | |
auto z1 = zip<5>(a, b); | |
// map | |
auto z2 = map<5>( | |
[](int x, char y) -> std::tuple<int, char> { | |
return std::make_tuple(x, y); |