caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Thomas Link" <t.link.tmp200101@gmx.net>
To: caml-list@inria.fr
Subject: [Caml-list] Newbie question concerning type definitions
Date: Thu, 11 Oct 2001 08:43:54 +0200	[thread overview]
Message-ID: <3BC55BCA.15676.5F0873@localhost> (raw)

Hello, 

I have hesitated to send this question to this mailing list as I 
suspect it to be rather stupid. What am I trying to do? I would like to 
implement a simple stack based language in OCaml in order to get a 
feeling for OCaml and also to test some ideas. Well, I didn't get far 
as I wasn't even able to define the basic data structures. I guess this 
is plain wrong:

type returnState = Succeeded | Failed | Error of int
and proc = (stack -> dictionary -> returnState) 
and procs = proc list 
and element = 
	Int of int 
  | String of string
  | Float of float
  | Word of proc 
and stack = element Stack.t 
and dictionary = (string, procs) Hashtbl.t;; 

When compiling this, the compiler tells me that proc's definition is 
cyclic. How can I circumvent this in OCaml? 

My apologies if this is too simple-minded for being asked in this 
forum, but could somebody tell me please how the correct definition of 
these types could possibly look like? 

Cheers, Thomas. 


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


             reply	other threads:[~2001-10-11  6:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-11  6:43 Thomas Link [this message]
2001-10-11  7:11 ` Remi VANICAT

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BC55BCA.15676.5F0873@localhost \
    --to=t.link.tmp200101@gmx.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).