13. Lambda Syntax


#1

I'm completely lost on this step. Am I even close? My code is below.

strings = ["leonardo", "donatello", "raphael", "michaelangelo"]
# Write your code below this line!

symbolize = lambda {|x| strings.to_sym}


# Write your code above this line!
symbols = strings.collect(&symbolize)

#2

Very close in fact. but lets dissect this line for a minute:

{|x| strings.to_sym}

"x" is acting as a parameter for "lambda". so instead of strings, put "x" like this:

{|x| x.to_sym}

#3

OMG, I'm kicking myself now. Thanks so much!


#4

I've always had a hard time grasping this concept. How does 'x' know to go thru the strings array being that we haven't referenced strings anywhere in the block | parameter?