First question answer: The code isn't the same. The ~x is the first argument for -> and is the last argument for ->>. So if you do a long chain of expression the first argument is passed into the return value into the next function with -> and ->> pass that value as the last parameter.
Second question: I think what you mean is (->> "hi" println) . If you wanted to give the function multiple arguments you could do this: (-> "hello" (println "world!")) and the other form it would be (->> "world!" (println "Hello")) Matt Hoyt ________________________________ From: Dennis Haupt <d.haup...@googlemail.com> To: clojure@googlegroups.com Sent: Wednesday, November 2, 2011 4:37 AM Subject: -> vs ->> and names vs anonymous function -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hi there, i stumbled over two odd things 1) -> and ->> have the same source code. why is that? 2) why can't i use "(-> "hi" #(println %))" directly? why do i have to put my function into a symbol first? is there a way to avoid this? (let [dummy #(println %)] (->> "hi" dummy)) - -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJOsQ9cAAoJENRtux+h35aGle8P/ih+1jVTdmrVUmF1o/QM7N06 s+bWnhkvt9qIcs+jB8dNUSIRLaDkdqQBsO6Aj7SvlGhhgjNjKyKrBBkHwAgriCXj H95Dk4UPAvkILYe1ztLJNkYde0TbEMiOtSHRza7PWdtMChFYRhdwW5RVQxzWQd1j VZbp681mfPh2k8NXEo1ywG0XRxpC4/gNdV9I3spfLBO/gvLgPDFHutLKzojZtTr9 Ba8HHXxseF3e9Yp/v+j2NqA05RCWgRMqjtNW0WIXOydgmsyYw/xhUQn+mHtNgd9V 43MP6Z9lbU+ZEJNnlnqP7FQ9M07g96z9iLOkPUKV3zMqwgpu3mTmWcJdN5TtPI1B Uzt5N6Ds/9Sx4yV3MUEK4ROcN6y94zOgUYMMrE1wdR5PvSTUehPXVWp+WfoOkpxV HO8Li4bTFIffNx8agHAv8N6U4kO513yUqNcM0HsTMwtOZ98unhWp4xcaypszQs0I 7DBoGdR6RV/bFJV2jp5vc4lGNxEpf1+RzMluh3Z9GPKjatVno2yI4MlEblhl/zXf SHJyOplR3Csr+ojN7v5IZZrVP+EzC41eHdpAXig4pYpVi3p3P8oAfKke7sY5yHAu kBVG+Q+gmLH4x7vkZZIu9T7JBEX/lMaGx4/pIW95inkjJKfF9rZMNc8BqN8ezqzv z6SKrE2KpF5YTEr8CscC =jkOp -----END PGP SIGNATURE----- -- 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