[racket] if problem

From: Pierpaolo Bernardi (olopierpa at gmail.com)
Date: Wed Feb 29 06:26:26 EST 2012

On Wed, Feb 29, 2012 at 12:14, ROELOF WOBBEN <r.wobben at home.nl> wrote:
> Hello,
> I have made this :
> (define (string-insert s1 i)
>   (if(> (string-length s1) 0)  (string-append (substring s1 0 i) "-"
> (substring s1 i (string-length s1)))))
> But on the if I get a this message :
> if: expected a question and two answers, but found only 2 parts
> So I think that the if get sonehow messed up ,
> What I try to do is this :
> When the lenght of the string is greater then 0 then take the first part of
> the string  then put the - and the last part of the string. As last append
> the pieces to 1 piece.
> Without the if everything works great on non empty strings.
> Anyone a idea where I did make the wrong turn.

What should happen when the length of the string is not greater than 0?

The error message is reminding you to answer this question.


Posted on the users mailing list.