Log in

How did I not find this language years ago ? (or my 'finding lisp') - Kreely's Journal [entries|archive|friends|userinfo]

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

How did I not find this language years ago ? (or my 'finding lisp') [Jul. 1st, 2009|09:53 am]
[mood |thoughtfulthoughtful]

It's really odd.
One can go through life feeling very clever and up to date, learning paradigms like object oriented programming, grokking new languages (like Python and C#) and getting really good at DB interaction.

Then, a couple of years ago, I took on a contract and ran into a ex-CIO who seemed quite good at architecture. I got talking with him about languages one day and he said his favourite language was common lisp.
I was genuinely surprised and I came out with what I later find is one of the stock standard arguments against lisp, "isn't it quite slow". He said you get speeds approaching C/C++ and more power to boot. He recommended that I have a look at SICP if I was interested in finding out about lisp like languages.

I still haven't finished SICP (still on my list to finish off), but one quote in the foreword really stuck with me

Lisp changes. The Scheme dialect used in this text has evolved from the original Lisp and differs from the latter in several important ways, including static scoping for variable binding and permitting functions to yield functions as values. In its semantic structure Scheme is as closely akin to Algol 60 as to early Lisps. Algol 60, never to be an active language again, lives on in the genes of Scheme and Pascal. It would be difficult to find two languages that are the communicating coin of two more different cultures than those gathered around these two languages. Pascal is for building pyramids -- imposing, breathtaking, static structures built by armies pushing heavy blocks into place. Lisp is for building organisms -- imposing, breathtaking, dynamic structures built by squads fitting fluctuating myriads of simpler organisms into place. The organizing principles used are the same in both cases, except for one extraordinarily important difference: The discretionary exportable functionality entrusted to the individual Lisp programmer is more than an order of magnitude greater than that to be found within Pascal enterprises. Lisp programs inflate libraries with functions whose utility transcends the application that produced them. The list, Lisp's native data structure, is largely responsible for such growth of utility. The simple structure and natural applicability of lists are reflected in functions that are amazingly nonidiosyncratic. In Pascal the plethora of declarable data structures induces a specialization within functions that inhibits and penalizes casual cooperation. It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures. As a result the pyramid must stand unchanged for a millennium; the organism must evolve or perish.

Strangely enough about 11 years worth of my experience is in Pascal. After discovering lisp, I find large parts of what goes on inside pascal to be very much about building rigid structures and being very careful to think about types. Pascal is good for what it does and is quite useful for relatively simple apps, but to make more complex dynamic software, one ends up writing subsets of lisp in pascal (Greenspuns tenth rule http://en.wikipedia.org/wiki/Greenspun%27s_Tenth_Rule).

Since reading that I've come across other quotes from people doing lispy things, this from Rich Hickey who developed Clojure
Discovering Common Lisp after over a decade of C++, I said to myself — 'What have I been doing with my life?', and resolved to at some point code in Lisp. Several years of trying to make that practical, with 'bridges' like jFli, Foil etc, made it clear that bridges weren't going to be sufficient for the commercial work I was doing.

quoted from http://lwn.net/Articles/335966/

The 'what have I been doing with my life?' part of the quote has really resonated with me. With such an amazing language, large chunks of what I've been doing seem somehow wasted when I could have done them with more ease in lisp.

I am starting to sound like a bible salesman, but you get that.

The next trick to pull off will be to use lisp to make some wildly useful tools in the C/C#/Pascal/SQL/HTML world that I live in. Should be fun, though may take some time.

From: (Anonymous)
2009-07-01 02:37 pm (UTC)

check out forth

check out forth
(Reply) (Thread)
From: (Anonymous)
2009-07-01 04:12 pm (UTC)

Re: check out forth

There is quite a bit of similarity (in principle) between LISP and other (mostly monadic) languages.

FORTH is an amazing language, but there's something about it which prevented its adoption. I have a love/hate relationship with it. It allows nearly free-form syntax, the solving of problems by constructing a solution vocabulary, interactivity second to none and can be implemented in a small amount of assembler code.

On the other hand, the semantics of using a stack as your primary data structure can become quite strange and easily gets out of hand. I know there are ways around it, but...

List (or more generally treap/hash) based languages provide a powerful and universal data structure that encourages general tool development, much as the author explains. There are parallels with unix pipe scripting as well.

Personally I like to use one powerful, general-purpose compiled language (currently D), write short utilities with a great scripting language (Python or Lua - both list/treap based) and play with a promising new language.

My favorite new language to learn is Haskell. It's very closely related to Scheme, though the syntax is easier on the eye. Its interactive, compiles to highly efficient machine language and it natively supports multi-core, multi-threading expressions / algorithms.

Quicksort can be expressed elegantly in a short, single, understandable line of code. (!!)

I have an neural net / AI project which I think would be wonderfully suited to it.

Check them all out.

FORTH: http://thinking-forth.sourceforge.net/
D: http://www.digitalmars.com/d/
Python: http://www.greenteapress.com/thinkpython/thinkCSpy/html/
Lua: http://en.wikipedia.org/wiki/Lua_(programming_language)
Haskell: http://www.haskell.org/haskellwiki/Introduction

(Reply) (Parent) (Thread)
From: (Anonymous)
2009-07-01 06:01 pm (UTC)

Re: check out forth

There are also other stack based languages which are purer or more modern replacements for good old Forth. Look at Factor, Cat and Joy.
(Reply) (Parent) (Thread)
[User Picture]From: kreelman
2009-07-01 11:25 pm (UTC)

Re: check out forth

Cool, thanks guys for the links and the ideas.
I remember someone explaining forth to me when I was about 13. I don't think I've heard of it much since then. So it probably passes one of the tests for a lost jewel of a language.
Always interesting to look at new stuff.

(Reply) (Parent) (Thread)
[User Picture]From: laikasrocket
2009-07-02 07:08 am (UTC)

Re: check out forth

For an interesting little FORTH inspired LISP, check out PicoLisp (it also comes with a PROLOG dialect built in):

(Reply) (Parent) (Thread)
[User Picture]From: kragen
2009-07-02 01:08 am (UTC)
I had the same experience; the CIO in my case was Jay Lark, and he wasn't a CIO quite yet. (And I had read Wilensky's Lispcraft years before, which opened my eyes quite a bit, too, but it was really SICP that changed my outlook. I wrote an essay about my evolution as a programmer which you can find if you are interested.)

Who was the CIO in your case?

My current preferred Lisp-equivalents are Python and JavaScript. They are quite slow, and I do use Common Lisp sometimes.
(Reply) (Thread)
[User Picture]From: kreelman
2009-07-09 06:41 am (UTC)
Hi Kragen,
The fellow I met was James Thorpe. He used to be a manager at Borland Australia and then became a CIO somewhere else after that.

Not wanting to be contrarian/annoying, but I don't know if I'd call Python lisp-like. There are some similarities, but I think the code is data thing is not there in Python. Are functions first class objects in Python (I've not looked into it)?

Must finish SICP. Must finish SICP. Must finish SICP. Must finish SICP....
(Reply) (Parent) (Thread)
[User Picture]From: kragen
2009-07-09 08:50 am (UTC)
Not wanting to be contrarian/annoying, but I don't know if I'd call Python lisp-like.

Well, you're entitled to your opinion, of course, but you should read Norvig's before you make up your mind completely. Don't worry about being annoying.

There are some similarities, but I think the code is data thing is not there in Python.

No, it's not, except in the trivial senses that you can eval or exec a string, and there's a module for parsing Python code so you can e.g. analyze Python programs for errors. In particular there are no macros. (But there were no macros in Lisp until sometime around 1970, either, and in some Lisps until well after that.) If it's embedded DSLs you want, you can do quite a bit in that direction by overriding __getattribute__ and operators.

Python is, however, reflective.

Are functions first class objects in Python (I've not looked into it)?

Yes, to the same extent as in a statically-scoped Lisp, and therefore to a greater extent than in older dynamically-scoped Lisps (elisp, any Lisp before 1976, most Lisps before Common Lisp). There's a minor syntactic annoyance, which is that Python distinguishes expressions from statements, and if you want to create a closure that contains statements, you can't do it in the middle of an expression; you have to do it in a def statement, which assigns it a name that you can then use inside an expression. But that's a purely syntactic constraint; it doesn't affect the power of the language.

On SICP: don't rush yourself. If it's going slowly, you may not be ready to go fast through a certain part of it yet. SICP is like a sushi dinner prepared by one of the world's best chefs: you can enjoy it enormously, but if you force it down your gullet as fast as it will go, you will be missing out on a lot. Worse, it may not stay down. Wait until your appetite has had a chance to recover before ordering another plate of uni. Maybe come back tomorrow.

(Reply) (Parent) (Thread)
From: ext_197072
2009-07-03 09:32 pm (UTC)

Grandson of Pascal - Oberon 2 and Component Pascal

I've found Oberon 2 and the commercial (though now open source) BlackBox Component Pascal to have a lot of the organismic qualities of Lisp. They were developed by Wirth and some of his grad students.

See oberon.ch/blackbox.html for more info (auf Deutch, but the docs in the downloadable (Windows only) version are in English).

Component Pascal has also available compilers for .NET and JVM, with an IDE available from CFB Software: http://www.cfbsoftware.com/cpide/cpide.aspx (see there for links to the compilers.
(Reply) (Thread)
[User Picture]From: kreelman
2009-07-09 06:42 am (UTC)

Re: Grandson of Pascal - Oberon 2 and Component Pascal

I've not looked into them. I might have a look. Thanks
(Reply) (Parent) (Thread)
From: (Anonymous)
2011-01-02 11:28 am (UTC)
I can see you happen to be an expert at your field! I am launching a website soon, and your facts will likely be quite fascinating for me.. Thanks for all your assist and wishing you all the success.
(Reply) (Thread)
From: (Anonymous)
2011-01-11 07:14 am (UTC)

Lily didn hallway narrowed like another could unify and choked mbc.

Blithesome Reborn Year[url=http://sdjfh.in/flexpen/],[/url] everybody under the sun! :)
(Reply) (Thread)
From: (Anonymous)
2011-01-18 02:57 am (UTC)

provides access

Cool article. No surprises that Google was number 1…
(Reply) (Thread)
From: (Anonymous)
2011-01-27 07:41 pm (UTC)


Онлайн порно (http://megafreeporn.ru/)
(Reply) (Thread)
From: (Anonymous)
2011-04-13 02:06 pm (UTC)

Looking forward to have my say

Hey - I am definitely delighted to discover this. great job!
(Reply) (Thread)