From 33c095c4a849041abbb2fe1e174290da57ce7ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com> Date: Mon, 4 Jul 2022 18:22:13 +0200 Subject: [PATCH] Add an example of builtin function embedding into a user function --- doc/userdoc.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/userdoc.org b/doc/userdoc.org index a1464f411..e98a11151 100644 --- a/doc/userdoc.org +++ b/doc/userdoc.org @@ -2295,6 +2295,18 @@ functions. They differ from user-defined functions in three points. (actually, this is not a limitation since it is trivial to embed a builtin function into a user-defined one). +Here is a simple example of builtin function embedding in a user +function. +#+NAME: builtin-function-embedding +#+BEGIN_SRC pugs :exports both :results output + import math; + + let cosinus: R -> R, x -> cos(x); + cout << "cosinus(2) = " << cosinus(2) << "\n"; +#+END_SRC +Running this example produces +#+results: builtin-function-embedding + Builtin functions are defined when modules are imported, see [[modules]]. ** TODO modules<<modules>> -- GitLab