add Cons and IListify all the things
All checks were successful
Go / test (push) Successful in 3s

This commit is contained in:
Adam Jeniski 2025-11-04 18:39:07 -10:00
parent d573528f3b
commit bfb8a2b0d8

View File

@ -35,17 +35,22 @@ func Empty() IList {
var emptyList = Empty()
func New(val any) *List {
func New(val any) IList {
this := new(List)
this.Value = val
this.next = emptyList
return this
}
func Cons(val any, rest IList) IList {
this := new(List)
this.Value = val
this.next = rest
return this
}
func (this *List) Conj(val any) IList {
new_head := New(val)
new_head.next = this
return new_head
return Cons(val, this)
}