Here are 3 powerful higher-order functions (functions that take other functions as input):
Map
performs a function on each item in a list and outputs a list, which you first saw in Using Lists to Write Vowel?
.Keep
chooses specific items and outputs a list, which you first saw in Developing a Block That Makes Plurals.Combine
calls a combining function (a function with two inputs) across all items in the set and outputs an object that may be a number, string, or list, depending on the combiner, which you may have seen in Script Variable Projects.Every character you type is encoded by the computer as a number. Unicode assigns a number to every letter that can be typed in any language, as well as to special characters, such as !, @, #, ö, λ, ♣, and the space bar.
encode (message)
that takes an input message (a sentence), tears it into letter-sized chunks, gets the unicode, adds 1 to each letter, and reports the encoded message.decode (message)
block to reverse encode (message)
.mod
to make the letters of the alphabet loop around to the beginning. You will need to take into account that A is 65.encode (message) by (offset)
block that takes an input message and an offset value, gets the unicode of the message, adds the offset to each letter, and outputs the encoded message.decode (message) by (offset)
block that takes an input message and an offset value and reverse encode (message) by (offset)
.An acronym is a "word" made up of the first letters of every capitalized word in a phrase. For example, the acronym for United States of America is USA, and SUNY is an acronym for State University of New York.
In this project, you will create a reporter block that takes a phrase as input and reports an acronym made only from the capitalized words. It should work like this:
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. OR, you could keep
only the words that begin with capitals and then use map
to create a list containing only the first letters of those words.
"This company spends more money on the big bosses than on the people who do the work," says Alyssa one day. Is she right? Write an expression to compute the total salaries of everyone paid less than $100,000 per year. Then find the total for everyone paid more than $100,000 per year.
AC: I can imagine kids getting confused because the chart doesn't contain integers > 70.
Mary: The idea of the chart is fine (although it kind of defeats the purpose of FYTD #1) but I think the headings on this chart are confusing. It's not the characters that are ASCII; it's the numeric code. Really the columns should be swapped and the headings should be "Character" and "Unicode value." This also eliminates having to raise the unnecessary confusion of ASCII vs. Unicode. --bh