Quick actions

cmd+k|ctrl+k

Navigation

Languages

Untitled

Snippet info

Language

Nim

Visibility

unlisted

Author

legacy-anonymous

Created

2017-04-09T08:30:52Z

Updated

2017-04-09T08:30:52Z

type
    BaseNode[T] = ref object of RootObj
        parent: ParentNode[T]
    Leaf[T] = ref object of BaseNode[T]
        content: T
    ParentNode[T] = ref object of BaseNode[T]
        forward: BaseNode[T]
        backward: BaseNode[T]
    Vertical[T] = ref object of ParentNode[T]
    Horizontal[T] = ref object of ParentNode[T]

type
  Color = ref object
    r,g,b: int

var 
    forward = new(Leaf[Color])
    backward = new(Leaf[Color])
    parent = new(Vertical[Color])
forward.content = Color()
backward.content = Color()
parent.forward = forward
forward.parent = parent
parent.backward = backward
backward.parent = parent

echo repr(parent)


echo repr(parent)

INFO