I noticed that Remove From() function isn't working as intended (and its documentation is written wrong in both Scripting Index and JMP Help). It seems to behave irrationally when last element is removed from the list.
I have contacted JMP support about this. According to them intended behaviour is as follows (same as I would expect it to be):
The expected behaviour is that Remove From returns the item(s) removed as your example shows for the first 9 items. Additionally, it modifies the input container by removing the item(s).
I have yet to hear back from them if they know about timeline when this will be fixed and documentation updated. I will report back here if I hear back with timeline.
Example and one "workaround" (if I really need same behaviour as Remove From, I will write my own function for it for now):
Names Default To Here(1);
m = 1::10;
For Each({item}, m,
earlier_m = m;
// Returns: The original source with the items deleted.
// Doesn't this return deleted list (except when it is last element...)
removed = Remove From(m, 1);
Print(Eval Insert("^removed^ removed from ^earlier_m^"));
);
// workaround?
m = 1::10;
For Each({item}, m,
earlier_m = m;
removed = m[1];
Remove From(m, 1);
Print(Eval Insert("^removed^ removed from ^earlier_m^"));
);
-Jarmo