这是我的挑战:
创建一个函数exists
,当项目在列表中时,该函数返回true
或false
。
1> exists(2,[1,4,5,3,2]).
true
2> exists(2,[]).
false
3> exists(2,[4,5,6,7]).
false
创建一个函数listLength
,它将返回列表的长度。不允许使用本机函数长度。
1> listLength([1,2,3]).
3
2> listLength([]).
0
答案 0 :(得分:3)
因为它看起来像家庭作业,我希望你不会在这里得到解决方案。我会给你一些线索。
第一个:
第二个相同: