Consider how you'd write a function to perform a similar task. A function can't delay evaluation, but it should work for something like:
(if-else (> 5 2) :else 'no-way :then 'sure) => 'sure If you manage to write a function that can do the above, you're 90% of the way to writing a macro. - James On 22 June 2014 21:28, Ryan Yogan <ryan.yo...@sonian.net> wrote: > Hi, I am trying to understand macros and I am having trouble with the > basics, I am working through some koans and I am stuck, an explanation not > just a solution would be amazing. > > I would like to create a macro that can provide the following > > (if-else (> 5 2)) > => nil > > (if-else (> 5 2) :then 'sure) > => sure > > (if-else (> 5 2) :else 'no-way :then 'sure) > => sure > > (if-else (> 5 2) :else 'no-way :then > (println 'this-is-random) 'sure) > => this is random > sure > > I know this is not efficient and do would make more sense, but I am trying > to understand a use case for this and how to accomplish this. > > Thank you! > > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.