[plt-scheme] meaning of "->" in proc name

From: troels knak-nielsen (troelskn at gmail.com)
Date: Tue Sep 30 08:10:19 EDT 2008

Also, in case you didn't know already, an arrow is used in math to
describe a transformation (A function). So you may see notations such
as `a b -> c`, meaning "A function that takes two input values of type
a and b, and returns one value of type c". So picture->painter isn't
just a name - it's also a description of its signature.

One really cool thing about plt-scheme, is that you can declare
contracts, which are like interfaces, but for functions. The syntax
for declaring a contract uses a symbol with the name `->`. So you
could see a contract like this:

    (provide/contract [foo (-> integer? string? Integer?)] )

Which should read as: The function, named `foo`, has the signature
`integer string -> integer`.

This may all be very basic stuff, but being new to Scheme myself, this
is something I've just recently picked up.

--
troels

On Tue, Sep 30, 2008 at 12:23 PM, Fred G. Martin <fredm at cs.uml.edu> wrote:
> Hey all,
> Is there any operational significance to "->" in a procedure name
> (e..g, picture->painter, round->exact)?
> I am guessing it is merely a cultural standard to indicate a proc that does
> type conversion, similar to the use of ? in predicates?
> Fred
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>


Posted on the users mailing list.