lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Nov 19, 2013 at 12:33 PM, Fabien <fleutot+lua@gmail.com> wrote:
A fun experiment would be to add a purely functional (non-mutable) container in Lua, and see how well it could cohabitate with imperative tables (the result would probably not feel lua-ish at all; maybe more scheme-ish). But my experience is, it rapidly becomes painful to pretend that tables can be used functionally.

I am a Lua newbie (4 months), but my self-assigned task for the past 2.5 months has been to teach a course that uses Lua to explore a few issues in programming languages.  For an early part of the course, I taught my students a bit of functional programming. It mostly worked, but one feature I did miss was the hierarchical list structures I was accustomed to using in Haskell, Scala, etc.  I did an "example" module in which I implemented what I called "cell lists" using a table as a "cons" cell. It was fun, but I suppose these are quite inefficient structures.

http://www.cs.olemiss.edu/~hcc/csci658/notes/658lectureNotes.html#cellList

Conrad