<div dir="ltr"><div><div>A pro pos split_at_most():<br>I've at times wished for a guard function 
'lists:length_at_most(L,N)' - something which determines 
min(length(L),N) in the non-stupid way, i.e. counting the elements of 
the list but stopping when it reaches N.<br></div>From time to time, I 
run into situations where I just need to know "is this lists 'large'?", 
and it feels wasteful then to measure its entire length when you know it
 might *be* quite large. And pattern-matching for [_,_,_,_, ... ,_|_] isn't nice (or efficient) either when the threshold length is, say, a hundred.<br><br></div>Is this just me, or has anyone else run into such cases?<br>
<div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/10 Richard A. O'Keefe <span dir="ltr"><<a href="mailto:ok@cs.otago.ac.nz" target="_blank">ok@cs.otago.ac.nz</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
There are actually two different things that someone might want to do:<br>
<br>
(X) I want *exactly* N items from this sequence:<br>
        n -> seq -> (pref, suff) where pref++suff == seq && #pref == n<br>
<br>
(Y) I want *at most* N items from this sequence:<br>
        n -> seq -> (pref, suff) where pref++suff == seq &&<br>
                                       #pref = min(#seq, n)<br></blockquote><div>[snip]<br></div></div><br></div></div>