ml

ML IDE and Compiler for Windows or Linux or Mac

爷,独闯天下 提交于 2021-02-17 07:45:09
问题 I have to write some code in ML and it is my first time I`m going to use the language. Is there any Development Environment for Standard ML? (preferably under Windows). I tried googling (and stackOverFlowing ! ) but all I found was plain compilers for Linux (at most with an interactive console), but no IDE nor Eclipse/NetBeans plugin. Any suggestions ? 回答1: How to Configure SML with Sublime Text 2 For those who prefer Sublime Text instead of Emacs as the editor of choice to program SML, the

number_in_month exercise (Why x = x + 1 is considered bool in sml while x is int and how to say x = x + 1 correctly?)

孤人 提交于 2021-02-08 09:22:27
问题 Update: What I want to do with this code is to get a list of dates, year/month/day and a given number as a month, and check to see how many of the dates in the given list are in the same month as that given month. What I meant of x = x + 1 was x++ such as in java or C or C#. As the output I want x. if there is no match, 0 and for any match x = x + 1 So this is my code, fun number_in_month (Dlist : (int * int * int) list, Month : int, x : int) = if null Dlist then x else if #2 (hd Dlist) =

Usage of the ref function in ML

不打扰是莪最后的温柔 提交于 2020-05-29 06:46:11
问题 Considering the ref operator I'm having trouble to understand its application and the sense of the follow instructions: 1. In this definition what am I defining? - val ref x=ref 9; val x = 9 : int 2. and here what am I doing with ref x:= ref 12? - val x= ref 8; val x = ref 8 : int ref - ref x := ref 12; val it = () : unit - x; val it = ref 8 : int ref 回答1: val ref x = ref 9 defines x to be 9 - just as if you had written val x = 9 . This is because ref is a constructor, so it's pattern

Mastering the game of Go with deep neural networks and tree search

烂漫一生 提交于 2020-04-25 17:00:46
Mastering the game of Go with deep neural networks and tree search David Silver , Aja Huang , Chris J. Maddison , Arthur Guez , Laurent Sifre , George van den Driessche , Julian Schrittwieser , Ioannis Antonoglou , Veda Panneershelvam , Marc Lanctot , Sander Dieleman , Dominik Grewe , John Nham , Nal Kalchbrenner , Ilya Sutskever , Timothy Lillicrap , Madeleine Leach , Koray Kavukcuoglu , Thore Graepel & Demis Hassabis Nature volume529 , pages484–489 (28 January 2016) doi:10.1038/nature16961 Download Citation Computational science Computer science Reward Received: 11 November 2015 Accepted: 05

SML List Deletion

帅比萌擦擦* 提交于 2020-01-17 03:44:29
问题 I am trying to write a function to delete a list from another list. ''a list -> ''a list -> ''a list Here's what I have so far: fun delete _ [] = [] | delete (h1::t1) (h2::t2) = if h1=h2 then t2 else h2::delete (h1::t1) t2; I am using MoscowML and it gives me a Warning: pattern matching is not exhaustive error. A test of the above function: - delete [4,5] [1,2,3,4,5,6,7,8]; > val it = [1,2,3,5,6,7,8] : int list The desired output is: > val it = [1,2,3,6,7,8] : int list 回答1: There are two

SML List Deletion

陌路散爱 提交于 2020-01-17 03:44:06
问题 I am trying to write a function to delete a list from another list. ''a list -> ''a list -> ''a list Here's what I have so far: fun delete _ [] = [] | delete (h1::t1) (h2::t2) = if h1=h2 then t2 else h2::delete (h1::t1) t2; I am using MoscowML and it gives me a Warning: pattern matching is not exhaustive error. A test of the above function: - delete [4,5] [1,2,3,4,5,6,7,8]; > val it = [1,2,3,5,6,7,8] : int list The desired output is: > val it = [1,2,3,6,7,8] : int list 回答1: There are two

Why do Maybe/Optional types use a Just/Some type instead of the actual type?

↘锁芯ラ 提交于 2020-01-10 03:47:25
问题 In Idris, the Maybe type is defined as followed: data Maybe a = Just a | Nothing It's defined similarly in Haskell: data Maybe a = Just a | Nothing deriving (Eq, Ord) Here's the ML version: datatype 'a option = NONE | SOME of 'a What are the benefits of using Just and Some ? Why not define the type without them? example: data Maybe a = a | Nothing 回答1: What would then be the difference between Maybe a and Maybe (Maybe a) ? There's supposed to be a difference between Nothing and Just Nothing .

install mlpy 3.5.0 on mac 10.9 error.Please help me

妖精的绣舞 提交于 2020-01-05 10:23:10
问题 THe following is my error which i am getting. Please help me to fix it. apple:mlpy-3.5.0 apple$ python setup.py install running install running build running build_py running build_ext building 'mlpy.gsl' extension cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy

what are curry and uncurry in high-order functions in ML

一个人想着一个人 提交于 2020-01-02 04:01:25
问题 fun curry f x y = f (x, y); fun uncurry f (x, y) = f x y; fun compose (f, g) x = f (g x); I understand compose function, but not quite understand curry and uncurry in ML. Can anyone explain these? Also, what do the following two lines mean? (1) compose (compose, uncurry compose) (2) compose (uncurry compose, compose) 回答1: If you look at the types, then you will clearly see what curry and uncurry does. Remember that it is possible to define function which either takes its arguments as one big

List.filter function not working in SML/NJ

你离开我真会死。 提交于 2020-01-01 19:48:46
问题 I'm building a simple function to remove item from List1 ... fun Strip(item, List1) = filter (fn x => x <> item) List1; Input: Strip(3,[1,2,3,4,3]); Error: Error: Unbound variable or constructor: Strip Alternate input: filter (fn x => x <> 5) [1,3,5,2,5]; Alternate error: stdIn:1.2-1.8 Error: unbound variable or constructor: filter Any ideas why such a simple function isn't working? 回答1: As to the error message "unbound variable or constructor: filter", in this case it means that the