Live data from Hacker News

Learn C and build your own Lisp

buildyourownlisp.com

131–140 of 150 posts

Re: Learn C and build your own Lisp

#131
post #15
post #5

In the last chapter, Bonus Projects, the author mentions Static Typing & type systems. If anyone's interested in learning more: I've implemented a few simple implementations of basic (and not so basic) type systems[1]. Currently, only 3 type systems are finished (Hindley Milner's Algorithm W, and Daan Leijen's extensible rows and first-class polymorphism), while gradual typing is almost done (based on [2], in branch…

Oh wow! This is extremely useful, thank you. I've been wanting to develop my own statically-typed language, but almost all tutorials on the web are for dynamic languages with little mention given to type systems. I've already started a toy dynamically-typed language, but the step up from that to a static language seems significant, particularly given the dearth of information I can find on the web (aside from dense a…

Looks like no one's mentioned Benjamin Pierce's authoritative book on this, "Types and Programming Languages" (TAPL). I would certainly put it way, way above the Dragon Book. Bob Harper can certainly defend his opinions as well as anyone, but I think Pierce is currently the standard text here.

Also, if you're looking to add a static type system to a Lisp-like language, you should take a look at Shriram Krishnamurthi's Programming Languages and Interpretation, second edition, at http://cs.brown.edu/courses/cs173/2012/book/ . It's a free online book, and I'm currently using it as the text in my programming languages class.

Re: Learn C and build your own Lisp

#132
post #64

How good is this book for a complete beginner? I am starting to learn C in my free time and I have no objective way to judge this book.

I was one of the beta readers. The book makes quite a different trade off from most other beginner C books. Most other books follow the K&R model of short examples and a lot of detail on the topic in question, while Build your own Lisp is just one project. So you actually see how the parts fit together. I would think that either way you can learn C. Which way is better for you depends if you are more motivated by goi…

I think it's better at teaching Lisp.

Re: Learn C and build your own Lisp

#133
post #100
post #89

Earlier quoted context omitted.

Out of curiosity, what are you doing with your time that is currently more important than reading it?

Working on my startup, a social photo/video aggregator that organizes by event, and has B2C and B2B aspects: http://wesawit.com Any feedback is appreciated.

It' slow.

DOM loaded in 59 seconds.

Content loaded in 180 seconds and weighs 12MB

It's also downloading mp4 files in the background.

....

4 minutes passed and it is still working on the banner-video.mp4

Also, it has problems with scrolling (freezing). I use a MacBook Air 11'' from 2012.

Re: Learn C and build your own Lisp

#134
post #70

Earlier quoted context omitted.

Here's a different book you might be interested in ("Practical Foundations for Programming Languages": http://www.cs.cmu.edu/~rwh/plbook/book.pdf It gets pretty math-heavy at times, at least in the beginning (you can probably skip the first chapter if it's too rough), but ultimately the book is about programming language design and different ways of designing and evaluating typed (or un(i)typed) languages. It also lo…

I've been wanting to read that for a while. Another candidate is Pierce's "Types and Programming Languages". Has anybody by any chance read both an can compare them?

I've read both and Pierce is much better. I have nothing but respect for Robert Harper, a great thinker in this space, but Pierce is a better writer.

Re: Learn C and build your own Lisp

#136
post #100

Earlier quoted context omitted.

Working on my startup, a social photo/video aggregator that organizes by event, and has B2C and B2B aspects: http://wesawit.com Any feedback is appreciated.

It' slow. DOM loaded in 59 seconds. Content loaded in 180 seconds and weighs 12MB It's also downloading mp4 files in the background. .... 4 minutes passed and it is still working on the banner-video.mp4 Also, it has problems with scrolling (freezing). I use a MacBook Air 11'' from 2012.

I get DOMContentLoaded in ~1.41 seconds on from here, but the background video downloading is worrisome.

Grandparent, currently your website has slurped 31.3 MB (and counting!) over the wire for a simple landing page. What gives man? Seems that everything which should be setup on your page already, is.

Re: Learn C and build your own Lisp

#137
post #17

Please don't. Rather pick something like "Compiler Construction" from Niklaus Wirth and learn how to write compilers using memory safe system programming languages. http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf

I wrote this book over several months. It took a few days to get the courage to share it online. It probably took you about 20 seconds to not read my book, dismiss it, and post a comment telling other to do the same. If you think an alternative is better that's fine, but how about you take an extra 20 seconds to think about the situation next time you are going post a comment.

OP, I hear you on this one and commend you for sticking it to the trolls. For what it's worth, I LOVE the book and think you rock for making it.

Re: Learn C and build your own Lisp

#138
post #68

Earlier quoted context omitted.

In examples, magic numbers are OK. It's in large production systems (that will require tuning, which becomes impossible with "magic numbers") that they're a code smell. I'd much rather, in a small example, see: new int[2048]; than #define TWENTYFORTYEIGHT 2048 new int[TWENTYFORTYEIGHT]; Also, it's generally OK to use a "magic number" if you know that the constant will only be used in that one place, or that there is…

In my experience, aliasing numbers to words has never improved any code in any way whatsoever, and sometimes causes more headaches since numbers are easy and natural to reason about numerically (big surprise...), while values such as TWENTYFORTYEIGHT impose more mental overhead and open you up to typos. It strikes me as a symptom of the "magic numbers are evil witchcraft" religion gone to the extreme. The whole point…

Yeah, we were always taught that zero, one, empty string and other "edge case" values were O.K. to have in code directly. I'm inclined to agree.

Re: Learn C and build your own Lisp

#139

Anyone know why clang on mac os x doesn't know about edit/history.h? The line editing portion of the book requires it.

You can try to install with MacPorts Readline with terminal command: sudo portu install readline

And after that you include with #include #include

Re: Learn C and build your own Lisp

#140
post #70

Earlier quoted context omitted.

Here's a different book you might be interested in ("Practical Foundations for Programming Languages": http://www.cs.cmu.edu/~rwh/plbook/book.pdf It gets pretty math-heavy at times, at least in the beginning (you can probably skip the first chapter if it's too rough), but ultimately the book is about programming language design and different ways of designing and evaluating typed (or un(i)typed) languages. It also lo…

I've been wanting to read that for a while. Another candidate is Pierce's "Types and Programming Languages". Has anybody by any chance read both an can compare them?

Pierce will get you working in Coq ASAP, but Harper will provide you with a much richer context.
Post reply on HN