Arc Forumnew | comments | leaders | submitlogin
1 point by zck 5142 days ago | link | parent

>- Notice that the pattern

  (if a b nil)
>is the same as

  (and a b)
For this, I prefer

  (when a b)


>This makes `(single stack)` read nicely, but we already know stack is a linked list, so we could also just say

  (~cdr stack) ; == (no:cdr stack) == (no (cdr stack))
I wouldn't want to go to this optimization until finding out that it would significantly increase performance, but that argument hinges on thinking it's slightly less readable than `(single stack)`.


3 points by shader 5142 days ago | link

Note that you don't need the nil at the end of the if, so

  (if a b)
also works.

-----

1 point by dpkendal 5142 days ago | link

Either of these are neater than using `and`, which for clarity is better only used as a predicate, in my opinion.

Thanks fallintothis, zck, and shader for your improvements. I'm trying to take everyone's suggestions into account to make a new version, which I'll put in Anarki when I'm satisfied with it.

-----