import check

def foo(L):
  if L!=[]:
    L[0] = L[0]*2
    new_list = L[1:]
    foo(new_list)
M = [1,2,3]
ignore = foo(M)
print(M)

##Make sure you understand why this code is wrong!
##Draw the pictures!
def multiply_by_incorrect(vals,multiplier):
    if vals != []:
        vals[0] = vals[0] * multiplier
        multiply_by_incorrect(vals[1:], multiplier)


def multiply_by_aide(vals, multiplier,pos):
    if pos <len(vals):
        vals[pos] = vals[pos] * multiplier
        multiply_by_aide(vals,multiplier,pos+1)    

        ## multiply_by(vals, multiplier) consumes a list of integers
        ## and an integer multiplier, produces none and will
        ## mutate vals so that each element is multiplied by
        ## multiplier.
        ## Effects: Mutates the list vals.
        ## multiply_by: (listof Int) Int -> None

def multiply_by(vals, multiplier):
    multiply_by_aide(vals,multiplier,0)

    #L = [3,0,-2,5]
    #check.expect("m=0", multiply_by(L, 0), None)
    #check.expect("m=0(L)", L, [0,0,0,0])
    #L = [3,0,-2,5]
    #check.expect("m=10", multiply_by(L, 10), None)
    #check.expect("m=0(L)", L, [30,0,-20,50])    
    
    
def make_posn(x_coord, y_coord):
    return [x_coord, y_coord]

def posn_x(point):
    return point[0]

def set_posn_x(point, new_x):
    point[0] = new_x
    
##Recall why the order of the conditions
##below is very important!
def is_posn(v):
    return type(v) == type([]) and\
           len(v) == 2 and \
           (type(v[0]) == int or 
            type(v[0]) == float) and \
           (type(v[1]) == int or 
            type(v[1]) == float)           