From 85b41606379da637d497ed3d8e1e5daa53197ec1 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Mon, 26 Dec 2016 14:52:23 -0800 Subject: [PATCH] Remove contrib.curry It's undocumented and of dubious value. --- hy/contrib/curry.hy | 21 --------------------- tests/__init__.py | 1 - tests/native_tests/contrib/curry.hy | 13 ------------- 3 files changed, 35 deletions(-) delete mode 100644 hy/contrib/curry.hy delete mode 100644 tests/native_tests/contrib/curry.hy diff --git a/hy/contrib/curry.hy b/hy/contrib/curry.hy deleted file mode 100644 index 0bf5bd7..0000000 --- a/hy/contrib/curry.hy +++ /dev/null @@ -1,21 +0,0 @@ -(import inspect functools sys) - - -(defn curry [func] - (let [sig (.getargspec inspect func) - count (len sig.args)] - - (fn [&rest args] - (if (< (len args) count) - (apply functools.partial (+ [(curry func)] (list args))) - (apply func args))))) - - -(defmacro fnc [args &rest body] - `(do (import hy.contrib.curry) - (with-decorator hy.contrib.curry.curry (fn [~@args] ~@body)))) - - -(defmacro defnc [name args &rest body] - `(do (require hy.contrib.curry) - (def ~name (hy.contrib.curry.fnc [~@args] ~@body)))) diff --git a/tests/__init__.py b/tests/__init__.py index c4e7ea6..13843ec 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -19,7 +19,6 @@ from .native_tests.contrib.loop import * # noqa from .native_tests.contrib.meth import * # noqa from .native_tests.contrib.walk import * # noqa from .native_tests.contrib.multi import * # noqa -from .native_tests.contrib.curry import * # noqa from .native_tests.contrib.sequences import * # noqa if PY3: diff --git a/tests/native_tests/contrib/curry.hy b/tests/native_tests/contrib/curry.hy deleted file mode 100644 index 7db504f..0000000 --- a/tests/native_tests/contrib/curry.hy +++ /dev/null @@ -1,13 +0,0 @@ -(require [hy.contrib.curry [defnc]]) - - -(defnc s [x y z] ((x z) (y z))) ; λxyz.xz(yz) -(defnc k [x] (fn [y] x)) ; λx.λy.x -(defnc i [x] x) ;; λx.x - -(defnc succ [n] (+ n 1)) - - -(defn test-curry [] - (assert (= 16 (((((s ((((k s) k) i) i)) (i i)) ((i (i i)) - ((((k s) i) ((s (k s)) k)) i))) succ) 0))))