Günther Schmidt gue.schm...@web.de writes:
I need a data structure as in my example without the [] being possible
to be empty.
Well, a list can by definition be empty, so this is clearly
impossible. The best you can do is to hide the constructors and have
smart constructor functions that
Hi,
please write to the whole list, not just me. There are a lot of people
around who can help you.
MH wrote:
Rendel do you mind to explain to me how Container a = Many a
(Container [a]) prevents user from creating an empty list?
I did try the following:
let a = Many string
a :: Container
I actually meant
data Container a = Many a(Container a)
but here is what I don't understand (fyi, I am a beginner) how can you
construct this container? I can do
let a = Many somestring - and I will get back a function but I can not do
let a = Many 'a' somestring - because the second param is
MH mha...@gmail.com writes:
data Container a = Many a(Container a)
but here is what I don't understand (fyi, I am a beginner) how can you
construct this container? I can do
let a = Many somestring - and I will get back a function but I can not do
let a = Many 'a' somestring - because the
On Fri, Jun 5, 2009 at 2:58 PM, MH mha...@gmail.com wrote:
I actually meant
data Container a = Many a(Container a)
but here is what I don't understand (fyi, I am a beginner) how can you
construct this container? I can do
I think I saw the above definition described as a coalgebra or
On Fri, Jun 5, 2009 at 4:13 PM, Jason Dagit da...@codersbase.com wrote:
On Fri, Jun 5, 2009 at 2:58 PM, MH mha...@gmail.com wrote:
I actually meant
data Container a = Many a(Container a)
but here is what I don't understand (fyi, I am a beginner) how can you
construct this container? I
Hi Jake,
Jake McArthur schrieb:
Günther Schmidt wrote:
data Container a = Single a | Many a [a]
but the problem above is that the data structure would allow to
construct a Many 5 [] :: Container Int.
I think you meant to do either
data Container a = Single a | Many a (Container
Hi Tom,
thanks for replying, no, I'm not looking for streams.
I hope I made myself a bit more clear in my response to Jake.
Günther
Tom Lokhorst schrieb:
Are you looking for something like Streams [1]?
They're infinite sequences, defined like this:
data Stream a = Cons a (Stream a)
They
Unless I'm missing something in your description, why not
data Container a = Single a | Many a a [a]
Dan
Günther Schmidt wrote:
Hi Jake,
Jake McArthur schrieb:
Günther Schmidt wrote:
data Container a = Single a | Many a [a]
but the problem above is that the data structure would
Dan Weston schrieb:
Unless I'm missing something in your description, why not
data Container a = Single a | Many a a [a]
Hi Dan,
the above solution would still allow to construct, for instance,
Many 5 42 [] :: Container Int
The reason why I'm trying to find the design for a data
Hi Günther,
Günther Schmidt wrote:
data Container a = Single a | Many a [a] but the problem above
I need a data structure as in my example without the [] being possible
to be empty.
So lets write a variant of list which cannot be empty. A usual list is
empty, or a head and a tail:
I note that you didn't address the suggestion of a zipper.
Günther Schmidt wrote:
Dan Weston schrieb:
Unless I'm missing something in your description, why not
data Container a = Single a | Many a a [a]
Hi Dan,
the above solution would still allow to construct, for instance,
Many 5
Hi Tony,
that's because I wasn't sure whether or not it would be applicable here.
As with monads, continuations, delimited continuations and quite a
number of other high level concepts I only understand them in part even
though I realize at the same time that understanding them fully would
Hi Jake,
apologies,
Jake McArthur schrieb:
Günther Schmidt wrote:
data Container a = Single a | Many a [a]
but the problem above is that the data structure would allow to
construct a Many 5 [] :: Container Int.
I think you meant to do either
data Container a = Single a | Many a
On Fri, 2009-06-05 at 02:08 +0200, Günther Schmidt wrote:
As for the zipper: In some of the examples I've seen, the zipper is
implemented on top of an underlying data structure, but not the data
structure itself.
In my app I was actually going to pull a zipper over it, once I had the
Hi Tillmann,
thank you for the elaborate example. This is exactly what it took for me
to realize that you and Jake have indeed given me the solution that I need.
I had a very hard time getting my head around it, but to my defense I'm
usually working on this stuff in the wee hours. :)
Hi Jeff,
it might actually be, I'll check it out after a good nights sleep.
Apparently working on this in the wee hours only leads to self
embarrassing requests for help.
Actually when it comes to the underlying data structure, Jake and
Tillmann have already found it for me, even though I
17 matches
Mail list logo