programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Ron McLeod
• Paul Clapham
• Jeanne Boyarsky
• Liutauras Vilda
Sheriffs:
• Rob Spoor
• Bear Bibeault
• Tim Cooke
Saloon Keepers:
• Tim Moores
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Piet Souris
Bartenders:
• Frits Walraven
• Himai Minh

# help in ML, anyone ?

Greenhorn
Posts: 2
• Number of slices to send:
Optional 'thank-you' note:
Hello,

I am new to SML-coding and need help to code a function. The function "nearest(w, m)" should calculate the distance to the coordinate
in the list m which is closest to the coordinate w. If the list is empty then use exception Empty.

We have been given a sml-file that can calculate the distance.

Sheriff
Posts: 4979
319
• Number of slices to send:
Optional 'thank-you' note:
Hello Amina, welcome to the Ranch! We don't get many ML questions round here. How exciting!

This sounds like homework. Unfortunately nobody here is going to do it for you (read NotACodeMill and DoYourOwnHomework) but we will help you with any specific problem you may have along the way.

So, show us what you have. Then tell us the particular problem you are having.

Amina Parveen
Greenhorn
Posts: 2
• Number of slices to send:
Optional 'thank-you' note:
Hello Tim,

Thanks :-)

sorry, I didn't mean that you should do my homework for me - as I wont learn anything from that .
I have coded the following, but can't continue from there. And I know that I should use "Real.min" to get to the nearest distance, but again, don't know how to.

use "distance.sml";
use "route.sml";

fun nearest[] = raise Empty
| nearest = [x1] = 0.0
| nearest= [x1::x2::xs] =

Could you give me some hints/example how to continue ?

 Consider Paul's rocket mass heater.