Lisp programming news

Demonstrating multi-processing in Bash 4

"I have an on-going project, to code the Collatz sequence in as many languages as I can.

www.topix.net | 7/29/10 7:55 PM
Writing GNU Emacs Extensions

This book introduces Emacs Lisp and tells you how to make the editor do whatever you want, whether it's altering the way text scrolls or inventing a whole new "major mode." Topics progress from simple to complex, from lists, symbols, and keyboard commands to syntax tables, macro templates, and error recovery.

www.topix.net | 7/27/10 10:31 PM
oldrunner 20100717

Oldrunner is a remake of Broderbund's Loderunner which contains the 150 original game levels.

www.topix.net | 7/19/10 1:20 AM
ABCL Dev: URI Pathnames
Among other goodies, ABCL-0.20 includes good support for using URI resources as arguments to about any function you would specify a filepath. Any builtin scheme like "http " or "file " or "jar" works as a full-on Lisp Pathname , with the caveat that one may not write to an associated Stream. We should be generic enough in implementation that the JVM extension mechanism for extending the classloader works for us for the most common use case, OSGi.

We pick up the ability to refer to URI, associating an input Stream with a source of lines easily as the following one-liner

CL-USER> (with-open-file (stream #p"http://google.com/index.html")
(format nil "~A" (read-line stream nil)))

Underneath we have implemented a new subtype of PATHNAME, namely the type URL-PATHNAME. We name this URL as opposed to URI as the underlying Java object is a java.net.URL with associated java.net.URLConnection that we'll be relying on for input sources.


CL-USER> (apropos (type-of #p"http://google.com/index.html"))
EXTENSIONS::SET-URL-PATHNAME-SCHEME (fbound)
EXTENSIONS::SET-URL-PATHNAME-AUTHORITY (fbound)
EXTENSIONS::SET-URL-PATHNAME-QUERY (fbound)
EXTENSIONS::SET-URL-PATHNAME-FRAGMENT (fbound)
URL-PATHNAME
URL-PATHNAME-AUTHORITY (fbound)
URL-PATHNAME-SCHEME (fbound)
URL-PATHNAME-FRAGMENT (fbound)
URL-PATHNAME-QUERY (fbound)
; No value
CL-USER>

The PATHNAME class now has two "beyond ANSI" subtypes: URL-PATHNAME and JAR-PATHNAME.


[[We
analyzed the CL4J technical paper, but decided not to use their abstractions as detailed on armedbear-devel]]

abcl-dev.blogspot.com | 7/11/10 10:32 PM
ECL News: ECL in Apache: mod_ecl
Louis Höfler has created a very interesting project: a module that allows you to execute Common Lisp in your Apache web server, much like PHP and perl modules I assume

The first version of the module is available here
https://sourceforge.net/projects/mod-ecl/files/

It uses ECL as embedded Common Lisp in a very simple way. I would encourage people interested in this project to research things like security and multithreading. sourceforge.net | 7/9/10 6:16 PM
Gnu Clisp 2.49

GNU CLISP is an ANSI Common Lisp implementation with an interpreter, compiler, debugger, object system , sockets, fast bignums, arbitrary precision floats, and a foreign language interface that runs on most Unix variants and Win32.

www.topix.net | 7/8/10 2:02 AM
Lispjobs: LISP Programmer with C++ (Cambridge, MA)

This is a software development position where the candidate will be responsible for helping add new platforms to an existing internal program. This person will be working with a piler program and must have experience with the programming language LISP.


lispjobs.wordpress.com | 7/7/10 10:14 PM
Thought and Performance, Live Coding Music, Explained to Anyone a " Really

In an extended video that begins with Radio City's Rockettes and kettle drum players, Stephen Ramsay explains a litany of technology's most elusive topics, in terms anyone could understand - no, really.

www.topix.net | 7/6/10 8:28 AM
Lispjobs: Senior Research Engineer, SRI International

The AI center at SRI International is looking for a highly creative
research engineer to join a team of researchers building evaluation
driven knowledge based systems.  We are seeking an individual with
strong background in logic, knowledge representation and ontologies.
The backend code is written in Lisp, and therefore, we require
strong Lisp programming skills.

Duties:

Responsibilities will include dedicated work in software development
and maintenance of complex software systems in the following areas:
- knowledge acquisition
- truth maintenance
- automated reasoning
- natural language processing

The research engineer’s role will be to contribute
approaches, designs, applications, implementations, documentation,
and publications. Initial project work will be to implement and extend
several knowledge management tools in Lisp.  We anticipate applying
these techniques to problems that are of interest to both government
and business with an eye toward commercialization
opportunities.  The position requires excellent communication skills,
willingness and ability to work in a team and to undertake a significant
system building effort.
Experience:

Background and exposure to Artificial Intelligence, specifically,
knowledge representation.  Substantial common lisp programming
experience.  Thorough understanding of web-based technologies,
for example, XML, HTML, and Java, and user interface programming.
Experience in writing test suites for large complex systems.

Education/Discipline Preferred:

MS/Ph.D. in computer science or equivalent with specialization in
Artificial Intelligence. Five years experience building complex systems.

Title of Position:

Senior Research Engineer / Computer Scientist


lispjobs.wordpress.com | 7/6/10 12:12 AM
Vladimir Sedach: Lisp and JS events
Heads-up on some upcoming Lisp and JavaScript events:

Tuesday July 13, the Montréal JavaScript User Group is having a meet-up. James Duncan of Joyent will talk about why software sucks and JavaScript is the end of programming language history. Laurent Villeneuve will demonstrate idiomatic use of closures.

The 2010 Workshop on Scheme and Functional Programming is taking place at the University of Montreal August 21-22.

ILC 2010 will be taking place October 19-21 in Reno, Nevada. Abstracts are due by August 1. I'm not planning on attending. carcaddar.blogspot.com | 7/5/10 10:06 PM
Runtime tags aren't necessary

To insert individual citation into a bibliography in a word-processor, select your preferred citation style below and drag-and-drop it into the document.

www.topix.net | 7/4/10 6:21 PM
Zach Beane: Lisp-powered Buddhabrot

I love reading any blog post that includes both "ridiculously large Buddhabrot" and "Lisp source included."

Check out Johann Korndoerfer's article about how he made a 20,000×25,000 pixel rendering of the Buddhabrot suitable for printing as a poster.

(Thanks for the link, mgr!)

xach.livejournal.com | 7/3/10 5:36 PM
Nick Levine: ITA sells to Google for $700m
Did I miss something, or does this count as a "lisp success story"?

news.bbc.co.uk/1/hi/technology/10486358.stm enlivend.livejournal.com | 7/3/10 8:51 AM
Lispjobs: Lispy PhD Studentships at Goldsmiths University of London

See: http://www.gold.ac.uk/computing/research/studentships/

Not Lisp positions per se, but Lisp use would be fine, and Lisp is used extensively there.


lispjobs.wordpress.com | 7/2/10 10:19 PM
François-René Rideau: Boston Lisp Meeting: Monday 2010-07-26 Slava Pestov on Factor (factorcode.org)

A Boston Lisp Meeting will take place on Monday, July 26th 2010 at 1800 at MIT 34-401B. Slava Pestov will speak about Factor: an interactive, dynamic, stack-based programming language.

Additionally, we will have two Lightning Talks. Speakers to be announced.

Note that lacking a sponsor, buffet is no longer being offered after our meetings.

1 Slava Pestov on Factor: an interactive, dynamic, stack-based programming language

Factor is a new dynamically-typed language. http://factorcode.org/ Factor's strengths include an extensive standard library, an interactive development environment, extensive meta-programming features, efficient support for operations on packed binary data, and interoperability with C. The presentation will cover the Factor language and environment, demonstrate some interesting features, and touch upon the history and motivations behind the project.

Slava Pestov started programming in elementary school using HyperCard, then moved on to Java. After getting a lot of useful work done in Java, he then moved on to study esoteric programming languages, and like any self-respecting language enthusiast, noticed that all existing ones were lacking and decided to write his own.

2 Lightning Talks

At every meeting, before the main talk, there are two slots for strictly timed 5-minute "Lightning Talks" each followed by 2 minutes for questions and answers.

The slots for next meeting are still open. Step up and come talk about your pet project! Contact me at fare at tunes.org.

3 Time and Location

The Lisp Meeting will take place on Monday, July 26th 2010 at 1800 (6pm) at MIT 34-401B.

Note that it's a new location.

MIT map: http://whereis.mit.edu/bin/map?selection=34

Google map: http://maps.google.com/maps?q=50+Vassar+St,+Cambridge,+MA+02139,+USA

Many thanks go to Alexey Radul for arranging for the room, and to MIT for welcoming us.

4 No Dinner

We haven't been able to renew sponsorship from our usual partners for 2010, and are not planning to have after-meeting buffet anymore at this point. An informal group will probably gather to have dinner within walking distance of the venue.

5 More about the Meeting

The previous Boston Lisp Meeting on Monday, May 24th 2010 had about 26 participants. Marc Battyani spoke about Leveraging Common Lisp and FPGAs for ultra high performance computing. http://fare.livejournal.com/156739.html

We're always looking for more speakers. The call for speakers and all the other details are at: http://fare.livejournal.com/120393.html Volunteers to give Lightning Talks are also sought. http://fare.livejournal.com/143723.html

For more information, see our web site http://boston-lisp.org/ For posts related to the Boston Lisp meetings in general, follow this link: http://fare.livejournal.com/tag/boston-lisp-meeting or subscribe to our RSS feed: http://fare.livejournal.com/data/rss?tag=boston-lisp-meeting

Please forward this information to people you think would be interested. Please accept my apologies for your receiving this message multiple times. My apologies if this announce gets posted to a list where it shouldn't, or fails to get posted to a list where it should. Feedback welcome by private email reply to fare at tunes.org.

fare.livejournal.com | 7/1/10 11:09 PM
Steel Bank Common Lisp 1.0.40

Steel Bank Common Lisp is a development environment for Common Lisp, with excellent support for the ANSI standard: garbage collection, lexical closures, powerful macros, strong dynamic typing, incremental compilation, and the famous Common Lisp Object System .

www.topix.net | 7/1/10 6:48 PM
Vladimir Sedach: Lisp in startups
Calgary-area Lisper Warren Wilkinson recently launched FormLis , a Lisp-powered web application that combines a wiki with an ingeniously easy way to create custom forms (backed by a schemaless database that automatically manages form definition changes). One of the interesting technical details is Warren's use of an embedded Forth to Lisp compiler . Doug Hoyte 's Let Over Lambda (read my review of the latter) features a Forth to Lisp compiler as a case-study chapter, but it's interesting to see one used in a real application.

In other news, ITA Software is trying to get acquired by Google for a billion dollars . carcaddar.blogspot.com | 7/1/10 5:32 AM
Patrick Stein: Missing Lisping

I hope that by later in the month I will have time to participate in the 2010 International Lisp Games Expo.

nklein.com | 6/30/10 3:00 PM
Zach Beane: 2010 International Lisp Games Expo

David O'Tool has announced the 2010 International Lisp Games Expo:

The 2010 ILGE is month-long exploration of programming and playing games in Lisp. This "virtual conference expo" is relatively free-form and self-assembling, something like the community it serves.

All entries must be playable games written in some dialect of Lisp (Common Lisp, Scheme, Arc, Clojure, et cetera.) Multi-platform release is encouraged, but not required.

More info on his site.

xach.livejournal.com | 6/30/10 1:28 PM
The Next Generation of Routing Architecture

Cisco announced a business-oriented pad somewhat similar to IPad. While intriguing, it's not the most intriguing new thing I learned today at networkers, so let me write briefly about LISP.

www.topix.net | 6/30/10 12:42 PM
Kevin Reid: Your metacircle of the day

Disambiguation (disambiguation).

(via Making Light)

kpreid.livejournal.com | 6/25/10 11:17 PM
Lispjobs: SISCOG still hiring (Portugal)

I’m Luis Sergio Oliveira and I work with the other Luis Oliveira at
SISCOG who informed you about the hiring we started about 2 months
ago. We are still hiring and the opportunities are the same (we have
an objective of at least 9 persons and we are under half) that the
other Luis Oliveira sent a while ago and which is published at
http://www.siscog.eu/subarea.asp?idSubArea=45&idArea=1.

I’m directly involved in the hiring process, so, any specific question
please send to my work email in Cc or publish my email as “luis dot
sign oliveira at character siscog . pt.


lispjobs.wordpress.com | 6/23/10 1:14 AM
Liam Healy: A CL workbook
I am looking for a way to conveniently keep a session of Lisp interaction. For example, when I write down a problem and solution for class, I define a succession of variables with defparameter (or a slightly more convenient form I've defined). In a later year, if I give the problem again with different numbers, I just change the defining parameters, and recalculate. This is clumsy, but it mostly works. What I'd really like is to define a few input parameters, and stepwise calculate the intermediate quantities. A single defun isn't appropriate because I need the intermediate values to show to the students. The defparameter approach is tedious and prone to error.

What I envision is a structure or class instance with "given values" provided at the beginning, and steps consisting of the form and the value. A new instance of the same problem would have the same forms to evaluate, but different values. It might also be nice to branch, i.e., at some step in the calculation, continue with a different set of calculations. but still be able to keep the tree structure (kind of like git for Lisp forms? hmmm).

Is there anything like this (in any language) out there? I tried some googling but if there's something along these lines out there, I'm not using the right keywords. For lack of a better word, I'm calling it a Lisp workbook or notebook. Bonus if it will integrate with LaTeX and/or org-mode . lhealy.livejournal.com | 6/22/10 3:35 AM
Uber Conf 2010 - Day 4 Report - OSGi/Java EE in GlassFish and Getting Started with Clojure

Uber Conf Day 4 started with yet another 10 miler with fellow attendees in 1 hr 18 mins and 7:49 pace.

www.topix.net | 6/22/10 12:23 AM
Economy Size Geek - Interview with Rich Hickey, Creator of Clojure

An in-depth look at the new language from the man himself. This month's column diverges from the normal pattern of covering my struggles with technology.

www.topix.net | 6/20/10 3:12 PM
Comprehending Monads

To insert individual citation into a bibliography in a word-processor, select your preferred citation style below and drag-and-drop it into the document.

www.topix.net | 6/20/10 11:57 AM
Lispjobs: LISP Programmer with C++ (Cambridge, MA)

This is a software development position where the candidate will be responsible for helping add new platforms to an existing internal program. This person will be working with a piler program and must have experience with the programming language LISP.


lispjobs.wordpress.com | 6/18/10 5:54 PM
Hans Hübner: How to convert your old-style Symbolics keyboard to USB

Peter got in touch with me because he tried to follow my instructions how to convert a Symbolics keyboard to USB with his old-style keyboard and he failed. He assumed, and that was what I would have assumed, that the color coding of the internal cabling of the old and new keyboards would match, but they don't. Here is a table that shows the pinout for both keyboard types:

New Style Old Style Function Teensy
Pin
Pin# Color Pin# Color
1blue8whiteGNDGND
2yellowblacknotconnected
3green2red5V5V
4red3greenDIND4
5black1yellowCLKD5
6white5blueCLRD6
netzhansa.blogspot.com | 6/17/10 10:33 AM
Christophe Rhodes: 15 Jun 2010
It's been a while. It's in fact almost embarassingly late for me to be blogging now about the 2010 European Lisp Symposium , which was over a month ago now – in my defence, I point to the inevitable stress-related illness that follows excessive concentration on a single event, coupled with hilarious clashing deadlines at work and in my outside activities.

So, we cast our minds back to April. When I booked my flight to Lisbon, I deliberately chose not to fly with British Airways, on the basis that they were likely to strike. It turned out that the activities of British Airways cabin crew was going to be the least of the problems associated with getting to an international conference...

Yes, shortly after I booked my tickets, Eyjafjallajökull went *boom* and most of Europe's airspace closed for a week, with ongoing disruption for the best part of a month. There were moments during the disruption when I wondered whether there was an actual curse affecting ELS, but in the event things cleared up and there was only minimal disruption to delegates and speakers, both getting there and getting back.

But enough about transport! How was the symposium itself? Well, I enjoyed the programme – but given that I had as much control over it as events would allow me, perhaps that's not the most unbiased endorsement of quality. Still, I was entertained by all the keynote speakers, from the window into the business world opened by Jason Cornez of Ravenpack, via the practical philosophy and view on history afforded by Kent Pitman, to the language experimentation and development in PLT Scheme Racket described enthusiastically by Matthias Felleisen. Pascal Costanza's tutorial on parallel and concurrent programming was highly informative, and there was a good variety of technical talks.

It's often said, though, that the good stuff at conferences happens between the programme, and for that the local organization needs to be on the ball. I'm glad to say that António Leitão and Edgar Gonçalves, and their helpers, enabled a huge amount of interaction: lunch, coffee and tea breaks, evening meals (including a fabulous conference banquet, but also a more informal dinner and a meal punctuated by Fado. I gather the excursion to Sintra on the Saturday was interesting; by then I was at the airport, looking nervously at the departure boards...

I enjoyed meeting and talking with many of the attendees; some whose names I knew but whose faces I didn't (and some whose names I knew because they shared them with other people who I knew already: take a bow, both Luís Oliveiras); but with always one eye on the next thing that could go wrong, I didn't get to go very deeply into interesting conversations. Maybe next year, in Hamburg for ELS2011 (expect the paper deadline to be around 31st December 2010) – in the meantime, there's likely to be a journal special issue with an open call for papers, coming soon, and of course the ALU are holding an International Lisp Conference this year, whose call for papers is currently open. So get writing!

www.advogato.org | 6/15/10 11:48 AM
Tough Macho Hacker

The first article I ever wrote about computer software was way back in -- I think -- 1977.

www.topix.net | 6/15/10 7:40 AM
Pascal Costanza: AOSD'11 conference
Another interesting conference is coming up: The International Conference on Aspect-Oriented Software Development will be held in Porto de Galinhas, Brazil in March 2011. The conference chair is Shigeru Chiba, who is a long-term contributor to reflection and metaprogramming techniques himself, and who has assembled a diverse program committee covering not only core aspect technologies (like AspectJ-influenced approaches), but also explicitly Feature-oriented Programming, Context-oriented Programming, and also metaprogramming and reflection (which have been somewhat neglected in the aspect community for a long time, although they are clearly very relevant), among others. Dynamic languages are also mentioned in the call for research papers , so good papers based on languages like Lisp, Scheme, Smalltalk, and so on, are definitely welcome.

Another interesting element of this conference that I haven't seen before is that there will be two opportunities to submit papers: The first deadline is July 1, 2010, and the second deadline is October 1, 2010. The idea is that papers that fail to get accepted in the first round can be improved by their authors for a second round of reviews. It will be interesting to see if this works out.
p-cos.blogspot.com | 6/14/10 2:37 PM
Cyrus Harmon: Cleaning up clem and ch-image

I made a lot of bad decisions early in my lisp coding days. Lately I've been trying to undo some of the most egregious mistakes. One of the big mistakes was that I had way too many dependencies between my various libraries. Everything I wrote depended on ch-util and ch-asdf. There was no need for this.

I've released new versions of clem and ch-image that don't depend on ch-util and ch-asdf. There may still be some references in the doc building stuff, but the core libraries and their associated tests no longer depend on these.

cyrusharmon.org | 6/11/10 10:33 PM
Making Emacs with emacs-starter-kit a little more friendly

Hopefully you've read the docs and know that you can override settings and implement your own extensions rather easily: Create a Lisp file under ~/.emacs.d/ specific to your username or system that Emacs with emacs-starter-kit will load automatically at startup.

www.topix.net | 6/11/10 3:08 PM
Pascal Costanza: International Lisp Conference '10
The International Lisp Conference (ILC'10) is being held again, sooner than expected: It will be held in October 2010 in Reno, Nevada. This year, the conference will be co-located with OOPSLA/SPLASH , which also hosts the Dynamic Language Symposium . So this event is bound to be a very interesting combination. Paper submission for ILC'10 is open, submission deadline is August 1, so there is enough time to submit something. See the call for papers for more information. p-cos.blogspot.com | 6/7/10 5:15 PM
Steel Bank Common Lisp 1.0.39

Steel Bank Common Lisp is a development environment for Common Lisp, with excellent support for the ANSI standard: garbage collection, lexical closures, powerful macros, strong dynamic typing, incremental compilation, and the famous Common Lisp Object System .

www.topix.net | 6/6/10 1:20 AM
ECL News: About the myth of slow starting
I am tired of reading complaints about how slow ECL is at being launched. Things are constantly improving but the current boot times are reasonable enough. A stupid way to test them is to do something like "ecl -norc -eval '(quit)'" or the equivalent for SBCL and CLISP.

Here are the findings

Ubuntu/x64
ECL: 0.060 s (git/CVS)
SBCL: 0.038 s (1.0.29.11)
CLISP: 0.021 s (v. 2.44.1)

Notice that the whole difference arises because ECL has to reconstruct the data that forms the program (constants, functions, etc) reading them from a text representation. Is it really that large a difference? sourceforge.net | 6/5/10 11:01 AM
Simplified Wrapper and Interface Generator 2.0.0

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.

www.topix.net | 6/5/10 8:57 AM
ECL News: EQL - Embedded Qt Lisp
Cut&past from the mailing list, here comes an exciting announcement!!!

OK, so we already have very nice Qt bindings for CL (CommonQt, cl-smoke). But what about an ECL embedded solution, with exactly 0 dependencies?

+ most of QtGui (+ overriding virtuals)
+ interactive SLIME (needs a small patch, but no threads)
+ unicode
+ internationalization
+ dynamically loadable UIs
+ cross-platform

- no CLOS
- no GC (not a real problem, see notes in documentation)

Tested (with SLIME) in Linux, OSX, WinXP + VS 2008 Express:
* ECL 10.4.1 (unicode)
* Qt 4.6.2.
* SLIME from CVS (2010-06-01)

Sources (LGPL) + screenshot:
http://password-taxi.at/EQL

Paul Ruetz

BTW, you do NOT want to test this with ECL from CVS/git because it is right now evolving very fast and in a probably unstable state. Use the last stable release instead (Juanjo) sourceforge.net | 6/4/10 10:22 PM
LISP: The Future of Internet Routing?

For others, LISP has a different meaning that is rooted in the future of Internet routing.

www.topix.net | 6/3/10 12:33 AM
Automatic Generalization

Personalize Layout Nick Harrison Thoughts on Design and Architecture Automatic Generalization I have been interested in functional programming since college.

www.topix.net | 6/2/10 7:28 PM
Patrick Stein: NeHe Tutorial 03: Color

Introduction

In the previous tutorial, we drew a plain triangle and quadrilateral on the screen. The next NeHe tutorial colors this triangle and quadrilateral.

We’re going to start with our simple-tutorial base.

;;; *.lisp
#<: use "simple-tutorial.lisp" >

;;; window title
"tut03: color"

Drawing colored triangles and quadrilaterals

In the base display code, we already cleared the color buffer and the depth buffer and reset the modelview matrix. Now, we’re going to translate the modelview matrix so that when we draw our triangle, it is going to be in front of our viewpoint and off to our left. Then, we’ll draw the triangle, translate over toward the right, and draw the quadrilateral.

;;; display extra code
(gl: translate -1.5 0.0 -6.0 )    ; translate left and into the screen
#<: use "draw triangle" >
(gl: translate 3.0 0.0 0.0 )      ; translate right
#<: use "draw quadrilateral" >


The above is untouched from the previous tutorial.

Drawing with vertex coloring

Now that we’ve moved over to the side a little bit and back a ways, we’re going to draw a triangle. We open with the with-primitives call and then specify the vertexes.

;;; draw triangle
(gl: with-primitives : triangles  ; start drawing triangles
  #<: use "draw triangle vertexes" >
  )

Before, we simply listed the vertexes. Here, we are going to specify a color before each vertex.

;;; draw triangle vertexes
  (gl: color 1.0 0.0 0.0 )        ; set the color to red
  (gl: vertex 0.0 1.0 0.0 )       ; top vertex


The arguments to color are the red, green, and blue values (respectively). The values range from zero (for the darkest) to one (for the brightest). I have omitted here the optional fourth argument for the alpha channel. It defaults to 1.0.

It is important to note that we have set the global color to red. This vertex will be red because the global color was red at the time we created the vertex. If we failed to ever set the color again, everything would be red.

Here, however, we’re going to make the next vertex green.

;;; draw triangle vertexes (cont.)
  (gl: color 0.0 1.0 0.0 )        ; set the color to green
  (gl: vertex -1.0 -1.0 0.0 )     ; bottom-left vertex

We are going to make the final vertex blue for this triangle.

;;; draw triangle vertexes (cont.)
  (gl: color 0.0 0.0 1.0 )        ; set the color to blue
  (gl: vertex 1.0 -1.0 0.0 )      ; bottom-right vertex

Note: the global color is now blue. We could leave it blue and it would be blue until we set it to some other color.

Drawing with flat coloring

Drawing quadrilaterals is much like drawing triangles. Here, of course, we need four vertexes. In this case, however, we’re going to color the whole quadrilateral the same color. So, we are just going to set the global color to a light blue and then draw the quadrilateral exactly as we did in the previous tutorial.

;;; draw quadrilateral
(gl: color 0.5 0.5 1.0 )          ; set the color to light blue
(gl: with-primitives : quads      ; start drawing quadrilaterals
  (gl: vertex -1.0  1.0  0.0 )    ; top-left vertex
  (gl: vertex  1.0  1.0  0.0 )    ; top-right vertex
  (gl: vertex  1.0 -1.0  0.0 )    ; bottom-right vertex
  (gl: vertex -1.0 -1.0  0.0 ) )   ; bottom-left vertex

Now, the color is still this light blue. It will remain so until we reset the color to red when drawing the triangle during the next time our screen is redrawn.

nklein.com | 6/2/10 12:07 AM
Patrick Stein: NeHe Tutorial 02: Drawing Triangles and Quadrilaterals

Introduction

In the previous tutorial, we made a basic shell of a CL-OpenGL application. I have slightly modified it for this tutorial so that it has some hooks where we can add in code specific to this tutorial.

In this tutorial, we’re going to draw a triangle and a quadrilateral in our window. We’re going to start with our simple-tutorial base.

;;; *.lisp
#<: use "simple-tutorial.lisp" >

Here is the whole tut02.lisp.

;;; window title
"tut02: triangles and quads"

Drawing triangles and quadrilaterals

In the base display code, we already cleared the color buffer and the depth buffer and reset the modelview matrix. Now, we’re going to translate the modelview matrix so that when we draw our triangle, it is going to be in front of our viewpoint and off to our left. Then, we’ll draw the triangle, translate over toward the right, and draw the quadrilateral.

;;; display extra code
(gl: translate -1.5 0.0 -6.0 )    ; translate left and into the screen
#<: use "draw triangle" >
(gl: translate 3.0 0.0 0.0 )      ; translate right
#<: use "draw quadrilateral" >


The parameters to gl:translate are x, y, and z (respectively). After the gl:load-identity, the modelview matrix is centered at the origin with the positive x axis pointing to the right of your screen, the positive y axis pointing up your screen, and the positive z-axis pointing out of your screen.

With the way that we set up the projection matrix in the reshape method, the origin of the modelview space should be dead-center in our window.

Drawing triangles

Now that we’ve moved over to the side a little bit and back a ways, we’re going to draw a triangle. The CL-OpenGL code looks like this:

;;; draw triangle
(gl: with-primitives : triangles  ; start drawing triangles
  (gl: vertex  0.0  1.0  0.0 )    ; top vertex
  (gl: vertex -1.0 -1.0  0.0 )    ; bottom-left vertex
  (gl: vertex  1.0 -1.0  0.0 ) )   ; bottom-right vertex


The with-primitives form lets OpenGL know how to use the vertexes we’re going to make. In this case, it’s going to make a triangle out of each set of three vertexes. If we had six vertexes there, we’d end up with two triangles.

Here, we drew the vertexes in clockwise order. By default, OpenGL considers this triangle to be facing away from us, then. With our current OpenGL settings, this does not make a difference since OpenGL will draw both front and back faces.

Each call to vertex gives the x, y, and z (respectively) coordinates in the modelview projection for the vertex. You will note that I used floating-point numbers here. I could have easily written them as integers like (gl:vertex 1 -1 0). CL-OpenGL would convert them to floating point numbers for me on the fly. I tend to use floating point constants when possible to try to save it the extra work. I should check, sometime, to be sure though that I don’t pay a boxing/unboxing penalty that negates the benefit.

Drawing quadrilaterals

Drawing quadrilaterals is much like drawing triangles. Here, of course, we need four vertexes.

;;; draw quadrilateral
(gl: with-primitives : quads      ; start drawing quadrilaterals
  (gl: vertex -1.0  1.0  0.0 )    ; top-left vertex
  (gl: vertex  1.0  1.0  0.0 )    ; top-right vertex
  (gl: vertex  1.0 -1.0  0.0 )    ; bottom-right vertex
  (gl: vertex -1.0 -1.0  0.0 ) )   ; bottom-left vertex


In this case, we drew a square. We could draw any convex quadrilateral.

Again, we drew the vertexes in clockwise order. By default, OpenGL considers this triangle to be facing away from us, then. With our current OpenGL settings, this does not make a difference since OpenGL will draw both front and back faces.

Toggling Fullscreen mode

We’re also going to add a slot that keeps track of whether or not our window is full screen.

;;; extra slots
(fullscreen : initarg : fullscreen : reader fullscreen-p)


;;; extra initargs
: fullscreen nil

Then, before we display our window, we’re going to switch to fullscreen mode if this is true.

;;; display-window extra code
( when (fullscreen-p win)        ; check to see if fullscreen needed
  (glut: full-screen ) )           ; if so, then tell GLUT

Switching based on keyboard event

Here, we add an extra case to the keypress handler. We destroy our window and create a new one with the fullscreen property toggled if we get an 'f' on the keyboard.

;;; keyboard extra cases
( (#\f #\F)                      ; when we get an 'f'
                                ; save whether we're in fullscreen
     ( let ( (full (fullscreen-p win) ) )
       (glut: close win)         ; close the current window
       (glut: display-window     ; open a new window with fullscreen toggled
           (make-instance 'my-window
                          : fullscreen ( not full) ) ) ) )
nklein.com | 6/1/10 10:18 PM
Tamas K Papp: Sub-array indexing

One of the things I have been missing in CL was convenient indexing for sub-arrays. Languages like R and Octave all have convenient sub-array indexing. I have experimented with various designs before (some of them I made public, eg AFFI and xarray), but none of them were entirely satisfactory and I kept searching for new solutions.

This is primarily an issue of syntactic convenience: I want to be able to select elements from arrays without writing (nested) loops. I also want to be able to copy elements from arrays to other arrays, similarly selected. Speed is welcome, but at this stage it is secondary: so far, profiling indicates that these operations comprise a tiny fraction of execution time in my programs, but having the ability to capture operations using (sub)arrays is an enormous timesaver and an invaluable semantic abstraction.

Introduction to sub

My latest attempt at tackling this problem is the generic function sub in my cl-num-utils library (BTW, this library is the successor of my earlier cl-numlib, which is now deprecated, all useful functionality will end up in other libraries, eventually). The syntax is as follows: (sub object &rest ranges). Each range is either a fixnum (selecting a single index), (cons start end) (selecting indexes in that range, excluding end as is usually done for CL library functions), t for all indexes, and finally, a vector of fixnums for anything else.

Let's see some examples:

 CLNU> (defparameter *a* #2A((1 2 3 4) (5 6 7 8) (9 10 11 12)))
*A*
CLNU> *a*
#2A((1 2 3 4) (5 6 7 8) (9 10 11 12))
CLNU> (sub *a* 1 t) ; second row
#(5 6 7 8)
CLNU> (sub *a* '(1 . 2) t) ; second row as matrix
#2A((5 6 7 8))

Notice how a single fixnum will drop that dimension (making a vector from a matrix), while selecting the same row with a cons doesn't.

For all other cases, you can use vectors:

 CLNU> (sub *a* t #(0 3)) ; first and last columns
#2A((1 4) (5 8) (9 12))
CLNU> (sub *a* t #(3 0)) ; last and first columns
#2A((4 1) (8 5) (12 9))

You can also use negative numbers for indexes: if (minusp index), it will select the column (- dimensions index):

 CLNU> (sub *a* -1 t) ; last row
#(9 10 11 12)
CLNU> (sub *a* #(-2 -1) #(-2 -1)) ; bottom right 2x2 matrix
#2A((7 8) (11 12))

Finally, 0 in a cons corresponds to the largest possible index in that dimension:

 CLNU> (sub *a* '(-2 . 0) t) ; last two rows
#2A((5 6 7 8) (9 10 11 12))

Setting subarrays

sub can also be used with setf:

 CLNU> *a*
#2A((1 2 3 4) (5 6 7 8) (9 10 11 12))
CLNU> (setf (sub *a* 1 t) #(-1 -2 -3 -4)) ; replace second row
#(-1 -2 -3 -4)
CLNU> *a*
#2A((1 2 3 4) (-1 -2 -3 -4) (9 10 11 12))
CLNU> (setf (sub *a* 2 t) (map 'vector #'+ (sub *a* 0 t) (sub *a* 1 t)))
#(0 0 0 0)
CLNU> *a*
#2A((1 2 3 4) (-1 -2 -3 -4) (0 0 0 0))

Note that the ranks have to be equal, make sure that you keep/drop dimensions as needed.

Macros for implementing sub

In cl-num-utils, you also find the macro with-range-indexing, which preprocesses the range arguments and implements an internal counter for row-major indexing. For example, sub for arrays is implemented as

 (defmethod sub ((array array) &rest ranges)
           (declare (optimize debug (speed 0)))
  (with-range-indexing (ranges (array-dimensions array) next-index
                               :end? end?
                               :range-dimensions dimensions)
    (let ((result (make-array (coerce dimensions 'list)
                              :element-type (array-element-type array))))
      (iter
        (until end?)
        (for result-index :from 0)
        (setf (row-major-aref result result-index)
              (row-major-aref array (next-index))))
      result)))

The macro takes the range specification as the ranges argument, and also needs the original dimensions of the array. next-index should be the name of the function that will be used to query the next index: it increments the internal counter and delivers the next index. The internal counter is an array of fixnums, and the index is calculated with an affine mapping, but the algorithm allows to update the sum only for the indexes which actually changed. All this is hidden by the macro. end? is a boolean, which can be used to query when all the elements have been traversed. dimensions will be bound to the dimensions of the result, after allowing for dimension droppings.

This macro is pretty versatile: I used it in LLA to implement (sub dense-matrix-like ...), ((setf sub) array dense-matrix-like ...) and ((setf sub) dense-matrix-like array ...) methods, even though LLA is column-major. The trick is to swap dimensions.

tkpapp.blogspot.com | 5/30/10 8:08 PM
Mea Culpa

Reflecting upon my previous post , I am wondering why LISP triumphalists like Paul Graham annoy me so much? Perhaps it is because I used to be one myself, in spirit if not in syntax.

www.topix.net | 5/28/10 12:21 AM
ABCL Dev: ABCL 0.20.0 released, including first funded feature
On behalf of the developers of ABCL (Armed Bear Common Lisp) I'm glad to be able to announce the 0.20.0 release.

ABCL is a Common Lisp implementation implemented in Java and running on the JVM, featuring both an interpreter and a compiler. The compiler targets the JVM directly meaning that its output is runnable JVM bytecode. The fact that ABCL is written in Java allows for relatively easy embedding in larger applications. For integration with existing applications ABCL implements Java Specification Request (JSR) 223: Java scripting API.

This release is the first to include a funded feature: funds were provided to implement the CLOS METACLASS feature and tests. Next to that, this release contains a large number of fixes and improvements, such
as the ability to use JARs and URLs as pathnames and the a new ASDF version (ASDF2). You can find the full release notes at:


and the list of changes at:


Latest and older binary and source distributions can be downloaded from

abcl-dev.blogspot.com | 5/27/10 9:53 PM
Patrick Stein: TC Lispers May Presentations online

The Twin Cities Lisp Users Group meeting for May was last Tuesday.

Teaching Introductory Programming Using Scheme

Daniel Feldman gave this presentation at the TC Lispers meeting in May 2010.

Teaching Introductory Programming Using Scheme on Vimeo.

ASDF2

Robert Goldman gave this lightning talk to the TC Lispers meeting in May 2010.

ASDF2 on Vimeo.

Programming Contest

Patrick Stein gave this lightning talk to the TC Lispers meeting in May 2010.

Programming Contest on Vimeo.

Lightning talk by Patrick Stein to the Twin Cities Lisp Users Group about hosting a Programming Contest. This presentation was recorded on 2010-05-25.

nklein.com | 5/27/10 3:12 PM