Live data from Hacker News

Learn C and build your own Lisp (2014)

buildyourownlisp.com

51–60 of 90 posts

Re: Learn C and build your own Lisp (2014)

#51

This book is on "Stuff that should be avoided" list[0]. [0] http://iso-9899.info/wiki/Main_Page#Stuff_that_should_be_avo...

I'm currently re-learning C, and I've been going through one of the books that they recommend (C Programming - A Modern Approach).

Whilst "A Modern Approach" is a great book, it's hard for me to keep focused as I'm not really implementing anything other than the exercises and projects (for which there are too many IMO, and I struggle to get them all done).

I've been working through Build Your Own Lisp in parallel, and it's great fun. I get to work on an actual project, and any holes I find in my knowledge can usually be filled in via A Modern Approach.

Re: Learn C and build your own Lisp (2014)

#52
post #11

I've had this in my bookmarks for awhile, intending to work through it. I think I can probably even do it solo without the guide, at this point. After years of programming, and learning (or at least playing with) many languages, I've come to a philosophical conclusion of sorts: C and Lisp should be the two languages all students start with, in my opinion. Probably SICP style Scheme education, and classic simple C89.…

I learned Objective-C this year and I love it.

It is a fantastic language to use because the tradeoff is obviously evident in the language.

You can use Smalltalk for a day. Understand the history. Understand the compromise.

And Objective-C captures a beautiful moment in the trajectory to ever more high level abstraction.

Re: Learn C and build your own Lisp (2014)

#54
post #7
post #2

I like this tutorial, but it's worth noting that you're building your own lisp with the author's bespoke parser generator.

It seems the author has added an appendix [0] where he replaces the library parser with a hand-rolled one. 0. http://buildyourownlisp.com/appendix_a_hand_rolled_parser

the author should not have written this. why would anyone ever hand-roll a parser? it's neither useful nor interesting

Re: Learn C and build your own Lisp (2014)

#55
post #11

I've had this in my bookmarks for awhile, intending to work through it. I think I can probably even do it solo without the guide, at this point. After years of programming, and learning (or at least playing with) many languages, I've come to a philosophical conclusion of sorts: C and Lisp should be the two languages all students start with, in my opinion. Probably SICP style Scheme education, and classic simple C89.…

Terrible suggestion. We need to kill all these c'isms as fast as possible. Teach people to write nice data-structures, with good api's, and with generic and sensible types. All these C'isms like returning -1 for false and 'nil' children seriously sucks. For a systems class it might still be suitable, but you could design good courses around other languages like ada, zig, rust w/e.

If you want to teach them a lisp as a first language, at least use Racket, which actually have modules designed for education. I think it's less of a headache to use a language with a more modern syntax, like python or pyret, but Racket is excellent of course. You can introduce lisp later in a undergraduate compiler/interpreter class so you don't have to talk about parsing for a month.

Re: Learn C and build your own Lisp (2014)

#56
post #11

I've had this in my bookmarks for awhile, intending to work through it. I think I can probably even do it solo without the guide, at this point. After years of programming, and learning (or at least playing with) many languages, I've come to a philosophical conclusion of sorts: C and Lisp should be the two languages all students start with, in my opinion. Probably SICP style Scheme education, and classic simple C89.…

I learned Objective-C this year and I love it. It is a fantastic language to use because the tradeoff is obviously evident in the language. You can use Smalltalk for a day. Understand the history. Understand the compromise. And Objective-C captures a beautiful moment in the trajectory to ever more high level abstraction.

Kind of, they went a bit overboard with @

Re: Learn C and build your own Lisp (2014)

#57
post #56

Earlier quoted context omitted.

I learned Objective-C this year and I love it. It is a fantastic language to use because the tradeoff is obviously evident in the language. You can use Smalltalk for a day. Understand the history. Understand the compromise. And Objective-C captures a beautiful moment in the trajectory to ever more high level abstraction.

Kind of, they went a bit overboard with @

I think most of the crazy @ features are in Apple's branch. There's still the GNU version floating around working with OpenStep that is much closer to the original Objective-C vision.

Re: Learn C and build your own Lisp (2014)

#58
post #11

I've had this in my bookmarks for awhile, intending to work through it. I think I can probably even do it solo without the guide, at this point. After years of programming, and learning (or at least playing with) many languages, I've come to a philosophical conclusion of sorts: C and Lisp should be the two languages all students start with, in my opinion. Probably SICP style Scheme education, and classic simple C89.…

Terrible suggestion. We need to kill all these c'isms as fast as possible. Teach people to write nice data-structures, with good api's, and with generic and sensible types. All these C'isms like returning -1 for false and 'nil' children seriously sucks. For a systems class it might still be suitable, but you could design good courses around other languages like ada, zig, rust w/e. If you want to teach them a lisp as…

I'm fairly conflicted about this. While I believe that learning C teaches bad habits - manual memory management tends to account for some absurd percentage (70-80%) of CVEs in modern programs - it's also unquestionably tethered to the history of software, and a majority of the immense foundation of tooling on a Linux system is authored in C.

There is a terrific benefit to learning on a platform where you can not only look up documentation within the system (man pages), but also "dig deep" into the code of any particular piece of the system you are interested in. So in learning C, you gain access to the body of knowledge contained in a Linux system, or contained in a BSD, and when you get curious about something like "These loops and conditionals are all fine and well, but how does a window actually get drawn to my screen?" you have everything at your fingertips to go and answer it.

Is that connection to the machine possible without learning C? You could use a toy operating system written in something else, but you miss out on the honesty that comes from teaching the same system that people are actually using (or at least able to use).

I think Go might not be an unreasonable alternative. It shares C's philosophical heritage, removes the need for manual memory management, and is capable of exposing a student to pointers, creating images, and HTTP communication all within the stdlib and the first chapter of the official book. The only downside, as I see it, is that one would need to additionally learn something like Rust to be able to apply the concepts to things like kernel drivers and close-to-the-metal programming.

Re: Learn C and build your own Lisp (2014)

#59
I’m a python programmer and my dream would be to learn C and an extension language like Guile or Ecl. Then I could write the performant bits in C and extend it with Lisp. I’m actually pretty proficient in Racket so I’m doing pretty well on the lisp side, but I’ve found the books for learning C lacking. I absolutely had “C a modern approach” and “Modern C”

Re: Learn C and build your own Lisp (2014)

#60
post #11

I've had this in my bookmarks for awhile, intending to work through it. I think I can probably even do it solo without the guide, at this point. After years of programming, and learning (or at least playing with) many languages, I've come to a philosophical conclusion of sorts: C and Lisp should be the two languages all students start with, in my opinion. Probably SICP style Scheme education, and classic simple C89.…

Terrible suggestion. We need to kill all these c'isms as fast as possible. Teach people to write nice data-structures, with good api's, and with generic and sensible types. All these C'isms like returning -1 for false and 'nil' children seriously sucks. For a systems class it might still be suitable, but you could design good courses around other languages like ada, zig, rust w/e. If you want to teach them a lisp as…

Why would you need to talk about parsing for a month with Lisp?

Lisp famously has one of the simplest syntaxes possible that is still structured, and one of the simplest data structures to understand. There's almost nothing to it.

And why would you introduce Lisp in a compiler/interpreter course, to people who are presumably already quite advanced in their knowledge?

Lisp is best as a teaching aid to introduce common high-level language concepts, in a way where it's clear how they all actually work in a familiar syntax- because it's Lisp nearly all the way down. (No black boxes.)

Most other languages suffer from a "trust me" problem, where students are taught what complicated things do but have to take it as gospel because they can't read the implementation, so they end up with high level concepts but no idea what's really going on to make those work, and a vague belief that "underneath" is more complicated and mysterious than it has to be. (Black boxes abound.) Indeed some students struggle to understand high-level concepts until they can see the mechanism.

Post reply on HN