Questions tagged [ml]

A family of functional programming languages including SML, OCaml, and F#. For questions about machine learning, use the [machine-learning] tag please.

ML ("Meta Language") is a family of functional programming languages, created by the Turing award winning computer scientist Robin Milner. It was initially created as the metalanguage for a theorem prover (hence the name), but quickly became used as a general-purpose programming language. One of ML's most famous characteristics is type inference supporting parametric polymorphism.

Some well known dialects of ML are Standard ML (), OCaml () and F# ().

676 questions
0
votes
2 answers

concurrent ml how import library

I have downloaded Standard ML of New Jersey (SML/NJ) and now I have to use the library of concurrent Ml (CML). How can I import (use) the library? Thanks
-1
votes
1 answer

ValueError: invalid literal for int() with base 10: ' ' in Python

When I write my codes like this, I get ValueError: invalid literal for int() with base 10: ' '. Basically I guess it's the problem with the type conversion but I don't know how to edit it here. Can you help me please ? This is my…
nesly
  • 17
  • 5
-1
votes
2 answers

I'm stuck trying to implement this function in Racket and ML

I have this assignment: Consider a list where every element is a nested list of length 2. The first element of each nested list is either a 0 or a 1. The second element of each nested list is some integer. An example input in Scheme is written…
-1
votes
1 answer

SML Convert integer to list

The below code is able to successfully convert an integer file to a list however i need to convert an integer to a list such as. Can anyone assist please ? readint 134516; result should be a list [1,3,4,5,1,6]; fun readint(infile : string) = let …
AinGLaw
  • 1
  • 2
-1
votes
1 answer

Recusive ML function of exponential with three variable helper function

I need help figuring out what I need to do for the helper function recursively, I am kinda lost of in what I need to do for the helper function. Here is the question and the example input. Here is the example of what the helper function does This…
jwolf
  • 33
  • 3
-1
votes
1 answer

SML Uncaught Exception Empty

I am quite new to SML and am trying to implement a selection sort. I am running into an uncaught empty error however and can't seem to see why. fun removeMin lst = let val (m, l) = removeMin(tl lst) in if null (tl lst) then (hd…
-1
votes
1 answer

Show Multiple occurrences of items in a list, sml

I'm trying to show the indices of all multiple occurrences for an element in a list. in standard ml. but my code show the empty list :( this is my code: fun index(item, xs,ys) = let fun index'(m, nil , ys) = ( SOME (ys) ) | index'(m, x::xr ,…
Blue Moon
  • 3
  • 2
-1
votes
1 answer

Creating an empty array of Strings of size x that can be updated

I'm trying to create an array of strings so that I can modify the contents of the strings depending on the input parameter of a function. I've only started to use OCaml recently so I may be missing something simple here. Currently I have: let…
NiallMitch14
  • 1,198
  • 1
  • 12
  • 28
-1
votes
1 answer

Standard ML running multiple functions in a loop (Using recursion or any other means)

I have defined three different functions that will perform calculations and return a value. These functions will consistently be redefining a variable until a specific condition is reached. I am having issues getting these to run in a "loop"…
Busta
  • 81
  • 9
-1
votes
2 answers

how I can implements multiFilter with datatype list in ML

datatype 'a Multilist = Node of 'a list | List of 'a Multilist list; fun isGreaterThen x y = y > x; fun multiFilter f (List([])) = [] | multiFilter f (List(m::multil)) = let fun flattenAuxiliray(Node(value)) = …
alex
  • 59
  • 5
-1
votes
1 answer

Why do ML languages (F#) have so many different operators compared to C languages (C#)?

It looks like it has several times more operators: https://msdn.microsoft.com/en-us/library/dd233228.aspx vs https://msdn.microsoft.com/en-us/library/6a71f45d.aspx Is this simply the price to pay to make language look "succinct" or historical ML…
Den
  • 1,827
  • 3
  • 25
  • 46
-1
votes
2 answers

Get min/max int in a list of tuples of (int, string) in PolyML

I have seen this question for Python, But I have the same question for SML (PolyMl). I want to create a function to extract from a list of tuples (int, string) the string value of the tuple with minimum int. For example, if I have this list: l =…
Nemo
  • 1
  • 6
-1
votes
1 answer

callng the same function twice with different parameters ocaml

this my problem, I want to call the same function, which has a base case with a return value, twice, and don't know how to do it; this is what I want to do: let rec hello = (*some code*) | And(a, b) -> let a = hello(a, l) in let b = hello(b, l)(*I…
ShahrukhKhan
  • 365
  • 1
  • 3
  • 11
-1
votes
1 answer

Creating a "mailbox" like abstraction in Concurrent ML

I am trying to create a bounded "mailbox" like abstraction in Concurrent ML. My abstraction has 2 channels for taking values in (which are later stored in a list called "buffer") and for sending values out. CM.make "$cml/cml.cm"; open CML; fun…
-1
votes
3 answers

List difference function

Does any existing programming language, particularly in the Lisp or ML families, have a library function to calculate list difference in the sense of 'first until start of second' - I'm not sure offhand what it should be called exactly - for…
rwallace
  • 31,405
  • 40
  • 123
  • 242
1 2 3
44
45