<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/walk
diff options
context:
space:
mode:
Diffstat (limited to 'walk')
-rw-r--r--walk/atom.go12
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: