init reader for lists

This commit is contained in:
2025-11-04 07:04:49 -10:00
parent f279d7c90a
commit 5200dfde00
4 changed files with 123 additions and 16 deletions
+10
View File
@@ -29,6 +29,9 @@ func (this *List) Conj(val any) *List {
}
func Conj(this *List, val any) *List {
if this == nil {
return New(val)
}
new_head := New(val)
new_head.next = this
return new_head
@@ -46,6 +49,9 @@ func (this *List) Rest() *List {
}
func First(this *List) any {
if this == nil {
return nil
}
return this.Value
}
@@ -53,6 +59,10 @@ func (this *List) First() any {
return First(this)
}
func IsEmpty(this *List) bool {
return this == nil
}
func String(this *List) string {
if this == nil {
return "{}"