I have this function that takes one lists and checkes for duplicates, if any duplicates are found they are added to a new list like this:
let foo1 z list = list |> List.filter (fun e -> e <= z)
this gives foo1 1 [2;3;4;1;5;1;6;1] => [1;1;1]
the problem is that I don’t want to use any of the builtin functions in f#
You asked a number of basic F# questions on list processing already, so I recommend reading some introductions first and trying it yourself.
Using built-in functions is the right way to solve the problem in practice. If you want to learn F# and understand recursion, then read the above first. Then you should be able to write something like:
There are many F# introductions that explain how
filterand similar functions are implemented. The F# wikibook covers this topic and you’ll find it in most of the F# books (see a list on fsharp.org) and Working lists section on http://www.tryfsharp.org covers this too.