I would like to drop an element from one difflist, process it, and append to another heterogenous list. After N steps where N is the length of a list, I’d like to end up with a list of the same type as the list I started with. So I would like to do:
let l = Cons 1 Cons('a', Nil);
let l' = Nil
let (head, tail) = dropoFirst f
let l' = append l' (head + 1)
let (head, _) = dropoFirst tail
let l' = append l' head```
I’ve tried to make it work but I’m failing to create a list for which it’s both possible get the first element (knowing it does exist, without option) and append to the end of it.
(experiments here: https://gist.github.com/wokalski/8f765caf542158a87fcf13b88fe577a5#file-experiments-re)