Lisplog

Blogging in Lisp

Search

Lisplog is a templating system that blends Apache and Hunchentoot to aid in the maintenance of a blog-like web site.

It is open source, written in Common Lisp, and the code is at github.com/billstclair/Lisplog

I'm looking for work. My resumé is at lisplog.org/resume.html

Quote

Submitted by Bill St. Clair on Wed, 19 Sep 2018 10:04:00 GMT

"APL is like a diamond. It has a beautiful crystal structure; all of its parts are related in a uniform and elegant way. But if you try to extend this structure in any way - even by adding another diamond - you get an ugly kludge. LISP, on the other hand, is like a ball of mud. You can add any amount of mud to it and it still looks like a ball of mud." -- Joel Moses

Add comment   Edit post   Add post

How do I run elm-test in Elm 0.19?

Submitted by Bill St. Clair on Mon, 17 Sep 2018 00:24:33 GMT

This is a FAQ, so I'm making a blog post to answer it.

elm-test is still in beta for Elm 0.19. To install it:

$ npm install -g elm-test@beta

The tests directory no longer needs an elm-package.json file (nor does it need elm.json).

Your top-level elm.json file needs to include the following:

    "test-dependencies": {
        "elm-explorations/test": "1.0.0 <= v < 2.0.0"
    }

The easiest way to get it there is with elm-test itself. The following will create a tests directory, containing an example test file, Example.elm, and will add test-dependencies to elm.json.

$ elm-test init

That's it. There is not yet support for running elm-test in the browser, nor is there support for testing DOM output.

billstclair/elm-localstorage is configured with a tests directory to test its JSON encoders and decoders: github.com/billstclair/elm-localstorage. To run the tests:

$ git clone git@github.com:billstclair/elm-localstorage.git
$ cd elm-localstorage
$ elm-test

Add comment   Edit post   Add post

CLtL2 on Kludges

Submitted by Bill St. Clair on Sat, 15 Sep 2018 11:26:58 GMT

Lest we believe we're building amazing systems as programmers, always remember that Common Lisp the Language, Second Edition, by Guy L. Steele, Jr. (CLtL2), has an index entry for "kludges", saying that they appear on pages 1 to 971. Page 972 is the "References" section.

kludges

Add comment   Edit post   Add post

iPhone Xs Pricing

Submitted by Bill St. Clair on Wed, 12 Sep 2018 19:22:55 GMT

From the www.apple.com/iphone pages.

Watch the 12 September keynote.

Prices (in parentheses) are per month for Apple financing.

Model64 gig128 gig256 gig512 gigOrderShip
iPhone Xs:$999
($49.91)
 $1149
($56.16)
$1349
($64.50)
9/149/21
Xs Max:$1099
($54.08)
 $1249
($60.33)
$1449
($68.66)
Xr:$749
($37.41)
$799
($39.50)
$899
($43.66)
 10/1910/26
iOS 12:Free9/17
macOS
Mojave
Free9/24

Add comment   Edit post   Add post

New Elm Package: billstclair/elm-port-funnel

Submitted by Bill St. Clair on Sat, 08 Sep 2018 20:23:12 GMT

I just published version 1.0.0 of billstclair/elm-port-funnel. It enables communicating with ALL of your custom JavaScript through a single Cmd/Sub port pair. It takes care of loading the JavaScript code, which you simply drop in a directory and add to a list, and dispatching messages from your Elm code. It allows pure-Elm simulators, to make testing your app easy in `elm reactor`.

https://package.elm-lang.org/packages/billstclair/elm-port-funnel/latest

The example is live at https://billstclair.github.io/elm-port-funnel

I will now begin work at converting my existing port modules to funnels. Those will be major version bumps, but will make them much easier to combine.

Thank you to Murphy Randall (@splodingsocks) for the basic idea that I generalized to create this package.

Add comment   Edit post   Add post

Building the Elm compiler

Submitted by Bill St. Clair on Fri, 07 Sep 2018 07:01:51 GMT

I learned how to build the Elm version 0.19 compiler, in an effort to get it to provide full backtraces of a bug I was tickling. I failed at getting the full backtraces, but I succeeded in adding some debugging output. Anyway, here's how to do it.

First, you need to install Haskell on your machine. You need version 8.2.2 for the Elm 0.19 compiler. www.haskell.org/platform/prior.html

Then do the following:

$ git clone git@github.com:elm/compiler.git
$ cd compiler
$ cabal sandbox init
$ cabal install

The Elm executable will be in .cabal-sandbox/bin/elm.

The first build takes a while, as it needs to download and build all the dependenies. After that, it gets faster. cabal sandbox delete lets you start over.

After making changes to the source, run cabal install again, and it will compile only the changed files and files that depend on them.


To build the entire Haskell stack, with stack backtraces enabled, from @mfeineis on the Elm Slack channel (I haven't tried this):

Init with stack:

$ stack init --resolver lts-11.20

Add options in elm.cabal:

Executable elm
    if flag(dev)
        ghc-options: -O0 -Wall -Werror -rtsopts -eventlog

Build with stack:

$ stack build --flag elm:dev --profile

Run with RTS options:

$ elm make ./src/Main.elm \
   --output=./dist/app.js +RTS -xc -lu -RTC \
   2>eventlog_readable.log

Add comment   Edit post   Add post

elm-websocket-client

Submitted by Bill St. Clair on Wed, 05 Sep 2018 02:49:40 GMT

Elm 0.19 shipped without an upgraded version of the elm-lang/websocket package. Since I use WebSockets for my games, I badly miss it. So I wrote my own, billstclair/elm-websocket-client. Since it uses ports to do the work that isn't in Elm itself, it needs a little more help from the user than Evan's package, but not that much.

Package: https://package.elm-lang.org/packages/billstclair/elm-websocket-client/latest
Changelog: https://github.com/billstclair/elm-websocket-client/blob/2.0.2/CHANGELOG.md

Add comment   Edit post   Add post

Server Updated to Ubuntu 16.04LTS

Submitted by Bill St. Clair on Fri, 27 Apr 2018 12:51:49 GMT

With the release of Ubuntu 18.04LTS, I have upgraded the server for this web site to Ubuntu 16.04LTS. I feel no need to follow the bleeding edge for a stable operating system, but 14.04 will only be supported for another year, so it was time to go to 16.04.

Add comment   Edit post   Add post

XKCD April Fools 2018

Submitted by Bill St. Clair on Mon, 02 Apr 2018 19:32:30 GMT

There's an amazing XKCD for April Fool's Day 2018. Right-click for pop-up menus and a marvel in JavaScript.

https://xkcd.com/1975/

Archived at lisplog.org/xkcd-right-click

Add comment   Edit post   Add post

JSMaze Returns, in Elm!

Submitted by Bill St. Clair on Thu, 29 Mar 2018 03:52:05 GMT

I mentioned JSMaze.com in my last post. Here are some more details.

I wrote a little maze game in 2012, as my first introduction to Node.js, and put it up on an Amazon AWS machine at JSMaze.com. I took it down a few months back, to save the $18/month it was costing me. I decided to remake it, in Elm, and it's back up, running on one of my Digital Ocean VMs, for no additional cost, again at JSMaze.com. Link there to GitHub repository.

So far I have the basic 2D and perspective rendering working, with movement via keyboard or buttons. It works in a touch-screen browser, though the keyboard is a much nicer control interface.

Next I'll work on a maze editor and persistent storage for mazes. Then a server, with war mode and the nice spinning bullet animation I did before. Then I'll add chat and sound, and I'll be back where I was before, but with code that's much easier to understand and expand.

My plan then is to do what I had in mind for the original, but that was too painful in plain JavaScript, the ability to have lots of mazes running at once, invitations to private mazes, drawings and uploaded images on the walls.

I'm having a blast!

Add comment   Edit post   Add post