EggXpert

A community site dedicated to Newegg shoppers.
Welcome to eggXpert.com. Sign in | Join | Help
in Search
Advanced Search

Can anyone help with ML?

Last post 09-18-2008, 3:43 AM by JJJIrish05. 0 replies.
Sort Posts: Previous Next
  •  09-18-2008, 3:43 AM 393846

    Can anyone help with ML?

    Trying to write a simple ML program to reverse a list...

     Here's what I got:

     

    fun reversehelper nil L = L

      |  reversehelper (X::L1) L2 = (reversehelper L1 (X::L2))

      |  reversehelper (X::L3) nil = (reversehelper L3 [X])

     

    fun myreverse List = reversehelper (List,)

     

    Then I open up my sml editor and type: use "hw1.sml";

    and get this:

    [opening hw1.sml]

    hw1.sml:5.22-5.46 Error: operator and operand don't agree [tycon mismatch]

      operation domain: 'Z list

      operand:              'Y * 'X list

      in expression:

         reversehelper (List,nil)

     

    uncaught exception Error

       raised at: ../compiler/TopLevel/interact/evalloop.sml:63.48-63.57

                     ../compiler/TopLevel/interact/evalloop.sml:44.54

                     ../compiler/TopLevel/interact/evalloop.sml:291.17-291.20

     

    I'm new to ML and have no idea what this means....

View as RSS news feed in XML

 Home   Forums   Chat   Blogs   Deals   Newsletter   About 

 FAQ   Terms of Use   Privacy Policy   Contact Us 

©2008 Newegg, Inc. All rights reserved.