I'm trying to get a list comprehension working, which intention is to verify that each element X in List is followed by X+Incr (or an empty list). Later, I shall use that list and compare it with a list generated with lists:seq(From,To,Incr). The purpose is to practice writing test cases and finding test properties.
I've done the following steps:
1> List. [1,3,5,8,9,11,13] 2> Incr. 2 3> List2=[X || X <- List, (tl(List) == []) orelse (hd(tl(List)) == X + Incr)]. [1] To me, it seem that my list comprehension only takes the first element in List, running that through the filter/guards, and stops, but it should do the same for EACH element in List, right?
I would like line 3 returning a list, looking like: [1,2,9,11,13].
Any ideas of how to modify current comprehension, or change my approach totally?
PS. I'm using eqc-quickcheck, distributed via Quviq's webpage, if that might change how to solve this.