create sqrt function in racket
问题 I tried to create a sqrt+ function, which will get a list of numbers and return a list of numbers. Can anyone tell me what's wrong with the function? #lang pl 03 (: sqrt+ : (Listof Number) -> (Listof Number)) ;; a version of `sqrt' that takes a list of numbers, and return a list ;; with twice the elements, holding the two roots of each of the inputs; ;; throws an error if any input is negative. (define (sqrt+ ns) (cond [(null? ns) 0] [(< (first ns) 0) (error 'ns "`sqrt' requires a nonnegative