From bb9107c8c1634353f3c2633467bbd4a1d52d1ff9 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 2 Dec 2014 16:04:34 -0500 Subject: [PATCH 1/3] `apply-gen' now generates functions for partial applications This is intended as a convenient shorthand: ```xml ``` --- src/transform/apply-gen.xsl | 112 +++++++++++--- test/transform/apply-gen-test-in.xsl | 15 ++ test/transform/apply-gen.xspec | 212 +++++++++++++++++++++++++++ 3 files changed, 315 insertions(+), 24 deletions(-) diff --git a/src/transform/apply-gen.xsl b/src/transform/apply-gen.xsl index adf5401..c194593 100644 --- a/src/transform/apply-gen.xsl +++ b/src/transform/apply-gen.xsl @@ -32,6 +32,7 @@ xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:f="http://www.lovullo.com/hoxsl/apply" + xmlns:_f="http://www.lovullo.com/hoxsl/apply/_priv" xmlns:fgen="http://www.lovullo.com/hoxsl/apply/gen" xmlns:out="http://www.lovullo.com/hoxsl/apply/gen/_out" exclude-result-prefixes="#default fgen"> @@ -147,10 +148,15 @@ @@ -161,15 +167,42 @@ + + + + + - - + + + + + + + + + + + + + + + + + @@ -187,7 +220,7 @@ - - - + - - - - - - - - - , - - $arg - - - + + + + + + + + + + + + + + + + + + + + + + + + , + + $arg + + + + + + + + diff --git a/test/transform/apply-gen-test-in.xsl b/test/transform/apply-gen-test-in.xsl index 72a64af..631ee0a 100644 --- a/test/transform/apply-gen-test-in.xsl +++ b/test/transform/apply-gen-test-in.xsl @@ -41,4 +41,19 @@ + + + + + + + + + + + + + + diff --git a/test/transform/apply-gen.xspec b/test/transform/apply-gen.xspec index 151731c..ad8dfca 100644 --- a/test/transform/apply-gen.xspec +++ b/test/transform/apply-gen.xspec @@ -26,6 +26,20 @@ xmlns:foo="http://www.lovullo.com/_junk" stylesheet="apply-gen-test.xsl"> + + + + + + + + + + + + + + @@ -218,5 +232,203 @@ select="2" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From e392d411fadca54d3b79337757893df7627a4c66 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 2 Dec 2014 16:43:05 -0500 Subject: [PATCH 2/3] Short-hand partial application example added to README.md --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 996db0b..8827e5c 100644 --- a/README.md +++ b/README.md @@ -70,11 +70,17 @@ the output included within a distribution. ### Partial Applications Dynamic function applications using `f:apply` are partially applied if the number of arguments provided is less than the arity of the target -function. +function. For convenience, the `apply-gen` stylesheet will also +generate functions to perform partial application without the use of +`f:apply` for the first call, as in the first example below: ```xml + + + @@ -84,6 +90,7 @@ function. ``` From 31aa7fa11161424df7f1599696c8f8c565bb59f1 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 4 Dec 2014 01:13:24 -0500 Subject: [PATCH 3/3] `apply-gen' now ingores arity-overloaded functions Rationale is provided in `apply-gen.xsl'. --- src/transform/apply-gen.xsl | 31 ++++++++++++++++++++++++++++ test/transform/apply-gen-test-in.xsl | 11 ++++++++++ test/transform/apply-gen.xspec | 21 +++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/src/transform/apply-gen.xsl b/src/transform/apply-gen.xsl index c194593..e7d80be 100644 --- a/src/transform/apply-gen.xsl +++ b/src/transform/apply-gen.xsl @@ -112,6 +112,37 @@ + + + + diff --git a/test/transform/apply-gen-test-in.xsl b/test/transform/apply-gen-test-in.xsl index 631ee0a..73ce7f6 100644 --- a/test/transform/apply-gen-test-in.xsl +++ b/test/transform/apply-gen-test-in.xsl @@ -42,6 +42,17 @@ + + + + + + + + + + + diff --git a/test/transform/apply-gen.xspec b/test/transform/apply-gen.xspec index ad8dfca..03c3203 100644 --- a/test/transform/apply-gen.xspec +++ b/test/transform/apply-gen.xspec @@ -130,6 +130,27 @@ + + + + + + + + + + + + + + + + + + +