In HASKELL
Write a function that will delete leading white space from a string.
cutWhitespace [" x","y"," z"]
ans: ["x","y","z"]
You are allowed to use any higher order function/List Comprehension(if you want to use) to solve this problem.
removeLeadingWhiteSpace (x:xs) cutSpace arr = map removeLeadingWhiteSpace arr |
In HASKELL Write a function that will delete leading white space from a string. cutWhitespace ["...
Haskell Programming 2. Returns the plural of a word by adding "s' unless the word ends in "y", in which can you remove the "y" and add "ies" 3. Write a function that takes two lists and returns a list of only those elements that appear in both lists. 4. Write a function that takes a list and an element and returns the number of times the element appears in the list. 5. Remove the leading spaces from a string...
Write a function in HASKELL to reverse a string (or list) without using the built-in reverse function. Example: Hello as olleh or [1,3,4,5] as [5,4,3,1].
Haskell Functional Programming Language: Write a function nestedParens that takes a string argument and returns true if it is a nesting of zero or more pairs of parentheses, e.g. "((()))" should return True ; "()()" or "(()))" should return False . Use recursion for this problem. nestedParens :: String -> Bool
All of the problems must be done in Haskell. You may download a local IDE or use [this website.][https://repl.it/languages/haskell]. You are not allowed any functions that trivialize a problem! Here are some examples of lists you can test your solutions on: let list1 = [5, 10, 15, 20, 25, 30] let list2 = [50, 100, 150, 200, 250, 300] Write a function that returns the maximum value in a list. Write a function that returns the nth element in the...
Haskell Define function-divisors that receives a number and returns a list of all divisors of that number.For example, if the input is 20, then the output would be[1,2,4,5,10,20]. You may use list comprehension, list ranges, and function mod for this purpose.Hint:Given numbern, consider all numbers from 1 ton, and then keep only the ones that dividen.
In Haskell: Write a recursive function fibonacci that computes the n-th Fibonacci number. fibonacci :: Int -> Int Write a recursive function myProduct that multiplies all the numbers in a list. myProduct :: [Integer] -> Integer Using the technique of List Comprehension write a function that would remove even numbers from a list of lists. For Example: given input: [[1,2,3,4], [6,3,45,8], [4,9,23,8]] expected output: [[1,3], [3,45],[9,23]]. Show how the library function replicate :: Int -> a-> [a] that produces a...
Write a function in Java Script that accepts a string. The function takes the last digit of the ASCII code and returns a string of digits sorted in ascending order E.G. function("zDbc") returns “2,8,8,9” (z => 122, D=>68, b=>98, c=>99) ....i am not allowed to use any of the built-in functions
Please use Haskell, thank you! For this question, you will implement (under specific constraints) a recursive function in Haskell that takes a list of characters as an argument and returns a list that contains only every third element from the argument list in the same order. As a clarifying example, this function, when passed the argument list “ABCDEFGHIJKLMNO”, should return the list “ CFILO”. It should also be noted that your function must work (i.e., not terminate with an error)...
implement a doubly-linked list in C. Each node in the linked list should contain a string, a pointer to the previous node (or NULL), and a pointer to the next node (or NULL). The nodes should be sorted by their strings. struct node_t { char* str; struct node_t* prev; struct node_t* next; } To maintain the doubly-linked list, you should keep a pointer to the head node of the list (or NULL if the list is empty), and a pointer...
Please solve this problem using Python Write a quicksort method that accept a list of numbers and use list comprehension to construct the method. Note that you need to sort the numbers in descending order . You MUST use List Comprehension to do the sorting Your program should contain the function with format shown as below: def quicksort(a): # Your codes here. Use List Comprehension and return the result.