| Who | When |
Messages | |
|
|
|
| Fox Harrell
|
72
|
 |
|
03-15-2004 05:24 AM PT (US)
|
|
|
| Mickey
|
73
|
 |
|
03-15-2004 01:44 PM PT (US)
|
|
In "Notes on Chapter 11", there is an example of using "not" together with "!(cut)".
not(X) :- X, !, fail. not(X).
not(fly(penguin)). // #1
not(fly(X)). // #2
so how do these work? What does "succeed" in the sentence "the first caluse for not will try to make fly(penguin) succeed" mean? Why does #2 produce incorrect results?
|
Sean O'Rourke
|
74
|
 |
|
03-15-2004 02:39 PM PT (US)
|
|
Mickey - this is how "not()" is (or can be) implemented. To see how it works, and to gain a much better understanding of how prolog works, I encourage you to try tracing through the search tree in both the "X is true" and "X is false" cases. Remember: prolog tries rules from top to bottom, and satisfies subgoals from left to right.
|
| TayboPowar
|
75
|
 |
|
03-15-2004 03:50 PM PT (US)
|
|
In the posted solutions for the midterm, problem 1, the definition of layout is given as "determine locations for storage." The other feasible solution is "determine the sizes for storage needed." Shouldn't it be the latter? I thought allocation is when you actually assign memory, and layout is when you just see "how it looks" in some abstract place in memory, more or less.
Thanks for the clarification.
|
| Yongbo
|
76
|
 |
|
03-15-2004 04:20 PM PT (US)
|
|
fn : ('a * 'b -> 'b) -> 'a list -> 'b -> 'b
What does the above function type mean?
|
| Fox Harrell
|
77
|
 |
|
03-15-2004 04:31 PM PT (US)
|
|
Taybo:
Your answer is not correct. Think of it this way:
Would you draw the array layout differenly for integers vs reals (which take up more space in memory)? For allocation you actually need to know the sizes of array elements. Sethi says "the layout of the array determines the machine address of an element A[i] relative to the address of the first item." "The machine address" has to do with location, not size. Locations can be described using relative addresses.
|
| Fox Harrell
|
78
|
 |
|
03-15-2004 04:36 PM PT (US)
|
|
Yongbo:
You should figure it out as an exercise. Use the type precedence rules on page 313 of Sethi.
|
| alex
|
79
|
 |
|
03-15-2004 06:32 PM PT (US)
|
|
Thanks, Sean. Once again, your intelligence and devilish good looks have kept me from dropping this class in frustration.
|
| alex
|
80
|
 |
|
03-15-2004 06:38 PM PT (US)
|
|
You too, Fox.
|
| Hard Final
|
81
|
 |
|
03-15-2004 10:46 PM PT (US)
|
|
That final sucked! It was 50 points all on Prolog and ML, which wasn't very representative of the course. I hope the curve is low and grading scale adjusted differently than 50% final!
|
| |
Messages 82-85 deleted by topic administrator 07-22-2006 09:28 AM |
| Riley
|
86
|
 |
|
07-22-2006 01:05 AM PT (US)
|
|
Pretty nice discussion, want to see much more on it! :) Congrats on your work. Sorry I wont get to see you at worlds. famvir and shingles webpage devoted to famvir and shingles. spironolactone weight loss webpage devoted to spironolactone weight loss.
|
|
|
87
|
 |
|
07-22-2006 01:05 AM PT (US)
|
|
Deleted by topic administrator 07-22-2006 07:22 AM
|