Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Latest commit

 

History

History
17 lines (9 loc) · 1.25 KB

File metadata and controls

17 lines (9 loc) · 1.25 KB

It's Around Here Somewhere

In this lab, you will implement several custom blocks performing variants of sequential search.

You There?

  1. Write your own version of the SNAP "contains" block, which takes a list and a value as arguments and reports true if the value is anywhere in the list and reports false otherwise. You should NOT use the existing "contains" block in your implementation.

Where?

  1. Write a custom block called "index of" that takes a list and a value as arguments and reports the index at which the value is found in the list, if it is there. If the value is not present anywhere in the list, report -1. So, for example, if the list is (2, 3, 5, 7, 11) and the value is 5, "index of" should report 3. If the list is (2, 3, 5, 7, 11) and the value is 4, "index of" should report -1.

Tell Me More

  1. Write a custom block called "first e-word" that takes a list as an argument and reports the first word in the list that starts with the letter 'e'. If no such word exists, report a blank (nothing).

  2. BONUS: Write a custom block called "first word that starts with" that takes a list and a letter as arguments, and reports the first word in the list that starts with the given letter. If no such word exists, report a blank (nothing).