An Erlang implementation of lists:seq for floats

November 24, 2009

If you want to use lists:seq/3 with floats you will notice that the standard implementation only works with integers. So I wrote a quick & dirty way to do it with floats. You can use it just like you would use lists:seq/3. If anybody has a better implementation I would love to see it.

1 2 3
%% This lets you do stuff like
1> my_lib:seq_float(10.01,10.13,0.02).
[10.01,10.03,10.05,10.07,10.09,10.11,10.13]

Discussion, links, and tweets

I work at Venture Spirit. Follow me on Twitter; you'll enjoy my tweets. I take care to carefully craft each one. Or at least aim to make you giggle. Or offended. One of those two— I haven't decided which yet.