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
import Data.List | |
import Data.Maybe | |
import Data.Char | |
import qualified Data.Map as Map | |
import qualified Data.Set as Set | |
type Var = Char | |
sets :: [[Var]] | |
sets = [ ['i', 'R', 'T', 'r'], |
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
import std.stdio, std.net.curl, std.algorithm, std.range, std.array, std.string, std.typecons, std.conv, std.math; | |
enum choco_xml = "choco.xml"; | |
struct TagReader { | |
string data, start, end, cur; | |
bool empty() { return data is null; } | |
string front() { return cur; } | |
TagReader popFront() | |
{ | |
if (findSkip(data, start)) { |
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; | |
import std.stdio, std.range, std.algorithm, std.conv, std.typecons, std.math; | |
auto primeSpiralPixels() | |
{ | |
auto primesSoFar = [2]; | |
int color(int x) { | |
foreach(prime; primesSoFar.until!(p => p > sqrt(cast(float)x))) | |
if (0 == x % prime) return 255; | |
primesSoFar ~= x; |
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 "stdafx.h" | |
#include <vector> | |
#include <stdio.h> | |
#include <atlcoll.h> | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
std::vector<int> data; | |
data.resize(10000000); | |
FILE *f = fopen("ints.dat", "rb"); |
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 readAndMeasure(K)(size_t num, string fname) { | |
auto data = cast(K[]) std.file.read(fname); | |
enforce(data.length == num); | |
auto h = new RHHash!(K,int); | |
measure("# " ~ typeof(h).stringof ~ ".make_histo", (){ | |
foreach(x; data) | |
h[x]++; | |
}); | |
measure("# " ~ typeof(h).stringof ~ ".read_histo", (){ | |
int v = 0; |
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
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace mangolian | |
{ | |
struct Pair<A, B> | |
{ | |
public A fst; | |
public B snd; |
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; | |
import std.stdio, std.range, std.algorithm, std.string, std.typecons; | |
enum W = 3; | |
enum H = 5; | |
char[W][H][10] symbols = [["111", "101", "101", "101", "111"], ["110", "010", "010", "010", "111"], | |
["111", "001", "111", "100", "111"], ["111", "001", "111", "001", "111"], ["101", "101", "111", "001", "001"], | |
["111", "100", "111", "001", "111"], ["111", "100", "111", "101", "111"], ["111", "001", "011", "010", "010"], | |
["111", "101", "111", "101", "111"], ["111", "101", "111", "001", "111"]]; |
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
line: 1 col: 1 digit: 0 | |
line: 1 col: 5 digit: 1 | |
line: 1 col: 9 digit: 2 | |
line: 1 col: 13 digit: 3 | |
line: 1 col: 17 digit: 4 | |
line: 1 col: 21 digit: 5 | |
line: 1 col: 25 digit: 6 | |
line: 1 col: 29 digit: 7 | |
line: 1 col: 33 digit: 8 | |
line: 1 col: 37 digit: 9 |
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; | |
import std.stdio, std.range, std.algorithm, std.string, std.typecons; | |
enum W = 3; | |
enum H = 5; | |
char[W][H][10] symbols = [["111", "101", "101", "101", "111"], ["110", "010", "010", "010", "111"], | |
["111", "001", "111", "100", "111"], ["111", "001", "111", "001", "111"], ["101", "101", "111", "001", "001"], | |
["111", "100", "111", "001", "111"], ["111", "100", "111", "101", "111"], ["111", "001", "011", "010", "010"], | |
["111", "101", "111", "101", "111"], ["111", "101", "111", "001", "111"]]; |
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
import Data.List | |
import Control.Monad.ST | |
import Control.Monad | |
import Data.Array.ST | |
import Data.Array.Unboxed | |
data Exp = IfGt Int Int Block Block -- if a[i] > a[j] then blk1 else blk2 | |
| Swap Int Int -- a[i] <-> a[j] (i,j < 8) | |
| Copy Int Int -- a[i] <- a[j] (i > 7) | |
deriving Show |
OlderNewer