16 Feb 2017

feedPlanet Lisp

Common Lisp Tips: The return value of read-sequence

I've seen this idiom a few times when working with a binary stream:

(let ((elements-read (read-sequence buffer stream)))

While the return value is the number of elements read in that situation, it's a useful coincidence in a common case. The actual return value of read-sequence is:

the index of the first element of sequence that was not updated

Therefore, treating the return value as the number of elements read is completely wrong if you use the start option to read-sequence.

For example, if stream has one or more elements available to read:

(read-sequence buffer stream :start 42 :end 43)
=> 43

The actual number of elements read is 1, not 43.

16 Feb 2017 1:59pm GMT

09 Feb 2017

feedPlanet Lisp

Nicolas Hafner: It's Been So Long - Confession 71

It's been a good while since I last wrote an entry. I didn't write anything all January for a multitude of reasons, at the forefront being that it was exam season again. That's over with now, fortunately, so I do have some more time on my hands to goof off. Unfortunately though, I only have one more week left of this precious "free" time before university strikes me in the back again. I best use it wisely.

The first week of my holidays now I've spent on a heavy reworking of Portacle, a portable, multiplatform, upgradable, install-less Common Lisp development environment project. I've only just now finally got it to work properly on all three platforms and differing versions thereof. It has been an unbelievable struggle, as every platform posed unique problems and nasty edge-cases that were hard to catch without testing everything on a multitude of virtual machines all the time. If you look through the commit history you can find plentyful examples of the borderline insanity that I reached at points. I might write an in-depth article about my adventures another time.

During the exam session itself I was mostly occupied with working on Lichat, my own light-weight chat protocol. It has the nice properties that it is very uniform and rather simple to implement a client for. Among the nice aspects of the protocol are that everything goes over a channel, even private messages, that each update is associated with an ID and failures or responses can be tracked even if they happen to be out of order, and that connection multiplexing is provided directly by the protocol, so you can log into the same user account from multiple machines or instances simultaneously. I've written both a TCP and a WebSockets server, and a CL and JS client for it as well, so you can easily set up your own distributions of it. These CL and JS clients also have respective user interfaces as well, namely LionChat and Lichat-JS. Lionchat might turn into a generic chat client at some point in the future.

I've also continued work on Maiden, and finished a Lichat client for it as well. It's now running as a bot alongside the previous Colleen and I'm intending on switching over fully soon. The only thing that I haven't switched over yet is the chat logging, as I haven't had time to test that extensively yet. I've also been using its Text To Speech module to provide some fun interactivity for my video game streams. Before I can unleash Maiden onto Quicklisp I'll need to heavily document everything though, as it is quite a lot more complex -and capable- than Colleen was.

Then, I've also taken the time to switch over TyNET to the new Radiance 1.0. Radiance is now complete and ready for release as far as I'm aware. I've been holding off on releasing it for good as I've been waiting for some feedback on its tutorial from a couple of friends of mine. Once they get ahead with that I'll type up a good, long entry to announce everything. If my paper for ELS 2017 gets accepted, I will even be presenting it at the symposium in April. Speaking of the symposium- I've been working on a new website for it on and off, to which it will be switching in a while. You can get a preview peek at it here.

For Christmas I gave my father a Raspberry Pi 3 and installed Emacs and CCL onto it. He's been using it, and a DAQ board, to interface with a Korg synthesizer, since he's interested in making music on a more low, analog level. To do this I've been trying to teach Lisp to him since Christmas. While it's been a hard road so far, he's slowly getting into it and making advances. Given that he's been a Fortran programmer for almost all his life, with probably close to forty years of experience or more in it, I'm actually surprised at how well he's been doing with something that probably seems very different and alien to what he's used to. As part of this, though, I've had to write a few libraries, namely cl-gpio to interface with the Pi's GPIO pins, cl-spidev to use the serial port interface, cl-k8055 for the DAQ kit he's been using, and pi-plates for the pi-plates extension boards. The last library isn't done yet as I haven't had the time to test it yet, but the other three should work just fine.

So, I've been slowly, but surely, working off my long stack of projects that need to be completed someday. With Maiden out of the way soon too, I'll finally be able to get back to two of the remaining major projects: Trial, my game engine, and Parasol, my painting application. I'm still undecided as to which I'll tackle first, though. If you have a preference, let me know!

Finally, aside from programming work, I've gotten back into the swing of drawing. Before I was constantly feeling down and unmotivated about it. Everything just seemed to suck and I could never come up with ideas for things that I actually wanted to draw. I'm still not exploding with ideas now, but at least I've found something that inspires me a lot. Specifically, I was reading through Yokohama Shopping Trip and it was filled with exactly the kind of scenery-heavy, romantic drawings that I always wanted to make. "Romantic" referring to the Romanticism art movement. For the past few days then I've been trying to get a scenery drawing done every evening. You can see them on my tumblr. I still have a very long way to go and I'm painfully aware of all the things I do badly at or can't figure out how to draw properly, but I just have to keep on keeping on. It's too late to throw it all to the wind now.

In the near future I'd like to focus some more on writing things again, and perhaps also on actually reading some of the books that I've started accumulating over the years. But then, I'd also like to continue streaming video games, as I've been enjoying that quite a lot. Ah, there's just so much I'd like to do. If only someone were to figure out the age-old problem of finite capacity. Or in the very least: if only I didn't have to worry about earning any money to make a living, I could just merrily focus on being as productive as I can be instead of having to focus on what's marketable. Ah well, you can't have everything, eh?

So, in the more immediate future you can, if you want to, look forward to a full release announcement of Portacle, Radiance, and Maiden, more drawings, and hopefully more articles and stories as well. No promises, though. I'm not very good at keeping to deadlines for projects.

09 Feb 2017 11:56pm GMT

08 Feb 2017

feedPlanet Lisp

Zach Beane: Gary Byers is stepping back from CCL and Clozure

Here's a message from Andrew Shalit to openmcl-devel:

To the CCL Community -

As many of you know, Gary Byers has been on a leave of absence from his Clozure CL work to attend to his health. I'm writing to let you know that, unfortunately, this leave will be permanent. Gary has resigned from his position at Clozure and will no longer be the lead developer of Clozure CL.

Over the last 30+ years Gary has made a tremendous contribution to the Common Lisp programming community, first through his work on Macintosh Common Lisp, and then through the creation of CCL. Gary has always been ready to share his deep knowledge of the Common Lisp standard and the issues attending its implementation. I don't know anyone whose understanding of the details of Common Lisp could match Gary's. His many contributions will be missed.

The work on CCL will continue, though. In Gary's absence, Matthew Emerson will be stepping up as the primary maintainer of CCL. Matthew is moving CCL to GitHub, and he hopes that others will pitch in to continue the development of this great software platform. Clozure Associates will also continue to support CCL, through direct contributions and through our consulting work. I'll be supporting those efforts, and I hope you'll consider supporting them as well.


Andrew Shalit
Clozure Associates

08 Feb 2017 2:07pm GMT

06 Feb 2017

feedPlanet Lisp

Eugene Zaikonnikov: Announcing CL-VIDEO

I'm happy to announce CL-VIDEO, a basic AVI/MJPEG video decoder written in Common Lisp. The library leverages CL-JPEG for frame processing and CL-RIFF for container format handling.

The code has only been lightly tested on SBCL 13.x/Linux x86-64. Some sample files can be found here (the toy plane AVI) and here.

To run it, CL-JPEG version 2.7 is required. Since it's not in Quicklisp yet as of time of writing, it must be cloned into your local-projects. Then you can load cl-video-player system and run (cl-video::play <your filename.avi>).

The implementation is still very much naive, as expected from a weekend project. There is no support for indexing, and a number of edge cases of legit AVI encodings might fail. The library will decode video frames in the order they occur. No parsing of BITMAPINFOHEADER structures; the assumption is they are MJPG DIB. No audio playback, although the stream is being read and adding at least PCM/WAV playback shouldn't be too big an effort.The decoder is factored out into independent implementation in cl-video.lisp. A primitive CLX media player is included in player.lisp. Each AVI instance contains one or more (audio or video) stream record objects, which hold ring buffers of frames with read and write cursors. The interaction between the decoder and player frontend runnning in separate threads is done via mutexed access to this ring buffer. The player thread can be kicked off a callback supplied to decode method: it will be called once the header part is parsed.

Since CL-JPEG doesn't use any SIMD extensions, the performance is modest. On my 6 year old 3GHz i5 (running one core of course) it decodes 480p 25fps file without hiccups, but going beyond that would require implementing multicore support in decode. Still it might be useful as is in applications not requiring real-time decoding performance.

06 Feb 2017 3:00pm GMT

25 Jan 2017

feedPlanet Lisp

Quicklisp news: January 2017 Quicklisp dist update now available

New projects:

Updated projects: acclimation, alexa, anaphora, architecture.service-provider, asdf-system-connections, asdf-viz, beast, binfix, caveman2-widgets, caveman2-widgets-bootstrap, cl-ana, cl-ansi-term, cl-arxiv-api, cl-association-rules, cl-autowrap, cl-csv, cl-cuda, cl-custom-hash-table, cl-dbi, cl-digraph, cl-enumeration, cl-freetype2, cl-glfw3, cl-gobject-introspection, cl-hamt, cl-jpeg, cl-liballegro, cl-libyaml, cl-marshal, cl-opengl, cl-opsresearch, cl-permutation, cl-qrencode, cl-readline, cl-routes, cl-statsd, cl-syslog, cl-typesetting, cl-unification, cl-wayland, cl-yaml, clazy, clinch, clml, clobber, closer-mop, clss, clx, croatoan, curry-compose-reader-macros, deeds, defenum, dexador, esrap, fare-quasiquote, fare-scripts, fare-utils, fast-io, femlisp, fixed, format-string-builder, gsll, inquisitor, jonathan, lambda-reader, let-plus, lisp-unit, local-time, log4cl, mcclim, metabang-bind, mito, mk-string-metrics, modularize, neo4cl, new-op, ningle, oclcl, opticl, parachute, parse-float, parser.common-rules, piping, plump, postmodern, postmodernity, prove, psychiq, qtools-ui, queues, restas, retrospectiff, rfc2388-binary, serapeum, spinneret, static-vectors, stumpwm, sxql, trivia, trivia.balland2006, trivial-ldap, trivial-rfc-1123, trivial-update, ubiquitous, uiop, unix-opts, varjo, vgplot, weblocks-utils, xhtmlgen, zlib.

Removed projects: cl-ledger, weblocks-examples.

To get this update, use: (ql:update-dist "quicklisp")


25 Jan 2017 1:27pm GMT

18 Jan 2017

feedPlanet Lisp

Eugene Zaikonnikov: New in CL-JPEG

In course of last few months there were numerous small changes introduced to CL-JPEG. None substantial enough to warrant own announcement, but taken together perhaps it's due for an update. So here we go, as of version 2.6:

18 Jan 2017 3:00pm GMT

Zach Beane: Common Lisp in the Wild - Deploying Common Lisp Applications.

Common Lisp in the Wild - Deploying Common Lisp Applications.

18 Jan 2017 11:54am GMT

Zach Beane: MKCL 1.1.10 is now available

MKCL 1.1.10 is now available

18 Jan 2017 11:43am GMT

02 Jan 2017

feedPlanet Lisp

Lispjobs: Web Technologist, Cadence, San Jose, California

They're looking for a "full stack Java programmer," but must also have 3+ years hand-on experience in Lisp/Tk Programming on Linux.

See web technologist job posting.

02 Jan 2017 3:52pm GMT

31 Dec 2016

feedPlanet Lisp

Quicklisp news: Thank you

Today (December 31) is the last day for the Quicklisp appreciation fundraiser. It has met and exceeded the matching fund goal by a wide margin. I am so thankful of all the support for this fundraiser, but also for the many kind words of appreciation, and for the "Quicklisp supporter club" donors, over the years. The positive feedback has made the work very satisfying.

Thank you, and best wishes for a happy 2017!

31 Dec 2016 3:33pm GMT