Consider a function F that takes a function and produces a function based on structure of the input function. As an example consider F that takes all functions having at least two conditionals and swaps their conditional expressions. so

if condition(a, b, c) then calc1(z) else (calc(y) + (if condition1(a, m, k) then u else p ))


if condition1(a, b, c) then calc1(z) else (calc(y) + (if condition(a, m, k) then u else p ))

Do functions like these fit into category theory/computational science? How are they called? Would love any pointers on books/wikipedia articles about them.

  • $\begingroup$ What do you mean by "takes a function"? What's your input representation? Abstract functions don't have conditionals; only their implementations. $\endgroup$ – Jeffε Feb 19 '13 at 18:30
  • $\begingroup$ lets say functions are represented as a composition of primitive functions. All functional programming languages rely on this way of creating complexity. It strikes me that most functional languages lack reflective capabilities so that the representation of the function itself can be inspected. This is why i ended up asking this question. $\endgroup$ – Andrew Butenko Feb 21 '13 at 6:53

Indeed there is a Wikipedia entry on metaprogramming. The question "What are staged functions?" on cs.stackexchange is also relevant.

| cite | improve this answer | |
  • $\begingroup$ Cool! i guess staged functions is what i was looking for. never heard of them before. $\endgroup$ – Andrew Butenko Feb 21 '13 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.