Is there a mark in ML?

Is there an eval function in ML?

+3
source share
3 answers

ML is really just a dialect, but the ML implementation that I used (OCaml, F #) has an eval value as far as I know. This makes sense since ML uses strong typing (types are known at compile time). Eval will violate this warranty.

However, I found an implementation of eval in OCaml that apparently uses code from the top level:

http://thelackthereof.org/OCaml_Eval

+1
source

In F # it is possible to have some form of eval, but the code to be evaluated must be specified.

#r"FSharp.PowerPack.dll"
#r"FSharp.PowerPack.Linq.dll"
(* load the PowerPack *)
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.QuotationEvaluation
let x = <@@ 8*11 @@>
x.EvalUntyped() // = 88

: http://msdn.microsoft.com/en-us/library/dd233212.aspx

0

, SML/NJ Poly/ML : .

Poly/ML : ML REPL

Poly / ML can do more of these things, such as managing an ML environment under program control. It also supports initial level debugging with arbitrary evaluation at breakpoints.

0
source

Source: https://habr.com/ru/post/1749406/


All Articles