This is the common behavior of head and tail as implemented in many languages.
(courtesy of http://learnyouahaskell.com/starting-out)
What you are suggesting is the behavior of the combination of init and last which we chose not to implement here. The main use case for this feature would be the head option, though tail has many uses in functional languages here it's mostly added for completeness and ease of use.
Note that by removing the element entirely by subtracting head from the list, it would remove the instance of that object everywhere in the list if it was in there multiple times, so your way of doing it has slightly different results.
If you do find a good use case for init and last then it would be fairly easy to implement at this point but we didn't want to clog the list of operations too much.
And a tail would be a lot faster aka better performance than a subtract on a large list
Ronald,
Although I agree with Sebastiaan on the correct functioning of the tail function, it's quite easy to implement the function as a reusable java action:
// BEGIN USER CODE
if(mendixObjectList.size() > 0){
return mendixObjectList.get(mendixObjectList.size()-1);
}
else{
return null;
}
// END USER CODE
Now you have an action that will take any list of objects and returns 1 object that has the same type as the type of objects in the list. In the image below I used a list of objects that I retrieved from the db (someEntityList) and the java action will return 1 object of the someEntity type.
Hope this helps when in need of the last part of the tail!