SML 函数参数
条件:
当1.列表比2.列表长时返回值:1
当 1.list 与 2.list 具有相同数量的元素时 返回值:0 1. 当列表比w短时。列表返回值:~1
([1,2,4,5],[3,2,5]);
1
([1,2],[1,5]);
0
([5],[8,2,3]);
~1
Condition:
when 1. list was longer than the 2. list Return Value :1
when 1. list had the same number of elements as the 2. list Return Value : 0
when the 1. list was shorter than the w. list Return Value : ~1
([1,2,4,5],[3,2,5]);
1
([1,2],[1,5]);
0
([5],[8,2,3]);
~1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,
length
函数可能是你的朋友:它将产生结果:
然而,这既低效又丑陋。因此,我们也可以一次从每个列表中取出一个元素,直到其中一个(或两个)变空:
这给出了结果:
Well the
length
function could be your friend in this case:which will yield the results:
However this is both inefficient and ugly. So we can also just pull off one element from each of the list at a time until one of them (or both) gets empty:
Which gives the results: