From e80dddbcf373cf93ef09d197e7cbbfb78322cfe7 Mon Sep 17 00:00:00 2001 From: lee Date: Thu, 27 Jun 2019 10:34:48 +0100 Subject: [PATCH 1/3] fixing the main and some sintax errors --- subjects/listremoveif.en.md | 45 ++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/subjects/listremoveif.en.md b/subjects/listremoveif.en.md index b27311ed5..e0c2ca77d 100644 --- a/subjects/listremoveif.en.md +++ b/subjects/listremoveif.en.md @@ -4,24 +4,22 @@ Write a function `ListRemoveIf` that removes all elements that are equal to the `data_ref` introduced in the argument of the function. -- In case the list is empty print the message `no data on list`. - -- Use pointers wen ever you can. +- In case the list is empty print the message present a new line `\n`. ### Expected function and structure ```go -type node struct { +type NodeL struct { data interface{} - next *node + next *NodeL } -type list struct { - head *node - tail *node +type List struct { + Head *NodeL + Tail *NodeL } -func ListRemoveIf(l *list, data_ref interface{}) { +func ListRemoveIf(l *List, data_ref interface{}) { } ``` @@ -35,33 +33,28 @@ package main import ( "fmt" + piscine ".." ) -func PrintList(l *list) { - m := l.head - for m != nil { - fmt.Print(m.data, " -> ") - m = m.next +func PrintList(l *piscine.List) { + it := l.Head + for it != nil { + fmt.Print(it.Data, " -> ") + it = it.Next } - fmt.Print(l.tail) - fmt.Println() + fmt.Print(nil, "\n") } func main() { - link := &list{} - link2 := &list{} - link3 := &list{} - - fmt.Println("------answer-----") - ListRemoveIf(link3, 1) - fmt.Println() + link := &piscine.List{} + link2 := &piscine.List{} fmt.Println("----normal state----") piscine.ListPushBack(link2, 1) PrintList(link2) - ListRemoveIf(link2, 1) + piscine.ListRemoveIf(link2, 1) fmt.Println("------answer-----") PrintList(link) fmt.Println() @@ -80,7 +73,7 @@ func main() { piscine.ListPushBack(link, 1) PrintList(link) - ListRemoveIf(link, 1) + piscine.ListRemoveIf(link, 1) fmt.Println("------answer-----") PrintList(link) } @@ -93,7 +86,7 @@ And its output : student@ubuntu:~/piscine/test$ go build student@ubuntu:~/piscine/test$ ./test ------answer----- -no data on list + ----normal state---- 1 -> From 876a35b84221371731b0db8ce299655a7c3aa831 Mon Sep 17 00:00:00 2001 From: LEEDASILVA <39002521+LEEDASILVA@users.noreply.github.com> Date: Thu, 27 Jun 2019 10:38:48 +0100 Subject: [PATCH 2/3] Update listremoveif.en.md --- subjects/listremoveif.en.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/subjects/listremoveif.en.md b/subjects/listremoveif.en.md index e0c2ca77d..c02d57389 100644 --- a/subjects/listremoveif.en.md +++ b/subjects/listremoveif.en.md @@ -4,8 +4,6 @@ Write a function `ListRemoveIf` that removes all elements that are equal to the `data_ref` introduced in the argument of the function. -- In case the list is empty print the message present a new line `\n`. - ### Expected function and structure ```go @@ -87,7 +85,6 @@ student@ubuntu:~/piscine/test$ go build student@ubuntu:~/piscine/test$ ./test ------answer----- - ----normal state---- 1 -> ------answer----- From a42e9540390eb8fa4b568706cf25cc595e7aeeb6 Mon Sep 17 00:00:00 2001 From: LEEDASILVA <39002521+LEEDASILVA@users.noreply.github.com> Date: Thu, 27 Jun 2019 10:39:49 +0100 Subject: [PATCH 3/3] Update listremoveif.en.md --- subjects/listremoveif.en.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/subjects/listremoveif.en.md b/subjects/listremoveif.en.md index c02d57389..24f692cb5 100644 --- a/subjects/listremoveif.en.md +++ b/subjects/listremoveif.en.md @@ -83,8 +83,6 @@ And its output : ```console student@ubuntu:~/piscine/test$ go build student@ubuntu:~/piscine/test$ ./test -------answer----- - ----normal state---- 1 -> ------answer-----