ravenbrook / mlworks Goto Github PK
View Code? Open in Web Editor NEWMLWorks is a Standard ML compiler and development environment.
Home Page: http://www.ravenbrook.com/project/mlworks
License: Other
MLWorks is a Standard ML compiler and development environment.
Home Page: http://www.ravenbrook.com/project/mlworks
License: Other
This example
functor Foo (val update : RealArray.array * int * real -> unit) =
struct
val foo = update
end
structure Foo = Foo (val update = RealArray.update);
val a = RealArray.array (3, 2.0)
val _ = (Foo.foo (a, 1, 1.0);
if Real.== (RealArray.sub (a, 1), 1.0) then print "OK\n"
else print ("WRONG (" ^ Real.toString (RealArray.sub (a, 1)) ^ ")\n"))
when executed with: mlworks -tty -no-init < test.sml
prints
MLWorks 2.1 Professional Edition
Copyright (C) 1999 Harlequin Group plc. All rights reserved.
MLWorks is a trademark of Harlequin Group plc.
MLWorks> MLWorks>> MLWorks>> MLWorks>> MLWorks>> MLWorks>> functor Foo
structure Foo =
struct
val foo : (RealArray.array * int * real) -> unit = fn
end
MLWorks> MLWorks> MLWorks>> MLWorks>> MLWorks>> MLWorks>> WRONG (7.9892357038E~312)
val a : RealArray.array = #F[2.0, 7.989235704E~312, 2.0]
the expected result is of course #F[2.0, 1.0, 2.0]
Socket.sendVec should take a Word8VectorSlice
as argument instead of the current buf
thing.
Not stricly required, but getpid would be quite useful.
The C function unix_bind
in unix.c assumes that the argument is an address for a Unix Domain Socket.
The case when the argument is an INET address is not handled properly.
On branch https://github.com/Ravenbrook/mlworks/tree/linux-boot, the runtime system currently fails to link statically with various unresolved symbols in X libraries. The symbols are actually in the libraries, so it might be a link-order problem.
See #2 for a list of prerequisite libraries you need to install.
I have been working on Ubuntu 12 i386, completely vanilla.
In 4799e00 I temporarily hacked the static runtime out of the makefiles so that we can make progress with the boot, but it's inconvenient to set LD_LIBRARY_PATH all the time when developing.
MONO_ARRAY.copy should have type {src : array, dst : array, di : int} -> unit
but currently it has { src : array, si : int, len : int option, dst : array, di : int} -> unit
There doesn't seem to be any CharVectorSlice in MLWorks, but it's required by the "standard":
http://sml-family.org/Basis/mono-vector-slice.html#CharVectorSlice:STR:SPEC
The compiler runs into a problem with this code even if it seems to be type-correct (SML/NJ and PolyML accept it):
functor Slice (type 'a elt
type 'a seq
val sub : 'a seq * int -> 'a elt) =
struct
datatype 'a slice = SLICE of 'a seq
fun app f (SLICE s) = f (sub (s, 0))
end
functor MonoSlice (type elt
type seq
val sub : seq * int -> elt) =
struct
structure S = Slice (type 'a elt = elt
type 'a seq = seq
val sub = sub)
val app = S.app
type slice = elt S.slice
type elt = elt
end
signature MONO_SLICE =
sig
type elt
type slice
val app : (elt -> unit) -> slice -> unit
end
structure S : MONO_SLICE = MonoSlice (type elt = CharVector.elem
type seq = CharVector.vector
val sub = CharVector.sub)
For instance the interpreter stops with an "Exception Zip":
mlworks -tty
Use: /home/helmut/.mlworks
val it : unit = ()
MLWorks 2.1 Professional Edition
Copyright (C) 1999 Harlequin Group plc. All rights reserved.
MLWorks is a trademark of Harlequin Group plc.
MLWorks> use "test.sml";
Use: /tmp/test.sml
functor MonoSlice
functor Slice
signature MONO_SLICE =
sig
type elt
type slice
val app : (elt -> unit) -> slice -> unit
end
Entering Debugger, scanning stack ... done.
Exception Zip[_lists.sml:128.15-128.17] raised
Entering debugger, commands: q : quit (return to listener), ? : more help
Current (innermost) stack frame:
No visible frame
Debugger>
STRING should have a concatWith function.
Noticed a minor issue in the implementation of OS.FileSys.readDir,
According to sml-family
readDir filters out the names corresponding to the current and parent arcs.
I had not quite figured out how to generate the whole .ans file, etc
(* Result: FAIL *)
(* Test OS.FileSys.readDir, should return false. *)
fun hasParentOrCurrentArc() =
let val cwd = OS.FileSys.openDir(OS.Path.currentArc)
fun hasParentOrCurrentArc(d, flag) =
let val entry = OS.FileSys.readDir(d)
fun check(entry) =
String.compare(entry, OS.Path.parentArc) = General.EQUAL
orelse String.compare(entry, OS.Path.currentArc) = General.EQUAL
fun ent (SOME entry, false) = hasParentOrCurrentArc(d, check(entry))
| ent (SOME entry, true) = true
| ent (NONE, flag) = flag
in ent (entry, flag)
end
in hasParentOrCurrentArc(cwd, false)
end
val a = hasParentOrCurrentArc();
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.