CSCI 461 Project Three Write Functions Answered – Standard ML Map, Foldr, Foldl & List Processing

$30.00

Explore Standard ML functional programming through five list-processing functions. Covers custom map implementations, foldr and foldl operations, recursion, character-to-integer conversion, list length calculation, and finding maximum integer values. Delivered as a downloadable ZIP file containing the programming project solution for educational reference.

Original Work ?

Download Details:

  • Name: ProjectThree-lbxs0u.zip
  • Type: zip
  • Size: 57.17 KB

Category: Tags: , , , You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (3 votes)

CSCI 461 Project Three focuses on functional programming in Standard ML (SML) through higher-order functions and list processing. The project explores map, foldr, foldl, recursion, and custom implementations of built-in functions. Students develop five functions involving list mapping, character-to-integer conversion, list length calculation, and finding maximum values in integer lists.

Assignment Description

Objectives:

1. Apply the concepts of folding
2. Apply the concepts of map
3. Implement mymap which works as built-in map function in sml
4. Apply foldr, foldl, and mymap to solve some problem in on line of code

Problem Description:

The student shall turn in five functions. You should use mymap1 and mymap2 in
problem 3, 4, and 5 if it is needed. However, the best way to do so is you use built-in
map to finish problem 3, 4, and 5 first. After they work, replace map with mymap1
or mymap2. If they still work, you can say that you implement them all correctly. If it
doesn’t work, then you now that your mymap1 or mymap2 maybe incorrect.

1. Define a function mymap1 with the same type and behavior as built-in map
function but without using map. This should be one-line of code. Use foldr or
foldl) (refer to problem Exercise 24 on page 147)

2. Define a function mymap2 with the same type and behavior as map. No map,
foldr, or foldl can be used. (refer to problem Exercise 26 on page 147)

3. Write a function ordlist of type char list -> int list that take a list of characters
and returns the list of integer codes of those characters. For example, if you
evaluate ordlist [#”A”, #”b”, #”C”] you should get [65, 98, 67] (refer to
Exercise 2 on page 144)

4. Write a function mylength fo type ‘a list -> int that returns the length of a list.
You cannot use the built-in length function. (refer to Exercise 11 on page
145)

5. Write a function max of type int list -> int that returns the largest element of
a list of integers. Your function need not behave well if the list is empty.

Sample Run:
Please see the screen shot on next page
Due Date:
The file need to be submitted through blackboard link on time. The file name should
be YourNameProjThree.sml. Due date will be announced on blackboard.

Solution Overview

The solution addresses five Standard ML functions: mymap1 using folding, mymap2 without built-in mapping or folding, ordlist for character codes, mylength without built-in length, and max for integer lists. It covers higher-order functions, recursion, and list processing.