Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,105 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,707 people online right now. Registration is fast and FREE... Join Now!




Set Intersection Function (ML)

 
Reply to this topicStart new topic

Set Intersection Function (ML)

wingz198
26 Nov, 2007 - 10:45 AM
Post #1

D.I.C Head
**

Joined: 14 Oct, 2005
Posts: 55


My Contributions
I'm writing a function that takes in a list of lists and returns the intersection. I think I've got the code doing what it's supposed to, but when I run it with input it gives me uncaught exception empty and I can't figure out why. Here's the code for the main function:
CODE
fun
    multiSetIntersection([]) = []
    | multiSetIntersection(list) = if findNumber(tl(list),hd(hd(list))) = true
                    then if tl(list) = nil then [] else hd(hd(list))::multiSetIntersection(tl(hd(list))::tl(list))
                    else if hd(list)=nil then []
                        else multiSetIntersection( tl(hd(list))::tl(list));

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 09:09PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month