I'm guessing that you're using DrRacket. The error reported happens because the teaching language in use doesn't allow to pass a non-list as the second parameter of cons
. Use a list
instead:
(define (polar_to_rectangular h r)
(list
(* (sin (DegreesToRadians h)) r)
(* (cos (DegreesToRadians h)) r)))
Or if you definitely have to use cons
, then in the bottom-left corner of the window select "Determine language from source" and write this line at the beginning of the file:
#lang racket