Lengkap

ML Palindrome Checker

Background

A palindrome is a sequence that reads the same forwards and backwards. For example “1234321” is a number palindrome, but “123456” is not. Examples of word palindromes include “wow” and “Hannah”. Phrases are generally considered palindromes when punctuation and spacing is ignored, such as “Madam, I’m Adam”,

“A man, a plan, a canal – Panama!” and “Able was I ere I saw Elba.”

+++++

Overview:

Write an ML program that determines if a string is a palindrome.

Specifics:

1. The only predefined ML functions that you are allowed to use are explode, chr, and ord. Otherwise, you need to write your own functions.

2. You may not use ML iterative functions such as for or while. (You may use @, ::, if-the-else and recursive function calls.)

3. You are required to write a function named is_palindrome that takes a string as the argument and returns Boolean true if the string is a palindrome, and false if it is not. The user can include any spacing, capitalization, and punctuation they wish – your program just analyzes whether the alphabetic characters constitute a palindrome. For example, give the function call is_palindrome “A man, a plan, a canal – Panama!” your function should evaluate to true. For the function call is_palindrome “ML is the best language!” your function should evaluate to false.

4. Please see the tips below for suggestions.

Style:

For full credit, you must follow the programming style requirements for this class:

• Include a header comment containing your name, the date, the name of the program, and the purpose of the program.

• Comment sections of your code in enough detail for another programmer to understand what you are doing. (Generally, commenting what each separate task is doing is sufficient.)

• Comment each function, describing the purpose of the function. This usually means that you will describe each argument of a function, and what the function evaluates to.

• There should be no “match non-exhaustive” warnings, except in really special cases where it does not make logical sense to make exhaustive matches (ask me if you are uncertain). A Poly Equal warning is acceptable, but no other warnings are allowed.

• In addition, for recursive functions you need to include a comment pointing out which is the base case and which is the recursive case.

Tips:

1. At the beginning of your file, it may be useful to define some variables that contain lists and strings. You can then use them for testing your various functions.

2. I recommend that you start out by writing helper functions to perform useful tasks (but these are not required -- you can solve this in a different way if you wish, within the problem constraints):

a. my_reverse: reverses a list (without using the built-in ML function reverse). The function call

my_reverse [#”a”, #”b”, #”c”]

should evaluate to

[#”c”, #”b”, #”a”]

b. removeNonAlphabetic: given a list of characters, this function returns a list where all non-letter characters have been removed. In other words, it deletes spaces, commas, other punctuation marks, and numbers. The function call

removeNonAlphabetic [#”A”, #” “, #”b”, #”!”]

should return

[#”A”, #”b”].

Note that this is equivalent to the function call

removeNonAlphabetic(explode “A b!”).

c. changeToLowercase: given a list of characters, this function returns a list where all uppercase letters have been converted to lowercase letters. Hint: The ML functions ord and chr could be useful here, as would the knowledge of the ASCII values for A and a. The function call

changeToLowercase [#”a”, #”A”]

should return

[#”a”, #”a”]

d. getLast: given a list, this function returns the last item in the list. A function call

getLast [1,2,3,4]

should return

4

e. removeLast: given a list, this function returns a list with the last item removed. A function call

removeLast [1,2,3,4]

should return

[1,2,3]

Kemahiran: Keselamatan Komputer, Pengaturcaraan

Lihat lagi: palindrome function, palindrome string, palindrome checker javascript, palindrome algorithm pseudocode, palindrome words, sml palindrome, palindrome algorithm, palindrome checker c#, jquery expandable sections sortable lists bit html, browse daily expiring lists date, style sheet fit background, photoshop change checker background, photoshop remove checker background, english style checker, twitter style myspace background

Tentang Majikan:
( 0 ulasan ) muncie, United States

ID Projek: #16746262

Dianugerahkan kepada:

xinglong717

Hello, I can do this project for you, I have more than five years of experience and I work daily with these technologies and therefore, I guarantee their expectations. Note: The amount charged is below market value Lagi

$50 USD dalam sehari
(0 Ulasan)
0.0

4 pekerja bebas membida secara purata $29 untuk pekerjaan ini

muhammadawab1293

Dear Client I have experience working in Java and android mobile development i can surely get this project done for you i think you should give me chance Client Satisfaction is my Top Priority I hope i wont disapp Lagi

$25 USD dalam sehari
(4 Ulasan)
2.2
Vibhuti897

Hi Greetings! We are the team of Sage Codeur. We have gone through your requirements and we can do this task. We can assure you for a complete professional work in given time line. Please share complete detail of Lagi

$25 USD dalam sehari
(0 Ulasan)
0.0
$15 USD dalam sehari
(1 Ulasan)
0.2