Wed 05 Jul 2006

I still hate stir-fry.

I've hated stir-fry for as long as I can remember. In fact, I think the only stir-fry I ever enjoyed was Elaina's, and I don't think it was very much like a stir-fry. (Also, she has a mystical ability to make anything taste pretty good.)

Why, then, did I just cook a stir-fry?

Tenderloin, thinly-sliced, failing to be as nice as if I'd just slapped it in a pan. Shitty, shitty Thai ginger and coconut rice; too sweet, too thick, and too much, overpowering the delicate flavour of the beef.

Speaking of which, I have stir-fried beef left over.

This meal, contrary to the propaganda of the stir-fry movement, was neither quick nor easy, and I'm surprisingly both hungry and uncomfortably full. I would have been far happier with a tin of black bean soup, or, indeed, some toast.

Never again.

Posted at 2006-07-05 19:16:20 by RichardLink to I still hate stir-…

strcat in GSL

GSL, the grammar language, has a string concatenation function. You do string concatenation a lot when you're producing grammar return values. Unfortunately, strcat is a binary function. Any multi-variable combination, then, has a lot of strcats.

Being your average programmer, I decided to give myself a fun little programming exercise, rather than doing 30 seconds of copy-and-paste.
(defun make-gsl-strcat (&rest vars)
"Produce a GSL strcat expression to join VARS together."
(labels ((join-pair (x y)
(concatenate 'string "strcat(" x " " y ")"))
(twoify (function list)
(if (second list)
(nconc
(list
(funcall function (first list) (second list)))
(twoify function (cddr list)))
;; Handles the one-item and nil cases quite happily!
list)))
(loop while (second vars) do
(setf vars (twoify #'join-pair vars)))
(car vars)))

This does a tree-combination, basically. Pass in variables ($a) or escaped string literals ("\"hello\"") and let this little recursive function do the work. Then you can copy-and-paste the output into your grammar!

Example:
* (make-gsl-strcat "$a" "\":\"" "$b" "$c" "d")

"strcat(strcat(strcat($a \":\") strcat($b $c)) d)"
*

Wow, the post with an audience of 1.

Posted at 2006-07-05 17:22:15 by RichardLink to strcat in GSL