By the way, once you start looking for conjugation in common code patterns, you see it everywhere. A less trivial example is the Schwartzian transform for caching sorting keys:
(defn schwartz [key-fn] #(map (fn [x] [(key-fn x) x]) %)) (def unschwartz #(map second %)) (defn schwartz-sort [key-fn] (conjugate sort (schwartz key-fn) unschwartz)) If you implement first-class support for invertible functions (surprisingly easy), you can capture important properties such as: - composing invertible functions gives an invertible function. - the inverse of an invertible function is an invertible function. >From this, it follows (with no extra work) that the conjugate transformation of an invertible function is an invertible function. -Per On Thu, Apr 22, 2010 at 10:38 AM, Michał Marczyk <michal.marc...@gmail.com> wrote: > On 22 April 2010 03:51, Per Vognsen <per.vogn...@gmail.com> wrote: >> Yet another variation: >> >> [...] >> >> Food for thought. :) > > This is absolutely beautiful. I feel a tremendous joy now. :-) > > Sincerely, > Michał > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en