From 2dd1432b07afd46ab2db2791941d0716ef84f479 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Thu, 19 Jan 2017 09:26:12 -0800 Subject: [PATCH] Docs: add an example of evaluating a string --- docs/language/api.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/language/api.rst b/docs/language/api.rst index 5838bc2..7df26fe 100644 --- a/docs/language/api.rst +++ b/docs/language/api.rst @@ -812,6 +812,15 @@ defaults to the name of the current module. => (eval '(print "Hello World")) "Hello World" +If you want to evaluate a string, use ``read-str`` to convert it to a +form first: + +.. code-block:: clj + + => (eval (read-str "(+ 1 1)")) + 2 + + eval-and-compile ----------------