From c2ebaccdda3af994c67a7bb8e84063737655676e Mon Sep 17 00:00:00 2001 From: Augusto Date: Fri, 21 Jun 2019 11:13:17 +0100 Subject: [PATCH 1/2] fix some sintax errors in the readme proposed function and program --- subjects/listpushfront.en.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/subjects/listpushfront.en.md b/subjects/listpushfront.en.md index 0e1e511b..288e51b7 100644 --- a/subjects/listpushfront.en.md +++ b/subjects/listpushfront.en.md @@ -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 } } ``` From a36cac71759b2d145b7d61fb1a3be1fabdcc7f43 Mon Sep 17 00:00:00 2001 From: Augusto Date: Fri, 21 Jun 2019 16:02:03 +0100 Subject: [PATCH 2/2] change type Node to NodeL --- subjects/listpushfront.en.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subjects/listpushfront.en.md b/subjects/listpushfront.en.md index 288e51b7..35901b23 100644 --- a/subjects/listpushfront.en.md +++ b/subjects/listpushfront.en.md @@ -7,14 +7,14 @@ Write a function `ListPushBack` that inserts a new element `node` at the beginni ### Expected function and structure ```go -type Node struct { +type NodeL struct { Data interface{} - Next *Node + Next *NodeL } type List struct { - Head *Node - Tail *Node + Head *NodeL + Tail *NodeL } func ListPushFront(l *List, data interface{}) {