Andrew Pimlott wrote:
This is a follow-up to a thread from June-July[1]. The question was how to
write the function
initlast :: [a] - ([a], a)
initlast xs = (init xs, last xs)
so that it can be consumed in fixed space:
main = print $ case initlast [0..10] of
Andrew Pimlott wrote:
This is a follow-up to a thread from June-July[1]. The question was how to
write the function
initlast :: [a] - ([a], a)
initlast xs = (init xs, last xs)
so that it can be consumed in fixed space:
main = print $ case initlast [0..10] of
This is a follow-up to a thread from June-July[1]. The question was how to
write the function
initlast :: [a] - ([a], a)
initlast xs = (init xs, last xs)
so that it can be consumed in fixed space:
main = print $ case initlast [0..10] of
(init, last) -
On Mon, Jun 19, 2006 at 05:50:13PM +0100, Duncan Coutts wrote:
On Mon, 2006-06-19 at 17:03 +0100, Jon Fairbairn wrote:
il [] = error foo
il [x] = ([], x)
il (x:xs) = cof x (il xs)
where cof x ~(a,b) = (x:a, b)
-- !
From a quick test, it looks like
Here's a puzzle I haven't been able to solve. Is it possible to write the
initlast function?
There are functions init and last that take constant stack space and
traverse the list at most once. You can think of traversing the list as
deconstructing all the (:) [] constructors in list.
On Jun 19, 2006, at 11:24 AM, C Rodrigues wrote:
Here's a puzzle I haven't been able to solve. Is it possible to
write the initlast function?
There are functions init and last that take constant stack
space and traverse the list at most once. You can think of
traversing the list as
On 2006-06-19 at 15:24- C Rodrigues wrote:
Here's a puzzle I haven't been able to solve. Is it possible to write the
initlast function?
There are functions init and last that take constant stack space and
traverse the list at most once. You can think of traversing the list as
On Mon, 2006-06-19 at 15:24 +, C Rodrigues wrote:
Here's a puzzle I haven't been able to solve. Is it possible to write the
initlast function?
There are functions init and last that take constant stack space and
traverse the list at most once. You can think of traversing the list as
Where's the solution and what is the repmin problem?
On Jun 19, 2006, at 5:21 PM, Jerzy Karczmarczuk wrote:
Such tricks become your second nature, when you take the solution
(lazy) of the repmin problem by Richard Bird, you put it under your
pillow, and sleep for one week with your head close
On Mon, 2006-06-19 at 17:03 +0100, Jon Fairbairn wrote:
On 2006-06-19 at 15:24- C Rodrigues wrote:
Here's a puzzle I haven't been able to solve. Is it possible to write the
initlast function?
There are functions init and last that take constant stack space and
traverse the list
On Jun 19, 2006, at 12:50 PM, Duncan Coutts wrote:
On Mon, 2006-06-19 at 17:03 +0100, Jon Fairbairn wrote:
On 2006-06-19 at 15:24- C Rodrigues wrote:
Here's a puzzle I haven't been able to solve. Is it possible to
write the
initlast function?
There are functions init and last that
Joel Reymont writes:
Where's the solution and what is the repmin problem?
On Jun 19, 2006, at 5:21 PM, Jerzy Karczmarczuk wrote:
Such tricks become your second nature, when you take the solution
(lazy) of the repmin problem by Richard Bird, you put it under your
pillow, and sleep for one
12 matches
Mail list logo