Getting Started

Remember to Do Pair Programming Swaps
I've been tucking these "Create a new project..." icons into the FYTD as the first list item to do. On this page, it might be particularly worth doing (visually) because there are two icons in a row. Any concerns with doing this in general? --MF
"U3L1-Intro"Create a new project called U3L1-Intro

Write down your observations.

The LIST block block creates a list. Use the left and right arrowheads to vary the number of input slots. Blocks that can be varied in this way are said to have a variadic input.
  1. Find LIST block in the Variables palette and construct LIST block with capitals.

    Describe what it does.

  2. Now describe what these do:
    1. ALL BUT FIRST block
    2. IN FRONT OF block
    3. item (last) of list (Augusta) (Boise) (Columbia) (Des Moines)
    4. Empty LIST block
  3. This artist's conception of a list is how snap displays a list. Each red rectangle is one list item. visual representation of list
    An input slot that looks like rectangle with two smaller orange rectangles inside means that a list value is expected.
  4. What's the difference between item 2 of list block and list with item 2 block?
  5. The red length of block returns the number of items in a list. For example, length (Augusta, Boise) returns 2. What do each of the following return?
    1. length (all but first (Augusta, Boise, Columbia))
    2. length (blank, Augusta, blank, blank, Boise, blank)
    3. length (empty list)
  6. Compare:
    1. say list block
    2. say any item block
    3. say (item (pick random 1 to 3) of list (Augusta) (Boise) (Columbia) (Des Moines)
    4. Import Tools
    5. say for each block
  Set Up Your Headphones or Speakers
  1. Compare:
    1. Import Tools
I suggest breaking here. The above is enough for a GS. --MF
Alphie and Betsy are trying to build a block to generate a list of whole numbers from n down to 1.
Alphie: I used a script variable and kept shoving a new number at the beginning of the list using for.
Image needs to be zoom block size 1.5. --MF
countdown using a for-loop
Betsy: Let's try it!
They take it out for a spin.
Alphie: Oh. Not what I expected...
  1. Fix Alphie and Betsy's countdown script so that it does what it's supposed to do.
Now Is a Good Time to Save
Gamal joins the group and looks over Alphie's shoulder.
Gamal: Wow, it would never have occurred to me to write it that way! You want countdown (5) to report the list {5, 4, 3, 2, 1}. But countdown (4) is {4, 3, 2, 1}, so all you have to do is stick a 5 in front:
Why is this countdown block a different color than the one just above? --MF
define countdown (n): if n=0 report empty list, otherwise report (n) in front of (countdown (n-1))
Talk with Your Partner
  1. Gamal's description of his algorithm didn't mention the if in his code. What would happen if he left that part out? Why?