lily niall
lily niall

Reputation: 39

Type of lambda expression

I want to ask,if one asks what is the type of lambda expression for this lambda expression,what will be the answer? Is it something like the type of result after completing that lambda expression?

For example : what is the type of lambda expression for this expression

(lambda (s) (string-append s s))

Thanks!

Upvotes: 1

Views: 81

Answers (2)

user7487664
user7487664

Reputation: 24

Scheme is dynamically typed, this object will satisfy the PROCEDURE? predicate but other than that it does not have a type.

Upvotes: 0

molbdnilo
molbdnilo

Reputation: 66451

It is a function with one parameter, so it has the type a -> b for some a and b.

Since it passes s to string-append, s must be a string.
The result of string-append is also a string, so the type is string -> string.

Upvotes: 2

Related Questions