3 ms·
I find it interesting that two of my favorite programming languages are complete polar opposites: C and Clojure. On the one hand I love the high-level abstract
by SeoxyS 14y ago
I find it interesting that two of my favorite programming languages are complete polar opposites: C and Clojure.
On the one hand I love the high-level abstraction of Clojure. I love its homoiconicity. I love functional programming, being able to map, reduce, apply, etc.
On the other hand is C, where I can handle the raw power of the computer. Where I know exactly what I'm doing. Where I can play with single bits and dribble pointers around. Where there is no magic GC or dynamic type systems to fuck me over at just the wrong time.
I'm constantly trying to reconcile those two worlds; making my C code as functional as possible (libdispatch and blocks are a great addition to the language).
- Retric 14y agoIf you like C, I would suggest you spend some time with assembly. With C your stuck with both the compilers oddity's and the processors oddity's where with ASM you can really dig in and discover a host of occasionally useful but often strange behaviors.
- SwellJoe 14y agoThis sounds like superstition, borne of lack of experience with C. I'm not saying assembly isn't interesting, or worth learning (to some degree). I spent quite a bit of my youth poking at 6510 and 68000 assembly (C64 and Amiga, respectively). But, I don't think it was more enlightening than my first few weeks with K&R, which were eye-opening on a whole other level. It's just misses the point to say C has oddities or whatever; maybe just say that learning a little assembly can be fun and useful, and leave it at that.
- Retric 14y agoIt's not that hard to find cases in C where x=a+b; y=c+d; is slower than x=a+b; y=c+d;. What that happens has very little to do with C you really do need to dig down a level to understand what's going on. That said, the C compiler was optimized for a range of diffrent CPU's all with their own preferences so it will swap some instructions around to help you along, but it's not prefect which is IMO some of the oddities's associated with C. 68000 assembly is vary different from x86-64. x86-64 has a huge instruction set with a lot of legacy crap, multiple execution units even on a single core chip, does out of order instructions etc. Just poke around http://sandpile.org/ http://sandpile.org/ for a few minutes and you will probably learn something new. Then read up on L1 cache which is a vary strange beast that's fast etc.
- tim-locke 14y agoHave you ever tried Forth or Factor?