Coding style best practices (was: Re: [plt-scheme] Scheme program to serve files over HTTP)

From: Amit Saha (lists.amitsaha at gmail.com)
Date: Tue Jul 28 12:42:00 EDT 2009

Hello Noel, all:


Noel Welsh wrote:
> Some notes:

Thanks a lot for the comments.

> 

</snip>

> - In larger programs you'll want to record types in comments.  E.g.:
> 
> ;; serve : Integer -> (-> Void)
> (define (serve port-no)
>   (define listener (tcp-listen port-no 5 #t))
>   (define (loop)
>     (accept-and-handle listener)
>     (loop))
>   (define t (thread loop))
>   (lambda ()
>     (kill-thread t)
>     (tcp-close listener)))
> 

serve : Integer -> (-> Void)

So this indicates a procedure by the name 'serve' taking a Integer 
parameter and a 'Void' return type? However, here I am returning a 
procedure, right ?

Also, how would I specify more than one parameter? like serve : Integer, 
Integer-> (-> Void)

Is there such a styling guide available on the web?

Thanks again.

Best,
-Amit

-- 
email: amitsaha.in at gmail.com
Journal: http://amitksaha.wordpress.com
µ-blog: http://twitter.com/amitsaha
IRC: cornucopic on #scheme, #lisp, #math, #linux


Posted on the users mailing list.