From c1b2f17fcf02ce40aaf345880d928f6ee540f80e Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 24 Nov 2014 22:44:42 -0800 Subject: 323 - function clauses You can now call 'def' on a function name multiple times. Each time the instructions you provide are *prepended* to any existing instructions. One important use for this is when you define a new type and need to support it in all your generic methods. Now you can keep all those extensions in one place, near the definition of the type. To redefine a function, use 'def!'. --- mu.arc | 8 ++++++-- mu.arc.t | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/mu.arc b/mu.arc index aaab580a..1e99adab 100644 --- a/mu.arc +++ b/mu.arc @@ -1067,11 +1067,15 @@ (each (op . rest) forms (case op ; syntax: def [ ] - def + ; don't apply our lightweight tools just yet + def! (let (name (_make-br-fn body)) rest (assert (is 'make-br-fn _make-br-fn)) - ; don't apply our lightweight tools just yet (= function*.name body)) + def + (let (name (_make-br-fn body)) rest + (assert (is 'make-br-fn _make-br-fn)) + (= function*.name (join body function*.name))) ; syntax: before