---
# System prepended metadata

title: F# - what we need to be better at
tags: [F#]

---

# F# - what we need to be better at

###### tags: `F#`


### Tail-recurive functions 

Create a tail recursive function insertTail : 'a -> 'a list -> 'a list , using an accumulator, that behaves the same as insert but that does not overflow the stack.
```F#
    let insertTail x lst =
        let rec aux x acc =
            match acc with
            |[] -> [x]
            |y::ys when x < y -> x::y::ys
            |y::ys -> y::(aux x ys)
        aux x lst 

This function does not work. Why not?
```

