Monday, February 8, 2016

This Old Android Colors App

I wrote an app last year.  It was written in Common Lisp.  It generated colors and selectors for an Android app.  It had an interface.  It kept colors related by degree.  It worked.  I put it away.  I forgot about it.

I can't imagine how Hemingway wrote in such short sentences.  It makes me nuts to feel all constrained by a single thought and not be able to use a conjunction to extend a thought to something maybe meaningful like...

I forgot what I was saying.  Then again, Hemingway wrote amazing books which have withstood the tests of time and I write marginal software and blog posts (also likely marginal.)

The point, the point... what is the point?  I wrote a color app for Android last year.  I wanted to make buttons with stroke and fill colors and lots of them.  But being a total color spaz, I wanted them to look like they had some kind of relation other than "lots of them".  Because we all know from emacs, hmm, editors in general, that lots of colors ends up looking not brown, like in art and oil painting or pastels, but like three vibrantly colored meals suddenly evacuated from... well, you get the point.

So I wrote an app in Lisp to see if I could write an app in Lisp that might help me work with colors while making said colors look visually appealing.  It worked.  Pretty much.  I used well-defined color relationships to create the color relationships.  I think I should have to find a way to put it on the web.  Because I think other people might want to generate the same thing I did, only for their own super-cool apps.  Not that it's the only app like it or that my apps are any great shakes (yet.)  But it's good to have choice and maybe it could be something somebody might want to use.  Maybe.  I never know what anybody wants anymore.

The app allowed for a variable number of controls, a stroke color and a fill color.  Each could be defined by color relations and then the degree/intensity could be modified:

  • analogous
  • triadic
  • split-complement
  • complementary
  • lightness

There might have been some other color relationship thing in there, like monochromatic.  It was a decent prototype, so I think as soon as I finish this calculator, I'll add it to the short list of projects to get done, because web projects in Lisp aren't difficult.  At least I don't remember them being difficult.

Not that I'm writing a teaser or anything.  I find if I don't write a note about it for public consumption, I forget about it.  Like I did last year whenever it was I wrote this app and forgot to write a blog post about it.


The fact that the app generated something like 200 color specifiers (I'd said 1500 earlier because that was the last index on the generated colors, but went back after thinking about it and calculating how many unique colors it would have created) and scads of other detail is what has me thinking it might be useful.  I think that's why I built it in the first place; I wanted colors, but I didn't have ten years to generate all the xml by hand, and if I was going to do all the xml by hand, because I wanted colors, I knew I was going to end up with black, white, and charcoal grey and a lot of impatience at that.  And my inner artist wanted something less Seattle winter and more Seattle spring.  I'm from Seattle.  If you've been, you know why coffee is big, winters are depressing, and spring is like waking from darkness into lots of fresh berries everywhere and colors that leave you blinking as you wonder where all the amazing colors came from.  Spring is an amazing season, but spring in Seattle is pretty nice, though it's been twenty years since I've visited.

I wax poetic sometimes.  But I can't write like anybody else.  Except I used to channel my inner Hunter S. Thompson a long time ago.  But that's a story for another time.

Friday, February 5, 2016

I Started with Nothing, and I Still Have a Whole Lot of It, But Look at All the Words!

I never know what I'm going to write here until I start writing.  I'm close to finishing an Android project.  Once that's done, it's back to some kind of Lisp.

I just put out a teaser on my Products blog about an upcoming product I'm going to be working on.  I'm currently a day or so away from releasing an upgrade to a calculator I wrote for Android.  I'm thinking that after that, I'm going to work on another calculator, but something that might have a programmable feel to it.  Something that makes use of this Common Lisp engine I spontaneously erupted into last year.

I still don't know what came over me, but in something like 3-5 weeks, I had a working Common Lisp repl going that did a surprising amount of stuff.  I think I need ten or fifteen more core functions in Java, then I can jump into writing Lisp code on top of it, though I have a bunch of Lisp functions already defined.  Then I can try this experimental package system I've got running around in my head and wow, look at me, I'm all running off at the mouth like an excitable teenager.

The thing I remember about working on that Lisp, was that it wasn't like Android, or really anything else.  Where Android requires groveling over docs, trial and error, figuring, head-scratching, and laps over certain areas of the program, the Lisp engine went like this:  Oh no, a bug!  Where is it?  It's right there.  What is it doing?  It needs a cons or an atom or both.  That's it?  Let me fix it.  Fixed!  Let me test it.  It works!

I'm kind of doing it tongue-in-cheek, but it really was a lot like - logic.  Strange that would be missing in other engineering languages (I'm kidding, a little.)  At first I remember freaking out when there was a bug in read or eval.  Then, I fixed them and they... were fixed... and never came back.  Then a function would break and I'd get stressed but then I noticed the fixes started looking logical and stable and, once fixed, they never broke again and there was test code that built up along with the system and everything ran and if it didn't, nothing broke and it was easy to fix.  I think mapcar tripped me up for a little while, but it was like a couple of hours.

It was weird because I could feel the system growing and at the same time gaining in stability over time.  Unlike the Java syndrome, where things suddenly explode and you're left slogging through a stack trace that's 99% spew and one hyperlink to a null variable, the Lisp code just worked or it returned null and it's not supposed to and it's a small function and not much of a fix.

It was like Programming Nirvana.

It was like a dream last summer that just kind of happened out of a little experiment inside of another program I was working where I wondered how it would look like if I built a data structure that looked like maybe how Lisp would do it, and then I eyeballed Peter Norvig's Python code squinty-eyed like until I went, "Oh, that's what it's doing!" and that showed how a reader worked, and then I thoroughly abused the Java type system, and it was all so fun, even if it was only interpreted for starters.  I think it was the most fun I'd had programming almost anything because it was totally fast and fun and I'm pretty sure my smile grew with each new thing that was added and that doesn't happen often, except in Lisp because I could try it two or three or ten different ways until I got it right and it was satisfying.  Not slogging.

There's some tools that need to get put into it, error handling, and some core functionality that needs to be expanded on, and the package system either has to be the Lisp package system, which is mostly there, or the one I've been wanting to plug in and try out with some sort of Frankeninterface on top of it that might be cool... or just weird.  But it's R&D and it's fun to try things out and play like it's clay except with bits and ideas and how does it work like this, or that, or this other way... not getting all worn out just doing it one way then being too tired and knowing there's nowhere near enough time to even try to do it another way.

Even if it is interpreted, it's Lisp and it's fun and maybe if it can be exposed even a little bit inside of a programmable calculator on Android for starters, it might be fun for others, too.  Maybe?