KernelFunction

KernelFunction[f]

represents a function to be evaluated in the Wolfram Engine kernel, even when it is called inside compiled code.

Details

  • The function f in KernelFunction[f] can be a built-in Wolfram Language function, a Function object or a function with definitions given by the user.

Examples

open all close all

Basic Examples  (1)

Use the Wolfram Engine evaluator to compute the AiryAi function from compiled code:

In[1]:=
Click for copyable input
Out[1]=

Execute the compiled function:

In[2]:=
Click for copyable input
Out[2]=

The result compares with the direct call:

In[3]:=
Click for copyable input
Out[3]=

Call a pure function that executes with the evaluator:

In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=

Define a function in the Wolfram Engine:

In[6]:=
Click for copyable input

Call the function from compiled code:

In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=

Scope  (4)

Neat Examples  (1)

Introduced in 2019
(12.0)