3 ms·
Yeah, I don't like Tcl either. :)
by silentbicycle 16y ago
Yeah, I don't like Tcl either. :)
- mahmud 16y agoAlso, take a look at the Lua 5 compiler. That fucker does matrices on par with Fortran, with just 500k worth of compiler + runtime! I particularly loved their hack for sparse matrices; they're implemented as hash-tables where the indices are zero-based integers, so only the indices that are initialized are created. Meaning, you can have an array with a few indices without having to create all the empty cells in between. I benchmarked it and it's far more than adequate. Makes graph algorithms breezy. Lua is very much an acceptable Scheme.
- silentbicycle 16y agoEach table (dict, hash, whatchamacallit) has a hash portion and an array portion, and contiguous integer keys are stored internally in the array. So, tables automatically adapt their internal implementation for use as an array, a dict, or both, at runtime. They're unique to Lua, AFAIK. It also has an interesting hash table optimization (that I don't quite grok). I've been reading through the Lua code bit by bit, but haven't made it there yet. Lots of other interesting stuff, though. LuaJIT's not too shabby, either! Lua's my favorite language for quick hacks, period. I wrote a library to add fairly idiomatic pattern matching (http://github.com/silentbicycle/tamale/ http://github.com/silentbicycle/tamale/). Every language needs pattern matching. :) I'm still working on explaining PM to people who aren't already into Erlang or ML, but it's documented now.
- mahmud 16y agoYou win this round, again.