From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id BF107BC88 for ; Mon, 7 Feb 2005 03:54:02 +0100 (CET) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.206]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j172s2hU004592 for ; Mon, 7 Feb 2005 03:54:02 +0100 Received: by rproxy.gmail.com with SMTP id a36so632036rnf for ; Sun, 06 Feb 2005 18:54:01 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=VhiqZsTd+9BUEMT9WboqYdDAXeFVrFZ+Xuck9ThOFkjS8zQh8Qq39rm+HkDW6Ojd/xox72BY9e7DVkVjd5lgkB/FJzU8U5uneoGIczpYH44DylBX54ejXOrmIT+WSXgGqjXWq02wJHhk03dySk8GL7gJyiuxxPkheeHI3LIgUho= Received: by 10.38.97.78 with SMTP id u78mr121819rnb; Sun, 06 Feb 2005 18:54:01 -0800 (PST) Received: by 10.38.209.53 with HTTP; Sun, 6 Feb 2005 18:54:01 -0800 (PST) Message-ID: Date: Mon, 7 Feb 2005 15:54:01 +1300 From: Jonathan Roewen Reply-To: Jonathan Roewen To: caml-list@yquem.inria.fr Subject: [Caml-list] Creating recursive values Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4206D84A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 recursive:01 redraw:01 recursive:01 match:02 bounds:02 bounds:02 let:03 let:03 rectangle:03 rectangle:03 gui:04 problem:05 white:94 quite:06 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.2 X-Spam-Level: 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