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
1
vote
2 answers

PolyML runtime eval

I am currently using PolyML 5.5.2, and trying to create a runtime compiler function that takes a string and runs it. The desired function should be like fun eval string -> unit when input >eval "val a=1;"; val a = 1: int I have done some research…
John Smith
  • 63
  • 2
  • 8
1
vote
1 answer

How to improving array benchmark performance in PolyML?

I have the following benchmark which iterates over an array, setting the next entry to one plus the previous entry. If the number gets bigger than a certain cap, I set the entry to zero, and proceed. Then at the end I sum the entries in the…
artella
  • 5,068
  • 4
  • 27
  • 35
1
vote
1 answer

PolyML/Motif: how do I simultaneously draw a window which contains an XmLabelPixmap button?

In PolyML, I am trying to draw a button with a pixmap in it, but cannot find a way to create the pixmap before calling XtRealizeWidget on the shell widget. Using XCreateBitmapFromData after XtRealizeWidget, gives a huge delay in drawing the button…
1
vote
1 answer

Poly/ML interpreter/compiler directly in emacs

I have installed sml-mode in emacs 24. I want to compile the code directly in emacs with Poly/ML how do I do that? I have installed Poly/ML and then typed sml-poly-ml in order to start the interpreter but i says no match. I tested both on windows…
1
vote
1 answer

Poly/ML runtime resizing of Heap

I read about the following words in a paper of heap resizing in Poly/ML. But I didn't understand how exactly is the heap resized? Could anyone explain it in more detail? At the end of every major GC(Garbage Collection), the adjustHeapSize() …
whileone
  • 2,495
  • 3
  • 21
  • 30
1
vote
2 answers

Multiple Conditionals in Poly ML

If, for example, I wanted to define a function that returned true if a=b and b=c, and false if neither one of those equalities were true in Poly ML, how would I write it? I'm not sure how to do more than one conditional simultaneously.
0
votes
1 answer

polyml CommandLine.arguments() returns nonsense

I want to read some command line arguments from a compiled polyml program. However, if I have a program like this: print_args.ml val args = CommandLine.arguments() fun main () = app (fn s => (print s ; print "\n\n")) args (which should just print…
0
votes
1 answer

RunCall structure of Poly/ML

I'm reading Isabelle's source code while I'm not experienced with programming in general. I found the use of RunCall structure of the Poly/ML basis library (e.g. in src/Pure/Concurrent/thread_attributes.ML to manipulate thread flags). I consulted…
opus26
  • 38
  • 7
0
votes
1 answer

Datatype declaration by datatype in Standard ML

I'm trying to read the source of Isabelle even though I'm a beginner of Standard ML. I arrive at the structure Unsynchronized in src/Pure/Concurrent/unsynchronized.ML, which seems for the multi-thread programming. It includes ... structure…
opus26
  • 38
  • 7
0
votes
1 answer

Quotation mechanism for PolyML top level

For various toy projects I'd like to be able to embed object languages into the PolyML top level, like the backtick syntax for HOL, where expressions between backticks are parsed by a custom parser. I don't mind the specific delimiting syntax:…
fds
  • 1
  • 1
0
votes
2 answers

PolyML colored output to terminal in Linux

Ideally, this line of PolyML code should give desired result: print "\033[31m RED \033[0m NORMAL \n"; But the \033 turns out to be just an exclamation mark, not a special symbol for color encoding. I use the following "way-around" approach, but it…
ged
  • 687
  • 7
  • 19
0
votes
1 answer

What causes the SML error: Exception- InternalError: asGenReg raised while compiling

I am learning SML, and couldn't figure out why the following textbook code generates an error: fun recip (x,y) = let val t = x *x + y *y in (x /t, ~y/t) end; The error is: Exception- InternalError: asGenReg raised while compiling This is with…
thor
  • 21,418
  • 31
  • 87
  • 173
0
votes
1 answer

Error compiling with polyc on Debian 10 Buster

"/usr/bin/ld: cannot find -lpolyml" I received this error when compiling a source sml file with polyc on Debian 10.
0
votes
2 answers

StandardML factorial evaluation enters infinite loop in Poly/ML REPL

The following factorial function is well and good... Poly/ML 5.8.3 Development (Git version v5.8.2-297-g8185978a) > fun fact 0 = 1 # | fact n = n * fact(n-1); val fact = fn: int -> int > fact 2; val it = 2: int > But the following takes the Poly…
Nalin Ranjan
  • 1,728
  • 2
  • 9
  • 10
0
votes
1 answer

Counting elements list without duplicates in Poly/ML programming

I'm stuck on this exercise of functional programming in Poly/ML: Do a function of type ''a list -> int so that it takes a list of ''a elements as argument. The function has to return the number of elements in the list without counting duplicates. I…