aboutsummaryrefslogtreecommitdiffstats
path: root/test/match.resp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-31 20:23:24 +0000
committerDavid Robillard <d@drobilla.net>2010-12-31 20:23:24 +0000
commit4132dc03beb1c636a3d4b7df81700fe02a4cf70d (patch)
tree7cca1d81264f2370534b5411e8c4d1f73494998a /test/match.resp
parent733e4d61c811dfec32953df51b7e57f853307a9b (diff)
downloadresp-4132dc03beb1c636a3d4b7df81700fe02a4cf70d.tar.gz
resp-4132dc03beb1c636a3d4b7df81700fe02a4cf70d.tar.bz2
resp-4132dc03beb1c636a3d4b7df81700fe02a4cf70d.zip
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
Diffstat (limited to 'test/match.resp')
-rw-r--r--test/match.resp14
1 files changed, 9 insertions, 5 deletions
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