Starting from:

$30

Programming Languages Homework #0 Solution

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