I hope you can help me with these exercises I have been stuck with. I am not in particular looking for the answers. Tips that help me solve them myself are just as good :)
1. Write a function implode : char list -> string so that implode s returns the characters concatenated into a string:
let implode (cArray:char list) = List.foldBack (+) 0 cArray;;
Error. I am thinking that i need to cast every char to strings before I do the above. I bet however, that there is a much simpler and better solution.
2. Write a function palindrome : string -> bool, so that palindrome s returns true if the string s is a palindrome
let isIdentical cArray1 cArray2 = (cArray1 = cArray2);;
let palinDrome (word:string) = isIdentical(word.ToCharArray(), Array.rev(word.ToCharArray()));;
I get the value:
val palinDrome : string -> (char [] * char [] -> bool), which is not what I want.
3. Write a function combinePair : int list -> int list so that combinePair xs returns the list with elements from xs combined into pairs. If xs contains an odd number of elements, then the last element is thrown away:
I have no idea for this one.