Computer Programming
Lazy Snake
個人資料 | email
posted 11-16-98 12:47 PM ET (US)
Does anyone know computer programming? Can anyone offer some help?
CC
個人資料 | email
posted 11-16-98 3:26 PM ET (US)
What kind of help do you need?
Lazy Snake
個人資料 | email
posted 11-16-98 8:25 PM ET (US)
CC,

I need some help on C++ VERY BADLY!!!!!

XiaHouJi
個人資料 | email
posted 11-16-98 10:16 PM ET (US)
Java too, if anyone knows it.
I am totally lost....since September.
CC
個人資料 | email
posted 11-17-98 12:16 AM ET (US)
What kind of assignment is it?

I dislike C++, but still I'll try to help.

CC
個人資料 | email
posted 11-17-98 12:18 AM ET (US)
To XiaHouJi:
Java of what level? I can only handle 100-level stuff.
Lazy Snake
個人資料 | email
posted 11-17-98 12:53 AM ET (US)
CC,

Can you read postscript files? If so, could you take a look here.

I'm having MUCH problems with templates, strings and classes. Actually these are 80% of the C++ language!! ~~>_<~~

CC
個人資料 | email
posted 11-17-98 12:38 PM ET (US)
Snake:

I just browsed on the assignment, but it's due Nov 12. In what way I could be of help.

BTW, does your textbook cover template well?
Maybe you need sth extra.

CC.

Lazy Snake
個人資料 | email
posted 11-17-98 4:04 PM ET (US)
CC,

The due date is forced to be Thursday Nov 19 now. We only had 2 weeks of lectures on overhead on OO programming, and the prof is presenting really very unorganized. Everyone is yelling at him.

N0 text or ref on C++ is supplied, I do have an intro book on C++ but it does not talk about templates and it's too beginner. Also it's like a PC version, I dunno if it's compatible with the ECF sparc system (I guess you would know what ECF is?).

Aside: I guess you are from the same University as me right?

Xiren
個人資料 | email
posted 11-17-98 6:29 PM ET (US)
Lazy Snake,

Unfortunately I cannot read postscript files,
otherwise I might be able to help.

I would like to recommend a book --
C++ Primer, 3rd Edition (Addison-Wesley)
by Stanley B. Lippman & Josee Lajoie

IMHO, this is by far the best C++ textbook on the market.
It covers the advanced features, such as templates,
classes, exception handling, inheritances thoroughly
and also provides a tremedous amount of examples.

Hope this is helpful!

Xiren
個人資料 | email
posted 11-17-98 7:03 PM ET (US)
BTW, if you want to learn more about this book,
check this out:
C++ Primer, Third Edition

This is not an advertisement. ^_^

Xiren
個人資料 | email
posted 11-17-98 8:31 PM ET (US)
XiaHouJi:

I'm not sure what level of help you need,
but you might find this site helpful --
The Java Tutorial
CC
個人資料 | email
posted 11-17-98 11:31 PM ET (US)
Free E-books from:
Macmillan Personal Bookshelf
http://www.mcp.com/personal/

You may bypass the Personal Bookshelf interface by entering the URL of a e-book directly, for example, the ISBN code for
"Teach Yourself JAVA 1.1 PROGRAMMING in 24 Hours"
is 1-57521-270-6 .

One can access the e-book or retrieve everything using some "mirroring" utility by this URL:
http://www.mcp.com/??7670400/
1-57521/1-57521-270-6/index.htm (in one line)

You may find your own ??7670400 by opening in New Window a chapter of any e-book and add 86400 (24*3600) to it for daily renewal.

Enjoy those 150+ free e-books on computing!

XiaHouJi
個人資料 | email
posted 11-18-98 12:50 AM ET (US)
CC, Xiren:
Thanks for your help, but I think I need a miracle more than help. Those Object/Class things are killing me.
Lazy Snake
個人資料 | email
posted 11-24-98 2:12 PM ET (US)
I'm having an assignment on both Scheme and Prolog now. Only 5 lectures and we have to do a BIG assignment in 10 days! Anyone knows anything about these?
CC
個人資料 | email
posted 11-24-98 2:39 PM ET (US)
Is it a project to be written in Scheme and Prolog?
Or two projects in Scheme and Prolog resp'ly?
Or a project to write a translator (interpretor) of Prolog in Scheme?
Or else?
Lazy Snake
個人資料 | email
posted 11-24-98 8:08 PM ET (US)
CC,

It's an assignment (7%) to write several (!) programs in Scheme AND several (!) programs in Prolog. Please take a look here.

CC
個人資料 | email
posted 11-25-98 11:37 PM ET (US)
I just took a look at the assignment, and I guess I could help on the first four Scheme problem, perhaps P#5 as well.
I shall download the MIT Scheme program...

P#6 seems straight-forward, but I've forgotten everything about Prolog. I guess what you need for P#7 is a translation scheme, does your TA give you guys any hints?

Lazy Snake
個人資料 | email
posted 11-25-98 11:52 PM ET (US)
CC,

No, the TA's s?cks.

Lazy Snake
個人資料 | email
posted 11-25-98 11:54 PM ET (US)
I guess it would be easy IF we can do it in C or C++ or something... also IF I'm familiar with the Scheme/Prolog syntax. Actually how often are those 2 languages used?
CC
個人資料 | email
posted 11-26-98 7:12 AM ET (US)
Snake:

I think you've missed the point. You take the programming language course to appreciate the "beauty" of the various programming paradigms, don't you? How often Scheme and Prolog are used is a non-matter. You don't learn the two languages (and other languages as well) in weeks, not even the complete syntax. However, you may learn the spirit of each of the programming paradigms.

I guess it would be easy IF we can do it in C or C++ or something...
I guess it would be easier IF you use a single language through the course, Scheme and MT(?) are two of the better choices.

also IF I'm familiar with the Scheme/Prolog syntax.
You don't need to know too much for the sake of the assignment.

Actually how often are those 2 languages used?
Mostly for AI stuff, believe. Anyway, Scheme is powerful yet simple enough to be used as an extension language (similar to AutoLisp in AutoCAD), and the MIT guys are promoting them to other areas. Scheme is a lovely language.

Lazy Snake
個人資料 | email
posted 11-26-98 9:24 AM ET (US)
CC,

So does it worth to buy a book on each Scheme and Prolog for future reference? You know it's like >$80 after tax, so $$$$$

Lazy Snake
個人資料 | email
posted 11-26-98 9:31 AM ET (US)
CC,

>You take the programming language course to
>appreciate the "beauty" of the various
>programming paradigms, don't you?

Really beatiful, haha.

>You don't need to know too much for the sake
>of the assignment.

If I'm not familiar with the syntax, how can i write such a BIG program? (OK, I know this one is just a combo of small ones but, the C++ one?)

CC
個人資料 | email
posted 11-26-98 10:36 AM ET (US)
So does it worth to buy a book on each Scheme and Prolog for future reference? You know it's like >$80 after tax, so $$$$$
Nope, does not worth it for a 3-week study period. However, there are already several good Scheme books in the library for future reference, one of which has interesting discussions on other programming paradigms, lazy evaluation, for instance.

For the sake of the assignment, you may consult any LISP book and the R4RS documnetation (available online, from the links on the MIT page, let me see... yeap, they are in WinHelp format come with the MIT Scheme program.) If you are really lost with Scheme, I guess I can help you work out the first few problems by providing you some dumb implemnetations and let you improve on them.

For Prolog, I suppose you need very minimal study material, there should be some Tutorial available online... try finding them.

If I'm not familiar with the syntax, how can i write such a BIG program?
Don't know.
Anyway, you have to get familiar with the syntax first, BE QUICK or you will suffer next week.

Lazy Snake
個人資料 | email
posted 11-26-98 8:28 PM ET (US)
CC,

>Nope, does not worth it for a 3-week study period.

Does it for the 'outside world'?

>If you are really lost with Scheme, I guess I can help you work out the first few problems by providing you some dumb implemnetations and let you improve on them.

Oh thank you! Actually I'm getting lost because everything is piling up in this period of time.

Anyways I will try to do it, after I finished my 15% project!!!

Lazy Snake
個人資料 | email
posted 11-29-98 9:57 PM ET (US)
CC,

Part 4 is changed such that we need to sum all the numbers in an arbitrary number of lists, instead of appending the list, since the append function is built in.

Also, they say we are forced to use unrestricted lambda, NOT period delimiters. Could you explain a little bit?

CC
個人資料 | email
posted 11-29-98 11:09 PM ET (US)
If the period delimiter form cannot be used, transform
(define (foo . x) ...)
to
(defein foo (lambda x ...) )
[note that the std form of a lambda expression is
(define foo2 (lambda (x) ...) ) ]

Well, one possible soln for prob 4 is:


(define append
(lambda ls (apply +
(map (lambda (l) (apply + l))
ls) )))
CC
個人資料 | email
posted 11-29-98 11:11 PM ET (US)
Could you still use higher order functions like let, apply, map, ...?
BTW, they are called "syntactic sugar".
Lazy Snake
個人資料 | email
posted 11-29-98 11:50 PM ET (US)
CC,

>Could you still use higher order functions like let, apply, map, ...?
>BTW, they are called "syntactic sugar".

I don't think so, but I'll ask on the newsgroup.

BTW, I don't quite understand your tree functions! ~~>_<~~ Did you use some built in functions that MIT Scheme doesn't have or that I dunno/can't use?

Lazy Snake
個人資料 | email
posted 11-29-98 11:56 PM ET (US)
Like length, list....
CC
個人資料 | email
posted 11-30-98 12:01 AM ET (US)
length and list are "essential" (i.e. must-have) procedures of Scheme.
Lazy Snake
個人資料 | email
posted 11-30-98 12:08 AM ET (US)
CC,

OK, so I can use whatever built in functions you used?

I guess I can use let, but not sure about apply, map.....

Actually, could you give me some examples in unrest.lambda? The lecture notes/tutorial notes/textbook are USELESS.

BTW, after all these assignments/labs/projects, could you give me some programs in Prolog so that I can use them as e.g.'s to study for finals?

CC
個人資料 | email
posted 11-30-98 6:12 AM ET (US)
Actually I've never heard of the term "unrestricted lambda (expression)". The one I mentioned is just a normal lambda expression taking a "half-pair" argument.
CC
個人資料 | email
posted 11-30-98 8:45 AM ET (US)
In fact, you don't have to use "let" structure.

(let ((x1 e1)
...
(xn en))
e)

is equivalent to

((lambda (x1 ... xn) e) e1 ... en)

For instance,


;;; ----------------------------------------
;;; subsets procedure
;;;
;;; parameter: l - a list, treated as a set
;;; return : a list of the 'subsets' of l
;;;
;;; algorithm: reduction!!
;;; base case: subsets[()] = (())
;;; induction: subsets[(a ls)] = (a%ss[ls] ss[ls])
;;; where ss[ls] = a bunch of elements in subsets[ls]
;;; & a%[X] = (a x1) (a x2) ... (a xn), n = |X|
;;;
;;; ----------------------------------------
(define (subsets l)
(if (null? l)
'(()) ; returns list of empty list
((lambda (m ls)
(append (map (lambda (x) (cons m x))
ls)
ls))
(first l) ; i.e. arg m
(subsets (rest l))))) ; arg ls


Also, other higher-order procedures can be reduced to lower-order functions, for example


(define (map procedure list)
(if (null? list)
'()
(cons (procedure (car list))
(map procedure (cdr list)) )))

Only that things become messy then.
CC
個人資料 | email
posted 11-30-98 8:46 AM ET (US)
I do not have a Prolog interpretor, what are you using, Snake?
Lazy Snake
個人資料 | email
posted 11-30-98 10:24 AM ET (US)
CC,

I ask the TA's, NO high order functions are allowed unless we write them ourselves. I guess we can only use the functions we write.

We HAVE TO use unrestricted lambda at least once in this assignment, and probably part 4 I guess.

I just don't know how to code it, I know what it is (-> Do I really know anything?). I'll try looking for some unrest.lambda on net.

BTW, what do the built in function that you used do?

CC
個人資料 | email
posted 11-30-98 12:28 PM ET (US)
You can find what the built-in procedures do from the R4RS documentation.

Could you please tell me your understanding on "unrestricted lambda"? (here lambda is a noun, what is a lambda???)

I believe that "length" and "list" are primitive functions, though we can write our own if necessary. Just a piece of cake, BTW.


楊過的傷心小站 | 過兒的討論區 | 討論精華
寫信給過兒 | 問題/建議 | 問題/建議精華討論主頁