Nice talk :
An interesting argument that logic programming is overrated
The reason why logic programming is so rarely useful is that, essentially, core.logic is just a complex DSL for doing exhaustive search. Clojure already has an elegant, compact DSL for doing exhaustive search — it is called the for comprehension.
Bit early. But I answered a question on Quora about languages to learn for 2018.
Here’s what’s interesting me for 2018 :
I want to continue getting more experienced and better with Clojure. No language is perfect, but for me Clojure is the best language I’ve ever used. And I want to use it for more projects and in more different situations. I want Clojure to be my default / “workhorse” language for server-side, browser-based UI, Android apps. etc. Clojure is not just a great language but a practical language. And I’m expecting there to be more jobs / contracts available with it, going forward.
I’m intrigued by Rust. I haven’t even installed it yet. But I want to try it as a low-level C alternative. I have an idea it might be suitable for.
I admit that Richard Kenneth Eng and Peter Fisk are getting to me. I’d quite like to go back and have another look at / play with Smalltalk. I loved Smalltalk when I used it a bit in the late 80s / early 90s. But I now understand much more about programming than I did then. I want to compare it to what I now know about Lisp. Does Smalltalks’s simple consistent syntax / semantics actually offer the same kind of elegance, expressivity and power that I now see in Lisp? Plus, how are the modern Smalltalk environments / frameworks for useful application development?
I’m a big Python fan. I’ve written a lot of it over the last 15 years or so. However, everything is Python 2.7. I think it’s time to bite the bullet and get to terms with (and translate my outstanding code into) Python 3. Also, just learn more about some of the Python machine-learning / AI / big-data frameworks.
This year, as every year, I think I’ll finally sit down and do something with Prolog or more likely miniKanren / core.logic. The language is less important here. It’s about understanding how to work with the logic / relational paradigm.
Why, yes. This is, indeed, OWL running on the PocketCHIP.
Here’s the story.
I spent 12 days recently, travelling in the south of Brazil and Uruguay border. And I decided, as an experiment, to see if I could live without my laptop. I wasn’t meant to be working, but I always like to keep some kind of SDI / MTC style software on me to make notes and generally think about my insanely long queue of tasks and all my other half-baked ideas. I feel lost without having access to these. And would usually take a laptop, just to keep them near to me.
This time, though, I decided to see how well I could cope with a “device swarm” of very small (and cheapish) tech.
Here’s what I took :
- The PocketCHIP
- My Android phone
- A small, portable USB mouse
- The rubber-tipped stylus.
- A 5V mini USB charger that plugs into the wall.
- An A5 sized paper notebook and pen.
On my trip, I also acquired a small bluetooth keyboard / mousepad that’s actually just a capacitative touch surface with letters marked on it. This impressed me a lot when I bought it at a Duty Free shopping outlet just on the Uruguay side of the Yaguarón River in Rio Branco for under $8. It charges via USB and feels pleasantly heavy and solid, while still pretty small.
Here are some things I found out.
I should note, first, that I’m also pretty much against keeping things on public clouds and other people’s servers. I increasingly want my data to be private, on systems that I control, and mainly synced between my own machines rather than using, say, my hosting provider.
Although I’m far from a satisfactory solution to that, it turned out that the discipline was useful in the sense that I wasn’t as persistently connected to the internet as I’d hoped. And so if I had depended on the cloud I would have been without access to my data more often than I had it.
I also, of course, want to use my own software. I currently have three distinct trajectories of development in this area.
- Mind Traffic Control, racket-version.
- The new engine behind ThoughtStorms wiki which is written in Python and uses the light-weight Bottle web-framework. I use this for both ThoughtStorms and a second personal wiki-notebook which is descended from my old SdiDesk notebook.
All these projects are still alive. And my notes and todos (and some more significant chunks of writing) are somewhat haphazardly scattered between them. So I wanted to see how well I could take them on the road with me with such minimal hardware.
Before leaving I updated the Debian on the PocketCHIP and installed the relevant libraries / environments. I already had MTC-racket running on it. And Emacs. Python was there too, but I needed to pip install a couple of standard libraries. Then I could install both Project ThoughtStorms and the Python-served version of OWL. (Spoiler alert : 2017 is going to be a year of consolidation between all these projects, particularly I’m aiming to unify the Python-OWL and Project ThoughtStorms servers into a single code-base.)
I didn’t try installing the Android version of OWL on my mobile, because of … er … reasons … which currently prevent me having a working dev / deployment environment for Android on my laptop. I hoped, though, that I’d be able to access the OWL server on the PocketCHIP from the phone.
The PocketCHIP is a wonderful machine. (And, seriously, a Debian box for $9 just insanely amazing.) It seemed to cope just fine with simultaneously running three Python servers (2 copies of the Project ThoughtStorms wiki, and the OWL server) + MTC. (I just ran unix “screen” on the terminal and ran each in a separate screen.)
Obviously these were not being heavily accessed. (I was the only user). But I’m still impressed.
The weakness of the CHIP is its WiFi. It is very weak. My original thought was to run the servers on the CHIP and then access them from either my phone, or other computers in the places I was staying. But even where WiFi was available, the CHIP typically failed to establish a usable connection with the router.
The only time I could get anything else talking to the CHIP was by turning the phone into a hotspot and then placing that within 10 to 20 centimetres of the PocketCHIP.
This way I was able to access both wikis and OWL from the phone. I didn’t get to remotely ssh-ing into the CHIP to see MTC in a terminal from the phone, but this would have been a particular fiddle and it’s not clear that it would have been worth it. In fact, nothing worked particularly well. OWL’s web-interface is pretty much impossible to work with on a small phone screen. It’s OK on a 7″ tablet, but the phone is way smaller and too difficult to manipulate. And the HTML UI doesn’t zoom in any effective way.
Reading the wiki pages was slightly better. I was surprised, though, how badly the phone handled the fairly simple, static html. I accept that there’s very little fancy “responsiveness” in the TS wiki at the moment. I hadn’t realized how little Chrome would help. On my laptop, ctrl + and ctrl – work beautifully to scale text up and down, reflowing and refitting the text. I have no hard settings for font-size or spacing. The page ought to be easy to automatically resize to convenience.
But pinch zooming a TS page on Android Chrome is diabolical. Not only does it not scale and reflow the text in a useful way. It also seems to remember (or guess) arbitrary different zoom levels for different pages, so you jump from a readable page to another page with illegibly tiny letters to another with enormous text, most of which is off screen. And zooming the menu seems to be independent of zooming the main page text. The whole thing is horrible.
Firefox on the phone is a bit better. You can go into “accessibility” and turn up the text size to full. And then the defaults are reasonably readable and consistent on all pages.
Editing is trickier. And this is somewhat my fault, I have set a fixed number of columns in the text-box in TS wiki which is too large for a phone with either browser.
Overall, I’m disappointed with the phone experience. TS wiki is just about readable on Firefox. But it’s useless for doing any kind of work. And horrible on Chrome. OWL looks OK on both browsers, but is too fiddly to actually edit.
I need to radically rework the UI for both these projects.
So I went back to see if I could actually look at these web-served applications on the PocketCHIP itself.
It turns out that OWL works surprisingly well with the surf browser which comes pre-installed … as long as you use a mouse!
The touch screen even with a rubber-tipped stylus isn’t viable for navigating and editing an outline. But attach an external mouse to the USB and it’s surprisingly usable. The PocketCHIP keyboard isn’t great for a lot of writing, but for short items in an outline it’s viable.
TS Wiki is also fine to read. But for some reason the text-area is coming out black, with black text. (I’m pretty sure I’m not setting this explicitly, so I assume it’s a bug in surf.) You, therefore, can’t edit the wiki with it. But reading is an acceptable experience. Once again, a mouse helps, but you can just about get away with the stylus.
The bluetooth keyboard I bought paired fine with the phone. But with the PocketCHIP there were some issues with the mapping between some symbols. I couldn’t find any combination of keys to make a backslash for instance. And sometimes the shift wouldn’t work. Also the bluetooth connection kept dropping. I found myself continually swapping between the PocketCHIP’s own keyboard for typing short commands with a lot of non-alphabetic symbols, and the bluetooth keyboard to type paragraphs of text. It was just enough to get some work done, and the bluetooth keyboard was just better enough to make it worthwhile, but it wasn’t really a viable solution.
This trip I also got interested in Logic Programming and tried out the Python Minikanren library, logpy, on the PocketCHIP. Unsurprisingly, it worked as expected. But, again, that is kind of startling when you think of it.
Well, this stuff works. If the PocketCHIP just had better wifi / bluetooth connections, then it would be a serious possibility to do some work on. It might be that a software update fixes the power-saving that may be weakening the wifi.
But it’s not something that even I can use yet.
Some of that is in my hands, of course, one task is to tweak the TS Wiki UI to ensure that the text-area is readable in surf. That would at least mean that PocketCHIP could be used (if uncomfortably) for working on my notebooks.
It’s not all working yet … but it’s getting closer.
These days, I’m thinking a lot about 3D printers, desktop manufacturing and software to create physical things.
Last year I did some art pieces using software to generate drawings for laser cutters and 3D printers, and I’m continuing along the same line. I want to move this stuff into the browser, and the combination of CoffeeScript and Raphael.js is turning out to be pretty good for this. (Did I mention I really, really like CoffeeScript?)
I also dabbled a bit with Prolog, wondering whether it can be used as a high-level description language for machines or other complex objects. The really interesting question is if you can use the built-in inference engine of Prolog to help with the design. (Aside, here’s a silicon layout engine in Prolog) I haven’t got very far with that yet, but I’m now considering how Prolog can be combined with or made to output OpenScad (or PyScad) code.
A couple of days ago Simon Wardley posted on his blog that he was searching for a SpimeScript :
So, I want to return to … the formation of Spime Script. We’re entering a phase where hardware will become increasingly as malleable as software which leads to a problem of choice – if I want to change the function of something, do I do this in software or hardware? The tendency today is obviously towards software because its more malleable but the future is never the past. However this creates a problem of skill – will I need to become proficient in both software and CAD / electronic design?
In reality both CAD and whatever software language you use, compile down to instruction sets and the function of the device is the interaction of these instruction sets – one which is substantiated physically and the other which is substantiated digitally.
Turning this on its head then why not write the function of what you want, the function of the device? Compilers can therefore undertake the complex decision trees (which is what they’re good at) required to determine what element of that function is encoded as physical and what element is digital.
A future language is needed, something whereby the output is both physical and digital and I describe merely the function of what I’m after.
That’s a really exciting vision.
Now, here’s what I think is really important for a SpimeScript.
It should learn from HTML / CSS.
While HTML / CSS is a pain in many ways, there’s a very interesting insight in it about design. That design comes in layers. It’s partly about the separation of logical structure and visual style. It’s partly about the cumulative effect of the Cascade in Cascading Style Sheets. It’s partly about the fact that the browser has reasonable defaults for the geometric properties of logical structure. (Today, those defaults look rather out-of-date but there would be little to stop a browser manufacturer making their defaults look more like Readability or Twitter Bootstrap.)
So here’s the main feature request for a SpimeScript. It should be possible to define the logical structure of, say, a machine and have some layout-engine give it plausible default geometric properties. But it should also be possible for designers to layer optional design hints on top of that layout in the form of extra constraints and have the engine deal with fitting them together.
As with the silicon design case, there must be some prior art here, but I’m not quite sure where it is. Electronic Design Automation maybe.
Back writing more Prolog and getting into Definite Clause Grammars. Having a parser generator built into the language is sweet. 🙂
Bloody hell, Prolog can be frustrating sometimes!!!!
Doh! I may have been a bit previous in saying that I’d got the hang of Prolog syntax.
Awesome response from SWI-Prolog when you just query an unbound variable. 🙂
?- X. % ... 1,000,000 ............ 10,000,000 years later % % >> 42
Wow! Playing with Prolog at the moment. It’s awesome.
I seem to have finally achieved some kind of fluency instead of fumbling around without knowing how to drive the thing. It probably helps that Erlang has accustomed me to the syntax and other conventions.