View Problem
Remove an element from a list by index
Given the list
Submit a new solution for ruby, cpp, fsharp, csharp ...
There are 22 other solutions in additional languages (clojure, erlang, groovy, haskell ...)
[Apple, Banana, Carrot], remove the first element to produce the list [Banana, Carrot]
fsharp
let split_at list n =
let rec split_at' list' n' left right =
match list' with
| [] -> (List.rev left, List.rev right)
| x :: xs -> if n' <= n then split_at' xs (n' + 1) (x :: left) right else split_at' xs (n' + 1) left (x :: right)
split_at' list 0 [] []
// ------
let (_, right) = split_at fruit 0
let rec split_at' list' n' left right =
match list' with
| [] -> (List.rev left, List.rev right)
| x :: xs -> if n' <= n then split_at' xs (n' + 1) (x :: left) right else split_at' xs (n' + 1) left (x :: right)
split_at' list 0 [] []
// ------
let (_, right) = split_at fruit 0
Submit a new solution for ruby, cpp, fsharp, csharp ...
There are 22 other solutions in additional languages (clojure, erlang, groovy, haskell ...)




