[SOLVED] Scheme CO545 Spring Term 201819 Assessment 2

$25

File Name: Scheme_CO545_Spring_Term_201819_Assessment_2.zip
File Size: 414.48 KB

5/5 - (1 vote)

CO545 Spring Term 201819 Assessment 2
This assessment is a text processing case study, and a partial implementation is provided in the file a2.erl.

You should submit your solutions to Moodle in a single Erlang file by 23:55, Monday 25 February.

Types and specs

This assessment uses the type and spec declarations described in the terminal class 4 worksheet.

Macros

We use an Erlang macro to specify the constant line length, LINELEN. When we want to use this we have to write ?LINELEN.

What should the functions do?

While the -spec declarations and comments in the file give you some idea of what the functions should do, heres some more information about some of the definitions that you need to complete.

get_word/1
get_word(St) will take the longest word from the beginning of the string St: that is the longest initial string up to the first whitespace character. There is an example in the file.
drop_word/1
drop_word(St) drops characters from the string St up to the first whitespace character.
drop_wsp/1
drop_wsp(St) drops characters from the string St up to the first non-
whitespace character.
words/1
words(St) splits the string St into a lost of words.
get_line/2
To build a line, take as many words as possible, keeping the total length (including a single inter-word space between adjacent words) below the specified length, which is the second parameter of get_line.
drop_line/2
Drop words corresponding to the line got by get_line.
lines/1
Repeatedly apply get_line and drop_line to turn a lost of words into a list of lines i.e. a list of list of words.

continued over the page

Marking scheme

Marks are awarded for functional correctness. Up to 10% of the marks will be deducted for solutions which are overly complicated, obscure or difficult to read.

While we would encourage you to talk to others about generalities of the work, the work that you submit should be identifiably your own. Please consult the university guidelines on plagiarism for more details.

Function
Marks
get_word/1
10
drop_word/1
10
drop_wsp/1
5
words/1
10
get_line/2
10
drop_line/2
10
lines/1
10
check/1
5
show_line_right/1
10
replicate/2
5
print_line_right/1
5
show_doc_right/1
5
print_doc_right/1
5

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Scheme CO545 Spring Term 201819 Assessment 2
$25