Starting from:
$30

$24

Programming Languages Homework #0 Solution

Hand-in Policy:




• Source codes must be uploaded to Moodle with a compressed format.

File name must be studentID.(rar/zip)

• No late submissions will be accepted.

• Your submission must contain 3 source code files. Name of them must be exactly studentID_part#.lisp. (Example: 181045999_part1.lisp)




Collaboration Policy: No collaboration is permitted. Any cheating (copying someone else's work in any form) will result in a grade of -100 for the first offense and -200 for the subsequent attempts.




Grading: Each homework will be graded on the scale 100. Unless otherwise noted, the questions/parts will be weighed equal.




--------------------------------------------------------------------------

-




This homework is about Common Lisp programming practice. Thus, you must write all the following parts in Common Lisp. You can write as many auxiliary functions as you want.




General Restriction: All your functions must be recursive. In other words, you are not allowed to use iteration.










Part 1: You must write a function called list-leveller. List-leveller function takes a (nested) list as an input and converts the input (nested) list to a list which does not contain any list(s).










Part 2: You must write a function called merge-list. Merge-list function takes two lists as inputs and merges the lists. Output must be a list.




Part 2 Restriction: You are not allowed to use append function for this part.










Part 3: Write a function called insert-n which takes a list, a number and an index as inputs, then inserts the number to the specified index in the list. Note that the i-th value in original list should not be overwritten.

More products