Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
fp:lab01-java-intro [2021/03/11 13:36]
pdmatei
fp:lab01-java-intro [2021/03/11 14:50] (current)
dmihai
Line 3: Line 3:
 ===== 1. A single function to implement all of them ===== ===== 1. A single function to implement all of them =====
  
-1.1. Write a method that takes a list of integers and returns a new list with all elements multiplied by two.+1.1. Write a method that takes a list of **integers** and returns a new list with all elements multiplied by two.
  
-1.2. Write a method that takes a list of doubles and returns a new list with all elements multiplied by two.+1.2. Write a method that takes a list of **doubles** and returns a new list with all elements multiplied by two.
  
 1.3. Write a method that takes a list of integers and returns a new list with all the elements’ successors (i.e. the elements incremented by 1). 1.3. Write a method that takes a list of integers and returns a new list with all the elements’ successors (i.e. the elements incremented by 1).
Line 26: Line 26:
 2.3. Write a method that takes a list of integers and returns a new list containing **even** elements **larger** than 100. 2.3. Write a method that takes a list of integers and returns a new list containing **even** elements **larger** than 100.
  
-2.4. Write a method that takes a list of strings and returns a new list of strings which start with letter ''​B''​.+2.4. Write a method that takes a list of strings and returns a new list of strings which start with letter ''​B'' ​only.
  
 2.5. (!) Write the signature of a generic ''​filter''​ function over lists. 2.5. (!) Write the signature of a generic ''​filter''​ function over lists.
Line 40: Line 40:
 3.3. Write a method that takes a list of integers and returns a string representation of all elements separated by commas, e.g. “1,​2,​3,​4” 3.3. Write a method that takes a list of integers and returns a string representation of all elements separated by commas, e.g. “1,​2,​3,​4”
  
-3.4. Write a method that takes a list of integers ​and another list (of integers) ​and returns ​the concatenation of the second to the first.+3.4. Write a method that takes a list of integers and returns ​their greatest common denominator.
  
 3.5. (Discussion) What is (could be!) common among all implementations?​ How should a ''​fold''​ function **signature** (which generalises over all previous ones) look like? 3.5. (Discussion) What is (could be!) common among all implementations?​ How should a ''​fold''​ function **signature** (which generalises over all previous ones) look like?