Did the first assignment (without hearing the lecture first, admittedly). Result here: http://baldwinsoftware.com/wiki/pmwiki.php?n=Main.MIT1
#!/usr/bin/env python # first assignment for MIT intro comp sci class. # http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/ # Problem Set 0 # Name: Tony Baldwin # Collaborators: Google # Time: 0:30 last = raw_input("Please enter your last name: ") first = raw_input("Please enter your first name: ") print("Hello, " + first + " " + last + "!")
Looks good if you're using Python 2.X. You using Unix?
debian ftw
Yeah, Debian GNU/Linux, and Python v.2.6. I also "translated" the script to bash, lisp and tcl, at the above link. I should probably go view the lecture, now... I, obviously, have tinkered with some code before, but my fu is n00bish, and I've decided to get serious and start learning to hack with the big boys.
My python fu is really weak, in all truth, so don't know why I picked that, first...I think something in the assignment suggested looking at the python I/O tutorial, or something. I just started looking at Lisp tutorials last night, and the code is inspirationally sparse, which was part of my motivation to seek out means to really learn to hack for real. I've been writing tcl/tk and bash scripts for a couple of years, but on a completely hobby level, and completely self-taught. I've tried, in the past, to learn both Java and C and gave up both within hours, finding them boring and confusing.
Python is a great language to start with. I never took programming in school, and I started with MIT's 6.00 materials (6.001 and SICP intimidated me but I will tackle it later since the videos are really great and Scheme/Lisp seems worth knowing even though some programmers think it's garbage; functional programming is becoming popular these days as modern languages inherit stuff from Lisp and F# is now a first class citizen in Visual Studio) Now that I'm done with the course I'm picking up C.
The lecture videos are relatively easy to follow, and you learn the basics of computer science and programming once you're done with them (what I've missed since I didn't take AP comp. sci, damn AP Bio)
CLisp: #!/usr/bin/env clisp ; Problem Set 0 ; Name: Tony Baldwin ; Collaborators: Google ; Time: 0:30 (format t "Please enter your last name: ") (let ((last (read))) (format t "Please enter your first name: ") (let ((first (read))) (format t "~%Hello, ~A ~A!" first last)))
Someone with some real Lisp fu could probably write something even more sparse and efficient, frankly.
What book would you recommend to a beginner on Common Lisp and/or Scheme?
I added perl to my solution, so it now has 5 languages. I just started learning Lisp night before last, using this: http://www.cs.gmu.edu/~sean/lisp/LispTutorial.html I did find two pdf books, but don't recall where. If there's a way for you to pm me, I could find a means to send them to you (attachments or upload to my server for you to download, or something).
Okay, I've now "translated" my original python script into 5 other languages, bash, lisp, tcl, perl and ruby. They all produce nearly identical results. (see them all at the first link I posted on my wiki).
I suppose it would be called "porting", changing a program/script from one language to another. Just, I work professionally as a translator of people languages (ES, FR, PT to US EN), and it seems like very much the same thing on many levels. And the computer languages are more related than many human languages. While all my languages are Latin-based, there are languages with very, very different syntax and grammar, etc. "Translation" or porting between most computer languages seems a lot like translating between people languages with a common root, like all Latin-based, or something.
Also, I've never learned any hackery from a book, really, just online tutorials, wikis, irc channel chats, etc. I also don't learn well from videos, so that's going to be tough. Too ADD to focus on a video, but I can read and learn well at my own pace.
No Russian? What a slacker :P
нет...извините
Join our real-time social learning platform and learn together with your friends!