Well, it would be harder for *me* to type. I imagine Hiredman has
these symbols bound to some short but little-used key sequences. If
you're not using your C-c bindings for anything else, you can
pick four of them and use them for this.
On Nov 16, 12:13 pm, Paul Hobbs wrote:
> Huh. Isn't a unic
Huh. Isn't a unicode composition symbol harder to type than comp? If it's
for readability, I'd rather go with the emacs hacks.
On Tue, Nov 16, 2010 at 11:54 AM, Alan wrote:
> Found it. See
> https://github.com/hiredman/odds-and-ends/blob/8a84e6ddbad9d71f714ba16c3e1239633228a7eb/functional.clj#
Found it. See
https://github.com/hiredman/odds-and-ends/blob/8a84e6ddbad9d71f714ba16c3e1239633228a7eb/functional.clj#L94
On Nov 16, 10:06 am, Alan wrote:
> Ask on #clojure about this. Someone (hiredman, I think?) has a macro
> that rewrites code using some funky unicode characters. I can't find
Hi Eric,
Looks good; nice job with complement too. Of course you can add it to the
Emacs Starter Kit ;-)
--
Paul Hobbs
On Tue, Nov 16, 2010 at 9:51 AM, Eric Schulte wrote:
> Just to follow up, I'm now using the following to pretty up Clojure code
> in Emacs
>
> #+begin_src emacs-lisp
> ;; sym
Ask on #clojure about this. Someone (hiredman, I think?) has a macro
that rewrites code using some funky unicode characters. I can't find
it at the moment, but it might be what you're looking for.
On Nov 16, 9:51 am, "Eric Schulte" wrote:
> Just to follow up, I'm now using the following to pretty
Just to follow up, I'm now using the following to pretty up Clojure code
in Emacs
#+begin_src emacs-lisp
;; symbols for some overlong function names
(eval-after-load 'clojure-mode
'(font-lock-add-keywords
'clojure-mode
(mapcar
(lambda (pair)
`(,(car pair)
atreyu writes:
> Yep, you have to use flip and it is not so elegant
>
> Prelude> let f x y z=(x+z)*y
> Prelude> map (flip (f 1) 2) [3,4,5]
> [9,12,15]
>
> OTOH in clojure we have, you guess..., macros!!!
>
> user> (->> [[2 3][3 3][6 6]] (filter (comp even? sum)) concat2 (map
> #(+ 5 %)))
> (8 8 1
Hi Paul,
Thanks for sharing this. It seems like the best compromise between the
desire to keep my code brief (at least to my eyes) without wanting to
introduce my own custom function names for global functions.
If you don't mind I'd like to add this to my fork of the Emacs Starter
Kit (will cred
Yep, you have to use flip and it is not so elegant
Prelude> let f x y z=(x+z)*y
Prelude> map (flip (f 1) 2) [3,4,5]
[9,12,15]
OTOH in clojure we have, you guess..., macros!!!
user> (->> [[2 3][3 3][6 6]] (filter (comp even? sum)) concat2 (map
#(+ 5 %)))
(8 8 11 11)
i promise i'll not comment ab
Hi,
On 16 Nov., 11:06, atreyu wrote:
> clojure is nice too for the example but if you'd add functions and
> they have arity more than 1 haskell gets better (imo of course):
And less than 3 if one is honest. Haskell is spicked with rather
unmotivated "`foo` x"s which simply means #(foo % x) in a
clojure is nice too for the example but if you'd add functions and
they have arity more than 1 haskell gets better (imo of course):
user> (def concat2 (partial apply concat))
#'user/concat2
user> ((comp (partial map (partial + 5)) concat2) (filter (comp even?
sum) [[2 3] [3 3] [6 6]]))
(8 8 11 11)
On Tue, Nov 16, 2010 at 3:23 AM, atreyu wrote:
> impenetrable for builtin curried functions and . operator as comp?? i
> dont think so, haskell can be hard to read but not for those reasons
> F. e. filter when the sum of elements are even:
>
> Prelude> filter (even.sum) [[2,3],[3,3]]
> [[3,3]]
>
>
impenetrable for builtin curried functions and . operator as comp?? i
dont think so, haskell can be hard to read but not for those reasons
F. e. filter when the sum of elements are even:
Prelude> filter (even.sum) [[2,3],[3,3]]
[[3,3]]
i think is pretty readable ;-)
On Nov 16, 2:19 am, Cyrus Har
Well, for those who use emacs, you could always make it *look* like it was
pretty... For example:
(eval-after-load 'clojure-mode
'(font-lock-add-keywords
'clojure-mode `(("\\"
(0 (progn (compose-region
(match-beginning 0) (match-end 0)
,(make-char 'greek-iso8859-7 107)) ;; a lambda
I think the minimal character count for composition and partial functions in
haskell are some of the reasons that haskell code is so impenetrable to
non-haskell hackers. Feel free to rig up crazy unicode characters to any
identifier you want in your own code, just don't ask me to read or debug
Coming from Haskell, where composition and partial functions are cheap and
free in terms of character count, it is actually pretty discouraging to have
to spell it out in Clojure for the same effect. Some of the cases where you
"should" be using multiple expressions in Clojure would be perfectly c
On Mon, Nov 15, 2010 at 10:26 AM, Alan wrote:
> The one that bugs me is complement - such a long name for a commonly-
> useful function. I often wind up defining ! as an alias for
> complement, but maybe others will think that is poor style.
Possibly because bang functions indicate "Here be drago
On Mon, Nov 15, 2010 at 1:26 PM, Alan wrote:
> I think comp is nice and short, personally. Partial is okay, and the
> long name helps discourage me from using it when I should be using #()
> instead - partial is a bit slower. And if you find yourself wanting to
> nest #() forms, it's not that bad
I think comp is nice and short, personally. Partial is okay, and the
long name helps discourage me from using it when I should be using #()
instead - partial is a bit slower. And if you find yourself wanting to
nest #() forms, it's not that bad to switch to partial, and it may
serve as a warning si
Am 14.11.2010 07:33, schrieb Eric Schulte:
Hi,
I find myself frequently using the `comp' and `partial' functions and
while I really enjoy being able to program in a point free style, the
length (in characters) of these command names often has the effect of
causing what should be a brief statemen
On Sat, Nov 13, 2010 at 11:33 PM, Eric Schulte wrote:
> I'm about to begin starting all of my clojure namespaces with
> (def o comp) ; o for cOmp, Haskell's (.) or Mathematical composition \circ
> (def p partial) ; p for partial
> Is there any support for including these function aliases for `com
21 matches
Mail list logo