You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
map3ToFreshConsTail operates on t1,t2,t3, recursively pops heads off, and fails if at least one but not all of the input lists are empty. It then reports the lengths of the current lists, not the lengths of the original lists.
A fix:
try
map3ToFreshConsTail cons f t1 t2 t3
cons
with_->
invalidArg3ListsDifferent "list1""list2""list3" xs1.Length xs2.Length xs3.Length
The text was updated successfully, but these errors were encountered:
That comes at the cost of incurring three length checks to report the error, each of which are O(n). I'd suggest altering map3ToFreshConstTail to take tuples of (currentLength, list) for the t1, t2, t3 parameters to enable fast error reporting.
Any performance considerations here should be benchmarked, as we don't know what the actual performance of either approach will be. Though I would prefer incurring the cost on the error.
This is misleading because the lists in user code have lengths 2,1,1 not 1,0,0.
src/fsharp/FSharp.Core/local.fs
map3ToFreshConsTail
operates on t1,t2,t3, recursively pops heads off, and fails if at least one but not all of the input lists are empty. It then reports the lengths of the current lists, not the lengths of the original lists.A fix:
The text was updated successfully, but these errors were encountered: