Repository navigation
[Query] Inspect Higher Order Functions
Generated from 'wiki-query.ts' on 2026-11-08, 09:20:49 UTC (v2.17.4), do not edit directly.
Inspect Higher-Order Functions Query [overview]
Determine whether functions are higher-order functions
This query is requested with the type inspect-higher-order.
Run in the REPL: :query @inspect-higher-order [(<crit>;...)] <code | file://path>
With this query you can identify which functions in the code are higher-order functions, i.e., either take a function as an argument or return a function.
A parameter the body itself calls (function(g) g(), function(g) lapply(x, g)) counts as well, without any call site having to hand a function over.
Please note, that functions that are just identities (e.g., function(x) x) are not considered higher-order if they do not take a function as an argument.
Using the example code f <- function() function(x) x; f() the following query returns the information for all identified function definitions whether they are higher-order functions:
[ { "type": "inspect-higher-order" } ](This can be shortened to @inspect-higher-order when used with the REPL command :query).
Results (prettified and summarized):
Query: inspect-higher-order
- Function 5 (1.17-29) is not a higher-order function
- Function 7 (1.6-29) is a higher-order function
Show Detailed Results as Json
The analysis ran (including parsing and normalization and the query) within the generation environment.
The JSON contains the ids of the nodes in question (see the Interface wiki page).
{"inspect-higher-order":{".meta":{},"higherOrder":{"5":false,"7":true}},".meta":{}}Original Code
f <- function() function(x) x; f()This query also supports a slicing criterion based query mode that only returns information for functions matching the given criteria:
[ { "type": "inspect-higher-order", "filter": [ "1@function" ] } ](This can be shortened to @inspect-higher-order (1@function) "f <- function() function(x) x; f()" when used with the REPL command :query).
Results (prettified and summarized):
Query: inspect-higher-order
- Function 7 (1.6-29) is a higher-order function
Show Detailed Results as Json
The analysis ran (including parsing and normalization and the query) within the generation environment.
The JSON contains the ids of the nodes in question (see the Interface wiki page).
{"inspect-higher-order":{".meta":{},"higherOrder":{"7":true}},".meta":{}}Implementation Details
The Inspect Higher-Order Functions Query is executed by executor.
Currently maintained by Florian Sihler and Oliver Gerstl at Ulm University
Email | GitHub | Penguins | Portfolio
- 🧑💻 Developer Onboarding
- 💻 Setup
- 👓 Overview
- 🪟 Interfacing with flowR
- 🌋 Core
- 🧹 Testing & Linting (Benchmark Page)
⁉️ FAQ- ℹ️ Extra Information