Funding for DARPA and NSF ultimately comes from the same place. DARPA funds military research. NSF funds dual use[1] research. All of it is organized around long term research goals. I maintained some of the software involved in research funding decision making.