Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

An idea for a freak DWIM lisp-2
I just thought of a specification for a weird lisp-2:

It has function and value cells but figures this out automagically (with
something like identifier-has-procedure?) without bothering the user.

It's somewhat backwards compatible with Scheme (you might want to
replace procedure? with identifier-has-procedure?), allows punning, and
have no need for explicit FUNCALL or #'. The idea should also generalize
to CL-like dialects, though Scheme is used for example code below:

(define a print)
(define a "hello")
(define (test x y) (x y))
(test a a) ; prints "hello"

Perverse!


(let ((list '(a b c d))) ; this doesn't shadow list
(list list))
=> ((a b c d))

(let ((list (lambda (x) 'hmmm))) ; this shadows list
(list list))
=> hmmm

Still allows all lovely/dubious scheme stuff like:

(rpn 1 1 +) ; my friend!

(define (bar) (identity bar))
(((((bar))))) => bar

and even some new stuff like
(define bar 'this-goes-into-value-cell)
(((((bar))))) => 'this-goes-into-value-cell ; given that the function
cell was defined as above

There's a slight problem with call-by-value, you'll have to tweak the
evaluation semantics. I think I've got some solutions to this somewhere
in my skull - it might suffice to change the semantics of

((lambda (new) ...) old)

to make new a shallow copy of all cells of the identifier old, instead
of just the value cell.

Maybe there are other problems (apart from the aesthetic and performance
(Sufficiently Smart Compiler(TM) to the rescue!) problems) I haven't
thought of yet, which'll make it unworkable.

I haven't bothered to implement this because it's so kink, and I'm lazy,
and I just thought of it, and I'm exhausted to the point of
hallucinations from an hour-long bike-ride, but do you think that anyone
would like this?

Regardless, it might be useful as a rhetorical device that both sides in
the ceaseless flamewar between lisp-1 and lisp-2 can use to their
advantage. Or maybe it can bring peace and prosperity to the world.
YEAH, RIGHT! AS IF THOSE CRACKSMOKERS WOULD EVER CHANGE THEIR MINDS, YOU
KNOW WHO I'M TALKING ABOUT. (Err... I'm talking about those with a
differing opinion in the namespace question than you, dear reader, of
course. Not you, I know you'd never touch the pipe, and I know that the
#\c in the name of your favourite lisp doesn't stand for HUGE FREAKING
ROCKS unlike THAT OTHER SHADY CAMP!)

I dub the idea DWIM-lisp-2.

(I don't claim to be the first to invent this - the lisp community has
seen its fair share of monstrosities over the last half-century - but I
haven't seen it, so I do claim independent reinvention.)

XOXOXO,
Sunnan
Follow-up set.

Report this thread to moderator Post Follow-up to this message
Old Post
Sunnan
05-04-05 09:00 PM


Re: An idea for a freak DWIM lisp-2

Sunnan wrote:

> I just thought of a specification for a weird lisp-2:

Oh please please tell me the spec will still only be one page long! That
is soooooo important.

>
> It has function and value cells but figures this out automagically (with
> something like identifier-has-procedure?) without bothering the user.

I see. You realize Common Lisp is winning and that it is just a matter
of months before the Scheme rebellion is pushed into the sea. Of course
you want to negotiate.

Ha! The amnesty period ends on the last day of spring. Throw down your
arms and approach the Common Lisp camp with your hands over your head
holding a copy of Practical Common Lisp. It is a little longer than one
page, so we understand if you have to stop to rest your arms every few
yards.

>
> It's somewhat backwards compatible with Scheme (you might want to
> replace procedure? with identifier-has-procedure?), allows punning, and
> have no need for explicit FUNCALL or #'. The idea should also generalize
> to CL-like dialects, though Scheme is used for example code below:
>
> (define a print)
> (define a "hello")
> (define (test x y) (x y))
> (test a a) ; prints "hello"
>
> Perverse!

Ya think? What problem are you trying to solve, other than Scheme's
imminent extinction?

>
>
> (let ((list '(a b c d))) ; this doesn't shadow list
>    (list list))
> => ((a b c d))
>
> (let ((list (lambda (x) 'hmmm))) ; this shadows list
>    (list list))
> => hmmm
>
> Still allows all lovely/dubious scheme stuff like:
>
> (rpn 1 1 +) ; my friend!
>
> (define (bar) (identity bar))
> (((((bar))))) => bar
>
> and even some new stuff like
> (define bar 'this-goes-into-value-cell)
> (((((bar))))) => 'this-goes-into-value-cell ; given that the function
> cell was defined as above
>
> There's a slight problem with call-by-value, you'll have to tweak the
> evaluation semantics. I think I've got some solutions to this somewhere
> in my skull - it might suffice to change the semantics of
>
> ((lambda (new) ...) old)
>
> to make new a shallow copy of all cells of the identifier old, instead
> of just the value cell.
>
> Maybe there are other problems (apart from the aesthetic and performance
> (Sufficiently Smart Compiler(TM) to the rescue!) problems) I haven't
> thought of yet, which'll make it unworkable.
>
> I haven't bothered to implement this because it's so kink, and I'm lazy,
> and I just thought of it, and I'm exhausted to the point of
> hallucinations from an hour-long bike-ride, but do you think that anyone
> would like this?
>
> Regardless, it might be useful as a rhetorical device that both sides in
> the ceaseless flamewar between lisp-1 and lisp-2 can use to their
> advantage.

Ah, there is your mistake: "ceaseless". That rumbling you hear is the
Common Lisp tank coming up behind your Scheme track bike to administer a
cessation.

> Or maybe it can bring peace and prosperity to the world.
> YEAH, RIGHT! AS IF THOSE CRACKSMOKERS WOULD EVER CHANGE THEIR MINDS, YOU
> KNOW WHO I'M TALKING ABOUT. (Err... I'm talking about those with a
> differing opinion in the namespace question than you, dear reader, of
> course. Not you, I know you'd never touch the pipe, and I know that the
> #\c in the name of your favourite lisp doesn't stand for HUGE FREAKING
> ROCKS unlike THAT OTHER SHADY CAMP!)
>
> I dub the idea DWIM-lisp-2.
>
> (I don't claim to be the first to invent this - the lisp community has
> seen its fair share of monstrosities over the last half-century - but I
> haven't seen it, so I do claim independent reinvention.)
>
> XOXOXO,
> Sunnan
> Follow-up set.

yer gonna love FUNCALL.

:)

kenny

--
Cells? Cello? Cells-Gtk?: http://www.common-lisp.net/project/cells/
Why Lisp? http://lisp.tech.coop/RtL%20Highlight%20Film

"Doctor, I wrestled with reality for forty years, and I am happy to
state that I finally won out over it." -- Elwood P. Dowd


Report this thread to moderator Post Follow-up to this message
Old Post
Kenny Tilton
05-04-05 09:00 PM


Re: An idea for a freak DWIM lisp-2
Sunnan wrote:

>
> (let ((list '(a b c d))) ; this doesn't shadow list
>     (list list))
> => ((a b c d))
>
> (let ((list (lambda (x) 'hmmm))) ; this shadows list
>     (list list))
> => hmmm


(let ((list '()))
(procedure? list))  => ? ; as if we need more ambiguity


Report this thread to moderator Post Follow-up to this message
Old Post
alex goldman
05-04-05 09:00 PM


Re: An idea for a freak DWIM lisp-2
I see that this is posted to both cls and cll. Did I misunderstand how
follow-up works?

alex goldman wrote:
> Sunnan wrote:
>
> 
>
>
>
> (let ((list '()))
>   (procedure? list))  => ? ; as if we need more ambiguity
>

As I tried to clarify, in "freak DWIM lisp-2", you use
"identifyer-has-procedure?" to find out whether or not the function cell
of the identifier list has been bound to a function. "procedure?"
doesn't exist.

Report this thread to moderator Post Follow-up to this message
Old Post
Sunnan
05-04-05 09:00 PM


Re: An idea for a freak DWIM lisp-2
Kenny Tilton wrote:
> Oh please please tell me the spec will still only be one page long!

Well, actually, yeah.

> That is soooooo important.

Please, tell me that your sarcastic adverbs will still have less than
seven #\os!

> Ha! The amnesty period ends on the last day of spring. Throw down your
> arms and approach the Common Lisp camp with your hands over your head
> holding a copy of Practical Common Lisp. It is a little longer than one
> page, so we understand if you have to stop to rest your arms every few
> yards.

"Practical..."? What's that? I am an idealist! I WILL NEVAR SURRENDAR!
 
>
>
> Ya think? What problem are you trying to solve, other than Scheme's
> imminent extinction?

Either:
I was tossing the lisp-2 community a little breadcrumb - the ability to
use functions as arguments without the sharp-quote-eyesores - and/or I
was giving some people the opportunity to say that they LIKE
funcalls/sharp-quotes; and that it's not *only* the ability to go (list
list) that they're after.

Or:

I was tossing the lisp-1 community a little breadcrumb - the ability to
use identifiers for more than one thing at the same time, or... er...
hrm.. something something.
 
>
>
> Ah, there is your mistake: "ceaseless". That rumbling you hear is the
> Common Lisp tank coming up behind your Scheme track bike to administer a
>  cessation.

Watch out, or I'll hit you with a flower!

> yer gonna love FUNCALL.

:)

(Have a nice spring. I hope it's a beautiful day where you are.)

Peace,
Sunnan

Report this thread to moderator Post Follow-up to this message
Old Post
Sunnan
05-04-05 09:00 PM


Re: An idea for a freak DWIM lisp-2

Sunnan wrote:

> Kenny Tilton wrote:
> 
>
>
> Well, actually, yeah.

Ah, well, the only complaints we are getting from the hordes of newbies
stampeding into c.l.l. is that /more/ things should be standardized,
such as threads, sockets, and FFI. So I think the Scheme bet on a small
spec qua language feature sleeps with the fish.

kenny

--
Cells? Cello? Cells-Gtk?: http://www.common-lisp.net/project/cells/
Why Lisp? http://lisp.tech.coop/RtL%20Highlight%20Film

"Doctor, I wrestled with reality for forty years, and I am happy to
state that I finally won out over it." -- Elwood P. Dowd


Report this thread to moderator Post Follow-up to this message
Old Post
Kenny Tilton
05-05-05 01:59 AM


Re: An idea for a freak DWIM lisp-2
Kenny Tilton wrote:
>
>
> Sunnan wrote:
> 
>
>
> Ah, well, the only complaints we are getting from the hordes of newbies
> stampeding into c.l.l. is that /more/ things should be standardized,
> such as threads, sockets, and FFI. So I think the Scheme bet on a small
> spec qua language feature sleeps with the fish.
>

Not that this wasn't about primarily about Scheme vs CL, or about
specification size.

Report this thread to moderator Post Follow-up to this message
Old Post
Sunnan
05-05-05 01:59 AM


Re: An idea for a freak DWIM lisp-2
"Sunnan" <sunnan@handgranat.org> wrote in message
news:4278B15A.5080603@handgranat.org...

*snip*
>
> Maybe there are other problems (apart from the aesthetic and performance
> (Sufficiently Smart Compiler(TM) to the rescue!) problems) I haven't
> thought of yet, which'll make it unworkable.

All lookups will probably have to be at run-time

I can do this in Lisp-1

(define (foo list)
(print list)
(map (lambda (fn) (fn 3 5)) list))

(foo (list + - / *))

and Lisp-2

(defun foo (list)
(print list)
(mapcar (lambda (fn) (funcall fn 3 5)) list))

(foo (list #'+ #'- #'/ #'*))

What does DWIM-lisp-2 do?

--
Geoff



Report this thread to moderator Post Follow-up to this message
Old Post
Geoffrey Summerhayes
05-05-05 09:00 PM


Re: An idea for a freak DWIM lisp-2
Geoffrey Summerhayes wrote:

> I can do this in Lisp-1
> What does DWIM-lisp-2 do?

I think the idea is to let you do

(define (foo list)
(list list))


Report this thread to moderator Post Follow-up to this message
Old Post
alex goldman
05-06-05 01:58 AM


Re: An idea for a freak DWIM lisp-2
Geoffrey Summerhayes wrote:
> "Sunnan" <sunnan@handgranat.org> wrote in message
> news:4278B15A.5080603@handgranat.org...
>
> *snip*
> 
>
>
> All lookups will probably have to be at run-time

I don't *think* that should be necessary, but I might've missed something.
In DWIM-lisp-2, the semantics of the evaluation of the car position is
different from the semantics of the evaluation of the other positions.

> What does DWIM-lisp-2 do?

Oh, I just reread your post and reinterpreted this as a question about
how DWIM-lisp-2 would work.

The scheme example would run as is in DWIM-lisp-2.

This latter stuff I wrote, before I reread your post, as a reply to,
because I thought you meant "what is the point of DWIM-lisp-2" (which
might still be what you mean, I don't know).
> What does DWIM-lisp-2 do?

Allows you to do all stuff you can do with a lisp-1; simultaneously as
it lets you do all the stuff you can do with a lisp-2.

One (rather useless) thing you only can do with dwim-lisp-2 (afaik) is:

(define bar (lambda () (identity bar)))
(define bar 3)
(+ bar ((((bar)))) (((((bar))))))
=> 9

This will work like this:
the program will see that the identifier bar is used in a
non-car-position and will use the value cell, 3. The program will also
see the bars in car position, where it uses the function cell (lambda ()
(identity bar)) and will repeatedly eval it until it gets it in a
non-car-position, where it'll use the value cell, 3.

Maybe there is some useful stuff you can do, I haven't thought of any.

The main point was to make a way for schemers to see the relative flaws
and benefits of having multiple namespaces without drowning in all the
#' and funcalls, and a way for CL:ers to see the relative flaws and
benefits of not having #' and funcalls, without drowning in all of the
unable-to-do-(list list)-ness.

Now, some people (mainly CL:ers) have argued for #' and FUNCALL being
good things in themselves since they make explicit when you're using
functions as values.

Others (mainly schemers) have argued for having only one namespace as a
good thing because the same identifyer shouldn't refer to two different
things at the same time.

I'm actually somewhat in the latter camp but I'm still intrigued by this
idea of dwim-lisp-2.

I think everyone on earth would think that the *opposite* of dwim-lisp-2
would be totally crap.

I mean a lisp where you had to use #' and funcall but still only had one
namespace. :)

Report this thread to moderator Post Follow-up to this message
Old Post
Sunnan
05-06-05 09:02 AM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

Scheme archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:36 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.