In this lab you will sort your contact list alphabetically by name.
On this page you will review the technique of recursion.

nested triangle block.
                    Your solution may not be exactly this, but it's probably close:
                
                    A top-level script is one that's in the scripting area, not inside the definition of a block.
An invocation is a use of a block. For example, 
 makes two invocations of +. The verb form is invoke.
nested triangle from a top-level script, how many times does that invocation (not counting invocations within invocations) run the purple block that invokes nested triangle?nested triangle draws the three lines shown in black in the picture below?
                if block in this code? (If you're not sure, you might try editing nested triangle to remove it, and see what happens.)A recursive problem (the thing you're trying to do, not the code to do it) is one in which the desired result includes a smaller version of itself, such as the green (or red or blue) fractal inside the bigger fractal. A recursive procedure (the actual code) is one that calls itself inside its definition. Do you see why a recursive procedure is likely to be a good solution to a recursive problem?
If a recursive procedure calls itself, and that call also calls itself, and that call also calls itself... the result will be an infinite loop, which means that the program will keep running forever (or until it runs out of memory). To avoid that bug, every recursive procedure must have a base case, a simple input for which the procedure can do its job without calling itself. (The base case of nested triangle happens when size ≤ 2; in that case the procedure doesn't have to do anything.)
The general pattern for a recursive command is
![if (base case?) then [do something simple] else [[do something] [recursive call] [do something]]](/bjc-r/img/8-recursive-reporters/rec-command.png)
Compare this with the nested triangle block above. (In that one, the base case is particularly simple: it does nothing at all.) Most recursive commands follow this pattern, except that in certain cases there's more than one recursive call.
It's therefore tempting to try to write a recursive reporter this way:
![if (base case?) then [report something simple] else [[report something] [report recursive call] [report something]]](/bjc-r/img/8-recursive-reporters/bad-rec-reporter.png)
But in fact you can't stack report blocks; once your block reports a value, it's finished. (This is why there's no connection tab at the bottom of the report block.) Instead, you have to use a combiner function to put the pieces together into a single thing to report:
![if (base case?) then [report something simple] else [report (combiner (stuff) (recursive call) (stuff)]](/bjc-r/img/8-recursive-reporters/rec-reporter.png)
The combiner can be any function with the correct range (the kind of value it can return). So if your custom reporter is supposed to return a sentence, the combiner might be join or join words; if it's supposed to return a number, you might use + or ×.
![if (empty slot for test) [report (empty slot for value)] else [report (empty slot for value)]](/bjc-r/img/3-lists/sumof-framework.png)
sum of block with no additional help, do it now.  Otherwise, fill in the three blanks in the definition this way:
                    if block.
) and all the other items (
).
                            
 and 
 are the main selectors for lists.all but first of the list? You really don't need this hint.
 block.  Try these examples:map and keep, combine requires a function with two empty input slots.

                map and keep, combine is mostly used with one of only these six functions in its first input slot:
 
 
 
 
 would be ambiguous.
                    sum of using combine.
map.
                    
, which makes a new list with one new item in front of an existing list.
                    
 
 (pronounced "sentence to list"). It lets you break a string at every space and convert the string to a list of words. It's in the Tools library.unicode of block will be helpful here.map to generate a new list containing only the first letters of the words in your input list, and then keep only those that are capital letters.keep only the words that begin with capitals and then use map to create a list containing only the first letters of those words.