Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
66 views

I have a question regarding the following code I found on github: fun quicksort nil = nil | quicksort (pivot :: rest) = let fun split(nil) = (nil,nil) | split(x :: xs) = ...
dvk512's user avatar
  • 59
1 vote
1 answer
102 views

I have a file foo.sml with a single line of Standard ML code: Int.toString 5 This runs fine in SML/NJ but not in MLton: $ cat foo.sml Int.toString 5 $ sml < foo.sml Standard ML of New Jersey (64-...
Lone Learner's user avatar
  • 21.2k
1 vote
0 answers
43 views

I have this configuration that works but my attempt to use an external file use "external.file"; in the functor failed. I wanted to test an external file by calling the functions in the ...
Mohan Radhakrishnan's user avatar
0 votes
0 answers
145 views

I installed WSL, SML and Millet extensions in VS code for a course I'm taking, I have 2 files with code when I'm trying to run them I get an error: "uncaught exception SysErr [SysErr: access: ...
tomer dror's user avatar
2 votes
2 answers
90 views

Updated Code: val changeTypeMapTable = fn (x: TypeMapTable) => fn (a: Variable, Type_Integer) => (fn (y: Variable) => if y = a then ...
Vikas Mishra's user avatar
0 votes
4 answers
484 views

I am trying to add all elements in a given integer list and finally return an integer as its sum Following is the code I have tried val intList = [1,2,3,4]; fun addList (list) = let val head = ...
Ishan's user avatar
  • 41
1 vote
1 answer
72 views

I am having this mysterious problem. I have this function in a file: fun sum _ nil acc = (Real.fromInt acc) | sum x (hd::tl) acc = if x=hd orelse toUpper x=hd then sum x tl (acc+1) ...
lil_papa's user avatar
1 vote
1 answer
90 views

I create a datatype and a function. The function must be able to do a multiplication according to whether the members of the pair are int(s) or real(s). I can get to work for Int, but when I add a ...
Hank Lenzi's user avatar
1 vote
1 answer
65 views

I am using a CM file "build.cm" to compile my sml files. In the file symbol_table.sml, I have used the structure HashTable from the sml basis library. When the CM file is run, I receive an ...
Aaveg jain's user avatar
0 votes
2 answers
41 views

In a simple recursion with first if expression true then 0. if steps in the recursion keeps going until that first expression is true, why isn't 0 always returned? fun stepping (n : int, number : ...
DAVID BRYANT's user avatar
0 votes
1 answer
85 views

The following function is using pattern matching. fun f (x,0) = x | f (0,y) = y | f (x,y) = x+y; I want to write this using if-else. This function of mine works fine: fun f1(x, y) = if y = 0 ...
Danial's user avatar
  • 444
0 votes
2 answers
45 views

I'm self-learning SML and am currently am stuck with the concept of recursion between two lists of varying sizes. Suppose you have two int lists of varying size, and a function that multiplies two ...
user avatar
1 vote
1 answer
128 views

Hello every body im training some SMLs and im creating a code to get deviation of a int list . in the process of it , i need to get a Real list out of some numbers in a int list , which it doesnt let ...
foxy's user avatar
  • 60
1 vote
0 answers
96 views

I'm trying to write a program in SML for the following problem: A game is played with a card-list and a goal. The player has a list of held-cards, initially empty. The player makes a move by either ...
Zakaria Bennane's user avatar
1 vote
3 answers
302 views

There are two list in sml and I want to add one to another val one = [1.1,2.2,3.3] : real list; val two = [4.4,5.5,6.6] : real list; The result should be [5.5, 7.7, 9.9]. I not sure I'm doing this ...
Wilson's user avatar
  • 13
1 vote
1 answer
180 views

Question: Write a function number_before_reaching_sum that takes an int called sum, which you can assume is positive, and an int list, which you can assume contains all positive numbers, and returns ...
pikatu's user avatar
  • 11
3 votes
0 answers
97 views

I would like to know whether there would be a way to print the name of the constructor of a datatype from a function in SML. I could find ways to do this in Haskell by deriving the datatype from ...
blueconch's user avatar
0 votes
2 answers
86 views

datatype mixed_expression = ME_NUM of int | ME_PLUS of mixed_expression * mixed_expression | ME_TIMES of mixed_expression * mixed_expression | ME_LESSTHAN of mixed_expression * mixed_expression; ...
Supper777's user avatar
0 votes
2 answers
135 views

I am currently writing a code in SML that takes in a string list full of numbers and spaces. The code must combine the numbers up to the space, then create a new list item for the next set of numbers, ...
RCPotatoSoup's user avatar
1 vote
1 answer
133 views

The SML/NJ code below results in a binding not exhaustive warning for "val Grove(whatTree) = glen". The F# equivalent code produces no warning. Why? Standard ML of New Jersey (32-bit) v110....
LearnerX's user avatar
  • 137
0 votes
1 answer
587 views

I am new to SML and was a bit confused. I am trying to write a function called makeList of type int -> int list that takes as input a positive integer n and returns the list [1, 2, ..., n] I want ...
Psycho Bunnies's user avatar
0 votes
1 answer
67 views

I've been shown this SML code as an example of an inner binding shadowing an outer one. let val x = 1 in (let val x=2 in x+1 end) + (let val y = x+2 in y+1 end) end After the example, the author ...
Caleb Jay's user avatar
  • 2,209
1 vote
1 answer
206 views

If I'm trying to do this: Convert #”N” to a real What ML expression would do this? In the same way that:\ str = Char -> string chr = int -> Char ord = Char -> int real = int -> real Is ...
Powerrangers123's user avatar
0 votes
1 answer
133 views

I made a function that identifies if a certain object has repetition as following: (PS: test is passing) (* ListOfPattern -> Pattern -> String List -> List.exists (function) -> bool*) val ...
Omar Shawky's user avatar
-1 votes
1 answer
208 views

i have a list , and a tuple (start,end,interval) i am trying to iterate over the list and return the elements that are in list from start to end with interval steps . for example: cutt [1,2,3,4,77,8,7]...
memeeol's user avatar
  • 65

1
2 3 4 5
18