Coursera Programming Languages Course

  • (10 Pages)
  • +
  • « First
  • 5
  • 6
  • 7
  • 8
  • 9
  • Last »

136 Replies - 60410 Views - Last Post: 30 March 2013 - 02:47 AM

#91 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,682
  • Joined: 19-March 11

Re: Coursera Programming Languages Course

Posted 03 February 2013 - 10:55 PM

I suppose I can "file a bug" on the forums. It just seems weird to me that this sort of thing happens on a platform operating at this scale.
Was This Post Helpful? 0
  • +
  • -

#92 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1148
  • View blog
  • Posts: 2,528
  • Joined: 05-May 05

Re: Coursera Programming Languages Course

Posted 11 February 2013 - 05:08 PM

Dang, HW3 was quite a bit harder than the others! I'm glad I started a little earlier or else I would have gotten a terrible grade. Question 11 was pretty tough. I'm hoping the midterm difficulty is around the same as the in-video questions. I really don't feel like studying :(

So jon.kiparsky, any luck with the peer assessment?

This post has been edited by blackcompe: 12 February 2013 - 08:44 PM

Was This Post Helpful? 0
  • +
  • -

#93 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,682
  • Joined: 19-March 11

Re: Coursera Programming Languages Course

Posted 12 February 2013 - 11:04 PM

I found hw3 to be conceptually pretty easy, but the SML syntax just killed me - I spent so much time just trying to get things that would compile, I wasn't able to spend the time I needed to debug. This was very frustrating, because I'd see the answer, but it would take an hour or more fighting with the language to get it to work - so I didn't really feel like I learned anything from the exercise.

I'm not happy with SML or with Grossman's presentation of it - hard to say which, but while I was working on HW3 I became convinced that the type checker was actually using a randomized algorithm. That was when I developed the theory that SML is actually a very subtle esoteric language, where the joke is much deeper than Brainf*ck's.
In fact, it's so subtle that Grossman hasn't twigged yet.
However, in order to falsify this hypothesis I've picked up a copy of Felleisen and Friedman's Little MLer, which looks like it's their usual hands-on walkthrough of the important features of the language. If I still hate the language after reading F&F on it, I will just have to accept that I hate the language.

Quote

any luck with the peer assessment?


As a matter of fact, yes. cfoley was kind enough to review my work and gave me some good and insightful feedback (if kinder than I'd have awarded to myself)

(Chris - I haven't had a chance to write up my thoughts on your solutions, but on the whole I found them very pleasant to read, and I would have very little to complain about)
Was This Post Helpful? 0
  • +
  • -

#94 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1148
  • View blog
  • Posts: 2,528
  • Joined: 05-May 05

Re: Coursera Programming Languages Course

Posted 13 February 2013 - 09:42 PM

Quote

I found hw3 to be conceptually pretty easy, but the SML syntax just killed me - I spent so much time just trying to get things that would compile, I wasn't able to spend the time I needed to debug.


Yeah I wasted literally two hours trying to fix the syntax of nested case statements. E.g.

fun foo lst1 lst2 =
    case lst1 of
        [] => 0 case lst2 of
                    [] => 0
                   |h2::t2 => 1
       |h::t => case lst2 of
                    [] => 0
                   |h2::t2 => 1



Turns out I needed to put those inner case statements in parentheses. The type checker actually thought the nested branches were apart of the outer case. I guess anyway. Ehhh...

I was really against the clock. I submitted with like 3 minutes left. I kept getting a non-exhaustive match exception, and the grader deducted a few points. I got a 70 on assign 2, so I really can't afford to get less than an A on any of the upcoming assignments.

This is a long course. There's like 4 more assignments to do. I'm learning a lot more in this class, than the Scala class, but the Scala assignments were more fun.

Quote

If I still hate the language after reading F&F on it, I will just have to accept that I hate the language.


Hmm... I don't have a problem with it, especially being 30 yrs old, but I'm sure there are better functional languages. They're mostly the same to me, just different syntax. Just wait for Ruby!! There's some really awesome stuff you can do in Ruby (metaprogramming) that's not in other languages. I hope he covers the good stuff.

I thought Grossman's demonstration of currying was really good. I didn't realize its potential when Odersky taught it.

This post has been edited by blackcompe: 13 February 2013 - 09:45 PM

Was This Post Helpful? 0
  • +
  • -

#95 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1939
  • View blog
  • Posts: 4,027
  • Joined: 11-December 07

Re: Coursera Programming Languages Course

Posted 15 February 2013 - 06:14 PM

Quote

(Chris - I haven't had a chance to write up my thoughts on your solutions, but on the whole I found them very pleasant to read, and I would have very little to complain about)


No problem. Thanks for the compliment. I've actually found that the homework has been getting easier as the course progresses, at least so far. I think the difference is that homework 1 was very detailed-orientated. You had to read the question very carefully, translate it to tests and translate that to application code.

The homeworks since have been less detail-oriented and more language-feature-oriented. There is usually a language feature that maps nicely to the question. In homework 3, it was especially so. If you didn't have 1-line answers for the first half of the questions then you had the wrong answer. I swear that in homework 3, I spent 10 times longer (and about 10 times more LOC) writing tests.

The actual answers were short, demonstrated a language feature and worked first time -- which is something that cannot be said for the tests I wrote. I wonder if that is a common observation.
Was This Post Helpful? 0
  • +
  • -

#96 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,682
  • Joined: 19-March 11

Re: Coursera Programming Languages Course

Posted 18 February 2013 - 06:20 PM

Well, we're done with sml for now. Funnily enough, after he put all of the stuff we really needed to know from the start in the lectures after we finished with the language, I was able to nail the mid-term with 100/104.
Well, whatever, off we go into racket. Useful tip: to turn off the annoying arrows of pointiness, you have to use the last tab of the preferences window (on my mac, anyway, presumably something similar is the case for other operating systems)

(Whose brilliant idea was that? Gee, looks like he's trying to read his code and figure out where he missed out a paren - let's scribble all over his source, that'll help!)
Was This Post Helpful? 0
  • +
  • -

#97 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1148
  • View blog
  • Posts: 2,528
  • Joined: 05-May 05

Re: Coursera Programming Languages Course

Posted 18 February 2013 - 06:37 PM

I guess we can talk about the test now (on the forums). I'm going to raise an issue about one of the answers.

Edit:
Actually I trust that the answer is right, and I'm just wrong, especially when I haven't seen an overwhelming vote towards there being a wrong answer in the midterm.

This post has been edited by blackcompe: 18 February 2013 - 06:39 PM

Was This Post Helpful? 0
  • +
  • -

#98 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1939
  • View blog
  • Posts: 4,027
  • Joined: 11-December 07

Re: Coursera Programming Languages Course

Posted 19 February 2013 - 02:41 AM

Thanks for the tip about the arrows in Dr Racket. They are actually new. I started dabbling with Racket a few months ago and there were no arrows in the release I downloaded then.

I just noticed that a repeat of Odersky's Scala course starts the day this course finishes, in case anyone is interested. It looks like there is a lot of overlap with this course so it should be pretty easy going and it would be nice to hear about Scala from the horse's mouth.
Was This Post Helpful? 0
  • +
  • -

#99 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,682
  • Joined: 19-March 11

Re: Coursera Programming Languages Course

Posted 19 February 2013 - 06:08 AM

Odersky's course is interesting, but if you're mostly interested in learning Scala, you might find it more effective to just sit down and learn Scala - particularly now that you've been exposed to ML. What Odersky is mostly after is presenting functional programming from the Scala perspective - you learn certain portions of the language, but there's a lot you never touch.
On the other hand, Scala is a pretty high-complexity language, with a lot of idiosyncratic assumptions, so taking two months to get a foundation might be worth your while.

View Postblackcompe, on 18 February 2013 - 08:37 PM, said:

I guess we can talk about the test now (on the forums). I'm going to raise an issue about one of the answers.


Which question was this?
Was This Post Helpful? 1
  • +
  • -

#100 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1939
  • View blog
  • Posts: 4,027
  • Joined: 11-December 07

Re: Coursera Programming Languages Course

Posted 19 February 2013 - 06:34 AM

Yeah, I'm not really in much of a rush. If I had to learn it for a project, I'd learn it while I was doing the project. I'm coming more from the point of view that I'm enjoying the programming languages course and want to do another one. I've never been all that intrigued by scala but I am up for dabbling in a few different languages and am happy to be guided along for a few weeks.

I think I'm mainly interested in getting proficient in a lisp. I was looking a Racket a while back and since I have 2 weeks of it with Dan, I'll continue with that. A friend introduced me to a very nice problem set (http://rosalind.info) so I'll probably work my way through it with Racket.
Was This Post Helpful? 0
  • +
  • -

#101 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,682
  • Joined: 19-March 11

Re: Coursera Programming Languages Course

Posted 19 February 2013 - 08:15 AM

Getting to proficient is a hard step with lisps - a lot of good programmers seem to get to the end of SICP and then just sort of stay there. I know I'm in that position, and I'm pretty sure I'll be stuck there until I knuckle down and just build something from end to end in a lisp. I don't know when that'll happen, though. Surely not while I'm doing all these courses! :)
Was This Post Helpful? 0
  • +
  • -

#102 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1939
  • View blog
  • Posts: 4,027
  • Joined: 11-December 07

Re: Coursera Programming Languages Course

Posted 19 February 2013 - 10:05 AM

Quote

Getting to proficient is a hard step with lisps


But rewarding, or so I hear. :)

Quote

I don't know when that'll happen, though. Surely not while I'm doing all these courses!


That's OK. There is too much interesting stuff to do. The important thing is to choose something to do and not feel guilty about leaving the rest for another day.
Was This Post Helpful? 0
  • +
  • -

#103 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,682
  • Joined: 19-March 11

Re: Coursera Programming Languages Course

Posted 19 February 2013 - 10:12 AM

View Postcfoley, on 19 February 2013 - 12:05 PM, said:

Quote

Getting to proficient is a hard step with lisps


But rewarding, or so I hear. :)



You've been reading Paul Graham again? :)
Was This Post Helpful? 0
  • +
  • -

#104 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,682
  • Joined: 19-March 11

Re: Coursera Programming Languages Course

Posted 20 February 2013 - 09:43 PM

Just a quick heads up for anyone new to Scheme/Racket - for some reason, Grossman does not mention that in a cond statement, you can use "else" for your catch-all default clause.
That is:
(cond ((= 1 2) "not this one")
      ((> 3 8) "nope, not this either")
       (else   "must be this one"))



which I think is a little nicer than

(cond ((= 1 2) "not this one")
      ((> 3 8) "nope, not this either")
       (#t   "must be this one"))




How y'all doing with thunks and streams? A little crazy-making, I think, but it really feels good when it clicks.

This post has been edited by jon.kiparsky: 20 February 2013 - 09:44 PM

Was This Post Helpful? 1
  • +
  • -

#105 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1939
  • View blog
  • Posts: 4,027
  • Joined: 11-December 07

Re: Coursera Programming Languages Course

Posted 21 February 2013 - 01:03 AM

Quote

for some reason, Grossman does not mention that in a cond statement, you can use "else" for your catch-all default clause.


Thanks for the heads up! I like it and will definitely use it but...

The way Dan described cond is that if the first expression evaluates to true then the second expression is evaluated and returned. Else clearly works but it does not evaluate to true in the REPL:

> else
. else: not allowed as an expression in: else



There is clearly some magic going on here that I can't explain. I wonder if Dan didn't want to either. That said, I'm sure everyone could cope with being told about else and many wouldn't even notice that it doesn't evaluate to true.

I was looking at some of the racket documentation last night. A few more things he didn't mention are:

  • first and rest instead of car and cdr.
  • empty for the empty list instead of null.
  • Functions can have more than 1 expression. All are evaluated but only the last one is returned. It is useful if you want side effects (like with begin) and it allows you to define inner functions without letrec:

    (define (do-me)
      (define (and-me)
        "Oh yeah!")
      (and-me))
    
    


    This one seems to make begin and letrec redundant and confusing but I'll hang on in case there is some subtlety I'm missing.

Was This Post Helpful? 0
  • +
  • -

  • (10 Pages)
  • +
  • « First
  • 5
  • 6
  • 7
  • 8
  • 9
  • Last »