Difference between revisions of "H-99: Ninety-Nine Haskell Problems"

From HaskellWiki
Jump to: navigation, search
(Created page with first problem filled in)
 
(added Category:Tutorials and used == heading instead of ===)
Line 1: Line 1:
 
These are Haskell translations of [http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Problems.html Ninety Nine Lisp Problems].
 
These are Haskell translations of [http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Problems.html Ninety Nine Lisp Problems].
   
=== Problem 1 ===
+
== Problem 1 ==
   
 
<pre>
 
<pre>
Line 17: Line 17:
 
last (_:xs) = last xs
 
last (_:xs) = last xs
 
</haskell>
 
</haskell>
  +
  +
[[Category:Tutorials]]

Revision as of 04:11, 12 December 2006

These are Haskell translations of Ninety Nine Lisp Problems.

Problem 1

(*) Find the last box of a list.
Example:
* (my-last '(a b c d))
(D)

This is "last" in Prelude, which is defined as:

last :: [a] -> a
last [x] = x
last (_:xs) = last xs