Skip to content

Commit b02ddfd

Browse files
committed
More cleanup.
1 parent 01f86d3 commit b02ddfd

23 files changed

+239
-680
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
NAME=ell
22
PKG=github.com/boynton/$(NAME)
33
CMD=$(PKG)/cmd/$(NAME)
4-
VERSION="v1.0.0"
4+
VERSION="v2.0.0"
55
all:
66
go build -ldflags "-X $(PKG).Version=`git describe --tag`" -o bin/$(NAME) $(CMD)
77

data/boolean.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
type Boolean struct {

data/notation.go renamed to data/elldn.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
import(

data/error.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
import(

data/instance.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
import(

data/list.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
import(

data/number.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
import(

data/string.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
import(

data/struct.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
import(

data/symbol.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
import(

data/type.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
var NullType = primitiveType("<null>")

data/value.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
type Value interface {

data/vector.go

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Copyright 2021 Lee Boynton
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
116
package data
217

318
import(

list.go

+1-36
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package ell
1818

1919
import (
20-
. "github.com/boynton/ell/data" // -> "github.com/boynton/data"
20+
. "github.com/boynton/ell/data"
2121
)
2222

2323
// Car - return the first object in a list
@@ -94,41 +94,6 @@ func ListEqual(l1 Value, l2 Value) bool {
9494
return false
9595
}
9696

97-
/*
98-
func listToString(lst *Object) string {
99-
var buf bytes.Buffer
100-
if lst != EmptyList && lst.cdr != EmptyList && Cddr(lst) == EmptyList {
101-
if lst.car == QuoteSymbol {
102-
buf.WriteString("'")
103-
buf.WriteString(Cadr(lst).String())
104-
return buf.String()
105-
} else if lst.car == QuasiquoteSymbol {
106-
buf.WriteString("`")
107-
buf.WriteString(Cadr(lst).String())
108-
return buf.String()
109-
} else if lst.car == UnquoteSymbol {
110-
buf.WriteString("~")
111-
buf.WriteString(Cadr(lst).String())
112-
return buf.String()
113-
} else if lst.car == UnquoteSymbolSplicing {
114-
buf.WriteString("~")
115-
buf.WriteString(Cadr(lst).String())
116-
return buf.String()
117-
}
118-
}
119-
buf.WriteString("(")
120-
delim := ""
121-
for lst != EmptyList {
122-
buf.WriteString(delim)
123-
delim = " "
124-
buf.WriteString(lst.car.String())
125-
lst = lst.cdr
126-
}
127-
buf.WriteString(")")
128-
return buf.String()
129-
}
130-
*/
131-
13297
func ListLength(o Value) int {
13398
if lst, ok := o.(*List); ok {
13499
return lst.Length()

net.go

-7
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,6 @@ func NewConnection(con net.Conn, endpoint string) Value {
236236
Out: outchan,
237237
Con: con,
238238
}
239-
/* connection := new(Object)
240-
connection.Type = TcpConnectionType
241-
s, _ := Struct([]Value{Intern("input:"), inchan, Intern("output:"), outchan, Intern("name:"), String(name)})
242-
connection.car = s
243-
connection.Value = con
244-
return connection
245-
*/
246239
}
247240

248241
func closeConnection(obj Value) {

notation.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"strconv"
2828
"strings"
2929

30-
. "github.com/boynton/ell/data" // -> "github.com/boynton/data"
30+
. "github.com/boynton/ell/data"
3131
)
3232

3333
// IsDirectoryReadable - return true of the directory is readable

number.go

+26-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"math/rand"
2222
"strconv"
2323

24-
. "github.com/boynton/ell/data" // -> "github.com/boynton/data"
24+
. "github.com/boynton/ell/data"
2525
)
2626

2727
// Zero is the Ell 0 value
@@ -158,3 +158,28 @@ func RandomList(size int, min float64, max float64) *List {
158158
}
159159
return result
160160
}
161+
162+
// IntValue - return native int value of the object
163+
func IntValue(obj Value) int {
164+
if p, ok := obj.(*Number); ok {
165+
return int(p.Value)
166+
}
167+
return 0
168+
}
169+
170+
// Int64Value - return native int64 value of the object
171+
func Int64Value(obj Value) int64 {
172+
if p, ok := obj.(*Number); ok {
173+
return int64(p.Value)
174+
}
175+
return 0
176+
}
177+
178+
// Float64Value - return native float64 value of the object
179+
func Float64Value(obj Value) float64 {
180+
if p, ok := obj.(*Number); ok {
181+
return p.Value
182+
}
183+
return 0
184+
}
185+

0 commit comments

Comments
 (0)