From fb0ada19437701a3a2f7571558171976eb2404ac Mon Sep 17 00:00:00 2001 From: "Brian T. Rice" Date: Sat, 20 Mar 2010 01:54:23 -0700 Subject: [PATCH] Reworked core Method apply/do methods to use apply* and avoid consing an Array dynamically for marshalling arguments. --- src/core/method.slate | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/method.slate b/src/core/method.slate index c21293d..1f17035 100644 --- a/src/core/method.slate +++ b/src/core/method.slate @@ -1,19 +1,23 @@ m@(Method traits) do "Just runs the method without any inputs and answers the result." -[m applyTo: {}]. +[m apply*]. m@(Method traits) applyWith: x "Applies the method to the one input." -[m applyTo: {x}]. +[m apply*, x]. m@(Method traits) applyWith: x with: y "Applies the method to 2 inputs." -[m applyTo: {x. y}]. +[m apply*, x, y]. m@(Method traits) applyWith: x with: y with: z "Applies the method to 3 inputs." -[m applyTo: {x. y. z}]. +[m apply*, x, y, z]. + +m@(Method traits) apply* +"Applies the method to all available inputs. NB The Compiler optimizes this." +[| *rest | m applyTo: rest]. s@(Symbol traits) sendWith: x [s sendTo: {x}]. -- 2.11.4.GIT