caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jonathan Roewen <jonathan.roewen@gmail.com>
To: caml-list@yquem.inria.fr
Subject: [Caml-list] Creating recursive values
Date: Mon, 7 Feb 2005 15:54:01 +1300	[thread overview]
Message-ID: <ad8cfe7e0502061854233a79f2@mail.gmail.com> (raw)

Hi,

The title might not be quite correct, but I don't really know how to
describe it. Anyways, I'm trying to create a value which references
another value that has to reference the original value.

let make_window origin bounds title =
	let (x,y) = origin
	and (w,h) = bounds in
	let window = GroupedGraphic (
		x, y, [
			InteractiveGraphic (
				[(Up,Graphic (Rectangle (0,0,w+8,h+8), control_brush, control_pen))],
				[(MouseDrag, on_drag)] (* Where trouble begins =( *)
			);
			Graphic (Rectangle (4,4,w,h), white_brush, control_pen);
		]
	)
	and on_drag () = match window with
	| GroupedGraphic (x,y,lst) -> GroupedGraphic (x+mouse.x,y+mouse.y,lst);
	redraw_gui () in
	window

I don't really want to have to deconstruct the window, and reconstruct
it again. I tried to make a start on that, and it was very messy.
There _has_ to be a better way to solve this recursive problem.

Regards,
Jonathan Roewen


             reply	other threads:[~2005-02-07  2:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-07  2:54 Jonathan Roewen [this message]
2005-02-07  3:28 ` skaller

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=ad8cfe7e0502061854233a79f2@mail.gmail.com \
    --to=jonathan.roewen@gmail.com \
    --cc=caml-list@yquem.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).