<p>Indeed there is a Wikipedia entry on <a href="http://en.wikipedia.org/wiki/Meta_programming" rel="nofollow noreferrer">metaprogramming</a>.  The question
<a href="https://cs.stackexchange.com/questions/2869/what-are-staged-functions-conceptually/2914#2914">"What are staged functions?"</a>
on cs.stackexchange is also relevant.</p>

CC BY-SA 3.0
2013-02-21T06:55:41.863Z
Cool! i guess staged functions is what i was looking for. never heard of them before.
Andrew Butenko
CC BY-SA 3.0
2013-02-18T20:57:29.667Z
2013-02-18T20:57:29.667Z
2017-04-13T12:48:30.830Z
Uday Reddy
<p>Consider a function F that takes a function and produces a function based on <strong>structure</strong> of the input function. As an example consider F that takes all functions having at least two conditionals and swaps their conditional expressions. so</p>

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

<p>becomes </p>

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

<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.</p>

CC BY-SA 3.0
2013-02-19T18:30:37.787Z
What do you mean by "takes a function"?  What's your input representation?  Abstract functions don't have conditionals; only their implementations.
Jeffε
CC BY-SA 3.0
2013-02-21T06:53:29.027Z
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
<functional-programming><ct.category-theory><function>
Newbie question: Meta-functions?
Andrew Butenko
# Newbie question: Meta-functions?

(Asked by: username_0 on 2013-02-18)

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 ))

becomes 
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.

**Tags:** functional-programming, ct.category-theory, function

> **Comments:**
> **username_1**: What do you mean by "takes a function"?  What's your input representation?  Abstract functions don't have conditionals; only their implementations.  
> **username_0**: 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.  

---

## 1 answers

### Answer by username_2 on 2013-02-18. Score: 4 | Accepted answer

Indeed there is a Wikipedia entry on [metaprogramming](http://en.wikipedia.org/wiki/Meta_programming). The question
["What are staged functions?"](https://cs.stackexchange.com/questions/2869/what-are-staged-functions-conceptually/2914#2914)
on cs.stackexchange is also relevant.

> **Comments:**
> **username_0**: Cool! i guess staged functions is what i was looking for. never heard of them before.  

---

