A Two-Level Approach to Logic plus Functional Programming Integration