Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show the type of a function

But in Racket, the interpreter does not show the type:

> cadr
#<procedure:cadr>

Is there a way to show the type of a function?

like image 427
SoftTimur Avatar asked Feb 15 '12 15:02

SoftTimur


People also ask

What are the 4 type of a function?

The types of functions can be broadly classified into four types. Based on Element: One to one Function, many to one function, onto function, one to one and onto function, into function.

How do you know what type of function?

In this course we've learned about three types of functions, linear, quadratic and exponential. Linear functions take the form y = m x + b . Quadratic functions take the form y = a x 2 + b x + c . Exponential functions take the form y = a ⋅ b x .


1 Answers

Racket is an untyped language, so there's no equivalent of this information there. However, if you use Typed Racket, a typed dialect of Racket, you'll get exactly this kind of information:

-> string-append
- : (String * -> String)
#<procedure:string-append>
like image 98
Sam Tobin-Hochstadt Avatar answered Oct 26 '22 01:10

Sam Tobin-Hochstadt