Lisp links thread

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
Post Reply
User avatar
teamonkey
Sheepie Whore
Sheepie Whore
Posts: 12082
Joined: Thu Jun 13, 2002 1:07 am 0
XBL Gamertag: itsthetaste
PSN: teamonkey_ca
Contact:

Post by teamonkey »

lis0r wrote:Lisp throws away all the practicality, most links with the real world, and concentrates on the theoretical basis of computation.
I've seen so much about how lisp is the language to use for pretty much everything, that it's so much faster to write good, clean, extensible Lisp code than in any other language. It should be very practical indeed! I've found many sources claiming that, but their reasons essentially boil down to "it just is" which lead me to believe that they don't actually know either. :)

There have been several obstacles in the way of me properly learning Lisp. The biggest overarching complaint that I have is that computer science scholars are exceptionally bad at describing things, and especially those dealing with Lisp. Lisp isn't a mainstream language, so the few people who can actually write coherent, useful teaching guides haven't. Picking up the language is easy enough because it's so simple at heart, working out why you'd ever want to use it is turning out to be really hard work.

For example, a perfect introductory guide would start with the second frame of that cartoon with the caption "This Is Lisp" - for me that epiphany happened only after many months, and it's something you really need to understand before you can actually do anything.

The other big problem that I have is that I'm working at learning Lisp backwards. That is, I'm already familiar with Lua, Javascript and Python, which are all derived from Lisp in some respect or other. I'm used to the Lisp-like features, so I think I'm dulled by them. Functions as values, closures and so on. Lua in particular seems to do quite a lot of things better than Lisp from a practical point of view. But I'm probably missing something.

Anyway, I'm about a fifth of the way through On Lisp, thanks to the link up there, so we'll see how it goes.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Post by adam »

http://www.defmacro.org/ramblings/lisp.html

this one supposedly is good at explaining why lisp is amazingly earth shatteringly good... i've only got through the hype at the beginning, have yet to read the content itself, but some random blogger raves about this article, so it must be good ;-)
User avatar
Firefox
Sheepie Whore
Sheepie Whore
Posts: 11412
Joined: Fri Apr 26, 2002 6:15 pm 0
Location: Sheffield

Post by Firefox »

teamonkey wrote:The other big problem that I have is that I'm working at learning Lisp backwards. That is, I'm already familiar with Lua, Javascript and Python, which are all derived from Lisp in some respect or other. I'm used to the Lisp-like features, so I think I'm dulled by them. Functions as values, closures and so on. Lua in particular seems to do quite a lot of things better than Lisp from a practical point of view. But I'm probably missing something.
No, I think you're probably spot on there.

I very much see Lua as the other side of the same coin as Lisp. Lisp does everything with lists; Lua does everything with hashes. But as you say they're very similar in the fundamental concepts they support and the sort of things they allow a programmer to do.

I learnt Lisp first, and went through the long don't-really-get-this period, followed by the sudden epiphany were it all clicked and I jumped out of my seat in surprise. I only really use it to add bits to my .emacs and .sawfishrc, but I'm really grateful I put the effort in to learn it; I even saw C coding in a new light afterwards.

So you've probably had your big Lisp epiphany already, but whilst learning other languages. :)
"I am a very considerate person. If I want to go out all night on my miniature golf course and shoot lizards, well, no reason to keep the neighbours awake..."
User avatar
lis0r
Baaaa!
Baaaa!
Posts: 894
Joined: Tue Jan 10, 2006 9:26 am 0
Location: The Frozen Wastelands Of The North

Post by lis0r »

Firefox wrote:No, I think you're probably spot on there.
As someone who's had to rewrite half the Lua VM to get it to do some of the things Lisp can do out of the box, I think we'll have to agree to disagree! :wink:
User avatar
Firefox
Sheepie Whore
Sheepie Whore
Posts: 11412
Joined: Fri Apr 26, 2002 6:15 pm 0
Location: Sheffield

Post by Firefox »

lis0r wrote:
Firefox wrote:No, I think you're probably spot on there.
As someone who's had to rewrite half the Lua VM to get it to do some of the things Lisp can do out of the box, I think we'll have to agree to disagree! :wink:
Ooooooooooh! Out-l33ted! :D

Go on then! What sort of things, and why would you need to rewrite the VM to do them? :)
"I am a very considerate person. If I want to go out all night on my miniature golf course and shoot lizards, well, no reason to keep the neighbours awake..."
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Post by adam »

this ones suitably lo-fi, and only 10 years old as well ;-) http://www.nhplace.com/kent/PS/About-PS.html
User avatar
lis0r
Baaaa!
Baaaa!
Posts: 894
Joined: Tue Jan 10, 2006 9:26 am 0
Location: The Frozen Wastelands Of The North

Post by lis0r »

Firefox wrote:Ooooooooooh! Out-l33ted! :D

Go on then! What sort of things, and why would you need to rewrite the VM to do them? :)
Mostly issues of overriding and proxying.

The project was a rather cunning full automatic C/scripting language binding engine. Run a few tools over the decorated abstract syntax tree for a C or C++ program, and you'd be able to instantiate any data types and call any functions defined therein.

One major issue was intercepting assigning values to a variable. You can't, at all. You can override assigning value to a table member, but that's really not the same thing. It makes user transparent proxy objects virtually impossible to create. There are also assorted problems related to making one type behave like another - at a VM level, it's impossible. The garbage collector is also written on the assumption that the user is a retard - Lua code can't hook it's own GC, because the authors don't trust the user to understand there might be limitations on what they can do.

Hacking this facility in was an absolute nightmare - the VM is, basically, undocumented. I had to add huge amounts of code to the parts that interact with the stack, in addition to a whole raft of extra metamethods.

Unfortunately, the authors are proud of the deficiencies in their language. It's almost as if they're of the mind set that it's a toy or a pet project - nothing more. Development is done under the covers, with virtually no community interaction, and the language is often backwards incompatible, even between point releases. As far as it goes, Lua does do some things better than Lisp. It's only when you need to take it that little bit further that you realise Lisp is being quirky for a reason - with Lua, you're just SOL.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Post by adam »

that sounds hardcooer lisor ;-)

todays lisp link is sketchy lisp

slightly... no, thats not it, must recopy link to clipboard, here we are: http://www.t3x.org/sketchy/vol1/toc1.html
User avatar
Firefox
Sheepie Whore
Sheepie Whore
Posts: 11412
Joined: Fri Apr 26, 2002 6:15 pm 0
Location: Sheffield

Post by Firefox »

lis0r wrote:(much hardcore stuff)
Blimey! I hadn't thought of that! :o

I'll have to go away and have a think about the proxying stuff... I'm sure there must be a way to do it. :?

I have my own homebrew Lua C/C++ binding tool, but it's very simple and I will admit that it requires that I slant my C/C++ APIs towards working well with it. I had plans to improve it, but so far I haven't felt a strong enough need to divert time away from other stuff so far...

I've watched Lua evolve over the last decade. It started out as a couple of mini languages, and grew and grew from there as it became more and more useful to more and more people. I don't think they set out to create a general-purpose language, it just sort of happened. :)

Probably you can't hook the garbage collector because it hadn't occurred to them. I've never thought of that; to me the garbage collector is something that works away in the background and that you don't have to worry about.

Perhaps I should've said "Lua is the other side of the same coin as Scheme", not Lisp? I.e., just the basic language, without any of the libraries or environment?

In any case, I think I'm going to have to do a serious project in Common Lisp sometime in the near future! :)
"I am a very considerate person. If I want to go out all night on my miniature golf course and shoot lizards, well, no reason to keep the neighbours awake..."
User avatar
teamonkey
Sheepie Whore
Sheepie Whore
Posts: 12082
Joined: Thu Jun 13, 2002 1:07 am 0
XBL Gamertag: itsthetaste
PSN: teamonkey_ca
Contact:

Post by teamonkey »

lis0r: Was that pre-5.1 or post-5.1? Lua 5.1 introduces a new garbage collection system that you can overload (and you can also hook your own memory allocation routines into lua_alloc).
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Post by adam »

User avatar
Firefox
Sheepie Whore
Sheepie Whore
Posts: 11412
Joined: Fri Apr 26, 2002 6:15 pm 0
Location: Sheffield

Post by Firefox »

teamonkey wrote:Lua 5.1 introduces a new garbage collection system that you can overload (and you can also hook your own memory allocation routines into lua_alloc).
Really? Time for me to update from 5.0.2 then! :)
"I am a very considerate person. If I want to go out all night on my miniature golf course and shoot lizards, well, no reason to keep the neighbours awake..."
User avatar
lis0r
Baaaa!
Baaaa!
Posts: 894
Joined: Tue Jan 10, 2006 9:26 am 0
Location: The Frozen Wastelands Of The North

Post by lis0r »

teamonkey wrote:lis0r: Was that pre-5.1 or post-5.1? Lua 5.1 introduces a new garbage collection system that you can overload (and you can also hook your own memory allocation routines into lua_alloc).
This was post - that only works for a restricted number of data types, none of which are actually available from within the language, IIRC.
User avatar
lis0r
Baaaa!
Baaaa!
Posts: 894
Joined: Tue Jan 10, 2006 9:26 am 0
Location: The Frozen Wastelands Of The North

Post by lis0r »

Firefox wrote:Really? Time for me to update from 5.0.2 then! :)
Careful - you may well buttfuck your Lua code in the process. Various things have changed between 5.0 and 5.1 in highly incompatible ways.
User avatar
Firefox
Sheepie Whore
Sheepie Whore
Posts: 11412
Joined: Fri Apr 26, 2002 6:15 pm 0
Location: Sheffield

Post by Firefox »

Okay, in that case I'll carefully examine 5.1 in order to see how it differs from 5.0. :)

I must admit that I haven't really been keeping up with developments in the Lua world lately, just doing the occasional "cp -rp ../../lua-5.0.2" when I start a new program...
"I am a very considerate person. If I want to go out all night on my miniature golf course and shoot lizards, well, no reason to keep the neighbours awake..."
Post Reply