QuickTopic (SM) free message boards QuickTopic (SM) free message boards
Skip to Messages
  Sign In to access your topic list  |New Topic |My Topics|Profile
Upgrade to Pro   Customize, show pictures, add an intro, and more:   QuickTopic Pro...and check out QuickThreadSM
Topic: CSE130@UCSD
Views: 4187, Unique: 1012 
Subscribers: 0
What's
this?
Printer-Friendly Page
Subscribe to get & post, or stop messages by email Subscribe
About these ads
Who | When
Messagessort recent-bottom   
Post a new message
 
zahirul islam  270
02-21-2009 03:53 AM ET (US)
sir,
it is not clear to me how should i prepare to myself as a computer engineer.if it is passible to you to give me suggetion as far as your passible it would be great help for me.
                                               thank you
Glingeesconse  269
01-13-2008 01:41 PM ET (US)
Make love, not war!
Bertram L. (Instructor)  268
04-05-2001 05:25 AM ET (US)
Sorry for the delay with your grades.

I worked together with the TAs over the weekend to get the results out as quickly as possible, which was Tuesday after the final on Friday!

I don't know why CSE hasn't provided the results yet!
Buzz Lightyear  267
04-02-2001 05:21 PM ET (US)
I have not received my grades either.

Professor: does each grade letter in the "overall" results represent each person? I sat towards the front of the class, so i did not have a chance to count how many people were in class.
?  266
04-02-2001 12:22 PM ET (US)
Am I the only one that haven't recieved the grade yet?
Bertram L. (Instructor)  265
03-27-2001 11:37 PM ET (US)
For the anonymized results (FINAL+ OVERALL) see the class page or here:

 http://www.sdsc.edu/~ludaesch/CSE130/results.html
__  264
03-26-2001 12:24 AM ET (US)
It was too long. It was about twice as long as usual.
Jenna Jameson  263
03-23-2001 11:41 PM ET (US)
Did anyone else think that final was waaaay tooo long??
Paul Hsu  262
03-23-2001 05:21 PM ET (US)
Is there another Paul Hsu in the class??
Paul Hsu  261
03-23-2001 03:59 PM ET (US)
Thanks!
Sam Cassell  260
03-23-2001 01:48 PM ET (US)
Paul -

You're cool.
Aicha Mouline  259
03-23-2001 01:45 AM ET (US)

Hi ST,
The program outputs the value of the global variable B because function main "knows" only the global B. The local variable B declared in p2 is not visible within main().
Concerning the value of A, the last update of this global variable (before being output), is during the execution of procedure p1 called by p2. In the statement A:=B, variable A is assigned the value of the B (local) since that local B is the B "known" to p2 (the calling procedure). Let me know if you are still confused.

Aicha
ST  258
03-23-2001 12:48 AM ET (US)
I am still confused about the output for the dynamic scoping for the homework#5.
Why we print out the global B, not local B?
So A will output 2... This 2 is from the first execution of p1 or it is affected by the local B (A:= B)?
Thanks!
Paul Reubens  257
03-23-2001 12:47 AM ET (US)
Um, the professor said pretty clearly that we are supposed to handwrite our notes. So no typing or xeroxing is allowed! And although I am not the TA of this class, I'll be checking who typed their notes myself.

-Paul
__  256
03-23-2001 12:36 AM ET (US)
Deleted by author 03-23-2001 12:36 AM
john  255
03-23-2001 12:35 AM ET (US)
I have noticed that some people are typing their notes. Will we be allowed to use typed notes if we bring them to class on Friday? Is anyone going to check?
a student  254
03-22-2001 02:00 PM ET (US)
Prof, do you still have office hours this Friday from 10a-11a?
Gabe  253
03-22-2001 03:19 AM ET (US)
Thanks Aicha, I get it now.
Aicha Mouline  252
03-22-2001 02:19 AM ET (US)

Hi Gabe,
The output with dynamic scoping is indeed "2 3 2".
When procedure p1 is called by p2, it is the local variable B declared in p2 that is updated within p1. So executing statement B:=C in p1 changes Blocal (and not Bglobal) from 2 to 1. The B variable that is output on the other hand is the global B which is still of value 3 ( assigned during the first execution of p1). Hopefully, this helps.

Aicha
Gabe  251
03-22-2001 02:03 AM ET (US)
I assignment 5 #1c how does B become 3? I keep getting the output to be: 2 1 2 instead of: 2 3 2
Bertram L. (Instructor)  250
03-22-2001 01:07 AM ET (US)
Edited by author 03-22-2001 01:18 AM
Solutions to or comments on the recent assignments are on the class page now!

Regarding the HANDWRITTEN NOTES FOR THE FINAL:
apart from fairness reasons (not everybody may read the board before the final), there are also others reasons to allow only handwritten notes.
In particular, it helps refresh the material while writing it down -- an effect that cannot be easily achieved by copy paste...
Nick Puz (TA)  249
03-22-2001 12:39 AM ET (US)
re: 248.
typically functions return a value, but procedures do not.
Confused  248
03-21-2001 11:40 PM ET (US)
What's the difference between procedures and functions?
BeOS  247
03-21-2001 11:22 PM ET (US)
Yeah, typing up the cheat sheet will make it much easier, I have two finals on Friday. Typing would save me lots of time.
George B. (Student)  246
03-21-2001 11:07 PM ET (US)
Professor, could we type our notes instead of handwriting them? I already typed it and i only occupies 1 side. I don't want to have to handwrite it. Thanks.
Bertram L. (Instructor)  245
03-21-2001 10:31 PM ET (US)
SOLUTIONS ARE COMING UP...

stand by...
Sun Jie  244
03-21-2001 10:24 PM ET (US)
I think the solution for IA5 is ready. Bertram will post them soon.
But I doubt if there will be a solution for GP3.
a third dude  243
03-21-2001 10:20 PM ET (US)
Yeah, it would be nice to know if the solutions are going to
be posted. I guess none of the TA's are checking the messasge board. Is anybody listening?
Another Dude  242
03-21-2001 02:12 PM ET (US)
So are the answers going to be posted? I would find the solutions to the last individual assignment most helpfull as it was not discussed in the review session.
Dude  241
03-20-2001 01:55 PM ET (US)
Proff is there a chance we could get the solutions to the last two assignments. They would really help.
Thank you!
BeOS  240
03-18-2001 11:35 PM ET (US)
Scooby Doo:

Yes, double-sided on two sheets.
Scooby Doo  239
03-18-2001 04:38 PM ET (US)
I came late to the class Wednesday and was wondering if anyone knows if the 2 sheets of handwritten notes for the final can be on both sides of the paper??
Bertram L. (Instructor)  238
03-17-2001 08:04 PM ET (US)
Q #237: What if we turn in the homework, does that consider to be extra credit then?

A: Yes, there will be some sort of extra credit. However this optional homework does not count directly towards the total points.
Only in marginal cases (wrt. overall grade), will this extra credit be considered.
pee wee herman's dad  237
03-16-2001 02:29 AM ET (US)
What if we turn in the homework, does that consider to be extra credit then?
JJ  236
03-16-2001 01:47 AM ET (US)
Why is the homework going to be graded?
Bertram L. (Instructor)  235
03-16-2001 01:35 AM ET (US)
FINAL HOMEWORK:

the final homework is OPTIONAL, ie. the points will not be counted towards the total points for the homeworks.

But I will accept homeworks that are turned in BEFORE the review session (they will be graded).

The solution to the final homework will be discussed during the review session on Monday.
Bertram L. (Instructor)  234
03-16-2001 01:30 AM ET (US)
Edited by author 03-16-2001 01:32 AM
I had asked in class whether there is a problem

(1) with the Monday evening review
(2) with turning in the assignment on Monday

I didn't hear anything to the contrary about (1) or (2) after having simplified the return of (2) at the review session directly.

There would have been no problem at all to
(1') have the review session on Tuesday and
(2') have the final assignment due on Friday before
     finals week (or cancel it altogether)
HAD I only known about it EARLIER!

I understand that everybody's schedule is very busy -- that's why I had asked about (2) in class (I didn't sense any opposition). It is just an additional chance to practice some material for the final.

But alright: I will make the homework optional. But I have to allow those students who have already done it to turn it in.

Regarding the Tuesday review: this is unfortunately too late now, since I won't be able to reach everybody, the room is booked, etc.
So it's Monday.
pee wee Herman's Mom  233
03-16-2001 12:14 AM ET (US)
My son pee wee is a very busy boy. He and his friends have been studying very hard this quarter and are trying to prepare for their finals, which do begin on Monday. All his other teachers understand how important it is for pee wee to review the material covered throughout the quarter and to prepare for a test that will count for around 30-40% of his final grade. This is why they have not assigned
homework for the last week of school. My guess is that you
want to squeeze a little more learning into his already full schedule. Well, that's a good idea. I mean, what if all the teachers assigned just one last homework assignment the week before finals. Then eveyone could all work on homework for the few days before their finals. Sounds like a good way to prepare for finals. You could make it optional, but then pee wee probably wouldn't do his assignment. Of course that wouldn't show on the final, so what does he care.
pee wee's brother  232
03-15-2001 06:22 PM ET (US)
Review on Tuesday night would be MUCH better. Pee wee's brother has a final monday night also.
BeOS  231
03-15-2001 03:39 PM ET (US)
I don't think individual assignment 5 is optional, although it would be great if it were. I have finals on Monday and Tuesday, I would rather spend my time studying for those finals. Optional homework doesn't mean people wouldn't do it, especially if the material will be covered in the final. I think it's just unreasonable to make us turning in homework during finals week.
Michael Jackson  230
03-15-2001 02:50 PM ET (US)
So, is individual assignment 5 optional?
mr. x  229
03-15-2001 06:08 AM ET (US)
Tuesday night is better for me also
Albert Liao  228
03-15-2001 04:25 AM ET (US)
You have my vote for moving the final review to tuesday night.
Jin  227
03-15-2001 12:44 AM ET (US)
I have some homework assignments and a group project that haven't been picked up yet, i am wondering where can i pick them up before the final exam?
m  226
03-15-2001 12:38 AM ET (US)
I second Vivi's idea of moving the review session on Tuesday night because I have a final monday night too.
Vivi  225
03-15-2001 12:23 AM ET (US)
I agree pee wee's suggestion to have the review on Tuesday night instead of Monday night because I won't be able to make it neither.
pee wee herman  224
03-14-2001 04:17 PM ET (US)
pee wee can't make the review session monday night because he has a final. Is there any way the reveiew session can be moved to tuesday night instead if other students can't make it as well?
Bertram L. (Instructor)  223
03-14-2001 02:33 AM ET (US)
REVIEW SESSION:
Monday Mar, 19th, 7-9pm
Warren Lecture Hall 2204
Bertram L. (Instructor)  222
03-14-2001 02:32 AM ET (US)
#221: the monday deadline has the advantage that we could discuss the solutions/main mistakes in the review section..
Alternatively you may want to consider turning it in on Friday... but also see #220!

#220: I'm not teaching the material as part of this assignment but rather have you exercise it.
Please bring this up tomorrow in class -- I will see whether it is possible to make this only an optional exercise!

#219: no, yes. (for the second question: you could also just use a data constructor called EQ_sign

#218: what could be meant by "localprocedures"?
how about a bunch of local procedures? ;-)
here "local" means local to the procedure in which the localprocedures occur... nested so to say!

#217: SUN JIE, SHRIRAM: please follow up on this

#215: some detail is fine, eg. to discuss what will live in the activation frame
Rob  221
03-13-2001 11:32 PM ET (US)
In regards to assignment #5, if you plan to make it still due, I would prefer it to be due Tues - Friday (why not before the final?).

I have several final exams on Monday and I hate to make the trip to turn it in. I don't even work out at Rimac cuz it is too far of a walk. SDSC is next to Rimac if i recall.

But I'm willing to email or fax it over from home (Since we are required to type out the assignments).

Thanks.
help  220
03-13-2001 09:52 PM ET (US)
Professor,
Regarding individual assignment #5, I feel its good that you're trying to teach us the new materials through assignments, but I do feel that at this point in this quarter it would be more beneficial if this assignment was only used for practice. Although our final is on Friday, this could harm those who have on finals on Monday, therefore if you could consider making this optional and just posting the answers on the net, it would be more beneficial. Thanks.
j  219
03-13-2001 11:56 AM ET (US)
This question is regarding problem 2 of Group Assgnt. Are we suppose to write any functions for our abstract syntax notation? Also, when we must represent an expresssion as
 expression = lhs "=" rhs, how would we represent the equals sign in a data construction? can we just say this is a Char?
majik  218
03-13-2001 02:14 AM ET (US)
professor, could you tell us whats the deal is with localprocedures? Is this something missing accidentally or on purpose?
j  217
03-12-2001 11:11 PM ET (US)
I have grading concerns about individual assignments 3 and 4. Could whomever graded these please let me know so that I can discuss them w/ you? Thanks
Nick Puz (TA)  216
03-12-2001 04:08 PM ET (US)
Lab Hours Today:
I will be in the lab today from 2:00 to 2:20. (I have OH from 1:00 to 2:00). If you have any questions please either come to OH or to the shorter lab hours.
Paul Hsu  215
03-12-2001 01:29 PM ET (US)
Is it necessary to give details about symbol tables/expression trees and activation frames?
Bertram L. (Instructor)  214
03-12-2001 12:21 AM ET (US)

Re Dave #213: parsing is NOT the goal of problem 2a). The whole point about using an abstract syntax notation (i.e., essentially expression trees) like Haskell data types is that you do NOT have to deal with the concrete syntax and parsing. Instead, the abstract syntax starts at a more abstract level where the objects you are dealing with have already been recognized as variablenames, literals, procedure names etc. See also the next reply:

Re Chris #212: the goal of part 2a) is to start from an abstract syntax notation. In an abstract syntax notation, you would not be considered with details like the precise character syntax. For the problem it is perfectly fine to say, e.g., that the Haskell type of variable names is "String". It is then sufficient to add a comment saying that in your variant of mPL variable names are of the form which you have described.
(this is NOT required, but you could give a Haskell function that checks whether a variable name is valid, or just write down its specification:
  is_valid_varname :: String -> Bool
  -- returns TRUE if the first character is a letter
  -- and all remaining characters are letters or digits
  -- returns FALSE otherwise

Re #211: test successful! ;-)

Re: pee wee herman #210:
overall there should be at most one group that does NOT have 3 participants. That would be ok. But there cannot be many groups of 1 or 2 people!


Re: Gabe #208:
1) no, part 2 c) is not by far the longest.
2) by sketching it is exactly meant what you said: a combination of pseudocode and English is fine. The goal is that you think about some of the issues in part b) and sketch their solution. YOu may find that certain things like environments have different "natural" implementations in Haskell vs. in Java.
Dave  213
03-11-2001 11:15 PM ET (US)
Edited by author 03-11-2001 11:16 PM
Yeah... how can we take a regular expression and ensure that a certain data type matches it?

This is an issue for parsing int types, float types, identifiers, etc... I don't know how to do this in Haskell...

Any help is appreciated.
Chris  212
03-11-2001 09:54 PM ET (US)
We are having trouble converting a regular expression of the form:
(Letter) (Letter|Digit)*
into a Haskell Data type for question 2 part (a)
We have tried searching for anything on Haskell Data Types of the sort on the web but could not come up with anything.
Could you give us some sort of an example or where we could find something helpful?
Also let's say we are trying to write:
Letter = all the letters a..z as a data type...
Is there any way we could write that?
HELP!!!!
test  211
03-11-2001 05:51 PM ET (US)
Edited by author 03-11-2001 06:21 PM
test
pee wee herman  210
03-11-2001 05:43 PM ET (US)
What happens if we can't find a third person?
David  209
03-11-2001 05:05 PM ET (US)
We are a group of two... looking for a third member.

E-mail at dkrambs@ucsd.edu... will respond quickly.
Gabe  208
03-11-2001 04:50 PM ET (US)
Reply to messsages 204 and 206.
1. Looking at the specification for problem 2, part C should be by far the longest part of the problem in terms of number of pages, correct?

2. When you say *sketch* does this mean we can use a combination of code, pseudocode and English? For instance, we might define method headers in concrete Java/Haskell syntax but we can define the body of these methods more loosely. ??
majik  207
03-11-2001 01:24 AM ET (US)
looking for a SWF into moonlight nights, sappy movies, long hours of programming, caffeine addiction, and emacs.

Actually we'll take just about anyone for our 3rd partner, as long as you're willing to share the work. icq #4644338, majik@massconfusion.com
Bertram L. (Instructor)  206
03-10-2001 11:12 PM ET (US)
Some more comments on Problem 2:
(REMEMBER TO HAVE GROUPS OF 3 PEOPLE!!! indiviudals or groups of 2 need to be combined to groups of 3!)


part a) only deals with the SYNTAX of mPL. Even for the syntax, it leaves several things unspecified. Which ones??
(e.g.: what data types does your version of mPL have? What primitive types, what complex (composite) types?
(you don't have to be as fancy as the Haskell type system, but two different primitive types and one complex type would be nice)
also: do you need to augment the syntax to declare parameter passing modes in the formal parameter declaration of a procedure? (I guess so ;-)

for part a) it is recommended (but not strictly necessary) to use Haskell data types as an ABSTRACT SYNTAX NOTATION (check the corresponding lecture notes) for mPL.
This has the advantage that you can type in an mPL program as a concrete Haskell data object. (although you can't "run" the program -- but at least you can see whether you're abstract syntax is ok).

part b) here you want to think about things that are still ambiguous in your language after having fixed exactly the abstract syntax (using Haskell data types) in part a).
Some things to think about: scoping (static? dynamic?), parameter passing modes (call by value, value-result, reference, name??), type checking (static or dynamic); e.g. what happens if you have an arithmetic expression involving integer and floating types? Is there some sort of type casting?
Can you create new data structures? How? (maybe you have to extend the syntax in part a)

These are examples of the things to think about in part b): what do you have to FIX (in addition to part a) in order to get an unambigous semantic (=meaning) of the program!?



c) in part b) you can make different choices, say you pick two specific parameter passing modes, some specific scoping, some primitive/composite data types etc.
now the question is: how do your choices affect the implementation: how would you implement environments?
in particular: what is happening when you call a procedure?
how is the environment changed?

sketch how your programming language interpreter or compiler would handle this issues from part b (parameter passing, scopes, static/dynamic variables...): briefly explain/specify what needs to happen...



hint: the "perfect" (concise) solution should not have more than 5-8 pages for problem 2.
Stephie  205
03-10-2001 06:40 PM ET (US)
In part(b) of problem 2 of the handout, it says that we suppose to think about what crucial semantic aspects are lacking? Could someone elaborate on this a little more? Is it asking for the lack of support of some crucial functionality that common PL should provide (e.g. Inheritance)? Or is it something else? What exactly is "semantic aspect"?
Bertram L. (Instructor)  204
03-08-2001 02:28 PM ET (US)
RE #201, 202:

The DUE DATE for the current group project is
            WEDNESDAY MARCH 14th
before class.
For some reason I seem to use the wrong calendar tool...
(the assignment sheet had the wrong date: not 15th but 14th!)

Regarding Problem 2:

The idea is that you think about the design and implementation of a programming language.
What do you need to do in order to implement such a language?

Part 2a) deals with the syntax: try to create a Haskell data type which will allow you to key in mPL programs. You may start something like this:

data Procedure = Proc Head Body
data Head = ...

Part 2b) asks you to think about what -- apart from syntax -- you need to specify in order to obtain a unique SEMANTICS of the language. As Shriram mentioned in an earlier posting, you ned to think e.g. about parameter passing modes...

Part 2c) Here you should *sketch* how you would implement mPL in Haskell AND in Java. For example, assume that one group member came up with the specification (syntax + semantics = Part a and Part b) and now this group member has to advise the other members how to implement the language: in Java: what classes are there, what will they do etc; this should be sketched to some level of detail, so that it becomes clear how you will handle your semantics that you assumed in Part b.
Shriram Bharath  203
03-08-2001 01:33 PM ET (US)
This is about the second part of the second question - What you need to talk about here is what kind of scoping rules you'd want to use, why,...and what kind of parameter passing would you need, why...
For the thrid part, talk about how you would implement mPL in Java and Haskell. How will the environments be taken care of, etc.
Hope this answers most of your questions...
Paul Hsu  202
03-08-2001 12:04 AM ET (US)
When is the group project due? The professor mentioned monday today and the assignment says 3/15 Wednesday, but the 15th is Thursday.
Paul Hsu  201
03-07-2001 04:07 PM ET (US)
Professor,
 Can you spend some time to clarify the group assignment please.. especially the second problem? Thanks.
Paul Hsu  200
03-06-2001 10:41 PM ET (US)
Must have mislooked that, thanks KLM.
KLM  199
03-06-2001 07:23 PM ET (US)
Probably, quoting from the assignment handout: "(ii) meaningful test outputs are to be submitted" for the problems marked with "P". And the Java queue problem does have "P".
Paul Hsu  198
03-06-2001 01:36 PM ET (US)
Is sample output for the java Queue's necessary?
Sun Jie  197
03-05-2001 11:30 PM ET (US)
Paul:
  if call by reference, after x = 1.0 then x=y=1.0.
  if you call by value result, it really depents on the order of copy back.
  but you can always swap x and y in the code to get a different result from "call by reference".
Paul Hsu  196
03-05-2001 11:03 PM ET (US)
Sun,
  In your example below, when you do call by reference, y=y*x is the last update of z so shouldn't it print 3? Also, in call by value result, how do u know which result (3 or 1) to use... why is it 3?
Sun Jie  195
03-05-2001 09:30 PM ET (US)
About the difference between call-by-value-result
and call-by-reference:
See following examples:

void S(x,y)
{
 x = 1.0;
 y = x * y;
}

void main()
{
  int z = 3.0;
  S(z,z);
  print z;
}

If call by value-result is used, print z will output "3.0".
if call by reference is used print z will output "1.0".
Your classmate  194
03-05-2001 09:19 PM ET (US)
What EXACTLY do we need to do for part 2(a) and 2(b) for the group assignment? Say if we have defined the abstract syntax notation in Haskell data types form, what are we suppose to explain afterward? It's not clear on the handout.
Sun Jie  193
03-05-2001 03:44 AM ET (US)
From the Professor:
What is stateless/stateful procedures/functions?

stateless = pure functional: no side effects, no local static/global variables;
when function/procedure is called with the same input args, it ALWAYS returns the same output args => it is a function in the mathematical sense.

obviously, the use of static/global variables can be use to remember some kind of state of a function/proc, hence can lead to "non-pure"behavioiur..

From Sun Jie
I think that more factors made the function stateful:
such as modification of file pointer, you can think of it as a global variable maintained by the OS.
Sun Jie  192
03-05-2001 03:36 AM ET (US)
I think that both case is OK for ArrayQueue,
but for ListQueue, certainly the size should be dynamic.
for the array queue one may have also a size of the array to be given at creation time, but static is also ok.
Paul Hsu  191
03-04-2001 05:07 PM ET (US)
Edited by author 03-04-2001 05:33 PM
Discussion Requests -
1. What is stateless/stateful procedures/functions?
2. Call by Value-Result vs call by reference. Do these achieve the exact same result in terms of updating memory?
3. More concrete examples of dynamic scoping.

Also, some of the unanswered questions below:
Paul Hsu  190
03-03-2001 06:26 PM ET (US)
Are we supposed to implement a queue with static or dynamic size? Our group cannot agree...

Paul
Yoway Buorn  189
02-28-2001 07:21 PM ET (US)
For the constraint the following constraint:

headQ(emptyQ) ==> error

For GP3, Problem 1, should this be an Exception? If so, do we thus have to implement a new class (i.e., EmptyQueueException).
Paul Hsu  188
02-27-2001 02:46 PM ET (US)
We only need to implement the necessary functionality of the linked list right? Not the entire linked list ADT?

Paul
Bertram L. (Instructor)  187
02-27-2001 06:00 AM ET (US)
RE: #185,186: you should define you own linked list type.
The methods and signatures of the Queue ADT can be taken from the previous assignment on queues. (a sample solution should be online in the next few days).

When creating an ADT in an OOPL like Java, the signatures may look somewhat different. In particular, think about how in Haskell the "old" queue is passed as an argument to the operations implementing the ADT. In Java you would instead send a method to an object of type queue in order to update that objects' state...
Paul Hsu  186
02-27-2001 03:25 AM ET (US)
Edited by author 02-27-2001 03:27 AM
Can we used the java built in class "linked list" to implement our list based Queue ADT? Or do we need to write our own?
Paul Hsu  185
02-27-2001 02:14 AM ET (US)
About the G3, exactly what methods do we need to implement for the Queue ADT. Also, what should the signatures of these methods be? What do they return and things like that?
The original BeastMaster  184
02-26-2001 06:08 PM ET (US)
When are the rest of the midterm solutions going to be posted?
captain caveman  183
02-26-2001 06:05 PM ET (US)
So, is there class today?
Mighty Mouse  182
02-26-2001 03:07 PM ET (US)
I highly doubt that the '...' means there is no lecture. If that were so, then we would be skipping three total. Only three lecutres/discussions seem to be affected, rescheduling wise. The rest, as they say, go on as planned. Thus the '...'.

-MM
Tony Clifton  181
02-26-2001 01:37 PM ET (US)
So how ya doin? You havin' a good time?

The scheduling is a bit confusing.. Is there going to be a lecture today? It says "..", so I am assuming there is no lecture. Thanks. And remember I'm the freaking 8th Wonder of the World!!

I'm outa here!!

-Tony
andy kaufman  180
02-26-2001 04:14 AM ET (US)
hello everybody. will there be a lecture on monday (today)?

-andy
?  179
02-22-2001 02:17 PM ET (US)
Are midterm solutions going to be posted on the web? I would find it helpful. Thanks
Bertram L. (Instructor)  178
02-21-2001 02:55 PM ET (US)
To LIST OR NOT TO LIST...

ADTs: public specification, private implementation.
So: the implementation can do what the implementation needs to do. If that is a list, so be it!
(Though you may learn more if in fact you use your own user-defined data structures. In this way, you LEARN something about lists ;-)

Bottom line: lists are ok. But make sure you understand the separation of specification from implementation!

When you USE the ADT Queue, you don't have to know how it's implemented!
Aicha Mouline  177
02-21-2001 02:42 PM ET (US)

In prb#1, how do we get an error message to print when deQ is called and the queue is empty? I get the message:
cannot find "Show" function for emptyQ

Thanks.
Shriram Bharath  176
02-21-2001 02:22 PM ET (US)
The question 1 clearly words that you have to define a concrete data type...as does question 2 clearly word that the Stack implementation must be based on lists. So, unless Bertram okays using lists, the question stands as it is...
MB  175
02-21-2001 01:35 PM ET (US)
Shriram...
I believe many of us have used the LIST to implement Problem 1. Since your response came so late (the same afternoon the project is due), do you expect us to suddenly redo our Problem 1 list implementations? Due to the fact that no one, prior to you, stated that Problem 1 should not use lists, I feel lists should be allowed.
Shriram Bharath  174
02-21-2001 12:57 PM ET (US)
This is just to re-confirm that for Problem 1 of the (Small) Group Assignment 2, you can't use lists.
Nick Puz  173
02-21-2001 12:45 PM ET (US)
JH,
Think of a bunch of binary trees and try to create the data representing each of them. You should quickly realize that one of the definitions will not work.
JH  172
02-21-2001 03:41 AM ET (US)
What is the BinTree looks like in Problem 3?

Something like:
data BinTree = EmptyBT | LeafBT Int | NodeBT BinTree BinTree
(from lecture notes, 2/5)

-or-

data BinTree a = Leaf a | Node a (BinTree a) (BinTree a)


Thanks.
Your classmate  171
02-21-2001 03:39 AM ET (US)
Someone has asked this question before but no one has answered it (like most other questions here), can the queue in problem 1 be implemented with a list? Or must we use an implementation that is similar to the stack ADT in lecture notes?

Pleaes, someone must know the answer!
Dwight Schultz  170
02-21-2001 03:38 AM ET (US)
Murdock impersonators:
Several fans on the internet have contacted me and made me aware of this CSE web board.

I take offense that you failed to reference my real name. After all, BA Baracus's real name on the show was Mr. T!

Thanks guys and remember transporter psychosis is a serious matter! Take care!

-Dwight
Matt DeVico  169
02-21-2001 03:35 AM ET (US)
I noticed that Problem #3 doesn't have a "P" next to it. Does this mean that we can give a high level overview of the algorithm without having to write any code? Thanks in advance.
Templeton Faceman Peck  168
02-21-2001 03:30 AM ET (US)
IMHO, smaller frequent assignments are more manageable than larger ones. Smaller assignments allow us to determine our weaknesses and recover from them in a productive and constructive manner.


By the way you lovely CSE ladies, I am free this Friday.
help  167
02-21-2001 03:14 AM ET (US)
In problem 2, when it asks for Stack to be implemented using Haskell lists, does this mean we have to use an actual list in our constructor such as [], or can we transform a linked list to implement the Stack?
Lt. Col. John Smith  166
02-21-2001 03:11 AM ET (US)
No, Murdock, I think Billy has been pissing on your leg again. Mr. T. is right.
Paul Hsu  165
02-21-2001 02:09 AM ET (US)
I second Mr. T and his groups opinion that smaller, yet more frequent assignments are the way to go.
Murdock  164
02-21-2001 02:08 AM ET (US)
I think the gold chains around your neck are cutting off the circulation to your brain Mr. T.
Mr. T  163
02-21-2001 01:38 AM ET (US)
Dear Professor,

My team feels strongly that your idea of more and smaller groups assignments are ideal and promotes learning in a positive and *efficient* manner. You are doing an excellent job and we would like to see you continue your instructional format as it is.
Sun Jie  162
02-21-2001 01:36 AM ET (US)
In problem 3 , "height" is just the formal definition of the height of the tree. "myheight" is the value that your function retruns. hope that clarifies.
help  161
02-21-2001 01:33 AM ET (US)
I'm not sure if it went through, but what exactly is "height" in problem 3? is this a predefined function?
help  160
02-21-2001 01:31 AM ET (US)
In problem 3, is height bt a predefined function? meaning, when we are to show height (bt) = myheight (bt), what is this height we are comparing?
Bertram L. (Instructor)  159
02-21-2001 12:35 AM ET (US)
RE: #146-148:
Q: Why does it seem like we have something due every single week??
A: originally the plan was to have "large assignments" and then fewer of them. I decided that more and smaller (simpler) assignments work in fact better!

Do you want to have fewer and larger assignments for the second half of the quarter?

(I checked with previous classes and the workload seems in fact lower until this point. We may indeed have larger group projects coming up).
Mr. T  158
02-21-2001 12:07 AM ET (US)
In Implementing Queue ADT, are we permitted to use "list" types?

ie) newQ = (QueueA [])
ElimiNatr  157
02-20-2001 11:15 PM ET (US)
For the current assignment, number 2b, when you pop the stack you get a list minus the first element...the thing is is that that first element is lost. so in reverse after you push all the elements onto a new stack, when you try to pop stuff off you lose the elements popped and can't add them to a new list (the reversed list). how can you get around this?
um  156
02-20-2001 06:02 PM ET (US)
What is considered the front of the queue? Is it considered the head or the tail?
Matt DeVico  155
02-20-2001 05:20 PM ET (US)
Nevermind...I fixed it. Thanks.
Nick Puz  154
02-20-2001 04:34 PM ET (US)
Deleted by author 02-20-2001 05:15 PM
Matt DeVico  153
02-20-2001 03:10 PM ET (US)
Edited by author 02-20-2001 03:12 PM
Whenever I try to enqueue a value I get the following error message:

Program error: {enQ (Num_fromInt instNum_v33 2) newQ}

For the above I tried: enQ 2 newQ. Does anyone know what this means? Thanks in advance.
Paul Hsu  152
02-20-2001 02:27 AM ET (US)
Edited by author 02-20-2001 02:27 AM
Gabe,

This is not always a balanced tree:
     data MyTree = Leaf Int | Node (MyTree) Int (MyTree)

It will work for any tree, except one that has all its children as the left or right subtree.
Gabe  151
02-20-2001 01:51 AM ET (US)
For #3 group assign 2 myheight is supposed to work for any binary tree, correct? (Not just a balanced binary tree such as
data MyTree = Leaf Int | Node (MyTree) Int (MyTree)
as defined in discussion.)
Also, for clarification, should we define our own BinTree?
Sun Jie  150
02-20-2001 01:16 AM ET (US)
Certainly it does not matter, because it is just implementation details of the ADT.
But you must be clear about which is head , which is tail, And be consistent with that.
Stephie  149
02-20-2001 01:13 AM ET (US)
Sun Jie or other TA's:

  Why does it matter where the end or the beginning of the queue/stack is as long as they're the opposite?

For example, if I have a queue1=[1,2,3,4,5] and i consider 1 the front and 5 the end of the queue, as long as the queue becomes [1,2,3,4,5,6] when I do "enQ 6 (queue1)" (so it enqueues the 6 to the end of the queue like it should), isn't this implementation also correct?

In the same manner, if I have stack1=[1,2,3,4,5] and I consider 1 the front and 5 the end of the stack, then push 6 (stack1) should output [6,1,2,3,4,5].

Would the above implementation also be correct because it's consistent with the definition of all the operations of stack and queue?
Nick Puz  148
02-20-2001 12:53 AM ET (US)
Another Student,
There will be at least one more assignment.
The quarter isn't over yet :)

The web page now says that:
There will be several individual (homework) assignments and group projects (1 group = 3 students);
Another Student  147
02-20-2001 12:20 AM ET (US)
Yeah. Isn't it cool? We have no more assignments from here on out!
student  146
02-20-2001 12:06 AM ET (US)
Edited by author 02-20-2001 12:08 AM
Why does it seem like we have something due every single week? On the original syllabus I printed out at the beginning of the quarter it says that we are supposed to have about 4 individual assignments and 2 group projects. Well, we have already had 4 individual and 2 group and its only the sixth week in the quarter.
Sun Jie  145
02-19-2001 07:16 PM ET (US)
James: derive your data type from "Show". you can find many examples from the lecture note.

Mr.T
I think 1 is the tail of the queue [1,2,3,4] and
deQ (enQ 1 (enQ 2 (enQ 3 newQ))) should return [1,2] with 1 at the tail of this queue.
If you want to Haskell to display the head of the queue first, you should change your code a little bit.
Mr. T  144
02-19-2001 07:06 PM ET (US)
For a Queue.. if I "foldr enQ newQ [1,2,3,4]" and I see [1,2,3,4] returned.. is 1 the head of this queue??

Another example:
if I had the following...
deQ (enQ 1 (enQ 2 (enQ 3 newQ)))
Should deQ return [2,3] or [1,2]? I just want to make sure we have the right idea about exactly which part of the queue is the *head* and which is the *tail*

enQ 1 (enQ 2 (enQ 3 newQ))) results in an output in hugs that looks like [1,2,3] I am currently assuming that 1 is the head of this queue. Thanks in advance for your help.
James  143
02-18-2001 04:22 AM ET (US)
I copied the Stack implementation and ran it. I tried,
testing error conditions (ie, popping an empty stack, or
top of an empty stack), and I keep getting errors like this:

Main> pop EmptyStack
ERROR: Cannot find "show" function for:
*** Expression : pop EmptyStack
*** Of type : Stack a

my Queue ADT does the same thing. How can I fix this? I've
got an error that should print out, but, that doesn't happen.
majik  142
02-18-2001 02:34 AM ET (US)
could we get some sample code of the stack implementation from lecture 8 actually being used to do something?
Albert Liao  141
02-16-2001 01:56 AM ET (US)
Someone have any hints for the structual induction? For the function myheight, I basically followed the formula for the height of a binary tree. Now what do I need to prove to show that height(bt) = myheight (bt) since my code is simply the definition in haskell format? How am I supposed to approach this problem?
rundfunk  140
02-14-2001 07:09 PM ET (US)
Edited by author 02-14-2001 07:10 PM
In regards to the deQ operation that we're supposed to define for Problem 1 of Group Assignment 2, should it return just the new queue, or should it return both the element removed from the front of the queue and the queue (sans that element)?
Paul Hsu  139
02-14-2001 02:51 PM ET (US)
Edited by author 02-14-2001 02:54 PM
About ADT's... The constraints that go in the specification part are supposed to be comments right? They are not actual code yes? Also, does the the specs and the implementation parts need to be in separate files or modules or something like that? Or can they be in the same file?

One more thing... concrete data types are part of an ADT's implementation They are also types where you can see the implementation. Are these one of the same or not?
Paul Hsu  138
02-14-2001 02:40 PM ET (US)
What is "tailstrap" and what is "bootstrap"? Thanks.
Qwerty  137
02-14-2001 02:47 AM ET (US)
The second group assignment is posted. It is here
http://www.sdsc.edu/~ludaesch/CSE130/homework5.pdf
Sun Jie  136
02-14-2001 02:34 AM ET (US)
though myfunction has a signature of Char->Char->Int->Int
but the expression of "myfunction x" has the signature of
Char->Int->Int. The whole expression act as the first augument of foldr. So a is Char , b is Int.
Dean Lee  135
02-14-2001 02:28 AM ET (US)
since foldr has type (a->b->b) -> b -> [a] -> b, does
this mean that foldr necessarily takes in a function that
has type (a->b->b) as the first argument?
I was able to pass in a function of type Char->Char->Int->Int
and it worked without any errors.
e.g. myfunction :: Char->Char->Int->Int
...
foldr (myfunction x) 1 "string", where x is a Char.
can anyone give an interpretation of this?
Mr. T  134
02-14-2001 01:28 AM ET (US)
For group assignment #2, Problem #2 part b.

We've used our Stack ADT to implement a "reverse" function.. but our implementation is not purely only from our Stack ADT. Does our implementation have to use soley our Haskell definition of Stack only? We found it necessary to use ++ (only once though) to get our reverse implementation to work correctly. Thanks for the info.

Also, just wanted to make sure i heard this right, but did you recommend that we go over group assignment #2 in preparation for our midterm tomorrow? Thanks again!
Tammy Michelle Lo  133
02-13-2001 10:10 PM ET (US)
Majik--

where did you get your example from? Are you sure there is nth in between foldr and []?

>>in the case of a default value given (aka foldr) for [] >>we have:
>>foldr [] = e

it seems to me there should be a function in between? or are u talking about myfoldr which is user-defined?
Tammy Michelle Lo  132
02-13-2001 10:00 PM ET (US)
Let me try ...An example of Tagged union is the XML tree that we code for our previous assignment.

data XML = EmptyXML
   | Leaf String
   | Elem String [Attribute] [XML]

The "|" is an example of tagged union. It is usually disjoint(exactly either one of the three cases above when you reduce it)

donno if this is right...and if i am answering ur question =)
anyway, hope this helps
Tammy Michelle Lo  131
02-13-2001 09:53 PM ET (US)
Could someone please post the group assignment? I mean at least one problem so that we could start on it before the prof will post it.

thank you in advance
majik  130
02-13-2001 08:19 PM ET (US)
Edited by author 02-13-2001 08:21 PM
Professor,

Why is the underscore present in the example below?
myfoldr _ [] = error "*** ERROR: non-empty 2nd arg required"

in the case of a default value given (aka foldr) for [] we have:
foldr [] = e
-- notice no _

basically my question is what purpose and/or functionality does the underscore serve/have? In the haskell tutorial we see the example

fac n | n < 0 = error "input to fac is negative"
      | n == 0 = 1
      | n > 0 = product [1..n]
-- again notice no underscore

But when I tried to do
maxlist [] = error "no max on empty list"
-- no _

for the last assignment, I got an error while loading... could you clarify as to when (and why) we use the _ and when do we not?
ElimiNatr  129
02-13-2001 06:21 PM ET (US)
I'm confused as to what exactly a tagged union is. Could someone please explain and allieviate my confusion? Thanks in advance.
ken  128
02-13-2001 05:13 PM ET (US)
Proff or TA,

Could you please put Group Assignment #2 on the webpage?
Paul Hsu  127
02-13-2001 01:11 PM ET (US)
Where is the 2nd group project description?
Kelly  126
02-13-2001 03:57 AM ET (US)
For Group Assignment #2 part a)
What axioms (equations) are we supposed to write? Can you give an example of what is required? Thanks.
Bertram L. (Instructor)  125
02-13-2001 03:00 AM ET (US)
RE #123: no, min/maxlist are supposed to work on lists of numbers, NOT lists of list!

RE#122: what should myfoldr ... [] return???
Good question: the definition (=assignment) says nothing about it. Think about it: what is the maximum of <nothing>?
It's not defined (a little bit like "pop Emptystack").

For example you could define:

myfoldr _ [] = error "*** ERROR: non-empty 2nd arg required"
Bertram L. (Instructor)  124
02-13-2001 02:55 AM ET (US)
RE #114 (Paul)
you haven't got the complete definition of your test!
You must have some arithmetic operation (e.g. + or *) that lets Haskell infer that you need an Integer type!

Also: you probably mean "Num a => ...".

Try that!
jingmin wei  123
02-12-2001 04:04 PM ET (US)
For problem 2 part b, what is the minlist(or the maxlist) mean? is it a list of a list? for example, if i apply minlist to [[1],[2],[3]], then it will return [1], am i correct?
Aicha Mouline  122
02-12-2001 03:20 PM ET (US)
For the definition of "myfoldr" what should the function
return if the list argument is an empty list?

Aicha
Daniel K. Le  121
02-12-2001 02:26 PM ET (US)
What is the maxlist of empty list ?
is this undefined?
Thanks

p.s. can I use predefine function to implement myfoldl?
Sun Jie  120
02-12-2001 02:16 PM ET (US)
From my understanding:
problem 1: You must use foldr
problem 1a
only boolean lists are considered.
problem 2: myfoldr should be (a->a->a) -> [a] -> a
Cis  119
02-12-2001 01:15 PM ET (US)
For problem 1 , are we required to only use foldr, or can we define a new foldr like foldr' so it functions correctly. For part b, i made up a alternative to foldr w/
foldr'. With length' i couldnt use foldr and make it compile, Is this Ok...
theman  118
02-12-2001 12:04 PM ET (US)
For max and minlist, should we able to handle "chars" as well as integers?
theman  117
02-12-2001 11:57 AM ET (US)
For myfold, can the signature be "(a->b->b) -> [a] -> b", or does it have to be "(a->a->a) -> [a] -> a"?
Blah  116
02-12-2001 10:18 AM ET (US)
Are we required to use helper functions for number 1 assign 4. And for 1a, I just inputed "and_list [True, False]" and reslut is False, do we have to allow any type. like and_list [1,2,1] resulting in false. Well hehe it says the signature is [Bool], but just checking... cause i think u can like maybe write something that interprets like for [1,2,1] into [T,F,T]
hehe o well
wcavatar@hotmail.com  115
02-12-2001 10:11 AM ET (US)
Deleted by author 02-12-2001 10:11 AM
Paul  114
02-12-2001 12:05 AM ET (US)
When I use a class specifier such as Ord in a type declaration like:

     test :: Ord a => [a] -> a.

I am unable use any specific return types which are in the Ord class. For example if I have:
   
     test [] = 0

I get an error which states than the inferred type of:
     [Integer] -> Integer is not generic enough.

Why does Hugs try to infer a type when one has been specified?
Paul  113
02-12-2001 12:02 AM ET (US)
When I use a class specifier such as Ord in a type declaration like:

     test :: Ord a => [a] -> a.

I am unable use any specific return types which are in the Ord class. For example if I have:
Bryan Chiang  112
02-11-2001 11:42 PM ET (US)
RE: 110
I think the (X) in myfoldr (X) is just a function variable.
I created a helper function to replace the (X) in my program
Bryan Chiang  111
02-11-2001 11:39 PM ET (US)
Is there anyway you can post the lecture notes BEFORE class
that way it'll be easier to take notes during class
theman  110
02-11-2001 07:52 PM ET (US)
in problem 2, when it says "myfoldr (x) [x1,..,xn] what is the (x) suppose to symbolize? it looks like an exclusive or, but is it just a function variable? thanks
ac  109
02-11-2001 06:36 PM ET (US)
Lecture notes on 31st Jan, 2001.
www.sdsc.edu/~ludaesch/CSE130/ln7.html

What is '=>'? It is on the last page of lecture.
The symbol is used in defining
sum, product :: Num a => [a] -> a
Nick Puz  108
02-11-2001 04:22 PM ET (US)
The show function takes an argument and returns a string representation of it.
show :: (Show a) => a -> String

The "Gentle Introduction to Haskell" (linked of the main class website) has a good description of how it works on page 37.

But I don't think that you need to use it for program 4.
Mr. T  107
02-11-2001 03:48 PM ET (US)
Hmm.. could someone tell Mr. T what this "show" function is?
The components (ie. helper functions) of my 'charcount' works fine.. but when i run 'charcount' itself, it does this below:

I'm getting the following error:
Main> charcount 'o' "help"
ERROR: Cannot find "show" function for:
*** Expression : charcount 'o' "help"
*** Of type : [a] -> Integer
Paul Hsu  106
02-10-2001 01:48 PM ET (US)
When I try to derive Show, the systems can't seem to find it. Anyone know what the problem is with this:

deriving Show -or- deriving (Eq,Show)?

Thanks.
Bertram L. (Instructor)  105
02-10-2001 03:36 AM ET (US)
Edited by author 02-10-2001 10:59 AM
RE#100: MIDTERM.

there will be no separate review session.
But I'll talk a bit about the midterm on Monday!

It will NOT be in SOLIS, but in CENTER HALL 115!!
Bertram L. (Instructor)  104
02-10-2001 03:35 AM ET (US)
RE: #103
You've answered it already: there is no maximum value of the empty list. Your program can either gracefully die ;-) or -- even better -- report an error message!

RE: #101
Ord and Num are "type classes" (not so important for this class, ie CSE130 ;-)

Anyways, the difference is that Ord is the type class of Ordinal Numbers, so you can e.g. compare them. Instance of the Ord type class include Int, Integer, Float, but also Char!

Num is the type class of Numerical values, so you can do +, *, etc. instances include Int, Integer, Float, but NOT Char!



Find out more about "Ord" and "Num" by typing
Main> :info Ord
ElimiNatr  103
02-09-2001 03:43 PM ET (US)
Edited by author 02-10-2001 02:30 AM
What is the maxlist of []??? logically there is no max, so what are we supposed to return? Or should we not worry about this case??
Chris  102
02-08-2001 03:42 PM ET (US)
Deleted by author 02-08-2001 04:11 PM
Paul Hsu  101
02-07-2001 11:14 PM ET (US)
What is the difference between the ord and num data classes?

Paul Hsu
Britney Spears  100
02-07-2001 11:10 PM ET (US)
Is there going to be a review session for the midterm? What kind of questions should we expect and what material should we study for the midterm?
Pamela Anderson Lee  99
02-07-2001 04:44 PM ET (US)
Haha . . talk about late in the game. Okay I have a question about the XML datatype and how to manipulate it.

Our XML tree is several nested functions (folding?). How do we extract "arguments" to these functions? For example, if I do this . .

kozmo :: XMLElem
kozmo = Xe("kozmonaut",attribs,elems)


Now, calling kozmo will give me

Xe ("kozmonaut",stuff,more stuff)

How do I extract "kozmonaut"?
Bertram L. (Instructor)  98
02-07-2001 12:01 PM ET (US)
Edited by author 02-07-2001 12:01 PM
The FORMAT for the Group Project 1 is similar to the one for individual assignments:

stapled papers, legible explanations, commented code.

Of course the turned in solutions need to identify the group members, include a printout of the solution and some typical testcases, e.g.,

powerset [1,2,3] ==> ...

See also Sun Jie's message #95! (same thing ;-)
Paul Hsu  97
02-07-2001 03:18 AM ET (US)
Nelson,
  The list of XML's of your nonleaf are of type XML(either a leaf or non leaf). There is no 3rd type... just the leaf and non leaf. The third type is actually a nonleaf that has a null list of attribute-value pairs. The string is a leaf element. Cool?

Paul Hsu
Nelson  96
02-07-2001 02:49 AM ET (US)
In problem number 5, the definition of the data type is supposed to have a leaf which just takes a string. A non-leaf that takes a tag(string),set of attributes, and a list of XML types. The list of XML types will take a tag and a string. Will our type definition have to accout for this 3rd type of XML?
class xml {
leaf = string
non-leaf = tag [attributes] [xml*]
xml*= tag string
}
Sun Jie  95
02-06-2001 10:23 PM ET (US)
rundfunk: you can use a list to implement a set, as long as you do not impose an explicit order to the element. right?

Chris: I think a report should include code from yourself and any helper functions you used; brief comments on these functions or types; running examples and results( as brief as possible). No disk required.
rundfunk  94
02-06-2001 08:57 PM ET (US)
In problem 5 for the current programming assignment, it asks us to define a set of attribute/value pairs. Since it specifically says that "the order of attributes is *not* important", I am assuming that we need to create a set (in the mathematical sense) as opposed to a list (where order matters). Is this done using the curly brackets (i.e. {})?
Paul Hsu  93
02-06-2001 07:35 PM ET (US)
2 questions about the individual assignment 4:

1. Can we use the init and last functions to write myfoldl?
2. max/minlist are supposed to be integers or floating point #'s. What is the next generic class that will contain both integers and floats? Or should we just use floats?

Paul Hsu
Chris  92
02-06-2001 07:30 PM ET (US)
Proff or T.A.
I posted a question yesterday and I never got an answer. Please could you let me know. This was it:
What do we have to turn in?
A report(writen) with the code and the results or do we have to submit our code through our accounts so that you can test them?
Or should we just submit a disk with everything on it..
Thank you
Bertram L. (Instructor)  91
02-06-2001 06:39 PM ET (US)
Edited by author 02-06-2001 06:59 PM
Lecture notes from Monday are on the Web.
Solutions from earlier assignments will follow later today!

A GENERAL NOTE ON POSTINGS HERE:

Please only post questions relating to CSE130!!
Also: don't insult others (even if you think they post trivial or obvious questions!)
I just had to delete some unrelated/inappropriate messages.
LiMuBai  90
02-06-2001 05:50 PM ET (US)
Mr. T:

The syntax for intersect that I used was the following:

<list1> `intersect` <list2>

I just copied the code for intersect from the website i found it at.
ElimiNatr  89
02-06-2001 03:06 PM ET (US)
I know this is late in the game, but I'm having trouble figuring out the first programming problem, about the powerset. If someone could point me in the right direction, I would really appreciate it.
Daniel K. Le  88
02-06-2001 02:49 PM ET (US)
Professor,
Would you please post the last Monday lecture so that we can have some hints to do the problem number 5.
Thanks,
DL
 
Messages 87-81 deleted by topic administrator 02-06-2001 06:52 PM
Tammy Michelle Lo  80
02-06-2001 01:44 AM ET (US)
Yes, Sun Jie. Thank you. I think I got it.
   79
02-06-2001 01:44 AM ET (US)
Deleted by topic administrator 02-06-2001 06:52 PM
Chris  78
02-06-2001 01:43 AM ET (US)
What do we have to turn in?
A report(writen) with the code and the results or do we have to submit our code through our accounts so that you can test them?
Or should we just submit a disk with everything on it..
Thank you
Sun Jie  77
02-06-2001 01:27 AM ET (US)
So many questions!
1.I think that 1 is square-free, so you should include it.
2.for problem 5a second part: I will give you a hint.
  For example , in Java ,you define a "XML" class, then you are asked to initialize a "bookstree" object which is type of class XML. I hope you know what I am talking!

Sun Jie..
   76
02-06-2001 01:16 AM ET (US)
Deleted by topic administrator 02-06-2001 06:52 PM
Tammy Michelle Lo  75
02-06-2001 12:51 AM ET (US)
A correction to my earlier posting
XML booksTree = books -- to start with
is this a correct interpretation of second part of problem 5a)?
Tammy Michelle Lo  74
02-06-2001 12:49 AM ET (US)
Coz my partner asked the TA. The TA said we have to print out 1 since it's square free. My English is bad so I just want to make sure if I understand the problem correctly Thanks for the "kind" advice.
   73
02-06-2001 12:32 AM ET (US)
Deleted by topic administrator 02-06-2001 06:52 PM
Mr. T  72
02-05-2001 10:14 PM ET (US)
LiMuBai:

You da man mah brothah. Except, I'm getting an "undefined variable intersect" message. Do i need to do some kind of list module import to use 'intersect' ? I loaded the list module and then loaded my test.hs file for squarefree... what am I missing?

Is this the syntax u use:
intersect <some list> `intersect` <the other list> == [] ?
Tammy Michelle Lo  71
02-05-2001 10:08 PM ET (US)
For problem 4 b), I just want to make sure we do not need to print out 1 as a square free number?

For example
[1..3] should have output [1,2,3] instead of [2,3]
Tammy Michelle Lo  70
02-05-2001 10:05 PM ET (US)
For Problem 5 second part of a) "Define the above sample CML document as a value booksTree of type XML," I am not sure what the problem wants us to define.
Is it something like (just an example to start with)
XML booksTree = book book
...continue thru the tags of booksTree

Thanks in advance
Tammy Michelle Lo  69
02-05-2001 09:46 PM ET (US)
According to message 36 by Sun Jie, there are XML docs in Haskell data structures already. But I dont seem to find them.
LiMuBai  68
02-05-2001 09:14 PM ET (US)
Mr. T:

There is an intersect function in the Haskell List module that you can use to compare the two lists. Just compare the result of the intersection see if it == [].
I found it at http://www.haskell.org/onlinelibrary/list.html
Mr. T  67
02-05-2001 12:19 AM ET (US)
elem.. hmm.. Yeah, I think I could also use the member function for that too. Thanks for the tip.. I guess I'll need to revise my approach to this problem.
Stephie  66
02-04-2001 11:02 PM ET (US)
I don't know if there's a function that compares two list, but there is a function to see if an element is in a list. You can use the function "elem". For example:

elem 23 [23,45,36]

This is to check whether 23 is in the given list, and in this case, this will return true. There's also a "notElem" function which does the opposite. It returns false if an element is in the list.
Mr. T  65
02-04-2001 08:06 PM ET (US)
In Haskell, is there a way I can compare two lists with elements such as:

[1,2,3] and [1,4,5]

and test to see if these two lists have at least one element that is contained in both? Kinda like the "intersection" principle if ya know what i mean...
Tammy Michelle Lo  64
02-04-2001 06:04 PM ET (US)
I heard that problem 5 (XML)is not due on the same day as the rest of the problems... Is this true? If yes, then what date will it be due on?
Amy Tan  63
02-04-2001 02:53 AM ET (US)
Edited by author 02-04-2001 02:54 AM
Assuming I have defined data types for Characteristic, shouldn't we be able to do the following?

data Person = Pe (name :: String,
                personality :: [Characteristic],
                children :: [Person])


I would think so. And so would the documentation for Haskell, but we get the following error:

ERROR "xmltype.hs" (line 1): Haskell 98 does not support extensible records
Bertram L. (Instructor)  62
02-03-2001 10:10 PM ET (US)
Q: when I write:
        factors j = [i|i <- [1..j-1], (j 'mod' i) == 0]
I get an ...
        ERROR ... Improperly terminated character constant
 
WHY??
 
A:
1. always read the error message and try to understand what it says!!
There is an "improperly terminated character constant"... what
character constant could be meant?
2. try to isolate the problem: e.g. make the expression simpler.
 
using (1) and (2) you soon find the "culprit": something is wrong with
'mod'!! What's wrong? Well, check the manual or the Prelude.hs or
some such place: you'll find that you need to use BACKQUOTES (`)
instead of QUOTES ('). That's all!!
Bertram L. (Instructor)  61
02-03-2001 08:57 PM ET (US)
NOTE: you can SUBSCRIBE to the webboard and get, for example, a daily summary by email!
That's a good idea!
Bertram L. (Instructor)  60
02-03-2001 08:55 PM ET (US)
Q # 54 (Chris) .. How can we convert an int to float without having to
copy the whole thing from Prelude.hs?????
 
A: Here are some examples that help you a bit to understand the type
system:
  Main> sqrt 10
  3.16228 :: Double
What happend? 10 is interpreted as a floating point number and not as
an integer. Had we declared 10::Int we would get an error, because
sqrt works on (double precision) floating point numbes:
  Main> sqrt (10::Int)
  ERROR: Illegal Haskell 98 class constraint in inferred type
  *** Expression : sqrt 10
  *** Type : Floating Int => Int
 
How do we convert then from an Int or an Integer to Double???
Using the type conversion function
        fromIntegral :: Num a => Integer ->a
Here is an example:
  Main> sqrt (fromIntegral (10::Int))
  3.16228 :: Double
Now the sqrt function works correct! Due to the use of fromIntegral,
the INPUT of sqrt can now be considered a Double. Since we have
        sqrt :: Double -> Double
everything is fine!
 
A final example: assume you want a function that takes the integer
part ("floor function") of the square root of a number. That number
may or may not be a float to begin with, so we use "fromIntegral" to
make it "fit into" the input of sqrt:
 
floor_sqrt n = floor (sqrt (fromIntegral n))
 
A shorter way to write this is using "function composition":
In Haskell, the composition of two function f and g is denoted
        f . g
This means that
        (f . g) x
(read "f composed, or after g applied to x) is the same as
        f (g x)
With this, we can write
floor_sqrt' = floor . sqrt . fromIntegral
 
and floor_sqrt and floor_sqrt' are really the same function!
Example:
  Main> floor_sqrt' 10
  3 :: Integer
Bertram L. (Instructor)  59
02-03-2001 08:54 PM ET (US)
Q: #49 (Bashir): I was wondering how we could support larger numbers
or even infinite Integer types because the largest perfect number I
get is 33550336 and then it will print -65536,-262144 because it runs
out of Int space.
 
A: Int is finite precision integers. For infinite precision use
Integer.
Bertram L. (Instructor)  58
02-03-2001 08:52 PM ET (US)
Q #43 (Mathers): Is there a function that will tell us if a number is in the Integer domain? For example . .
IsInt 5.6 -> False
IsInt 5.0 -> True
 
A: Technically speaking neither 5.6 nor 5.0 is an integer. But I know what you mean: define a function that compares a number x to its "floor" (the smallest integer less or equal to x). If they are the same, then return true else false:

  looks_like_int x = x == fromIntegral (floor x)

Note that the "fromIntegral" is necessary because floor returns an Integer and we CANNOT compare an Integer to a floating point value x. Hence the "fromIntegral" conversion (in this case to Double):
  Main> looks_like_int 5.1
  False :: Bool

  Main> looks_like_int 5
  True :: Bool
Bashir  57
02-03-2001 07:47 PM ET (US)
Oh the reason I wanted function that does not take a parameter was that the assignment specifies to DEFINE THE LIST OF ALL PERFECT NUMBERS so this list is treated as a constant but it needs to be computed at runtime so can we define a constant whose value is actually computed at runtime and if so what would be the signature for such a constant.

thanks,
bashir
Sun Jie  56
02-03-2001 07:12 PM ET (US)
yes, you CAN have your own helper function, as long as you explain them briefly.
I do not know the answer for the second question. But in functional programming, why you need a function take nothing as parameter? If there is no stateful information, then the function must return the same thing every time, therefore a constant will suffice this purpose!
Bashir  55
02-03-2001 07:02 PM ET (US)
My question about helper functions is still not answered, I may have been unclear but I was wondering if it is ok to use helper functions that WE HAVE written. For example for my perfect function I have 3 other helper functions that I wrote to implement it. Is this ok or should everything be just in one function?
Also how to do specify a function that does not take any parameters. I tried ->[Int] but it didn't work. Is there a way in Haskell to specify void?(I searched the net couldn't find anything either).

thanks,
bashir
Chris  54
02-03-2001 05:26 PM ET (US)
O.K. How can we convert an int to float without having to copy the whole thing from Prelude.hs????? All we need is primIntToFloat but it has a bunch of dependencies itself in Prelude.hs.........
Bertram L. (Instructor)  53
02-03-2001 04:49 PM ET (US)
Edited by author 02-03-2001 04:54 PM
RE: messages #50-#52:

Sun Jie is right: you shouldn't do a function powerset that works only on Integer. In fact the very same code will work for a list of any type (that's why it's called polymorphic). So we indeed should define the type as
  
  powerset :: [a] -> [[a]]

The problem with Hugs is this:
  Main> powerset []
  ERROR: Cannot find "show" function for:
  *** Expression : powerset []
  *** Of type : [[a]]

The message is very precise! Hugs does not know what type of input list we have (since we gave the empty list! So empty list of what???)
So to "fix" this problem, we just tell Hugs what kind of empty list we have:
  Main> powerset ([]::[Int])
  [[]] :: [[Int]]
  (25 reductions, 49 cells)
Note how we "helped" Hugs and said "ok this empty list is an empty list of integers".

If we give a non-empty list, then there is no problem, because Hugs figures out the type:

  Main> powerset [1,2,3]
  [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]] :: [[Integer]]
  (211 reductions, 407 cells)

Just as well we can give sth else:
  Main> powerset "abc"
  ["abc","ab","ac","a","bc","b","c",""] :: [[Char]]
  (332 reductions, 490 cells)

Observe how Hugs treats the string "abc" really as a list of characters ['a','b','c'] (so the input has type [Char]), which in turn is our "Haskell way" of writing the set {a,b,c}.
The result is of type [[Char]] (which we read as "set of sets of character") and corresponds to
{ {a,b,c},{a,b},{a,c},{b,c},{a},{b},{c},{} }
Sun Jie  52
02-03-2001 04:17 PM ET (US)
No, I mean that you can keep that answer, because I think that is right.
Paul Hsu  51
02-03-2001 03:34 AM ET (US)
Edited by author 02-03-2001 03:34 AM
But if you declare the powerset for a specific type, say
powerset :: [Integer] -> [[Integer]], then you will not have this error, because hugs environment know how to display this kind of value.


So are we supposed to assume that we will only take the powerset of Integers?

Paul Hsu
Sun Jie  50
02-02-2001 10:47 PM ET (US)
1. Professor Bertram said that in your group project, you can use the helper function in the Prelude.hs etc..., but you must copy them in your project and give a brief explanation of it.
2. I think you should turn in the group project with the code, the execution of some examples, brief explanation of your code.
3. you need not to calculate perfect number to that large range, just show it works and give two or three perfect numbers is enough.
4. I think the powerset of [] is [[]]. When you compute the powerset of [], you get the error about 'show' from hugs. I think that the hugs environment does not have a predefined function to show this generic type, say [[a]]. But if you declare the powerset for a specific type, say
powerset :: [Integer] -> [[Integer]], then you will not have this error, because hugs environment know how to display this kind of value.
Bashir  49
02-02-2001 10:14 PM ET (US)
I was wondering how we could support larger numbers or even infinite Integer types because the largest perfect number I get is 33550336 and then it will print -65536,-262144 because it runs out of Int space.

thanks,
bashir
Bashir  48
02-02-2001 09:15 PM ET (US)
I was wondering if we could use any helper functions for any of the problems in particular the perfect numbers and square frees

thanks
James Sheppard  47
02-02-2001 08:07 PM ET (US)
Paul: I get the same error when trying to calculate the
power set of []. I think haskell is trying to look inside
the empty set and its causing an error. If you try doing a "powerset (tail [1])" that is essentially the powerset
of the empty set (I think?). And you'll get what you expect
back, [[]].
Paul Hsu  46
02-02-2001 06:58 PM ET (US)
What should the powerset of null return? I think it should be [[]], but I keep getting an error(Something with show).

Paul Hsu
Paul Hsu  45
02-02-2001 06:22 PM ET (US)
The instructions for the Group Project mentions a "group report." Is this a report consisting of the code for the 3 problems and comments or is something else expected?

Paul Hsu
Sammy Sosa  44
02-02-2001 02:41 AM ET (US)
Just in case anyone else is actually checking out the messaging board, here's a few resources that might help:

http://www.netaxs.com/people/nerp/proglang/summer-98/haskell.html

http://cs.wwc.edu/~cs_dept/KU/PR/Haskell.html
Marshall Mathers  43
02-02-2001 02:36 AM ET (US)
Edited by author 02-02-2001 02:36 AM
Is there a function that will tell us if a number is in the Integer domain? For example . .

IsInt 5.6 -> False
IsInt 5.0 -> True
Dean Lee  42
02-02-2001 01:11 AM ET (US)
Deleted by author 02-02-2001 01:15 AM
Bertram L. (Instructor)  41
01-31-2001 12:58 AM ET (US)
>> for the programming assignment problem 2, are we
>> supposed to give alist of perfect numbers in a range
>> from [1..infinite] or are we suppose to give the list of
>> perfects within a range [1..n] for some arbitrary n?

the assignment says "define the list of ALL perfect numbers", hence you should give a definition that can work with a (potentially) infinite list!
theman  40
01-30-2001 08:00 PM ET (US)
for the programming assignment problem 2, are we supposed to give alist of perfect numbers in a range from [1..infinite] or are we suppose to give the list of perfects within a range [1..n] for some arbitrary n?
Sun Jie  39
01-30-2001 06:54 PM ET (US)
xs can be any type, certaily it can be a list type.
theman  38
01-30-2001 06:31 PM ET (US)
in problem number 1, one of the definitinons is xs:[]. Are we supposed to assume xs is of type "list"? or can we take it as just an "element"?
Sun Jie  37
01-30-2001 04:02 AM ET (US)
>>In problem 1 of the assignment 3, what is y? Can we >>assume that y is any type such as [a] or a?

y should be anything that makes the operands of : operator
valid! That means if x:y and x is type a, then y must be type [a].
Sun Jie  36
01-30-2001 03:59 AM ET (US)
Some question and answers:

> This XML data type that we define, are we supposed to
> make it generic so that it we can
> mimic any XML document, or do you want it to only work
> with the given example?

It should be generic!

>Meaning, if I defined my own XML language, should the >Haskell program still work?

absolutely.

>Secondly, are we supposed to read in an XML document?
no. There will be some sample "XML docs" that are already given as Haskell data structures.
Paul Hsu  35
01-30-2001 12:57 AM ET (US)
In problem 1 of the assignment 3, what is y? Can we assume that y is any type such as [a] or a?

Paul Hsu
Sun Jie  34
01-28-2001 08:49 PM ET (US)
(1) When doing the LI evaluation, for example
mult (add(root 2)(root 3))
the evaluating order should be
1. root 2
2. root 3
3. add
4. mult.
Paul Hsu  33
01-28-2001 01:48 PM ET (US)
What is the difference between using an if,then,else clause and a series of | symbols? (In Haskell)

Paul Hsu
Paul Hsu  32
01-28-2001 01:23 PM ET (US)
Can we use all the build in functions from Prelude.hs? If not, can we overwrite these functions?
Paul Hsu  31
01-28-2001 01:18 PM ET (US)
When generating the list of "perfect numbers," where do we stop? Or is this the the situation where Haskell does not do something until it is needed so we do not need to specify an upper limit?

Paul Hsu
theman  30
01-26-2001 10:23 PM ET (US)
When doing leftmost innermost, do we evaluate the expression furthest in, or do we evaluate the one furthest in thats' to the left?

i.e.
mult (add(root 2)(root 3))

would we evaluate add first or root?
Bertram L. (Instructor)  29
01-25-2001 11:23 PM ET (US)
Edited by author 01-25-2001 11:24 PM
I have created a new topic where students can leave their contact information and hence can build project groups (3 students per group)

CSE130-GROUPS@UCSD
Bertram  28
01-25-2001 11:16 PM ET (US)
Sun Jie  27
01-25-2001 12:45 AM ET (US)
First a relation over A1, A2,...Ak is a subset of A1*A2*...*Ak.

Second a subset of A is an element of A's powerset 2^A.
Third the powerset 2^A can be thought as a function from A to {true, false}. Different functions from A to {true and false} represent differnet elements in the powerset.
There is a one-to-one mappings from 'a subset of A' to 'a function from A to boolean'. Then you can think how to model the relationship(which is a subset of ...) to a function.

....
Gabe  26
01-24-2001 11:41 PM ET (US)
I am having trouble understanding what #2c (HW 2) is asking for. What is meant by "..model a relation over A1,...,Ak as a function?"
Thanks.
Sun Jie  25
01-24-2001 04:41 PM ET (US)
you can interpret f 17 3 as ((f 17) 3)
when f :: a->(b->c).
then (f 17) will be a value whose type is something like b->c
and ((f 17) 3) will be a value whose type is something like c.
Mr. T  24
01-24-2001 04:20 PM ET (US)
I need some clarification for 1b. How do you apply f 17 3 to the function signature of f :: a -> (b ->c) ?
Bertram L. (Instructor)  23
01-24-2001 01:46 AM ET (US)
re Chris, #22 : "map" was explained on Monday (1/22) in class! It's also in the lecture notes of that day!!
Chris  22
01-23-2001 04:52 PM ET (US)
Assign2,Prob1(b),for g it says think of the map function explained in class. What is the map function I couldn't find it in the notes?????????
Sun Jie  21
01-21-2001 09:22 PM ET (US)
just an example:
f0:: integer -> integer;
f0 is a mapping from int to int. but when the domain of the mapping is finite, you can also regard it as an int array.
so the f1,f2 in problem 1a is trivial, but the f3 need more thinking.
theman  20
01-21-2001 08:23 PM ET (US)
hi, i just wanted some clarification on what asst. 2 is asking for. When it says explain the type, what does that mean?
ThreeZeroK  19
01-19-2001 01:07 AM ET (US)
Edited by author 01-19-2001 01:08 AM
I just want clarification on Asst2.Problem1a. Is this question asking for a description? For example, would the following be a correct question-answer:

f4 :: (String, Float) -> Float -> Float
A mapping from a String and a Float to a mapping from a Float to a Float.
Tammy Michelle Lo  18
01-17-2001 02:49 PM ET (US)
part 1a string seems to me that it could be both primitive and composite depending on which language used...

Please clarify =)
Thanks
Tammy Michelle Lo  17
01-17-2001 02:43 PM ET (US)
For part 1a Sun Jie said that string is a primitive type but why? Coz I thought it is composite =/
Thanks in Advance
Paul Hsu  16
01-17-2001 01:55 AM ET (US)
Edited by author 01-17-2001 01:57 AM
Sun,
  I emailed the professor asking him whether or not we need to write the functions to add/delete nodes in the Tree:

PH> Hi Professor Ludaescher,
PH> Regarding the first assignment, besides the definition of Tree, Leaf, and InnerNode, is problem 2b a programming problem? Do we need to write code for adding and deleting, or do we just give an explanation of how it would be done? I guess its confusing because you say "...in your language of choice." Thanks
PH>
PH> Paul Hsu

His reply:

Hi Paul,

Assignment 1 is NOT a programming assignment.
Just define the TYPE of Tree in 2(b). For the second part of the question
(creation, update operations on Tree) it is sufficient to sketch or
describe informally (and briefly) how trees can be created and
updated.
Sun Jie  15
01-16-2001 11:58 PM ET (US)
I am very confused about the homework problem 2.
2b). How is an instance of a tree created or updated?
     * is it OUR choice which to present creation or update?
    adding or deleting children?
     * what kind of tree are we talking about here and so
       what kind of properties must the tree obey (i.e. left
       to right insertions, hierarchy, or do we define
       those?
>>>> Because in the Question 2b the tree type is loosely defined, so I guess that any reasonable respresentation for a rooted tree should be acceptable. There is no need for ordering the node according to the tag.

     * if an inner node can only point to a tree type then
       whose is the parent of an inner node and of a leaf?
>>>> I can not understand this. the parent of an inner node or a leaf must be an inner node, right?

     * if the tree has only one node what does that mean?
       does it mean that that node is an inner node with one
       tree/inner node/leaf?
>>>> I think the root of this tree is a leaf type.

     * assume you have only one node type leaf on the tree,
       and I want to insert a node type innernode, then how
       is this inner node going to fit in the structure?
       do we push down the leaf one level and now we have
       the just inserted inner node to be the parent of the
       original leaf?
>>>> you can think that way. But there maybe another way to do that. when you insert a node into a tree, is it necessary to know whether this node is an inner node or a leaf? You can encapsulate this details in your operation functions.

     * assume we have only one inner node in the structure.
       and that all of its pointers have leafs. if we want
       to insert another leaf what do we do?
>>>> same as above. if you emphasize that you only what to "insert a leaf" or "insert a inner node", then these kind of problem will certainly happen. You must define a consistent way to solve this kind of situation. But if you encapsulate this in you operation functions, then you do not need to care about this.

     * What is the purpose of the tag in an inner node?
       if it is to "denoting what kind of inner node it is"
       then how many other kind of inner nodes there are?
       I thought there was only one kind of inner node.
>>>> I think the tag field is just an identifier to differentiate among many inner nodes. It has no special use in the operation of the tree.

Thanks!!!!!!!!!

Sun Jie.
jesus pasallo  14
01-16-2001 11:17 PM ET (US)
I am very confused about the homework problem 2.
2b). How is an instance of a tree created or updated?
     * is it OUR choice which to present creation or update?
    adding or deleting children?
     * what kind of tree are we talking about here and so
       what kind of properties must the tree obey (i.e. left
       to right insertions, hierarchy, or do we define
       those?
     * if an inner node can only point to a tree type then
       whose is the parent of an inner node and of a leaf?
     * if the tree has only one node what does that mean?
       does it mean that that node is an inner node with one
       tree/inner node/leaf?
     * assume you have only one node type leaf on the tree,
       and I want to insert a node type innernode, then how
       is this inner node going to fit in the structure?
       do we push down the leaf one level and now we have
       the just inserted inner node to be the parent of the
       original leaf?
     * assume we have only one inner node in the structure.
       and that all of its pointers have leafs. if we want
       to insert another leaf what do we do?
     * What is the purpose of the tag in an inner node?
       if it is to "denoting what kind of inner node it is"
       then how many other kind of inner nodes there are?
       I thought there was only one kind of inner node.

Thanks!!!!!!!!!
Sun Jie  13
01-16-2001 08:19 PM ET (US)
Hi, If you are clear about the difference between the mappings and the Cartesian product, you can skip this message.

Why string must be think of int -> char , but not int * char?

Basically mapping is function. For examples, the string "sun" can be think of a function f from integer(positive) to character, where f(1) = 's', f(2) ='u', f(3) = 'n' and for any other integer i , f(i) = ' ' or nothing.
This unique function related to the string "sun".
But think about following relationship:
{ (1, 's'), (2, 'u'), (3,'n'), (1, 't') ...}
It is certainly not a mapping because 1 is 'mapped' to both 's' and 't'. But it is a subset of int * char.
That is why you can not think the string as int*char.

Hope this will clarify the question.

thanks.
Sun Jie.
Sun Jie  12
01-16-2001 02:26 PM ET (US)
In 1a) "string" is a primitive type.
Sun Jie  11
01-16-2001 02:25 PM ET (US)
Hi, Bashir:
Here is some of my understandings of the homework1:
1. You can think of that every InnerNode has exactly k children. The insertion order is not relevant to this problem, I think that you just should give a procedure to add a child node/a subtree to a existing node. You can use heap to allocate these tree nodes.
I suppose that the "tag" is just another field of the InnerNode.

2. You must give the actual code in Java or C for adding and deleting the tree node. You should also give a BRIEF descriptions or comments for this code to get full credit.

3. sorry , I don't know that mathematical notation.

Sun Jie
Yeo Soo Kim  10
01-16-2001 02:01 PM ET (US)
in 1b), it asks signature for string(seen as a compostite type).
r we looking string in 1a) as composite type or primitive type?
Bashir Eghbali  9
01-16-2001 05:05 AM ET (US)
Hi,

I have several questions regarding the homework assignment:
1) Problem 2b)Is it true that a maximum of one InnerNode can have less than k children and that all other InnerNodes have k children? Does the insertion work in a breadth-first, Heap-tree like fashion? what is meant by each InnerNode has a tag indicating the type of the InnerNode(what kinds of InnerNode are there or is this generic)?

2) Problem 2b)Do we just explain in english what data structures are required and how the add or delete works?

3) Is there a mathematical shorthand notation for representing an N tuple (e.g. real1 X real2 X ... realN)?

Thanks,
bashir
Bertram L. (Instructor)  8
01-15-2001 10:45 AM ET (US)
Edited by author 01-15-2001 10:48 AM
Re: Matt DeVico (5) and Ameet (6):
In general, the *signature* of a function f is a description of the (types of) arguments and the result of f.
For example,
     f: integer x integer --> integer
is the signature of a function f taking two integers and returning an integer. For example, f may be "integer addition" or "max_of_two_int" (return the maximum of two integers)

For the assigment, think of string and associative array
as *mappings*, i.e., *functions*.
A string, e.g., can be seen as a special case of an associative array, and the latter is a function (as explained in Assignment 1).
Bertram L. (Instructor)  7
01-15-2001 10:30 AM ET (US)
Re: Paul Hsu (4)
you should NOT start your own topic, but instead post them under CSE130@UCSD.
Ameet  6
01-14-2001 10:00 PM ET (US)
I was unclear on the type of operations that we need to list for the first problem in homework #1. I was also wondering if you could specify whether we need the book or not, because I noticed this first homework assignment asks questions that weren't covered in class. Thanks.
Matt DeVico  5
01-12-2001 03:45 PM ET (US)
I am a little unclear on what a signature is. For example, when considering the composite type "string", would the signature be something like "length of string" x "CharArray"? Thanks in advance
Paul Hsu  4
01-12-2001 12:59 PM ET (US)
Can other's see topics which I create through "Start your own topic?" Or must I put it under "CSE130@UCSD?"

Paul Hsu
Charles Elkan  3
01-11-2001 09:58 AM ET (US)
The labs to use for CSE 130 are
 APM B402
 EBU-2 313

The combination for the door lock is 0723471.

Feel free to post questions about the lectures here!
Nick Puz (TA)  2
01-09-2001 02:45 PM ET (US)
There will be no discussions this week (first week).
Bertram  1
12-21-2000 02:10 PM ET (US)
Edited by author 12-21-2000 02:13 PM
Welcome to the bulletin board for CSE130@UCSD, Winter2001.
Here you can ask your fellow students general questions about CSE130, e.g., organizational questions, technical problems, questions to clarify assignments etc.

In addition, the TAs will also monitor the board and answer frequently asked questions.

You can also SUBSCRIBE to the board and thus receive email whenever new messages are posted (or once per day).
RSS link What's this?
QuickTopicSM message boards
Over 200,000 topics served
Learn more Frequently asked questions  Acknowledgements
What they're saying about QuickTopic
 Questions, comments, or suggestions? Contact Us
Read our use policy before beginning. We value your privacy; please read our privacy statement.
Copyright ©1999-2008 Internicity Inc. All rights reserved.