Hi Alexandrians,
I believe curry and rcurry are the wrong names for the current functions in Alexandria. See the following for example,
http://srfi.schemers.org/srfi-26/mail-archive/msg00000.html http://srfi.schemers.org/srfi-26/mail-archive/msg00015.html
What about papply or partial-apply? Or maybe p-apply? This way, The reversed version might be called rp-apply. Otherwise reverse-partial-apply?
I am aware that this is a common usage/mistake in CL, but Alexandria doesn't have to perpetuate this error. An unfortunate downside is breaking backwards compatibility. I'm not sure what Alexandria's policy is regarding this...
I'm happy to send patches if this renaming is agreed upon.
Theam Yong Chew
2009/6/4 szergling senatorzergling@gmail.com:
Hi Alexandrians,
I believe curry and rcurry are the wrong names for the current functions in Alexandria. See the following for example,
http://srfi.schemers.org/srfi-26/mail-archive/msg00000.html http://srfi.schemers.org/srfi-26/mail-archive/msg00015.html
What about papply or partial-apply? Or maybe p-apply? This way, The reversed version might be called rp-apply. Otherwise reverse-partial-apply?
I am aware that this is a common usage/mistake in CL, but Alexandria doesn't have to perpetuate this error. An unfortunate downside is breaking backwards compatibility. I'm not sure what Alexandria's policy is regarding this...
I'm happy to send patches if this renaming is agreed upon.
I'm not sure. I'm not totally opposed, but I'm not convinced either: even if it wrong, the names are "culturally correct", if you will. Names partial-apply and partial-reverse-apply would be my preferred ones if we did the renaming.
Cheers,
-- Nikodemus
On Thu, Jun 4, 2009 at 9:26 PM, Nikodemus Siivolanikodemus@random-state.net wrote:
2009/6/4 szergling senatorzergling@gmail.com:
Hi Alexandrians,
I believe curry and rcurry are the wrong names for the current
...
I'm not sure. I'm not totally opposed, but I'm not convinced either: even if it wrong, the names are "culturally correct", if you will.
Yeah, I know, this is just a personal itch of mine. I believe Alexandria is in a unique position to promote a naming convention (and do the right thing too).
Names partial-apply and partial-reverse-apply would be my preferred
Yes, I like these too. I've looked into the extent of the work required to do the renaming, and it ended being quite straight-forward. The minor exception being the documentation, since the "include" directory is not in version control. See lines 119 & 120 in doc/alexandria.texinfo
@include include/fun-alexandria-curry.texinfo @include include/fun-alexandria-rcurry.texinfo
Aside from that, I've attached darcs patches. (Where did the "Ignore-this" comments come from?)
ones if we did the renaming.
Cheers,
-- Nikodemus
Names partial-apply and partial-reverse-apply would be my preferred
when looking at the issue with a clean mind, without having read any papers about currying (there are newborns every day!), the long versions of the proposed names are much more intuitive.
just one more 0.02,
szergling senatorzergling@gmail.com writes:
The minor exception being the documentation, since the "include" directory is not in version control. See lines 119 & 120 in doc/alexandria.texinfo
That directory is auto-generated from the docstrings. See doc/Makefile.
Nikodemus Siivola nikodemus@random-state.net writes:
I'm not sure. I'm not totally opposed, but I'm not convinced either: even if it wrong, the names are "culturally correct", if you will. Names partial-apply and partial-reverse-apply would be my preferred ones if we did the renaming.
I find them too long. Long names can distract from the intent of the actual code. They're supposed to merely combine domain-level logic, but being long they make the impression they're more than that.
-T.
Tobias C. Rittweiler wrote:
Nikodemus Siivola nikodemus@random-state.net writes:
I'm not sure. I'm not totally opposed, but I'm not convinced either: even if it wrong, the names are "culturally correct", if you will. Names partial-apply and partial-reverse-apply would be my preferred ones if we did the renaming.
I find them too long. Long names can distract from the intent of the actual code. They're supposed to merely combine domain-level logic, but being long they make the impression they're more than that.
I second this.
On Jun 8, 2009, at 09:40 , Tobias C. Rittweiler wrote:
Nikodemus Siivola nikodemus@random-state.net writes:
I'm not sure. I'm not totally opposed, but I'm not convinced either: even if it wrong, the names are "culturally correct", if you will. Names partial-apply and partial-reverse-apply would be my preferred ones if we did the renaming.
I find them too long. Long names can distract from the intent of the actual code. They're supposed to merely combine domain-level logic, but being long they make the impression they're more than that.
FWIW, I agree with Tobias' arguments.
I'd vote for PAPPLY (and probably by extension REVPAPPLY) if there is to be a name change.
I find them too long. Long names can distract from the intent of the actual code. They're supposed to merely combine domain-level logic, but being long they make the impression they're more than that.
if i see PAPPLY (or any other abbreviated name for that matter), my brain first maps it to PARTIAL-APPLY and then to the meaning itself.
IMHO, abbreviation is bad because it can be done in a million ways and it only introduces an extra level of indirection which is an (admittedly small) obstacle against understanding.
of course the picture is different for names that are used in every second line.
it might be only me, though. and i don't have strong feelings because names are inherently subjective and our tools should handle the personal preferences. CL + slime does not provide much in this regard, but packages and symbol aliases work.
On 6/8/09, Attila Lendvai attila.lendvai@gmail.com wrote:
I find them too long. Long names can distract from the intent of the actual code. They're supposed to merely combine domain-level logic, but being long they make the impression they're more than that.
if i see PAPPLY (or any other abbreviated name for that matter), my brain first maps it to PARTIAL-APPLY and then to the meaning itself.
IMHO, abbreviation is bad because it can be done in a million ways and it only introduces an extra level of indirection which is an (admittedly small) obstacle against understanding.
of course the picture is different for names that are used in every second line.
it might be only me, though. and i don't have strong feelings because names are inherently subjective and our tools should handle the personal preferences. CL + slime does not provide much in this regard, but packages and symbol aliases work.
I tend to agree on long names & short names being an orthogonal issue.
What is this "symbol aliases" you mentioned? Is it some common idiom or unannounced library of yours?
I was wondering if anyone knows of any equivalent to Python's
import some_long_external_module_name as shortname
using just the plain CL package system?
Yong.
szergling wrote:
I was wondering if anyone knows of any equivalent to Python's
import some_long_external_module_name as shortname
using just the plain CL package system?
You could use RENAME-PACKAGE:
http://www.lispworks.com/documentation/HyperSpec/Body/f_rn_pkg.htm#rename-pa...
Leslie
2009/6/4 Nikodemus Siivola nikodemus@random-state.net:
What about papply or partial-apply? Or maybe p-apply? This way, The reversed version might be called rp-apply. Otherwise reverse-partial-apply?
I am aware that this is a common usage/mistake in CL, but Alexandria doesn't have to perpetuate this error. An unfortunate downside is breaking backwards compatibility. I'm not sure what Alexandria's policy is regarding this...
I'm happy to send patches if this renaming is agreed upon.
I'm not sure. I'm not totally opposed, but I'm not convinced either: even if it wrong, the names are "culturally correct", if you will. Names partial-apply and partial-reverse-apply would be my preferred ones if we did the renaming.
I'm slowly coming to think that calling them CURRY and RCURRY is indeed a mistake we should stop propagating.
(defun partial-apply (function &rest partial-arguments) "Returns a function that calls FUNCTION with PARTIAL-ARGUMENTS followed by the arguments it is called with." (declare (optimize (speed 3) (safety 1) (debug 1))) (let ((fn (ensure-function function))) (lambda (&rest more) (declare (dynamic-extent more)) ;; Using M-V-C we don't need to append the arguments. (multiple-value-call fn (values-list partial-arguments) (values-list more)))))
(define-compiler-macro partial-apply (function &rest partial-arguments) (let ((temps (make-gensym-list (length partial-arguments) "PARTIAL-ARG"))) `(let ,(mapcar #'list temps partial-arguments) (declare (optimize (speed 3) (safety 1) (debug 1))) (lambda (&rest more) (declare (dynamic-extent more)) (apply ,function ,@temps more)))))
(defun reverse-partial-apply (function &rest partial-arguments) "Returns a function that calls FUNCTION with the arguments it is called with followed by PARTIAL-ARGUMENTS." (declare (optimize (speed 3) (safety 1) (debug 1))) (let ((fn (ensure-function function))) (lambda (&rest more) (declare (dynamic-extent more)) (multiple-value-call fn (values-list more) (values-list partial-arguments)))))
Cheers,
-- Nikodemus
Nikodemus Siivola wrote:
I'm slowly coming to think that calling them CURRY and RCURRY is indeed a mistake we should stop propagating.
Alright, but don't you agree that partial-apply and esp. reverse-partial-apply are names that are too long for such a basic function?
Leslie
2009/8/6 Leslie P. Polzer sky@viridian-project.de:
Nikodemus Siivola wrote:
I'm slowly coming to think that calling them CURRY and RCURRY is indeed a mistake we should stop propagating.
Alright, but don't you agree that partial-apply and esp. reverse-partial-apply are names that are too long for such a basic function?
No. Clarity is far more important than being terse: they are no slower to read, and meaning is that much more immediately obvious. Note though that I'm not convinced either is a real win over
(lambda (b) (foo a b))
and
(lambda (a) (foo a b))
in any way. Using PARTIAL-APPLY above would be sophistry and obfuscation. They become nice only when the number of arguments is increases:
(partial-apply #'foo a b c)
rather than
(lambda (d e f) (foo a b c d e f))
in which case the lenght of the name is a non-issue:
(papply #'foo a b c)
saves a whopping 6 letters.
Cheers,
-- Nikodemus
Alright, but don't you agree that partial-apply and esp. reverse-partial-apply are names that are too long for such a basic function?
No. Clarity is far more important than being terse: they are no slower to read, and meaning is that much more immediately obvious. Note
if people second the other opinion, then i feel that i must speak up on behalf of the non-abbreviation group.
the need for abbreviation (if any) should be satisfied by a tool (the editor), not a library.
Attila Lendvai wrote:
if people second the other opinion, then i feel that i must speak up on behalf of the non-abbreviation group.
the need for abbreviation (if any) should be satisfied by a tool (the editor), not a library.
I also vote for the longer, more descriptive name. Auto-complete is my friend.
Thanks,
Ryan Davis Acceleration.net Director of Programming Services 2831 NW 41st street, suite B Gainesville, FL 32606
Office: 352-335-6500 x 124 Fax: 352-335-6506
Attila Lendvai wrote:
if people second the other opinion, then i feel that i must speak up on behalf of the non-abbreviation group.
the need for abbreviation (if any) should be satisfied by a tool (the editor), not a library.
Indeed, but it's also a matter of screen estate. Composition of three functions partially applied in reverse order might be a one-liner using RCURRY but a whopping three lines using REVERSE-PARTIAL-APPLY.
Anyway I feel this discussion is largely based on fancy. How about offering both interfaces?
Leslie
From: "Leslie P. Polzer" sky@viridian-project.de
Nikodemus Siivola wrote:
I'm slowly coming to think that calling them CURRY and RCURRY is indeed a mistake we should stop propagating.
Alright, but don't you agree that partial-apply and esp. reverse-partial-apply are names that are too long for such a basic function?
I second this.
regards, Samium Gromoff
alexandria-devel@common-lisp.net