This file contains hidden or 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
/* | |
The SKI combinator calculus in D's type system | |
Inspired by https://michid.wordpress.com/2010/01/29/scala-alias-level-encoding-of-the-ski-calculus/ | |
*/ | |
interface Term { | |
alias ap(X: Term) = Term; | |
alias eval = Term; | |
} |
This file contains hidden or 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
// ¬P | |
bool not(bool p) { | |
return !p; | |
} | |
// P ∧Q | |
bool and(bool p, bool q) { | |
return p && q; | |
} |
This file contains hidden or 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.range, | |
std.stdio, | |
std.file; | |
void main(string[] args) { | |
args = args[1..$]; | |
if (!args.length) { | |
writeln("usage : ./hexr files..."); | |
} |
This file contains hidden or 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
//N-Queen Solver with backtracking in D | |
import std.algorithm, | |
std.range, | |
std.stdio, | |
std.conv; | |
enum N = 8; | |
string rep(string ptn, size_t n) { | |
string ret; |
This file contains hidden or 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/ld: /usr/lib/libphobos2.a(exception_223_55a.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC | |
/usr/bin/ld: /usr/lib/libphobos2.a(exception_224_3b4.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC | |
/usr/bin/ld: /usr/lib/libphobos2.a(exception_227_4a2.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC | |
/usr/bin/ld: /usr/lib/libphobos2.a(exception_229_5cc.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC | |
/usr/bin/ld: /usr/lib/libphobos2.a(aApply_4d7_3be.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC | |
/usr/bin/ld: /usr/lib/libphobos2.a(dmain2_626_47b.o): relocation R_X86_64_32 against symbol `_D6object9Thro |
This file contains hidden or 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
/* | |
Minimal Queue data structure Implementation in D | |
Copyright (c) 2016 alphaKAI | |
This software is released under the MIT License. | |
*/ | |
import core.memory; | |
struct Node(T) { |
This file contains hidden or 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
/** | |
* The associative array that an order was guaranteed. | |
* | |
* Whythis library was necessary: | |
* D's Associative Array has a (critical) trouble: | |
* int[string] foo = [ | |
* "abc" : 123, | |
* "k" : 3874, | |
* "abcdef" : 0]; | |
* foreach (key, value; foo) { |
This file contains hidden or 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
enum ExprType { | |
Number, | |
Add, | |
Sub, | |
Mul, | |
Div, | |
Variable | |
} | |
alias Environment = double[string]; |
This file contains hidden or 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 tinyBase64Encoder | |
open System | |
open System.Collections.Generic | |
// Declare fundamental functions | |
// Convert binary string into decimal | |
let binToDec binStr = Convert.ToInt32 (binStr, 2) | |
// Convert decimal into binary string |
This file contains hidden or 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.algorithm, | |
std.string, | |
std.ascii, | |
std.range, | |
std.conv; | |
import std.stdio; | |
R delegate(Args) Z(R, Args...)(R delegate(R delegate(Args), Args) f){ | |
return (Args args) => f(Z(f), args); | |
} |