Skip to content

Commit

Permalink
More cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
boynton committed May 1, 2021
1 parent 01f86d3 commit b02ddfd
Show file tree
Hide file tree
Showing 23 changed files with 239 additions and 680 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NAME=ell
PKG=github.com/boynton/$(NAME)
CMD=$(PKG)/cmd/$(NAME)
VERSION="v1.0.0"
VERSION="v2.0.0"
all:
go build -ldflags "-X $(PKG).Version=`git describe --tag`" -o bin/$(NAME) $(CMD)

Expand Down
15 changes: 15 additions & 0 deletions data/boolean.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

type Boolean struct {
Expand Down
15 changes: 15 additions & 0 deletions data/notation.go → data/elldn.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

import(
Expand Down
15 changes: 15 additions & 0 deletions data/error.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

import(
Expand Down
15 changes: 15 additions & 0 deletions data/instance.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

import(
Expand Down
15 changes: 15 additions & 0 deletions data/list.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

import(
Expand Down
15 changes: 15 additions & 0 deletions data/number.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

import(
Expand Down
15 changes: 15 additions & 0 deletions data/string.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

import(
Expand Down
15 changes: 15 additions & 0 deletions data/struct.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

import(
Expand Down
15 changes: 15 additions & 0 deletions data/symbol.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

import(
Expand Down
15 changes: 15 additions & 0 deletions data/type.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

var NullType = primitiveType("<null>")
Expand Down
15 changes: 15 additions & 0 deletions data/value.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

type Value interface {
Expand Down
15 changes: 15 additions & 0 deletions data/vector.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
Copyright 2021 Lee Boynton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package data

import(
Expand Down
37 changes: 1 addition & 36 deletions list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package ell

import (
. "github.com/boynton/ell/data" // -> "github.com/boynton/data"
. "github.com/boynton/ell/data"
)

// Car - return the first object in a list
Expand Down Expand Up @@ -94,41 +94,6 @@ func ListEqual(l1 Value, l2 Value) bool {
return false
}

/*
func listToString(lst *Object) string {
var buf bytes.Buffer
if lst != EmptyList && lst.cdr != EmptyList && Cddr(lst) == EmptyList {
if lst.car == QuoteSymbol {
buf.WriteString("'")
buf.WriteString(Cadr(lst).String())
return buf.String()
} else if lst.car == QuasiquoteSymbol {
buf.WriteString("`")
buf.WriteString(Cadr(lst).String())
return buf.String()
} else if lst.car == UnquoteSymbol {
buf.WriteString("~")
buf.WriteString(Cadr(lst).String())
return buf.String()
} else if lst.car == UnquoteSymbolSplicing {
buf.WriteString("~")
buf.WriteString(Cadr(lst).String())
return buf.String()
}
}
buf.WriteString("(")
delim := ""
for lst != EmptyList {
buf.WriteString(delim)
delim = " "
buf.WriteString(lst.car.String())
lst = lst.cdr
}
buf.WriteString(")")
return buf.String()
}
*/

func ListLength(o Value) int {
if lst, ok := o.(*List); ok {
return lst.Length()
Expand Down
7 changes: 0 additions & 7 deletions net.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,6 @@ func NewConnection(con net.Conn, endpoint string) Value {
Out: outchan,
Con: con,
}
/* connection := new(Object)
connection.Type = TcpConnectionType
s, _ := Struct([]Value{Intern("input:"), inchan, Intern("output:"), outchan, Intern("name:"), String(name)})
connection.car = s
connection.Value = con
return connection
*/
}

func closeConnection(obj Value) {
Expand Down
2 changes: 1 addition & 1 deletion notation.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"strconv"
"strings"

. "github.com/boynton/ell/data" // -> "github.com/boynton/data"
. "github.com/boynton/ell/data"
)

// IsDirectoryReadable - return true of the directory is readable
Expand Down
27 changes: 26 additions & 1 deletion number.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"math/rand"
"strconv"

. "github.com/boynton/ell/data" // -> "github.com/boynton/data"
. "github.com/boynton/ell/data"
)

// Zero is the Ell 0 value
Expand Down Expand Up @@ -158,3 +158,28 @@ func RandomList(size int, min float64, max float64) *List {
}
return result
}

// IntValue - return native int value of the object
func IntValue(obj Value) int {
if p, ok := obj.(*Number); ok {
return int(p.Value)
}
return 0
}

// Int64Value - return native int64 value of the object
func Int64Value(obj Value) int64 {
if p, ok := obj.(*Number); ok {
return int64(p.Value)
}
return 0
}

// Float64Value - return native float64 value of the object
func Float64Value(obj Value) float64 {
if p, ok := obj.(*Number); ok {
return p.Value
}
return 0
}

Loading

0 comments on commit b02ddfd

Please sign in to comment.