I'm trying to turn a string into a char list list and I have the following code:
fun linelist file =
let
val instr = TextIO.openIn file
val str = TextIO.inputAll instr
in
String.tokens (fn x => x = #"\n")str
...
Hi,
I have an assignment to do and I can't figure out how to do one question.
Here is what I have to do:
" Write a function which collects all elements in the tree T which satisfies the property p and returns it. Traverse the tree in inorder.
Find all elements in BST satisfying f using success continuations.".
I did the following:
da...
I'm trying to declare a function takelist : 'a list list -> int -> 'a list, so that calling takelist xs n will return the elements in spot number n in the lists from xs.
takelist [[#"3", #"6"], [#"6", #"2"], [#"5", #"9"]] 1;
should return [#"6", #"2", #"9"].
This is what I have:
fun tagliste (x::xs) n = List.nth(x,n);
I does half ...
How to declare a function so Listn : ' ' a list -> ' ' a list -> bool, listn xs and ys return true.
Example: lisen [#"1" #"2"] , [#"1" "#3"] return false and [#"1" , #"2"] [#"2" , #"1"] return true
...
Does anyone know how to declare a function
rscheck : char list list -> bool
, that checks, if the number 1-9 are used once in every row and every list... so it returns true?
like in a sudoku game..
Thnx.
...
I'm trying to declare a function that will let me change a number in a char list list (I'm still working on the sudoku game from earlier).
changesudo : char list list -> int * int * char -> char list list
I need to be able to call changesudo xs (r,s,c) where xs is the char list list, r is the list, s is the position in xs and c is the c...
My question is like the one here.
I'm working on a char list list and I need to check that 1-9 are used once in every list, but also once in every position in the list.
My code looks like this:
infix member
fun x member [] = false
| x member (y::ys) = x = y orelse x member ys;
fun rscheck xs =
let
...
In a EIK Bank should I make now an account called Nice Item, all operations seem like a
Basic Account, except those payments, which works as follows:
At each accrual added 4% (rounded down) of the balance immediately after the last payments, provided that the period remains unclaimed in the account. Has closed the account, attributed to ...
I'm working on making functions that'll perform different functions that a bank would need.
I'm given this:
signature ACCOUNT =
sig
type account
val open : int -> account
val trans : account * int -> account option
val balance : account -> int
val interest : account -> account
end;
I now need to declare some functions:
ope...
This is part of a homework assignment so my goal is to understand why this is wrong. As I mentioned before I'm using Moscow ML.
fun filter pred = let
fun f ([], a) = []
| f ([], a) = a
| f (e::L, a) = if pred e then (f L (e::a) ) else (f L a)
in
f
end
The error I get is:
| f (e::L, a) = if pred e then (f L (e::a) ) else (f L a...