You can in fact do this in C with macros. For example I have a nice list-sorting macro which takes a comparison code fragment as argument, and expands to fast code to sort a list using that comparator. Tree search and hash tables can be done similarly.
I agree macros more like LISP would be much more versatile. This is an area where C++ does well too, with or without templates.