|
|
|
@ -17,7 +17,7 @@ type List struct {
|
|
|
|
|
Tail *Node |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func ListPushFront(l *list, data interface{}) { |
|
|
|
|
func ListPushFront(l *List, data interface{}) { |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
@ -29,21 +29,22 @@ Here is a possible [program](TODO-LINK) to test your function :
|
|
|
|
|
package main |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"fmt" |
|
|
|
|
piscine ".." |
|
|
|
|
"fmt" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
|
|
|
|
|
|
link := &list{} |
|
|
|
|
link := &piscine.List{} |
|
|
|
|
|
|
|
|
|
piscine.ListPushFront(link, "Hello") |
|
|
|
|
piscine.ListPushFront(link, "man") |
|
|
|
|
piscine.ListPushFront(link, "how are you") |
|
|
|
|
|
|
|
|
|
for link.head != nil { |
|
|
|
|
fmt.Println(link.head.data) |
|
|
|
|
link.head = link.head.next |
|
|
|
|
it := link.Head |
|
|
|
|
for it != nil { |
|
|
|
|
fmt.Println(it.Data) |
|
|
|
|
it = it.Next |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|