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
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
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
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
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