I hereby claim:
- I am pbackus on github.
- I am snarwin (https://keybase.io/snarwin) on keybase.
- I have a public key ASAnmhPVG2DLs6taF1tK8c4kF24Qfc2wqVN7s-AAa0RJNwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/env dub | |
| /+ dub.sdl: | |
| authors "Paul Backus" | |
| license "MIT" | |
| dependency "sumtype" version="~>0.8.0" | |
| +/ | |
| import sumtype; | |
| alias Cell = SumType!(string, This[]); |
| module example; | |
| import extension; | |
| import lib; | |
| // Can extend types from other modules | |
| bool empty(A a) { return false; } | |
| char front(A a) { return 'a'; } | |
| void popFront(A a) {} |
| module brainfuck; | |
| /// Brainfuck memory | |
| struct Memory | |
| { | |
| private ubyte[] data; | |
| private void extendTo(size_t i) | |
| { | |
| if (i >= data.length) data.length = i + 1; |
| Field | Value |
|---|---|
| DIP: | 1035 |
| Review Count: | 1 |
| Author: | Dennis Korpel [email protected] |
| Implementation: | |
| Status: | Post-Community 1 |
| DC = gdc | |
| COMPILE.d = $(DC) $(DFLAGS) $(TARGET_ARCH) -c | |
| LINK.d = $(DC) $(DFLAGS) $(TARGET_ARCH) | |
| .d: | |
| $(LINK.d) $^ $(LOADLIBES) $(LDLIBS) -o $@ | |
| .d.o: | |
| $(COMPILE.d) $(OUTPUT_OPTION) $< |
| module tail_unqual; | |
| import std.traits: isPointer; | |
| import std.stdint: uintptr_t; | |
| private union HiddenPointer | |
| { | |
| // Stores a pointer, cast to an integer. | |
| uintptr_t address; |
| struct Ref(T) | |
| { | |
| T* ptr; | |
| ref inout(T) deref() inout | |
| { | |
| return *ptr; | |
| } | |
| alias deref this; | |
| } |
| /// map over a variadic argument list | |
| template mapArgs(alias fun) | |
| { | |
| auto mapArgs(Args...)(auto ref Args args) | |
| { | |
| import std.typecons: tuple; | |
| import core.lifetime: forward; | |
| import std.meta: Map = staticMap; | |
| auto ref mapArg(alias arg)() |
| // Mixin to generate a new identifier that won't repeat within a scope | |
| enum gensym(string prefix = "_gensym") = | |
| `"` ~ prefix ~ `" ~ __traits(identifier, {})["__lambda".length .. $]`; | |
| // Works multiple times on the same line | |
| unittest | |
| { | |
| enum sym1 = mixin(gensym!()); enum sym2 = mixin(gensym!()); | |
| static assert(sym1 != sym2); | |