Theoretical Computer Science Stack Exchange is a question and answer site for theoretical computer scientists and researchers in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
What do you mean by "takes a function"? What's your input representation? Abstract functions don't have conditionals; only their implementations. – Jeffε Feb 19 '13 at 18:30
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. – Andrew Butenko Feb 21 '13 at 6:53
up vote 3 down vote accepted

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

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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