Click here to Skip to main content
15,891,749 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello i have problem.

Write a function split (int list -> int list list). Which for list L=[ 1; 3 ; 0; -2; -2; -4; 9]
will do translation to this [[1; 3]; [0]; [-2 ;-2 ;-4]; [9]].

EveryList contains numbers with the same characters. Negatives with negatives etc and positive with positive.




I done something similar but i only make it increment not with character. Any hints how to do that ? I can't use recursion and loops ,here is problem :( Some code

F#
<pre lang="F#">
let zad44 =
let zad4 acc lst =
    match lst with
    | current::rest ->
         match current with
        | head::_ when acc < head -> (acc::current)::rest // add acc to current list
        | _ -> [acc]::lst   // start new list
    | _ -> [[acc]]
zad4;;

 List.foldBack zad44 [5;2;3;2;4;0;-1;5;3;0;1;5;] [] ;;</pre>
Posted
Updated 11-Nov-14 3:07am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900