On 8/9/07, Chad Scherrer [EMAIL PROTECTED] wrote:
extract :: [Int] - [a] - [a]
extract = f 0
where
f _ _ [] = []
f _ [] _ = []
f k nss@(n:ns) (x:xs) = if n == k then x:f (k+1) ns xs
else f (k+1) nss xs
Finally, even if no one else is using it,
Agreed. I like select better too, and the regular vs Asc version
is a nice parallel with fromList and fromAscList.
Chad
On 8/10/07, Tillmann Rendel [EMAIL PROTECTED] wrote:
Non-negative is obvious for a list of indexes. Ordered makes sense
implementation-wise, and should be easy to match for
Chad Scherrer wrote:
extract :: [Int] - [a] - [a]
[...]
This behaves roughly as
extract ns xs == map (xs !!) ns
extract sounds like removing the elements to be extracted from the
original list. I would therefore expect it's type signature to be
extract :: [Int] - [a] - ([a], [a])
with
Posix has pretty well taken the name select. It probably isn't a
good idea to use that name in a commonly imported library like
Data.List, since users will have to mask and qualify it if they also
import Posix libraries.
--
Brian T. Sniffen
[EMAIL PROTECTED]or[EMAIL PROTECTED]
Hmm, this would make a good QuickCheck property. I wonder, is listify
a contravariant functor? Fun to work through the details of that some
time, I think.
Chad
On 8/10/07, Brent Yorgey [EMAIL PROTECTED] wrote:
Amusingly, extract is intimately related to function composition. Suppose we
have
Chad Scherrer wrote:
I wonder, is listify a contravariant functor?
I wonder - will I ever reach the stage where I too make off-hand remarks
like this? :-}
Now I know how all the normal people feel when I tell them that a
relation is simply a subset of the extended Cartesian product of the
Is there process for submitting functions for consideration for
inclusion into future versions of the standard libraries? For example,
I'd like to see this in Data.List:
extract :: [Int] - [a] - [a]
extract = f 0
where
f _ _ [] = []
f _ [] _ = []
f k nss@(n:ns) (x:xs) = if n == k
On Thu, Aug 09, 2007 at 02:29:50PM -0700, Chad Scherrer wrote:
Is there process for submitting functions for consideration for
inclusion into future versions of the standard libraries? For example,
I'd like to see this in Data.List:
extract :: [Int] - [a] - [a]
extract = f 0
where
On 10 Aug 2007, at 9:37 am, Stefan O'Rear wrote:
http://www.haskell.org/haskellwiki/Library_submissions
I'd like to ask if it's possible to add expm1 and log1p to
the Floating class:
class ... Floating a where
...
exp, log, sqrt :: a - a
expm1, lop1p:: a - a--
On 8/9/07, Chad Scherrer [EMAIL PROTECTED] wrote:
Is there process for submitting functions for consideration for
inclusion into future versions of the standard libraries? For example,
I'd like to see this in Data.List:
I imagine including it in std lib takes a while. Would it be a good
idea
rk:
On 8/9/07, Chad Scherrer [EMAIL PROTECTED] wrote:
Is there process for submitting functions for consideration for
inclusion into future versions of the standard libraries? For example,
I'd like to see this in Data.List:
I imagine including it in std lib takes a while. Would it be a
11 matches
Mail list logo