Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] small_exercise
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] small exercise
> input:  string    "1.15.120.13.43.35.340.190.0"
> output: int array=  [| 1; 15; 120; 13; 43; 35; 340; 190; 0; |] 

That's easy:

let answer_to_the_exercise = function
    "1.15.120.13.43.35.340.190.0" -> 
                [| 1; 15; 120; 13; 43; 35; 340; 190; 0; |] 

I'm sure your professor will love this solution, as it is not only
correct w.r.t. the specification, but also quite concise.

- Xavier Leroy

P.S.1: this list isn't for doing student's homework.
P.S.2: the beginner's list http://groups.yahoo.com/group/ocaml_beginners
isn't either, but you might find more sympathy there.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners