Moscow ML is an open source compiler for the Standard ML programming language.
Questions tagged [mosml]
23 questions
1
vote
2 answers
Understanding user defined append list Standard ml
Im having trouble understanding this implementation of lists in Standard ML. Here is how it is defined:
An append list is a (simple) implementation of the list abstract data type that makes construction cheap (O(1)), but makes destruction expensive…

MasterYork42
- 228
- 2
- 11
1
vote
1 answer
Output option for Moscow ML compiler
I am compiling some .sml files using mosmlc.exe. The problem is that .ui and .uo output files are placed in the same directory of my input .sml files. I would like to do something like this:
mosmlc.exe -o out/ src/file1.sml src/file2.sml
So that…

Andry
- 16,172
- 27
- 138
- 246
0
votes
1 answer
Type clash expression of type int * int cannot have type int * int * int on SML
I'm trying to make a code on Moscow ML/SML about magic squares. Whenever I try to run the code, I always get this error on line 15:
! Type clash: expression of type
! int * int
! cannot have type
! int * int * int
! because the tuple has the…

spacecowboy
- 1
- 1
0
votes
1 answer
How to create an empty environment represented by a function
I came across this problem online which I found interesting, it had a decent explanation but I was confused about the solution. So given
type 'a fenv = name -> 'a
create a value of type
'a fenv
which would be our empty env. I thought this to be…

BearsBeetBattlestar
- 318
- 2
- 13
0
votes
1 answer
Wrapping Datatypes in Standard ML
This question is a follow up question to the question posted here:
Understanding user defined append list Standard ml
The problem I am running into is that I can't seem to figure out how to properly wrap the Append Node within the NonNil correctly.…

MasterYork42
- 228
- 2
- 11
0
votes
1 answer
SML Unbound value identifier Error in Insert Function
Im having an issue with my separate function. Separate returns a list that inserts element x after each k elements of list l (counting from
the end of the list). For example, separate (1, 0, [1,2,3,4]) should return [1,0,2,0,3,0,4] and separate (3,…

MasterYork42
- 228
- 2
- 11
0
votes
1 answer
How to add elements to a list every nth round?
I need to
Write a function separate of type int * 'a * 'a list -> 'a lst such that
separate (k, x, l) returns the list that inserts element x after each k elements of list l (counting from
the end of the list). For example, separate (1, 0,…
0
votes
1 answer
How to acess argument from a function passed as argument in SML
I am new to coding SML and am still trying to understand pattern matching. I am trying to find out how to access an argument from a function passed as an argument in SML. For example, if a function takes 2 arguments, a function and an integer, how…

John Jenkins
- 1
- 3