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.