Questions tagged [polyml]

The Poly/ML implementation of Standard ML

Poly/ML is an advanced (but little known) implementation of Standard ML.

Some notable features:

  • Full multiprocessor (multicore) support in the thread library and garbage collector.
  • Interactive debugger.
  • Fast compiler that produces fast native code (notably x86 and x86_64).
  • Support for Linux, Windows, Mac OS X in 32bit and 64bit mode.
  • It is the preferred SML implementation for large projects including Isabelle and HOL4.

See also the development site on Github.

60 questions
3
votes
1 answer

Type variable before function name and resulting scope limitations

I recently noticed that a type variable is allowed before a function name in a function declaration. But I cannot see how it is used. Here are some examples using it: Poly/ML 5.5.2 Release > fun 'a print a = PolyML.print (a); val print = fn: 'a ->…
eatonphil
  • 13,115
  • 27
  • 76
  • 133
3
votes
3 answers

is there an eval in ML?

is there a eval function in ML?
m34
  • 31
  • 1
2
votes
1 answer

Is there a way to display every function of a SML package/library? I am using PolyML

I want to list every function of a SML library. Is there something like an help command? For example: Is there a way to see this list in the PolyML terminal? I need to view it on the terminal without using google. I can't use internet during the…
Pater
  • 83
  • 1
  • 6
2
votes
1 answer

Compiling Poly/ML on MobaXterm: the ar u option

I am to compile the Poly/ML Standard ML compiler on the MobaXterm v11.1 cygwin-based distribution. Upon make, I get /bin/sh ./libtool --tag=CC --mode=link gcc -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -march=core2 -Wall…
Gergely
  • 6,879
  • 6
  • 25
  • 35
2
votes
1 answer

In SML why aren't you allowed real constant in pattern?

This code is not accepted; > fun fact 0.0 = 1.0 Error-Real constants not allowed in patterns > | fact n = n*fact(n-1); Static Errors Why is this?
2
votes
2 answers

Referring to a type involving the result of a functor in a signature

How can I refer to a type in a signature used in a structure that derives the type from the result of a functor. Here is an example using the poly interpreter: > signature Res = sig type f end; signature Res = sig type f end > functor F (A: sig type…
eatonphil
  • 13,115
  • 27
  • 76
  • 133
2
votes
0 answers

How to clear a HashArray in Poly/ML?

Not much methods for that, I found only two methods about that? delete, fold. so I do: fold ( fn ( k, _, _ ) => delete ( h, k ) ) () h; But I don't Think it is a good idea? How to do that smart?
sa ma
  • 135
  • 7
2
votes
1 answer

Viewing specialization/subtype of generic in polyml after functor application

In the following program we know that valStr.value assumes the subtype pair of the generic type t. Yet when I examine it in poly the type is shown as being t. Is there any way I can see in the poly interpreter that t has been specialized to…
artella
  • 5,068
  • 4
  • 27
  • 35
2
votes
1 answer

Structuring a Library in SML

I'm currently building a testing library in Standard ML (using Poly/ML as the interpreter). I have the following directory structure: project/a.sml project/src/b.sml project/src/c.sml ... Where a.sml is just a bunch of calls to use use…
Alex Coplan
  • 13,211
  • 19
  • 77
  • 138
2
votes
2 answers

Using Poly/ML to build projects with nested directory structures

Until now, I have been using Poly/ML for several small projects where all source code files are all in the same directory. To build these projects, all I had to do was run the following command in the REPL: > PolyML.make "Main"; But now I have a…
isekaijin
  • 19,076
  • 18
  • 85
  • 153
1
vote
4 answers

Why am I getting this error for a function that simply adds a value to every integer in a list?

Here's my function: fun inclist [] 0 = [] | inclist (l, inc) = map (fn x => x + inc) l; l is a list of ints, and I'm trying to add inc to each integer in l. But I'm getting these errors Function: inclist : int list * int -> int list Argument: [1,…
Grav
  • 461
  • 6
  • 18
1
vote
1 answer

Create a list reading a file with SML

I'm trying to create a List reading a text file, for example I have a text file like this "1 5 12 9 2 6" and I want to create a list like this [1,5,12,9,2,6] using SML
1
vote
2 answers

Polymorphic coersion to Word64 in Standard ML

I would like create a polymorphic function that converts 8,16,32 bit words into 64 bit word. How can I do it? UPDATE1 In the basis library all word structures have functions toLarge and fromLarge to convert to/from the LargeWord, which is as far as…
xafizoff
  • 398
  • 1
  • 13
1
vote
1 answer

Poly/ML Exception Cast "toAddress" raised

Using Poly/ML, I wanted to write a function to construct an n*n identity matrix using Array of Arrays. I wrote: fun equiv x y = if x = y then 1 else 0; fun idmatrix n = Array.tabulate(n, fn i => (Array.tabulate(n, equiv i))); and it compiled…
Z. Yan
  • 53
  • 4
1
vote
2 answers

How to define a higher-order function which applies a polymorphic function to a specific type

If I define fun id x = x Then naturally id has type 'a -> 'a Of course, id 0 evaluates to 0, which makes perfect sense. Since this makes perfect sense, I should be able to encapsulate it by a function: fun applyToZero (f: 'a -> 'a) = f 0 With the…
John Coleman
  • 51,337
  • 7
  • 54
  • 119