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
-2
votes
1 answer

Why does `a` in `a :: nil` represent a list of length 1?

In Ullman's SML book: Note that the way we express "list of length 1" as a pattern is to put square brackets around a single identifier, like [a]. Such a pattern can only match a list with a single element, and variable a acquires that…
Tim
  • 1
  • 141
  • 372
  • 590
-2
votes
1 answer

How to implement static scope, dynamic scope, and lazy evaluation in ml and haskell?

I understand conceptually what all of these are, I'm just hoping for some code examples of how to implement them in ML and Haskell.
-2
votes
2 answers

How to define the type profile for the following function?

I have to define the type profile of this function: compose(f, g, x) = f(g(x)) The result should be the following, but I don't really get why. (’a -> ’b) * (’c -> ’a) * ’c -> ’b
mlhack
  • 73
  • 1
  • 4
-2
votes
1 answer

What does "??" mean in standard ML

I was looking at this ML code and I saw this statement fun doSomething (a, b) = if a < b then ?? else ?? ; What does the "??" in this context mean?
PTN
  • 1,658
  • 5
  • 24
  • 54
-2
votes
1 answer

ML syntax function program

What could be the possible function foo, which has a type ’a * ’a -> int in ML. i.e. a function which has the following type of the output
-3
votes
0 answers

Getting Started with Titanic

Hay, I am stuck at the Kaggle first step into ML "Getting Started with Titanic" This the link to the notebook = https://www.kaggle.com/code/jisnukalita/getting-started-with-titanic the error look something like this Error pandas I am expecting the…
-3
votes
1 answer

Read file character by character in SMLNJ

I need to read a text file character by character in SMLNJ and store it in a list. The file consists of one line with numbers, without spaces or any form of separation. My question is how do I get a single character from the file and add it to the…
user2129306
-4
votes
1 answer

Check if a list is sorted or not in ml language

i want to write program that can checked a list is sorted or not in ml language program but i am new at this language i write the below code and seems it works is there any tips i can use in my ml programing ml programming language let issorted…
-4
votes
1 answer

When I run the code, it returns 1 not the right number of repeated values in the list "list of int"

I want to get an int that indicates the number of repeated values in the list of int fun iretate_list (fx : int list, tn : int) = if null fx then [] else let val count = 0 in if hd fx = tn then count + 1…
-5
votes
1 answer

Please, help me. I'm a beginner and I don't really understand

Write a function min_max : int list -> int * int that takes a non-empty list of numbers, and returns a pair (min, max) of the minimum and maximum of the numbers in the list. Here is what I've written so far. fun min_max (n : int list) = if null n…
Maslo Kar
  • 9
  • 1
-5
votes
1 answer

How do I write an ML program in Java? With Nested Functions

My Exercise gave me this as the original coded. They then wanted us to do a java implementation of it. I thought that I had now I can't get any of it to make sense. There is a spot in this that uses a variable "n" that screws it all…
-5
votes
1 answer

how to compile category code with ML compiler?

find that there are many ML compilers which i do not know which compiler is suitable for these code, and do not know how to compile it and find that haskell has operads package which is suitable for usage of category is it possible to translate to…
1 2 3
44
45