views:

101

answers:

3

I missed a short syntax to express fundamental operations over functions in Clojure. Because of that, I started to use º as a shorthand for comp (cause it's closer to the math operator but easily accessible) and ¬ for partial (because reminds me of missing parameters).

What are your thoughts about this? is it useful or does it have the risk of making code confusing?

+3  A: 

It's confusing for people who don't know the notation. I imagine it's probably quite difficult to type, too. I'd just stick with the standard names.

harto
Sure im a not objective but i think is relativily easy to remember (at least for me) after seeing the definition and perhaps the shorter syntax (near haskell dot operator) worth. We must carefully select the forms to be shortened but i think comp and partial are basic higher order functions and good candidates...But i get your point.
jneira
+3  A: 

As a rule of thumb, I would be very hesitant to invent new names for already-named established concepts.

Svante
+2  A: 

I prefer not to use non-ASCII characters in code (outside of string / character literals and comments). How about having your editor prettify the code for you when it's displayed, but not when saving it? E.g. the following function will cause Emacs to display comp as (the actual function composition symbol):

(defun pretty-comp ()
  (font-lock-add-keywords
   nil `(("\\<\\(comp\\)\\>"
          (0 (progn (compose-region (match-beginning 1)
                                    (match-end 1)
                                    ?∘)
                    nil))))))

Apparently it's not perfect -- it seems to mangle the display of compfoo etc. -- but you might be able to tweak it to work for you.

Michał Marczyk
jneira