From: "gabriele renzi" <[EMAIL PROTECTED]>:
Looks fine to me. Do you experience problems running it?

no, it works like a charm, but since I don't really know (Alice|S)ML I was
wondering if there was an obvious fallacy that I could not spot, say, a
better way to declare the function or writing the case expression or
whatever. Thanks again.

The only minor thing I see is that the let seems overkill, i.e. here is how I would write it:

fun serve (socket, host, port) =
   (case Socket.inputLine socket of
      | SOME line => print line
      | NONE      => ();
    Socket.close socket)

You could also use higher-order functions to avoid the case:

fun serve (socket, host, port) =
   (Option.app print (Socket.inputLine socket);
    Socket.close socket)

It's probably a matter of taste whether you consider that more readable.

- Andreas


_______________________________________________
alice-users mailing list
[email protected]
http://www.ps.uni-sb.de/mailman/listinfo/alice-users

Reply via email to