This thread's making me uncomfortably aware of how many tricks I - and we as a community - have forgotten about. The HN-style forum interface isn't ideal. Perhaps we need a repository of tips like http://vim.wikia.com/wiki/Vim_Tips_Wiki
I remember seeing tricks for cons counting, profiling (http://arclanguage.org/item?id=11556, another story about forgetting the existence of a key tool), tracing, visualizing macroexpansion.. the list goes on. Lots of stuff in the arc2 branches never made it to arc3. I'm certain there's gems there.
I'm using 'const' as just documentation - it's up to the programmer to not change the variable.
I don't want to use init (http://arclanguage.org/item?id=11103) because I do want the value to be updated when I reload the file. init is for global state in data structures which shouldn't be reset when I reload the file, and const is for global parameters that influence the behavior of my app. Those I often do want to update on reload.
-
Another recent macro encapsulates a common pattern for initialization code:
A workhorse of readwarp: pick a random feed from a set and check if it satisfies certain properties (e.g. has an unread item, is recent, is well-cleaned, etc., etc.)
(Okay, that last one was excessive, but I thought it was funny. I'm just glad anyone likes things I write. :P)
P.S.: Gah! I hadn't realized rand-elt would break on empty sequences before. Good catch. Should probably use (unless (empty ...) ...), in case you want a random string character.
Yeah, I've noticed that a lot of arc ideas have been posted as code in comments, instead of linked to on a source control site. This makes it so that the code is more likely to get lost, and harder to use in the first place.
To be honest, this is what I think people should be using the 'lib section of Anarki for; posting code that they think is useful. That way it's available for anyone that wants it. If you post code on the forum, post it somewhere else so that people can find it again.
Maybe people don't like using Anarki for that purpose, either because they're worried about dirtying the codebase, or because they just don't like using git. In that case, maybe we should make a server for arc hacks? Like an HN style arc-app that allows submission of code and comments, but with a search engine and an API for pulling code remotely. Thoughts? Maybe this should me moved to another thread.
> maybe we should make a server for arc hacks? Like an HN style arc-app that allows submission of code and comments, but with a search engine and an API for pulling code remotely. Thoughts? Maybe this should me moved to another thread.