Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Haskell Task Description- Complete the following coding requirements-.docx

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige

Hier ansehen

1 von 1 Anzeige

Haskell Task Description- Complete the following coding requirements-.docx

Herunterladen, um offline zu lesen

Haskell
Task Description: Complete the following coding requirements.
Complete these activities from the “Haskell – Day 1” self-study.
1-Write a function that takes a list and returns the same list in reverse.
2-Test the reverse list function using a number of lists with different data types and lengths.
Complete these activities from the “Haskell – Day 2” self-study.
3-Write a sort that takes a list and returns a sorted list.
4-Test the sort function using a variety of lists with different lengths.
Solution
I know there\'s a built-in function that does it for me but the requirement is that I only use head , tail , elem and null (No pattern matching either). So my question is: is there a better solution where I only have one function, myreverse, that consumes only one list? (That meets the requirements above, of course)
.

Haskell
Task Description: Complete the following coding requirements.
Complete these activities from the “Haskell – Day 1” self-study.
1-Write a function that takes a list and returns the same list in reverse.
2-Test the reverse list function using a number of lists with different data types and lengths.
Complete these activities from the “Haskell – Day 2” self-study.
3-Write a sort that takes a list and returns a sorted list.
4-Test the sort function using a variety of lists with different lengths.
Solution
I know there\'s a built-in function that does it for me but the requirement is that I only use head , tail , elem and null (No pattern matching either). So my question is: is there a better solution where I only have one function, myreverse, that consumes only one list? (That meets the requirements above, of course)
.

Anzeige
Anzeige

Weitere Verwandte Inhalte

Weitere von rtodd588 (20)

Aktuellste (20)

Anzeige

Haskell Task Description- Complete the following coding requirements-.docx

  1. 1. Haskell Task Description: Complete the following coding requirements. Complete these activities from the “Haskell – Day 1― self-study. 1-Write a function that takes a list and returns the same list in reverse. 2-Test the reverse list function using a number of lists with different data types and lengths. Complete these activities from the “Haskell – Day 2― self-study. 3-Write a sort that takes a list and returns a sorted list. 4-Test the sort function using a variety of lists with different lengths. Solution I know there's a built-in function that does it for me but the requirement is that I only use head , tail , elem and null (No pattern matching either). So my question is: is there a better solution where I only have one function, myreverse, that consumes only one list? (That meets the requirements above, of course)

×