[Solved] What is the answer to this list? [closed]


This is a really bad question. However, The last line in your code will fail with

This expression was expected to have type
int list list but here has type
int

.. because :: concatenates an element to a list. It can only do it from the front because the list is a singly linked list. If you want to add an element at the end of the list, you’re probably using the wrong data structure. If you really want to add an element to the end of a list, you could do

[4;5;2;7] @ [3];;

Be aware that this will be really inefficient.

solved What is the answer to this list? [closed]