Question: Help for Racket Write a mutually recursive function named (n-list? obj) that takes one argument, which can be any Racket value. n-list? returns true if

Help for Racket

  1. Write a mutually recursive function named (n-list? obj) that takes one argument, which can be any Racket value. n-list? returns true if and only if obj is an n-list. For example:
     > (n-list? '(2019 2015 2011)) #t > (n-list? '(1 (2 (3 4) 5) 6)) #t > (n-list? '(1 (2 (3 a) 5) 6)) ; oops, there's an 'a #f 
    n-list? should be mutually recursive with the function num-expr?, which returns true if its argument is a number expression and false if not. Even though the argument to this function can be any Racket object, you can still use the definition of n-list to design your function. An n-list must either be an empty list or a pair whose first is a number-expression and whose rest is an n-list. Similarly for number expressions. So your functions must follow the definition in order to tell if their arguments do!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!