From 4132dc03beb1c636a3d4b7df81700fe02a4cf70d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 31 Dec 2010 20:23:24 +0000 Subject: Only compile symbols once (cache compiled symbol values specially for this). Working pattern matching / deconstruction when object is a function parameter. git-svn-id: http://svn.drobilla.net/resp/resp@396 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- test/match.resp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/match.resp b/test/match.resp index 0d490ec..7f1c9dc 100644 --- a/test/match.resp +++ b/test/match.resp @@ -2,9 +2,13 @@ (Circle Float) (Rectangle Float Float)) -(def s1 (Circle 2.0)) -(def s2 (Rectangle 3.0 4.0)) +(def (area s) + (match s + (Rectangle w h) (* w h) + (Circle r) (* 3.14159 r))) -(match s2 - (Rectangle w h) (* w h) - (Circle r) (* 3.14159 r)) + +;(area (Circle 2.0)) + +(def s (Circle 2.0)) +(area s) \ No newline at end of file -- cgit v1.2.1