Skip to content

Instantly share code, notes, and snippets.

import strutils
type
TThing = ref object
data: int
children: seq[TThing]
proc `$`(t: TThing): string =
result = "($1, $2)" % @[$t.data, join(map(t.children, proc(th: TThing): string = $th), ", ")]
type
TNode_S = ptr object
id: int
child_l: TNode_S
child_r: TNode_S
var
counter = 0
wurzel: TNode_S = nil
@acolley
acolley / gist:7370453
Last active December 27, 2015 18:29
C Struct in Nimrod
type
Node_S = object
child_l: ptr Node_S
@acolley
acolley / gist:7368951
Created November 8, 2013 10:09
Compile this and occasionally get a compiler segfault.
import os
import re
import sequtils
import strutils
import tables
import typetraits
type
EDocoptLanguageError = object of E_Base
@acolley
acolley / gist:7356220
Created November 7, 2013 15:12
Compiler issues "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" when compiling this code.
type
TThing = ref object
method something(t: TThing): string:
result = "thingy"