[racket] Finding out values
On 2013-01-18 16:24:29 -0800, Brandon Mick wrote:
> new to racket. im trying to find out what would ii get as a value if I
> replace the s with “hello”
> its easier to do this with numbers where you would define s and give it a
> number, but it won't work here.
I think I may be misunderstanding your question, but does the following
interaction not do what you want?
$ racket
Welcome to Racket v5.3.2.2.
-> (define s "hello")
-> (cond
[(<= (string-length s) 5) 10]
[(string=? s “hello”) 50]
[(string=? (substring s 1 4) “ell”) 25]
[else 130])
10
Cheers,
Asumu