This is what we have done. We have a lot of domain-specific UDFs available in our SQLite scopes. Both scalar and aggregate types. Note that not all functions must be pure. You can quickly repurpose SQLite into a full-blown DSL by going down this path.
See: https://www.sqlite.com/appfunc.html
And: https://docs.microsoft.com/en-us/dotnet/standard/data/sqlite...