fun fjern_klamme [] a = (List.rev a,[]) | fjern_klamme (x :: xs) a = if x = #"[" then fjern_klamme xs a else if x = #"]" then (List.rev a,xs) else fjern_klamme xs (x :: a)
fun liste x = let fun tilfoej_liste (x,y) = if y = [] then [x] else x :: tilfoej_liste (fjern_klamme y []) in tilfoej_liste (fjern_klamme x []) end
fun string_liste x = map (fn f => implode f) x
fun string_liste_til_char_liste x = explode x
fun kun_real x = let fun fjern_komma [] = [] | fjern_komma (y :: ys) = if y = #"," then fjern_komma ys else y :: fjern_komma ys fun indsaet_minus [] = [] | indsaet_minus (z :: zs) = if z = #"~" then (implode[z,hd zs]) :: indsaet_minus (tl zs) else (implode [z]) :: indsaet_minus zs in indsaet_minus (fjern_komma x) end
fun real_fra_string x = [valOf(Real.fromString (List.nth (x,0))),valOf(Real.fromString (List.nth (x,1))),valOf(Real.fromString (List.nth (x,2)))]
fun find_real_i_liste x = let fun find_real [] = [] | find_real (y :: ys) = (real_fra_string (kun_real (string_liste_til_char_liste y))) :: find_real ys in find_real x end;
fun string_til_real_liste_liste x = find_real_i_liste (string_liste (liste (explode x)));
Er der nogen som har en idé til hvordan mit problem løses. Behøver måske ikke lige kodeeksempler, hvis det er for svært, men bare nogle idéer til hvordan jeg skal gå igang :-)
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.