api-evaluation.texi 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. @c -*-texinfo-*-
  2. @c This is part of the GNU Guile Reference Manual.
  3. @c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006
  4. @c Free Software Foundation, Inc.
  5. @c See the file guile.texi for copying conditions.
  6. @page
  7. @node Read/Load/Eval
  8. @section Reading and Evaluating Scheme Code
  9. This chapter describes Guile functions that are concerned with reading,
  10. loading and evaluating Scheme code at run time.
  11. @menu
  12. * Scheme Syntax:: Standard and extended Scheme syntax.
  13. * Scheme Read:: Reading Scheme code.
  14. * Fly Evaluation:: Procedures for on the fly evaluation.
  15. * Loading:: Loading Scheme code from file.
  16. * Delayed Evaluation:: Postponing evaluation until it is needed.
  17. * Local Evaluation:: Evaluation in a local environment.
  18. * Evaluator Behaviour:: Modifying Guile's evaluator.
  19. @end menu
  20. @node Scheme Syntax
  21. @subsection Scheme Syntax: Standard and Guile Extensions
  22. @menu
  23. * Expression Syntax::
  24. * Comments::
  25. * Block Comments::
  26. * Case Sensitivity::
  27. * Keyword Syntax::
  28. * Reader Extensions::
  29. @end menu
  30. @node Expression Syntax
  31. @subsubsection Expression Syntax
  32. An expression to be evaluated takes one of the following forms.
  33. @table @nicode
  34. @item @var{symbol}
  35. A symbol is evaluated by dereferencing. A binding of that symbol is
  36. sought and the value there used. For example,
  37. @example
  38. (define x 123)
  39. x @result{} 123
  40. @end example
  41. @item (@var{proc} @var{args}@dots{})
  42. A parenthesised expression is a function call. @var{proc} and each
  43. argument are evaluated, then the function (which @var{proc} evaluated
  44. to) is called with those arguments.
  45. The order in which @var{proc} and the arguments are evaluated is
  46. unspecified, so be careful when using expressions with side effects.
  47. @example
  48. (max 1 2 3) @result{} 3
  49. (define (get-some-proc) min)
  50. ((get-some-proc) 1 2 3) @result{} 1
  51. @end example
  52. The same sort of parenthesised form is used for a macro invocation,
  53. but in that case the arguments are not evaluated. See the
  54. descriptions of macros for more on this (@pxref{Macros}, and
  55. @pxref{Syntax Rules}).
  56. @item @var{constant}
  57. Number, string, character and boolean constants evaluate ``to
  58. themselves'', so can appear as literals.
  59. @example
  60. 123 @result{} 123
  61. 99.9 @result{} 99.9
  62. "hello" @result{} "hello"
  63. #\z @result{} #\z
  64. #t @result{} #t
  65. @end example
  66. Note that an application must not attempt to modify literal strings,
  67. since they may be in read-only memory.
  68. @item (quote @var{data})
  69. @itemx '@var{data}
  70. @findex quote
  71. @findex '
  72. Quoting is used to obtain a literal symbol (instead of a variable
  73. reference), a literal list (instead of a function call), or a literal
  74. vector. @nicode{'} is simply a shorthand for a @code{quote} form.
  75. For example,
  76. @example
  77. 'x @result{} x
  78. '(1 2 3) @result{} (1 2 3)
  79. '#(1 (2 3) 4) @result{} #(1 (2 3) 4)
  80. (quote x) @result{} x
  81. (quote (1 2 3)) @result{} (1 2 3)
  82. (quote #(1 (2 3) 4)) @result{} #(1 (2 3) 4)
  83. @end example
  84. Note that an application must not attempt to modify literal lists or
  85. vectors obtained from a @code{quote} form, since they may be in
  86. read-only memory.
  87. @item (quasiquote @var{data})
  88. @itemx `@var{data}
  89. @findex quasiquote
  90. @findex `
  91. Backquote quasi-quotation is like @code{quote}, but selected
  92. sub-expressions are evaluated. This is a convenient way to construct
  93. a list or vector structure most of which is constant, but at certain
  94. points should have expressions substituted.
  95. The same effect can always be had with suitable @code{list},
  96. @code{cons} or @code{vector} calls, but quasi-quoting is often easier.
  97. @table @nicode
  98. @item (unquote @var{expr})
  99. @itemx ,@var{expr}
  100. @findex unquote
  101. @findex ,
  102. Within the quasiquote @var{data}, @code{unquote} or @code{,} indicates
  103. an expression to be evaluated and inserted. The comma syntax @code{,}
  104. is simply a shorthand for an @code{unquote} form. For example,
  105. @example
  106. `(1 2 ,(* 9 9) 3 4) @result{} (1 2 81 3 4)
  107. `(1 (unquote (+ 1 1)) 3) @result{} (1 2 3)
  108. `#(1 ,(/ 12 2)) @result{} #(1 6)
  109. @end example
  110. @item (unquote-splicing @var{expr})
  111. @itemx ,@@@var{expr}
  112. @findex unquote-splicing
  113. @findex ,@@
  114. Within the quasiquote @var{data}, @code{unquote-splicing} or
  115. @code{,@@} indicates an expression to be evaluated and the elements of
  116. the returned list inserted. @var{expr} must evaluate to a list. The
  117. ``comma-at'' syntax @code{,@@} is simply a shorthand for an
  118. @code{unquote-splicing} form.
  119. @example
  120. (define x '(2 3))
  121. `(1 ,@@x 4) @result{} (1 2 3 4)
  122. `(1 (unquote-splicing (map 1+ x))) @result{} (1 3 4)
  123. `#(9 ,@@x 9) @result{} #(9 2 3 9)
  124. @end example
  125. Notice @code{,@@} differs from plain @code{,} in the way one level of
  126. nesting is stripped. For @code{,@@} the elements of a returned list
  127. are inserted, whereas with @code{,} it would be the list itself
  128. inserted.
  129. @end table
  130. @c
  131. @c FIXME: What can we say about the mutability of a quasiquote
  132. @c result? R5RS doesn't seem to specify anything, though where it
  133. @c says backquote without commas is the same as plain quote then
  134. @c presumably the "fixed" portions of a quasiquote expression must be
  135. @c treated as immutable.
  136. @c
  137. @end table
  138. @node Comments
  139. @subsubsection Comments
  140. @c FIXME::martin: Review me!
  141. Comments in Scheme source files are written by starting them with a
  142. semicolon character (@code{;}). The comment then reaches up to the end
  143. of the line. Comments can begin at any column, and the may be inserted
  144. on the same line as Scheme code.
  145. @lisp
  146. ; Comment
  147. ;; Comment too
  148. (define x 1) ; Comment after expression
  149. (let ((y 1))
  150. ;; Display something.
  151. (display y)
  152. ;;; Comment at left margin.
  153. (display (+ y 1)))
  154. @end lisp
  155. It is common to use a single semicolon for comments following
  156. expressions on a line, to use two semicolons for comments which are
  157. indented like code, and three semicolons for comments which start at
  158. column 0, even if they are inside an indented code block. This
  159. convention is used when indenting code in Emacs' Scheme mode.
  160. @node Block Comments
  161. @subsubsection Block Comments
  162. @cindex multiline comments
  163. @cindex block comments
  164. @cindex #!
  165. @cindex !#
  166. @c FIXME::martin: Review me!
  167. In addition to the standard line comments defined by R5RS, Guile has
  168. another comment type for multiline comments, called @dfn{block
  169. comments}. This type of comment begins with the character sequence
  170. @code{#!} and ends with the characters @code{!#}, which must appear on a
  171. line of their own. These comments are compatible with the block
  172. comments in the Scheme Shell @file{scsh} (@pxref{The Scheme shell
  173. (scsh)}). The characters @code{#!} were chosen because they are the
  174. magic characters used in shell scripts for indicating that the name of
  175. the program for executing the script follows on the same line.
  176. Thus a Guile script often starts like this.
  177. @lisp
  178. #! /usr/local/bin/guile -s
  179. !#
  180. @end lisp
  181. More details on Guile scripting can be found in the scripting section
  182. (@pxref{Guile Scripting}).
  183. @node Case Sensitivity
  184. @subsubsection Case Sensitivity
  185. @c FIXME::martin: Review me!
  186. Scheme as defined in R5RS is not case sensitive when reading symbols.
  187. Guile, on the contrary is case sensitive by default, so the identifiers
  188. @lisp
  189. guile-whuzzy
  190. Guile-Whuzzy
  191. @end lisp
  192. are the same in R5RS Scheme, but are different in Guile.
  193. It is possible to turn off case sensitivity in Guile by setting the
  194. reader option @code{case-insensitive}. More on reader options can be
  195. found at (@pxref{Reader options}).
  196. @lisp
  197. (read-enable 'case-insensitive)
  198. @end lisp
  199. Note that this is seldom a problem, because Scheme programmers tend not
  200. to use uppercase letters in their identifiers anyway.
  201. @node Keyword Syntax
  202. @subsubsection Keyword Syntax
  203. @node Reader Extensions
  204. @subsubsection Reader Extensions
  205. @deffn {Scheme Procedure} read-hash-extend chr proc
  206. @deffnx {C Function} scm_read_hash_extend (chr, proc)
  207. Install the procedure @var{proc} for reading expressions
  208. starting with the character sequence @code{#} and @var{chr}.
  209. @var{proc} will be called with two arguments: the character
  210. @var{chr} and the port to read further data from. The object
  211. returned will be the return value of @code{read}.
  212. @end deffn
  213. @node Scheme Read
  214. @subsection Reading Scheme Code
  215. @rnindex read
  216. @deffn {Scheme Procedure} read [port]
  217. @deffnx {C Function} scm_read (port)
  218. Read an s-expression from the input port @var{port}, or from
  219. the current input port if @var{port} is not specified.
  220. Any whitespace before the next token is discarded.
  221. @end deffn
  222. The behaviour of Guile's Scheme reader can be modified by manipulating
  223. its read options. For more information about options, @xref{User level
  224. options interfaces}. If you want to know which reader options are
  225. available, @xref{Reader options}.
  226. @c FIXME::martin: This is taken from libguile/options.c. Is there
  227. @c actually a difference between 'help and 'full?
  228. @deffn {Scheme Procedure} read-options [setting]
  229. Display the current settings of the read options. If @var{setting} is
  230. omitted, only a short form of the current read options is printed.
  231. Otherwise, @var{setting} should be one of the following symbols:
  232. @table @code
  233. @item help
  234. Display the complete option settings.
  235. @item full
  236. Like @code{help}, but also print programmer options.
  237. @end table
  238. @end deffn
  239. @deffn {Scheme Procedure} read-enable option-name
  240. @deffnx {Scheme Procedure} read-disable option-name
  241. @deffnx {Scheme Procedure} read-set! option-name value
  242. Modify the read options. @code{read-enable} should be used with boolean
  243. options and switches them on, @code{read-disable} switches them off.
  244. @code{read-set!} can be used to set an option to a specific value.
  245. @end deffn
  246. @deffn {Scheme Procedure} read-options-interface [setting]
  247. @deffnx {C Function} scm_read_options (setting)
  248. Option interface for the read options. Instead of using
  249. this procedure directly, use the procedures @code{read-enable},
  250. @code{read-disable}, @code{read-set!} and @code{read-options}.
  251. @end deffn
  252. @node Fly Evaluation
  253. @subsection Procedures for On the Fly Evaluation
  254. @xref{Environments}.
  255. @rnindex eval
  256. @c ARGFIXME environment/environment specifier
  257. @deffn {Scheme Procedure} eval exp module_or_state
  258. @deffnx {C Function} scm_eval (exp, module_or_state)
  259. Evaluate @var{exp}, a list representing a Scheme expression,
  260. in the top-level environment specified by @var{module}.
  261. While @var{exp} is evaluated (using @code{primitive-eval}),
  262. @var{module} is made the current module. The current module
  263. is reset to its previous value when @var{eval} returns.
  264. XXX - dynamic states.
  265. Example: (eval '(+ 1 2) (interaction-environment))
  266. @end deffn
  267. @rnindex interaction-environment
  268. @deffn {Scheme Procedure} interaction-environment
  269. @deffnx {C Function} scm_interaction_environment ()
  270. Return a specifier for the environment that contains
  271. implementation--defined bindings, typically a superset of those
  272. listed in the report. The intent is that this procedure will
  273. return the environment in which the implementation would
  274. evaluate expressions dynamically typed by the user.
  275. @end deffn
  276. @deffn {Scheme Procedure} eval-string string [module]
  277. @deffnx {C Function} scm_eval_string (string)
  278. @deffnx {C Function} scm_eval_string_in_module (string, module)
  279. Evaluate @var{string} as the text representation of a Scheme form or
  280. forms, and return whatever value they produce. Evaluation takes place
  281. in the given module, or in the current module when no module is given.
  282. While the code is evaluated, the given module is made the current one.
  283. The current module is restored when this procedure returns.
  284. @end deffn
  285. @deftypefn {C Function} SCM scm_c_eval_string (const char *string)
  286. @code{scm_eval_string}, but taking a C string instead of an
  287. @code{SCM}.
  288. @end deftypefn
  289. @deffn {Scheme Procedure} apply proc arg1 @dots{} argN arglst
  290. @deffnx {C Function} scm_apply_0 (proc, arglst)
  291. @deffnx {C Function} scm_apply_1 (proc, arg1, arglst)
  292. @deffnx {C Function} scm_apply_2 (proc, arg1, arg2, arglst)
  293. @deffnx {C Function} scm_apply_3 (proc, arg1, arg2, arg3, arglst)
  294. @deffnx {C Function} scm_apply (proc, arg, rest)
  295. @rnindex apply
  296. Call @var{proc} with arguments @var{arg1} @dots{} @var{argN} plus the
  297. elements of the @var{arglst} list.
  298. @code{scm_apply} takes parameters corresponding to a Scheme level
  299. @code{(lambda (proc arg . rest) ...)}. So @var{arg} and all but the
  300. last element of the @var{rest} list make up
  301. @var{arg1}@dots{}@var{argN} and the last element of @var{rest} is the
  302. @var{arglst} list. Or if @var{rest} is the empty list @code{SCM_EOL}
  303. then there's no @var{arg1}@dots{}@var{argN} and @var{arg} is the
  304. @var{arglst}.
  305. @var{arglst} is not modified, but the @var{rest} list passed to
  306. @code{scm_apply} is modified.
  307. @end deffn
  308. @deffn {C Function} scm_call_0 (proc)
  309. @deffnx {C Function} scm_call_1 (proc, arg1)
  310. @deffnx {C Function} scm_call_2 (proc, arg1, arg2)
  311. @deffnx {C Function} scm_call_3 (proc, arg1, arg2, arg3)
  312. @deffnx {C Function} scm_call_4 (proc, arg1, arg2, arg3, arg4)
  313. Call @var{proc} with the given arguments.
  314. @end deffn
  315. @deffn {Scheme Procedure} apply:nconc2last lst
  316. @deffnx {C Function} scm_nconc2last (lst)
  317. @var{lst} should be a list (@var{arg1} @dots{} @var{argN}
  318. @var{arglst}), with @var{arglst} being a list. This function returns
  319. a list comprising @var{arg1} to @var{argN} plus the elements of
  320. @var{arglst}. @var{lst} is modified to form the return. @var{arglst}
  321. is not modified, though the return does share structure with it.
  322. This operation collects up the arguments from a list which is
  323. @code{apply} style parameters.
  324. @end deffn
  325. @deffn {Scheme Procedure} primitive-eval exp
  326. @deffnx {C Function} scm_primitive_eval (exp)
  327. Evaluate @var{exp} in the top-level environment specified by
  328. the current module.
  329. @end deffn
  330. @node Loading
  331. @subsection Loading Scheme Code from File
  332. @rnindex load
  333. @deffn {Scheme Procedure} load filename [reader]
  334. Load @var{filename} and evaluate its contents in the top-level
  335. environment. The load paths are not searched.
  336. @var{reader} if provided should be either @code{#f}, or a procedure with
  337. the signature @code{(lambda (port) @dots{})} which reads the next
  338. expression from @var{port}. If @var{reader} is @code{#f} or absent,
  339. Guile's built-in @code{read} procedure is used (@pxref{Scheme Read}).
  340. The @var{reader} argument takes effect by setting the value of the
  341. @code{current-reader} fluid (see below) before loading the file, and
  342. restoring its previous value when loading is complete. The Scheme code
  343. inside @var{filename} can itself change the current reader procedure on
  344. the fly by setting @code{current-reader} fluid.
  345. If the variable @code{%load-hook} is defined, it should be bound to a
  346. procedure that will be called before any code is loaded. See
  347. documentation for @code{%load-hook} later in this section.
  348. @end deffn
  349. @deffn {Scheme Procedure} load-from-path filename
  350. Similar to @code{load}, but searches for @var{filename} in the load
  351. paths.
  352. @end deffn
  353. @deffn {Scheme Procedure} primitive-load filename
  354. @deffnx {C Function} scm_primitive_load (filename)
  355. Load the file named @var{filename} and evaluate its contents in
  356. the top-level environment. The load paths are not searched;
  357. @var{filename} must either be a full pathname or be a pathname
  358. relative to the current directory. If the variable
  359. @code{%load-hook} is defined, it should be bound to a procedure
  360. that will be called before any code is loaded. See the
  361. documentation for @code{%load-hook} later in this section.
  362. @end deffn
  363. @deftypefn {C Function} SCM scm_c_primitive_load (const char *filename)
  364. @code{scm_primitive_load}, but taking a C string instead of an
  365. @code{SCM}.
  366. @end deftypefn
  367. @deffn {Scheme Procedure} primitive-load-path filename
  368. @deffnx {C Function} scm_primitive_load_path (filename)
  369. Search @code{%load-path} for the file named @var{filename} and
  370. load it into the top-level environment. If @var{filename} is a
  371. relative pathname and is not found in the list of search paths,
  372. an error is signalled.
  373. @end deffn
  374. @deffn {Scheme Procedure} %search-load-path filename
  375. @deffnx {C Function} scm_sys_search_load_path (filename)
  376. Search @code{%load-path} for the file named @var{filename},
  377. which must be readable by the current user. If @var{filename}
  378. is found in the list of paths to search or is an absolute
  379. pathname, return its full pathname. Otherwise, return
  380. @code{#f}. Filenames may have any of the optional extensions
  381. in the @code{%load-extensions} list; @code{%search-load-path}
  382. will try each extension automatically.
  383. @end deffn
  384. @defvar current-reader
  385. @code{current-reader} holds the read procedure that is currently being
  386. used by the above loading procedures to read expressions (from the file
  387. that they are loading). @code{current-reader} is a fluid, so it has an
  388. independent value in each dynamic root and should be read and set using
  389. @code{fluid-ref} and @code{fluid-set!} (@pxref{Fluids and Dynamic
  390. States}).
  391. @end defvar
  392. @defvar %load-hook
  393. A procedure to be called @code{(%load-hook @var{filename})} whenever a
  394. file is loaded, or @code{#f} for no such call. @code{%load-hook} is
  395. used by all of the above loading functions (@code{load},
  396. @code{load-path}, @code{primitive-load} and
  397. @code{primitive-load-path}).
  398. For example an application can set this to show what's loaded,
  399. @example
  400. (set! %load-hook (lambda (filename)
  401. (format #t "Loading ~a ...\n" filename)))
  402. (load-from-path "foo.scm")
  403. @print{} Loading /usr/local/share/guile/site/foo.scm ...
  404. @end example
  405. @end defvar
  406. @deffn {Scheme Procedure} current-load-port
  407. @deffnx {C Function} scm_current_load_port ()
  408. Return the current-load-port.
  409. The load port is used internally by @code{primitive-load}.
  410. @end deffn
  411. @defvar %load-extensions
  412. A list of default file extensions for files containing Scheme code.
  413. @code{%search-load-path} tries each of these extensions when looking for
  414. a file to load. By default, @code{%load-extensions} is bound to the
  415. list @code{("" ".scm")}.
  416. @end defvar
  417. @node Delayed Evaluation
  418. @subsection Delayed Evaluation
  419. @cindex delayed evaluation
  420. @cindex promises
  421. Promises are a convenient way to defer a calculation until its result
  422. is actually needed, and to run such a calculation only once.
  423. @deffn syntax delay expr
  424. @rnindex delay
  425. Return a promise object which holds the given @var{expr} expression,
  426. ready to be evaluated by a later @code{force}.
  427. @end deffn
  428. @deffn {Scheme Procedure} promise? obj
  429. @deffnx {C Function} scm_promise_p (obj)
  430. Return true if @var{obj} is a promise.
  431. @end deffn
  432. @rnindex force
  433. @deffn {Scheme Procedure} force p
  434. @deffnx {C Function} scm_force (p)
  435. Return the value obtained from evaluating the @var{expr} in the given
  436. promise @var{p}. If @var{p} has previously been forced then its
  437. @var{expr} is not evaluated again, instead the value obtained at that
  438. time is simply returned.
  439. During a @code{force}, an @var{expr} can call @code{force} again on
  440. its own promise, resulting in a recursive evaluation of that
  441. @var{expr}. The first evaluation to return gives the value for the
  442. promise. Higher evaluations run to completion in the normal way, but
  443. their results are ignored, @code{force} always returns the first
  444. value.
  445. @end deffn
  446. @node Local Evaluation
  447. @subsection Local Evaluation
  448. [the-environment]
  449. @deffn {Scheme Procedure} local-eval exp [env]
  450. @deffnx {C Function} scm_local_eval (exp, env)
  451. Evaluate @var{exp} in its environment. If @var{env} is supplied,
  452. it is the environment in which to evaluate @var{exp}. Otherwise,
  453. @var{exp} must be a memoized code object (in which case, its environment
  454. is implicit).
  455. @end deffn
  456. @node Evaluator Behaviour
  457. @subsection Evaluator Behaviour
  458. @c FIXME::martin: Maybe this node name is bad, but the old name clashed with
  459. @c `Evaluator options' under `Options and Config'.
  460. The behaviour of Guile's evaluator can be modified by manipulating the
  461. evaluator options. For more information about options, @xref{User level
  462. options interfaces}. If you want to know which evaluator options are
  463. available, @xref{Evaluator options}.
  464. @c FIXME::martin: This is taken from libguile/options.c. Is there
  465. @c actually a difference between 'help and 'full?
  466. @deffn {Scheme Procedure} eval-options [setting]
  467. Display the current settings of the evaluator options. If @var{setting}
  468. is omitted, only a short form of the current evaluator options is
  469. printed. Otherwise, @var{setting} should be one of the following
  470. symbols:
  471. @table @code
  472. @item help
  473. Display the complete option settings.
  474. @item full
  475. Like @code{help}, but also print programmer options.
  476. @end table
  477. @end deffn
  478. @deffn {Scheme Procedure} eval-enable option-name
  479. @deffnx {Scheme Procedure} eval-disable option-name
  480. @deffnx {Scheme Procedure} eval-set! option-name value
  481. Modify the evaluator options. @code{eval-enable} should be used with boolean
  482. options and switches them on, @code{eval-disable} switches them off.
  483. @code{eval-set!} can be used to set an option to a specific value.
  484. @end deffn
  485. @deffn {Scheme Procedure} eval-options-interface [setting]
  486. @deffnx {C Function} scm_eval_options_interface (setting)
  487. Option interface for the evaluation options. Instead of using
  488. this procedure directly, use the procedures @code{eval-enable},
  489. @code{eval-disable}, @code{eval-set!} and @code{eval-options}.
  490. @end deffn
  491. @c FIXME::martin: Why aren't these procedure named like the other options
  492. @c procedures?
  493. @deffn {Scheme Procedure} traps [setting]
  494. Display the current settings of the evaluator traps options. If
  495. @var{setting} is omitted, only a short form of the current evaluator
  496. traps options is printed. Otherwise, @var{setting} should be one of the
  497. following symbols:
  498. @table @code
  499. @item help
  500. Display the complete option settings.
  501. @item full
  502. Like @code{help}, but also print programmer options.
  503. @end table
  504. @end deffn
  505. @deffn {Scheme Procedure} trap-enable option-name
  506. @deffnx {Scheme Procedure} trap-disable option-name
  507. @deffnx {Scheme Procedure} trap-set! option-name value
  508. Modify the evaluator options. @code{trap-enable} should be used with boolean
  509. options and switches them on, @code{trap-disable} switches them off.
  510. @code{trap-set!} can be used to set an option to a specific value.
  511. See @ref{Evaluator trap options} for more information on the available
  512. trap handlers.
  513. @end deffn
  514. @deffn {Scheme Procedure} evaluator-traps-interface [setting]
  515. @deffnx {C Function} scm_evaluator_traps (setting)
  516. Option interface for the evaluator trap options.
  517. @end deffn
  518. @c Local Variables:
  519. @c TeX-master: "guile.texi"
  520. @c End: