-
Completed at: 2023-03-21T09:11:02.516Z
-
Completed languages: javascript
-
Tags: Lists, Filtering, Data Structures, Fundamentals
-
Rank: 7 kyu
In this kata you will create a function that takes a list of non-negative integers and strings and returns a new list with the strings filtered out.
filter_list([1,2,'a','b']) == [1,2]
filter_list([1,'a','b',0,15]) == [1,0,15]
filter_list([1,2,'aasf','1','123',123]) == [1,2,123]
ListFilterer.GetIntegersFromList(new List<object>(){1, 2, "a", "b"}) => {1, 2}
ListFilterer.GetIntegersFromList(new List<object>(){1, "a", "b", 0, 15}) => {1, 0, 15}
ListFilterer.GetIntegersFromList(new List<object>(){1, 2, "a", "b", "aasf", "1", "123", 123}) => {1, 2, 231}
{ 1 2 "a" "b" } filter-seq ! { 1 2 }
{ 1 "a" "b" 0 15 } filter-seq ! { 1 0 15 }
{ 1 2 "aasf" "1" "123" 123 } filter-seq ! { 1 2 123 }
Kata.filterList(List.of(1, 2, "a", "b")) => List.of(1,2)
Kata.filterList(List.of(1, "a", "b", 0, 15)) => List.of(1,0,15)
Kata.filterList(List.of(1, 2, "a", "b", "aasf", "1", "123", 123)) => List.of(1, 2, 123)
filterList(List(1, 2, "a", "b")) == List(1, 2)
filterList(List(1, "a", "b", 0, 15)) == List(1, 0, 15)
filterList(List(1, 2, "aasf", "1", "123", 123)) == List(1, 2, 123)
filterList(ListOf(1, 2, "a", "b")) == [1, 2]
filterList(ListOf(1, "a", "b", 0, 15)) == [1, 0, 15]
filterList(ListOf(1, 2, "a", "b", "aasf", "1", "123", 123)) == [1, 2, 123]