C# has lambdas which can be 'dynamically declared.' That is technically possible in C#. But I don't recommend it. It's very dangerous. What would happen if your database somehow got "Directory.Delete("C:\Windows\system32")" in it? Alternatively, consider adding a scripting language to your program (I recommend Lua). That would let you store scripts as strings in the database, and execute them in a controlled environment. You can ensure scripts don't have the ability to do bad things like delete files, and that they only have access to the C# functions you expose. Yes. LISP does what you want fantastically. Everything you're asking for: homoiconicity, lambdas, first-class functions, partial application. But that is a deep rabbit hole. I definitely recommend diving down it someday. But for now, to actually accomplish your project, I'd stick with C#, and either embed a scripting language or use C# lambdas (possibly both).
You can also pass around the lambda/delegate to other functions, for them to call it. delegate int del(int i);
static void Main(string[] args)
{
del myDelegate = x => x * x;
int j = myDelegate(5); //j = 25
}
define parts of the function once in the database assemble it as a string at run time and execute it on the fly
"Does this have anything to do with the 'enlightenment' that I see all over the place when Lisp developers talk about loving their language so much?"
Thank you so much, rob05c. My co-worker got a huge kick out of: | Everything you mention but don't know the terms for: "He's schooling you, brah!" "Yeah. Obviously I fucking need it. I can't even articulate in the proper vernacular what I'm trying to do."