Friday, April 1, 2016

Boy do I love working with Lisp

And in the strangest turn of events, working with Lisp and Java together has turned out to be...

A Lot of Fun

Who knew?  Actually... Guy Steele does.  He probably keeps hoping a lot of somebodies keep finding ways to put his chocolate (Lisp) with his peanut butter (Java) and make something awesome.

If I can keep chugging away on this Lisp implementation, which is starting to take shape and look interesting, I might have something to share when it's my turn to present:

What I Did This Summer...

Well... let me tell you, my summer was awesome.  But this one thing with Lisp & Java was really cool.  It all started with a thought experiment.  I was wondering, "What would happen if I wrote this piece of my calculator program so I could make it look and work like Lisp."

Wow. I sound like a nerd. :-)

Thursday, March 24, 2016

Reader Update and Other Stuff

I reworked the reader code in my Lisp.  It's complete in that it's handling all the required cases for a commercial Lisp now.  I'm putting in the details for each case and building the test cases to ensure each type of Lisp symbol is parsed right.

Getting into the heart of the language is fun.  Understanding how it all fits together and why certain decisions were made and how things work is worth the frustration of learning.  Now that the reader is getting solidified, it'll give me a sense of how to modify eval, get the last core routines written in Java, and start thinking about the core Lisp code written in Lisp.

After that?  I've been looking at m-expressions, or the idea of m-expressions.  I think there's some kind of...something... that can live in between something and something else and make it easier to code Lisp in a way that expands the language.

One other thing I've been squeezing my brain over is R&D on an idea to build interfaces.  I think it's the first stable starting point to being constructing some of the concepts I've been kicking around over the years.  It looks like, as the idea grows, it'll be possible to start carving in the idea I've had for packages and an oop concept I was considering a long time ago while creating interfaces quickly. Some kind of interfaces. I never know how things are going to turn out, but this project is the most stable R&D I've done in a while, so I'm hopeful I won't paint myself into a corner.

Thursday, March 17, 2016

Now with More Pinhead & Less Sleep

I've been revisiting this Lisp implementation that hatched last year.  It's still rough, but it's not so rough.  Moving it into a Java development environment is going to turn out to be a smart move.  Whoever came up with that idea and the brilliant idea to move it all to NetBeans?  They deserve a pat on the back, because code turnaround is significantly faster and the frustration level has vaporized.

I was brain-locked about what to do because I'd tried but failed miserably to move the code to Eclipse.  I know it was user-error, but Eclipse really helped a lot by tripping me up and pinning me down every time I tried to simply move the code in.  It's just a relief to be working at a faster clip and in a stable world.  Android is cool and all, but waiting for code to launch is agonizing.

It took a while to get my head back into the implementation, but now that I'm there, it's starting to feel good.  I've been putting the code in place for normal packages and adding parsing code to the reader.  It's been really fun considering how to put the editor on top of it along with some of the other useful utilities that come with Lisp, like documentation and trace and such.  One of my primary goals is to start working out the details of actually implementing my package idea.  I also have some conceptual ideas for some OOP-related modifications for method dispatch that will have to find their way into the mosh pit so they can either become something or be shelved.

For now, I'm cleaning up some redundancy and building a project plan with the initial goal being to implement the Java code that comprises the core of Lisp.  I'm pretty sure I have about 10 more functions to write to make that a reality.  Once there, it's Lisp and turtles and test-cases (300 so far) and bug fixes all the way down.  If I can add even a rudimentary editor that has tools that enable some quick text gyrations?  Maybe it'll all have some kind of probabilistic chance greater than 0.00000000001 to turn into a usable program for someone other than yours truly.

Wednesday, March 16, 2016

I'm Such a Pinhead (and my own worst critic)

I've been working on a Lisp that's built as a native Java app with a layer on top for Android.  Fine.  It's all fine.  It's all fine and going a bit slow and that's okay.  At least I thought it was.  Until last night, when I realized it wasn't fine and was taking too long and going too slow and I started freaking out so I looked for solutions.

Having been around the block (and around and around and around), I knew I had to step away from building it on Android.  Old computer, old tablet, bad cable, (some any all) was all it takes to slow things down.  It's Lisp, it should be fast.

Problem one, I can't plain old Java on Android Studio.  I can Android Java on Android Studio, but not regular old Java.  At least that's what I believe in my tired, confused, Android Studio brain.  So I decided I had to look elsewhere.

Was considering a saunter back into Emacs, but the thought of getting tempted to do anything in Emacs Lisp had me repulsed like magnetic polarity.  Emacs Lisp and all that politics is what frustrated me into Common Lisp and I've never returned since 1997.

In looking desperately for a solution, I arrived at the awareness that I've given up on Eclipse.  Every time I tried to import, export, build, or do anything that resembled work in it, I never knew where to look to see what happened.  Or it didn't know where to look to find anything.  It was like two old people trying to find a pair of shoes, coat and glasses and neither one knew what day it was.  Not that the day would matter, it's just meant to highlight the disconnect between knowing what you're supposed to be doing and how you ended up here forgetting what you were supposed to be doing but not really caring.

Because Matlock, that's why.

I had NetBeans installed on my computer from a million years ago, but it looked like it was somebody's Junior High School editor project and WITH REALLY BIG FONTS so I never opened it again.  But while Emacs and some editor I was loathe to use was downloading, I fired the Jr. HS project up, moved my Lisp code in and in a couple of hours of minor tweaks, had the Lisp repl up and running.

I was chameleon eyeing Guy Steele's Common Lisp book somewhat simultaneously, trying not to let my heart sink at the recognition of the mountain of work building a real Lisp is while wanting to cry at it and the notion of building it in a JHS editor project, or finding an editor that worked, because I gave up on making Hemlock work on Ubuntu, because Wire hoarks up a hairball and some other error I can't remember but lacked the knowledge and/or patience to dig into kept arriving with every five keystrokes demanding I drop into the repl and type 5 and (ed) each and every time (but now in the fog of my mind I seem to recall it's a configuration problem, but I still can't figure out the wire problem but none of this ever happened on FreeBSD, so I hate Ubuntu, but need it for Android development.)

And while looking at the configurations and my target build and my desire to just create a program that showed either my insane stupidity or possibly not so stupid maybe almost cleverness, I felt like I was surrounded by a pile of Ikea furniture boxes that were all missing parts and screws and had one set of pictorial instructions and text written in Mandarin and I just wanted to build something to show my stupid kid that I was somehow a capable dad and we could have a table, or sofa, or he could have a bunk bed where the bed didn't hang through the hole where the bed was supposed to be supported, but the part had to be here somewhere, let me just check the directions but it wasn't and I couldn't read it and I just wanted to curl up in a ball in the corner and rock myself into a state of mild discomfort while sobbing uncontrollably at the impending downfall of earth at the hands of people who think murder is somehow a solution to any problem at all.

For a bunch of engineers, we really can't build shit that's very good, stable, or easy.  What the fuck is up with that?  I feel like I'm running a gauntlet of demonic proportion that's a constant beat-down in my very precious mind.  And Apple is building military-level encrypted devices in Communist China that law enforcement in the USA can't open and I'm not supposed to be wondering how it is we think we're smart, capable, or even very good and the first amendment and the Constitution AND us aren't seriously under attack?  These systems are a tragic mess that we somehow organize just enough to be able to get our work done and forget how hard and stupid configuration and where it all is is...at... and we are.  What happened to us and that sentence?  I have an excuse because of my high school diploma, but all the education you smart people have... what is it for if not making things easy to use and understand?

Software is a train wreck.  Except for Quicklisp.

Whatever, this is all so stupid I wish I'd followed that cute lady Irene into dentistry and a lifetime of vacations and helping the poor and chasing her on the powder slopes of Utah and Colorado and I can't even see what I'm typing, my retinas are both burning from the radiation and flooded with tears.  How'd it all go so wrong?  Freedom isn't some abstract concept, it's only available here in the USA, and in small doses at that unless we all work together to make it grow to make really big freedom.  If we understood the import, we'd never let anybody or anything separate us free people from our freedoms with name-calling.

Sigh, where was I?  Cars are easy.  Computers are stupid-hard.  But I digress.

Whatever.  Fine.  Whatever!  The point?  The point is, JHS NetBeans worked like a pro.  The editor is almost crisp.  It'd be way more fun if it was Hemlock and I could start hacking Lisp to make it bend to my (very tired) will.  But compared to all the other crap I've had to do to get a Java program built, configured, and whatever else one does with Java, it was almost pleasant.  I was surprised.  I'd say pleasantly, but there's nothing pleasant about crying with burning retinas at the recognition of lost Irene and all that lost time building software that mostly doesn't totally suck because I have to squint to make it look good.

Now that I have a second build, I can start making the cross-platform code and the interfaces, so the Lisp and the UI can ship on anything Java.  Hopefully.  Maybe.  If the configurations and builds and jar files and calls aren't tied to some stupid idea of write once run anywhere that doesn't run everywhere.

The first and very noticeable thing was that the code turnaround is going to be insanely fast compared to Android Studio, which goes into a deep trance during builds, like a Google Guru, and returns with great insight that sounds like, "Gradle Build completed in 3 minutes and 47 seconds".  WTF?  WTF?  WTF?!  Java.  Half-way to Lisp from C++...  The equation is not commutative.  Halfway back to C++?  Might as well be halfway to Hell.  And halfway to Hell is way too far inside the gates of Hell (and a trip back to code generation circa 1995) for anybody who's ever had their code loaded into the repl and tested in the time it takes to type it and press a key on a mechanical keyboard.

Does this rant make my ass look fat?  I can never tell.

Coffee is my only friend.  And Lisp.  And they're all I need.

Now if you'll excuse me, I'm old and very tired and need a nap.

Tuesday, March 15, 2016

Ahh, Lisp

Spending some time today working on my Lisp implementation while reading Common Lisp by Guy Steele in combination with Ansi Common Lisp by Paul Graham.  Been writing a website for a while that is Lisp-based and SQL-backed and it's a nice change to step out of Java and into Lisp, and then back into Java to write Lisp.

I've been putting the Lisp implementation off because all the other stuff (Android) takes so much longer to put together and I keep thinking it's going to be difficult to get back into and find the narrative thread, as it were.  But it's been a pleasant surprise to remember how stable the language is to build, how fast the features come together, and how easy and quick it is to debug.

My short-term goal is to get what's written into my calculator, so it becomes possible to program math functions in Lisp.  Then, I'll start extending the application into something even more fun and interesting.  Sometime soon-after the programmable calculator, I'm going to test my implementation of packages.  It's taken me forever to get to the place where I can start plugging that code in.  It's kind of intricate, but I think it has merit.

Thursday, February 25, 2016

Just Ramblin' On

I've been juggling projects the last few days.  Aside from the two Android products I'm alternating between, there are (currently) two lisp projects.  The first is the Android Lisp I started a while ago and the second is a website I prototyped years ago for real estate that's finally getting some attention.  The website will also be a web-app or Android app and merge with the commercial app I wrote (with the circa 1995 manual-data-entry-UI.)  Maybe.  Hopefully.  Probably.

I'd like to be building iPhone apps, too, but I'm not there yet.  Maybe once I get organized enough to find a volunteer intern willing to work for experience, future possible stock options, and coffee.  One day.  Sooner rather than later would be great.

You know you're using Lisp "old-school" when you spend an hour or so writing some code, then you turn it loose on a computer and it runs forever.  I had a friend in the early 90's who was fond of saying, "Lisp is one of the best ways to abuse a computer."  He'd often describe writing small chunks of Lisp or Scheme code that would take minutes to write and hours or days to process as they brought computers and networks to a grinding halt.  Different times.  My scripts have been running for a while now and they're definitely pushing my tired old laptop into an overheated frenzy.  It's strangely gratifying, though I tend to prefer working on interfaces over large datasets, but haven't really minded either way.  It's all problem-solving.

In an effort to do something that wasn't programming, I started referring stuff on my backup Twitter account.  Mostly books for starters, but I'll probably expand into other areas.  Will be using it as an alternative to a website or blog until I get some of the software I'm working on into more doneness simply because it's quick and meaningful, though concise.  My first recommendation is a bit of nostalgia, mixed with practicality - a book I've owned forever (bought at Borders at the WTC in NYC somewhere around '97) & I still refer to often: ANSI Common Lisp by Paul Graham.  I've always appreciated how concise and approachable the book is.

Now it's back to juggling projects.  I just uploaded an apk for DangAlarm!, my Android alarm clock.  And the data to the database for the website is finally in and now I have to remember how SQL works so I can start putting a couple of web interfaces on top of it using Lisp.  I'm pretty sure things started as one website, but once I have the queries and views built, it'll probably morph into at least two.  Will share more detail soon.

Monday, February 22, 2016

Lisp as a Scripting Language

My first car was an old '59 Ford pickup truck I bought back in high school.  It had been a three-generation truck, owned by a grandfather, father, and then the son.  But it'd been in an accident and they didn't want to repair it.  I bought it for all the money I had; $300.  It wasn't pretty to look at, but that truck was solid.  It ran like a top, had hydraulic assist brakes, granny first gear, and I could fix most anything in a pinch, even on the side of the road.  If I'd been less of a disaster at that age, I'd have done the work to make it look good again.

I'm not sure what it has to do with Lisp.  I think I'm just adding copy to take up space.

I wrote some Lisp code today.  It wasn't much, just a little script to do a little work and generate some Java classes.  I could have used any scripting language, but having a body of work ready to leverage makes Lisp the easy candidate.  That I can return to the code later and understand it just adds to the allure of Lisp.  In the end, it saved me a lot of time to have Lisp write the classes for me.  Especially since the alternative in Android Studio is mind-numbingly slow and manually intensive.

That's all I got.  Maybe more soon.  I might be building a website in Lisp this week.  It'll likely freak me out to spend a whole day in Lisp.  I'll be sure to post something more interesting if/when that actually happens.