Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I need help with a very simple ML program

 
Van Johnson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please tell me what is wrong with this program. Screen shot attached. Thanks.
wrong ml code is_older.png
[Thumbnail for wrong ml code is_older.png]
screen shot of program and error message
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Van, welcome to the Ranch!

Is there a program in that screen shot? I can't read it, the text (if that's what it is) is way to small. Could you just copy the text and paste it here?
 
Van Johnson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how to get the text info out of the Emacs window that SML is running in (can't copy w/ normal windows commands), and I'm too tired to write it in note pad right now. However I'm able to click on the screenshot and enlarge the view and it is quite viewable for me. Thanks for responding!
 
Tim Cooke
Sheriff
Pie
Posts: 2972
123
Clojure IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code after your andalso:

is attempting to perform a less than operation on two int list types. This is the source of your error.

Given the timing and the fact that I recognise the function I assume that you are working on Dan Grossman's Programming Languages course on Coursera? I am also doing this course so best of luck with it, and if you get my assignment for peer review please be kind....

If this function is for the assignment then you might want to review the function signature requirements as I think as it stands your function will fail the auto grader. The required signature is:

and your current signature is
 
Van Johnson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for the help. I looked everywhere for how to define a tuple in an function and couldn't find it anywhere. You've saved me a lot of frustration. Now to try it out...
Yes this is for Grossman's PL class, but I'm pretty far behind because of time constraints so I probably won't be doing any peer assessments. I'm so glad I found a good site to ask for help.
 
Van Johnson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I guess I just don't know how to access the items in a tuple. It seems that the 'tl' command can't be used on a tuple, is that right?. Attached is another try at making the function work, along with error messages. Thanks again for any help I may receive.
another try at is_older.png
[Thumbnail for another try at is_older.png]
 
Van Johnson
Greenhorn
Posts: 7
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, I've figured it out. hashtag, duh.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Van Johnson wrote:I don't know how to get the text info out of the Emacs window that SML is running in (can't copy w/ normal windows commands)

If you need to do this again, there is an easy way. Navigate to the directory containing the file in finder, right click the sml file and open in NotePad or TextEdit or whatever the plain text editor is on your system.
 
Tim Cooke
Sheriff
Pie
Posts: 2972
123
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Van Johnson wrote:hashtag, duh.

Very witty. Deserved of a nerdy grin.

Glad you got it sorted. Best of luck with the course.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic