[racket] Is this a good design

From: Roelof Wobben (r.wobben at home.nl)
Date: Wed Feb 29 15:17:42 EST 2012

You ignored part of what Asumu said, which (to paraphrase) is that your 
program should live and die by its contract.  When you write down:
>    String -> String
> you're saying this program consumes a String and produces a String.  
> If somebody applies your program to something that is *not* a string, 
> they (not you) messed up by not using your program according to the 
> contract you wrote down.  When somebody misuses the program, who knows 
> what happens.  Maybe it signals an error, maybe it produces 7, maybe 
> it melts your computer.  So don't bother checking that the input is a 
> String; assume it is.  Let bad stuff happen if it isn't.
> On the other hand, if somebody applies your program to a string and 
> you produce something other than a string, well that's your fault; you 
> messed up.  So make sure you produce strings (on the assumption you're 
> given a string).
> Asumu also pointed out the corner case of the empty string, which you 
> responded to by saying you can assume the string is not empty.  That's 
> fine, but *write it down*.  How are we to know, as reader's of your 
> contract and purpose statements, that we have to provide non-empty 
> strings?
> David

Wierd idea that input control is not neccesarly.  I have tried C and C++ 
and they empasise to do input control.
But oke then this is the new function.

;String -> String
;This function takes out the first character of a given non-empty string 
with the name s
; given "roelof" expect "r"
; given "example" expect "e"
(define (string-first s)
(string-ith s 0 ))


Posted on the users mailing list.