Hacker Newsnew | past | comments | ask | show | jobs | submit | rspivak's commentslogin

Basically, instead of asking 'why?', this flips it to 'why not?'. Good point.


Agree, C's legacy is enormous.


thanks, that's a great way to put it!


I'm curious about the community's thoughts on whether learning C is still valuable in today's world. Here are some of my personal points in favor of learning C:

1. there's a lot of literature on the fundamentals that use C/C++ in examples, and the Linux kernel is still primarily written in C

2. as Dennis Ritchie said, "C is quirky, flawed, and an enormous success." I believe that's the Lindy effect at work

3. learning C can open up a deeper understanding of how things work


Interesting, never heard it expressed like that. Thanks for the comment. And simplicity is definitely key.


Absolutely agree, soft skills are crucial. I didn't mean to imply they're less important by listing them last, but I see your point.


Thank you for the implementations! Do you have any suggestions how to test the postscript code on mac/linux? I tried on macos using ghostscript, but I get the following error:

$ gs cat.ps helloworld.txt

Error: /undefined in ARGUMENTS ...

Thanks!


To give command-line arguments to a PostScript program in Ghostscript, you must prefix the name of the PostScript file with two minus signs, such as:

  gs -dNODISPLAY -q -- cat.ps helloworld.txt
(The -dNODISPLAY and -q are not needed to get this PostScript program to work, but -dNODISPLAY disables graphical output, and -q avoids Ghostscript's messages getting mixed in with the PostScript program's output. You might also need -dNOSAFER; if you get a invalidaccess error, try that. As far as I know, ARGUMENTS and -- are a feature specific to Ghostscript.)


Now also in Scheme (GNU Guile)


Feel free to add your own implementation. :)


FWIW, iter() handles the logic of testing for an explicit EOF marker, so another way to write it is:

    import sys

    with open(sys.argv[1]) as fin:
        for c in iter((lambda: fin.read(1)), ""):
            sys.stdout.write(c)


That's a good point. Thanks!


It took me a while to finally publish this part. :) If you've waited for a long time for this to happen, thanks for your patience.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: