* TP <[email protected]> [2012-04-01 00:29:15+0200] > I am wondering if there is any means to get "f 3 5" instead of "8" in the > output of this program.
No, this is not possible by referential transparency. The output of your function can't depend on whether it is passed 8 or the result of f 3 5. In Lisp-like languages, you could do what you want by using macros. However, they have their own problems: you have to remember whether something is a function or a macro, and what quoting it expects. For instance, have a look at this StackOverflow question (and the answers): http://stackoverflow.com/questions/9912511/filenotfoundexception-when-loading-my-project-core-with-an-external-dependency In Haskell you can achieve your goal by using quasiquoting, but, unlike in Lisp, it won't look like an ordinary function invocation (because it isn't). -- Roman I. Cheplyaka :: http://ro-che.info/ _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
