CO545 Spring Term 2018–19 Assessment 2This 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 specsThis assessment uses the type and spec declarations described in the terminal class 4 worksheet.MacrosWe 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, here’s 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 tCO545留学生作业代做、代写LINELEN作业、代做Java,Python语言作业、c/c++,Java程序作业代写 he 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 …Simon Thompson 10, 11 February 2019Marking schemeMarks 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 Marksget_word/1 10drop_word/1 10drop_wsp/1 5words/1 10get_line/2 10drop_line/2 10lines/1 10check/1 5show_line_right/1 10replicate/2 5print_line_right/1 5show_doc_right/1 5print_doc_right/1 5转自:http://ass.3daixie.com/2019022234825213.html
讲解:CO545、LINELEN、Java,Python、c/c++,JavaDatabase|Databas
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。