diff options
Diffstat (limited to 'walk/atom.go')
-rw-r--r-- | walk/atom.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/walk/atom.go b/walk/atom.go index dfe5fe4..299c39d 100644 --- a/walk/atom.go +++ b/walk/atom.go @@ -37,6 +37,12 @@ func NewAtomBool(v bool) Atom { } } } +func (v Atom) Bool() bool { + if v.Typ != AtomBool { + panic("Tried to use non-bool as bool") + } + return v.data == 1 +} func NewAtomNumber(v float64) Atom { return Atom { Typ: AtomNumber, @@ -73,6 +79,12 @@ func NewAtomStringRune(v rune) Atom { data: uint64(v), } } +func (v Atom) StringRune() rune { + if v.Typ != AtomStringRune { + panic("Tried to use non-stringrune as stringrune") + } + return rune(v.data) +} func (v Atom) String() string { switch v.Typ { case AtomNull: |