diff options
| author | Joel Martin <github@martintribe.org> | 2014-10-04 23:40:43 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-10-04 23:40:43 -0500 |
| commit | 9feb2c9527294d82592bf35b97f8039f61bbec45 (patch) | |
| tree | ad98f49352e56fe439b43385c4612aa337c1c095 /go/src/types | |
| parent | 8b8afefc458810da516272d679b5a9de1f0daa17 (diff) | |
| download | mal-9feb2c9527294d82592bf35b97f8039f61bbec45.tar.gz mal-9feb2c9527294d82592bf35b97f8039f61bbec45.zip | |
go: add step3_env
Diffstat (limited to 'go/src/types')
| -rw-r--r-- | go/src/types/types.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/go/src/types/types.go b/go/src/types/types.go index 9fcc78c..2eacaaf 100644 --- a/go/src/types/types.go +++ b/go/src/types/types.go @@ -1,5 +1,9 @@ package types +import ( + "errors" +) + //type Error interface { // error //} @@ -43,6 +47,14 @@ func Vector_Q(obj MalType) bool { } } +func GetSlice(seq MalType) ([]MalType, error) { + switch obj := seq.(type) { + case List: return obj.Val, nil + case Vector: return obj.Val, nil + default: return nil, errors.New("GetSlice called on non-sequence") + } +} + // Hash Maps func Hash_Map_Q(obj MalType) bool { switch obj.(type) { |
