Live data from Hacker News

Learn C and build your own Lisp

buildyourownlisp.com

141–150 of 150 posts

Re: Learn C and build your own Lisp

#141
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.

I had the time to read a good portion of this book. Really well written. I hope some of the negative comments don't discourage you from sharing your work next time around. I learnt something useful this time.

Re: Learn C and build your own Lisp

#142
post #70

Earlier quoted context omitted.

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.

TAPL isn't Coq-focused. Pierce and his collaborators have another book available online, Software Foundations, which is written as a Coq literate program: http://www.cis.upenn.edu/~bcpierce/sf/index.html

Re: Learn C and build your own Lisp

#144

Sounds like this may subvert Greenspun's Tenth Rule: "Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp." http://en.wikipedia.org/wiki/Greenspun's_tenth_rule

Actually the project depends on the library which claims to implement the named rule:

https://github.com/orangeduck/mpc

Re: Learn C and build your own Lisp

#145
post #71

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…

Tell me what the number represents rather than what the value of the number is. How about this? #define BUFFER_LENGTH 2048 new int[BUFFER_LENGTH];

And Standard C already defines a constant you can use: BUFSIZ.

Re: Learn C and build your own Lisp

#146

Earlier quoted context omitted.

The person you're responding to has a history of hating on C around here. I wouldn't take what he wrote personally (easier said than done, I know). That said, I offer the following: Almost any language can be (ab)used in an "unsafe" manner. Conversely, it is entirely possible to create elegant, efficient, and safe code using C, and there is no particular reason to not use C for this project. In fact, C is marvelous i…

> In fact, C is marvelous in its simplicity and is an excellent candidate for it. While I don't disagree with your comment, I'd like to point out that the Oberon language (used in pjmlp's suggested book) is even simpler than C. It's worth checking out if you value simplicity in your programming languages. http://www.inf.ethz.ch/personal/wirth/Oberon/Oberon07.Report...

@OrangeDuck - Just wanted to thank you. Your style is clear and ideas progress easily from the first chapter onward.

The links offered in this thread are wonderful, The University links are impressive. HN is a tuition free education.

Re: Learn C and build your own Lisp

#147
Thanks for writing this. I find your writing style to be very easy to follow. I've wanted to play with a toy language for some time, so I'm very excited to dive into your book with both feet. I'm working on Windows and am up to chapter 6. Very enjoyable. The only suggestions I would offer is perhaps to mention that AST stands for Abstract Syntax Tree. It seems this book is targeted to less experienced programmers, so it may be helpful to mention what AST means in this context. Thank you for your hard work and willingness to share your knowledge.

Re: Learn C and build your own Lisp

#148

Thanks for writing this. I find your writing style to be very easy to follow. I've wanted to play with a toy language for some time, so I'm very excited to dive into your book with both feet. I'm working on Windows and am up to chapter 6. Very enjoyable. The only suggestions I would offer is perhaps to mention that AST stands for Abstract Syntax Tree. It seems this book is targeted to less experienced programmers, so…

Well, just made it to the next chapter where you talk about AST. :-)

Re: Learn C and build your own Lisp

#149
post #61

I am new to programming. What is it so special about Lisp that I keep hearing about it in Hacker's News (often in Machine Learning and from old programmers)?

Homoiconicity is a neat thing when you just get started, although there's some interesting discussion around that subject here - http://calculist.org/blog/2012/04/17/homoiconicity-isnt-the-...

Thanks for sharing. Interesting discussion.

I think the author confuses the concept (homoiconicity) and it's practical consequences. I think this quote from the comments below summarizes it:

    > But the fact of the matter is that programmers interact with text, not with data structures.
    
    Not Lisp programmers. It's trivial to implement an environment where code will be represented graphically and won't be ever represented as text.
    
    That's, actually, the point: language semantics isn't tied to textual representation.

Re: Learn C and build your own Lisp

#150
post #37
post #9

Earlier quoted context omitted.

I also did a scan of the book; it seems pretty good! However, if you're serious about learning C then I strongly recommend getting the K&R book [0]. It's short and quickly gets down to business --- the first chapter alone gives you a condensed but working overview of the language as a whole. Even experienced C programmers seem to keep the book around as it's good as a reference as well. I strongly recommend people to…

Or King's C Programming: A Modern Approach , which lacks the conciseness (and affordability) of K&R but is probably the best single text out there, and unlike K&R is updated through C99.

Kim King wrote my Modula-2 textbook. If this is as good as that, it's probably something worth picking up.
Post reply on HN