[Haskell-cafe] Creating an alias for a function
Gregory Crosswhite
gcross at phys.washington.edu
Tue Oct 6 22:10:23 EDT 2009
Michael,
You can define a function without listing some or all of its arguments
by specifying it in terms of another function. So all you really need
to write is, e.g.,
car = head
cdr = tail
cadr = car . cdr
caddr = car . cadr
cadar = car . cdr . car
etc...
On Oct 6, 2009, at 7:01 PM, michael rice wrote:
> How do I create an alias for a function, like giving CAR the same
> functionality as HEAD. I know I can do it by creating a definition
> (see below), but is there a better way, like Scheme's
>
> (define head car)
>
> car :: [a] -> a
> car x = head x
>
> The reason for doing this is to more closely mirror legacy code.
>
> Michael
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091006/46c9bfa9/attachment.html
More information about the Haskell-Cafe
mailing list