Saturday, December 12, 2009

LISP's non-C-style syntax has something for everyone! For LISP users, they don't have to use C-style syntax. For non-LISP users, they can pretend that the reason they don't use LISP is something silly like the syntax, instead of admitting that they're too committed to their existing thought model of programming.

If you don't want to use LISP, that's totally fine with me. There is a beautiful diversity of programming languages out there (and even if you want to use C/C++/Java, that's still perfectly wonderful, keep at it you brilliant prince). Claiming that the language is deficient because of its syntax means you're missing something, unless you have a proposal for an alternate syntax that is still homoiconic. Let me know!

Sunday, November 15, 2009

(destructuring-bind (a b (c d)) '(1 (2 3) (4 (5 6)))
"Should be 1 (2 3) 4 (5 6)"
(list a b c d))

Thursday, November 12, 2009

The Property List Editor (plist editor for Mac) is at
/Developer/Applications/Utilities/Property List Editor.app
You get it when you install Xcode.

Monday, November 9, 2009

Mac environment variables are set by adding them to
  ~/.MacOSX/environment.plist.

Don't add an entry for $PATH there, though. I'm still reeling from that.

Sunday, November 8, 2009

To convert to/from hexidecimal in emacs, it's advised to use M-x calculator instead of M-x calc. The single-quote key (M-x calculator-rotate-displayer) will eventually get you to the point that you're outputting with the correct formatter (instead of scientific notation). Then:
  • H to switch to hex i/o
  • C-y to yank a hex number in
  • D to switch to decimal
  • M-x calculator-copy to copy the number
  • backspace to clear the number from calculator
Then it's just on the killring and you can C-x o over and yank it.
Reverse the lines in a pipe with
( cat -n | sort -nr | cut -f 2- )

I hear there's something called 'tac' to do this, but I don't have it on my Mac (and can't find it in ports).

Friday, November 6, 2009

The gcc argument to print out all the preprocessor macros and their
definitions is -E -dD. (The -E is 'preprocess only and output to
stdout', the -dD is 'dump definitions'.) Make sure that
-fmessage-length is not set to 0 and probably you don't want -quiet
either if you're doing this inside Xcode.