Live data from Hacker News

Learn a Programming Language Faster by Copying Unix

rodrigoalvesvieira.com

31–40 of 110 posts

Re: Learn a Programming Language Faster by Copying Unix

#31
Your ruby version of cat implements none of the command line switches.

I learned C by going through the FreeBSD code and helping with POSIX compliance. For fun I would implement a lot of the commands in Python. You get the most out of learning both the language and UNIX by implementing all the command line options.

Re: Learn a Programming Language Faster by Copying Unix

#32
post #17

For a purely functional language like Haskell, this would not be a very good advice. Any kind of I/O would involve monads and other imperative constructs. Better implement an algorithm involving trees or graphs to better appreciate a functional language.

Well you could always follow the Unix system programming in OCaml tutorial:

http://ocamlunix.forge.ocamlcore.org/

Re: Learn a Programming Language Faster by Copying Unix

#34
post #31

Your ruby version of cat implements none of the command line switches. I learned C by going through the FreeBSD code and helping with POSIX compliance. For fun I would implement a lot of the commands in Python. You get the most out of learning both the language and UNIX by implementing all the command line options.

"Your ruby version of cat implements none of the command line switches." I don't think he was trying to show off what a feature complete cat command he wrote. Just trying to illustrate his idea. No need to be rude about it.

Re: Learn a Programming Language Faster by Copying Unix

#35
post #31

Your ruby version of cat implements none of the command line switches. I learned C by going through the FreeBSD code and helping with POSIX compliance. For fun I would implement a lot of the commands in Python. You get the most out of learning both the language and UNIX by implementing all the command line options.

And you get a better grounding in the Unix philosophy if you omit the command line switches and make small utilities to handle those cases, because as the paper said, cat -v is harmful (http://harmful.cat-v.org/cat-v/unix_prog_design.pdf).

Re: Learn a Programming Language Faster by Copying Unix

#36
post #31

Your ruby version of cat implements none of the command line switches. I learned C by going through the FreeBSD code and helping with POSIX compliance. For fun I would implement a lot of the commands in Python. You get the most out of learning both the language and UNIX by implementing all the command line options.

But his version is a lot closer to the UNIX philosophy than GNU's version...

Re: Learn a Programming Language Faster by Copying Unix

#40

Heh. I've been doing something similar. In my free time, I've been actually re-implementing the `tree` command (with most of the switches as well) in Python. I'll also be writing some other utilities! :)

Nice, man!

Share the code with me if you feel like it. My GitHub is https://github.com/rodrigoalvesvieira and my email is rodrigovieira1994 [at] gmail [dot] com

Post reply on HN