|
Re: A useful list operator: msg#00280lang.scala
On 1/23/07, Iulian Dragos <iulian.dragos@xxxxxxx> wrote: David Pollak wrote: where 'f' is a predicate used to find the first element you want, and The inconvenience of using find here is that if you choose f to be {x => !usefulTransform(x).isEmpty}, then, in order to get the result of usefulTransform(x) afterwards, you have to apply it again. One could fudge, and assign the result as a side effect to some variable in scope, though, but then using find is not so elegant after all. I would agree with Iulian if usefulTransform was a PartialFunction and had a method isDefinedAt! The List object (not the trait) is full of functions that serve to get efficiency which could be easily implemented otherwise ( e.g. mapConserve), so IMHO one more function of this sort wouldn't hurt. cheers, B -- Burak Emir Research Assistant / PhD Candidate Programming Methods Group EPFL, 1015 Lausanne, Switzerland http://lamp.epfl.ch/~emir |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Preparing for Scala 3._: 00280, Warren Henning |
|---|---|
| Next by Date: | Re: Scala generics for automatic differentiation: 00280, Eric Willigers |
| Previous by Thread: | Re: A useful list operatori: 00280, Iulian Dragos |
| Next by Thread: | Re: A useful list operator: 00280, David Pollak |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |