Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Lisp > Re: A question ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 11 of 66 Topic 12412 of 13573
Post > Topic >>

Re: A question (confusion) about closure

by "xahlee@[EMAIL PROTECTED] " <xahlee@[EMAIL PROTECTED] > May 5, 2008 at 08:33 PM

Dear Stefan and all,

If you could, put out a snippet of code of closure, in emacs lisp.
I'll show how it is done with global vars.

Common Lisp is fine but i don't know Common Lisp.

------------

For good or bad, i'd like to reiterate here: folks, closures are
effectively just function using global vars. This, is the most clear
statement capturing the heart of closure, and illustrating it in a
background practically all modern computer languages can understand.

It is just one perspective, not the only way. It isn't a correct
description if taken from the perspective of history. It isn't a
sensible description from the perspective of implementation. But from
semantic point of view, with a touch of education and pragmatics, it
is perfect.

what you guys are saying, are technical details. One social way to see
this is that, effectively the closure is used in lisp community only.
Outside, may it be bash, perl, python, javascript, Java, Haskell,
Mathematica, the term is effectively unknown. Not that these languages
doesn't have the power of closure builtin, just that the term is
foreign. Why? Precisely because only the Lisp languages, define or
implement them in particular way, and call it Closure.

Stefan Nobis <sno...@[EMAIL PROTECTED]
> wrote:
=C2=ABA closure is, to try a more formal, mathematical definition, an
object consisting of two components: a function body (the code) and an
accompanying environment (just a bunch of data). ...=C2=BB

Yeah. Now, that accompanying env, can be the global env. One just need
to partition it so as to become several envs with a identification
scheme. One simple to illustrate way, is by tagging id to the var
names. (folks, was this so hard to understand? was this so deep a
concept that required me like 5 painful messages in heavy competition
to finially clarify? Recall, Rainer began, by called me FUD! That's
FEAR, UNCERTAINTY, and DOUUUUUUUBT!!!)

Effectively, a closure is just language feature that allow users to
create subroutines that works as a state machine. Alternatively, a
closure feature that would give a subroutine a paper and pen, where it
can write down values and remember it.

Global vars is one big piece of paper folks. Share!

For a good, fresh, simple, explanation of the semantic essence, of
many jargons and concepts in computing esp those associated with OOP,
see:

 What are OOP's Jargons and Complexities
 http://xahlee.org/Periodic_dosage_dir/t2/oop.html

Read the above, and you'll come away with a clarity, of the
mathematical essence of many jargons and concepts you hear all day,
like never before.

If nobody can show a snippet of emacs lisp code of closure for me to
tear down, then i demand 3 public posts of this content: Xah Lee is a
beautiful.

PS soliloquy to myself: gosh, i so hate tech geekers. The dumb, fat,
stupid, ugly, common, plebian, *****. Slaving around the world all
day, just to contradict me and pull me down. O, this reminds me,
Friedrich Nietzsche wrote about Master-slave morality. Yeah, the
****ing ***** of the mundane. Catch heart attack!!!!!

  Xah
  xah@[EMAIL PROTECTED]
 http://xahlee.org/

=E2=98=84

On May 5, 8:01 am, Stefan Nobis <sno...@[EMAIL PROTECTED]
> wrote:
> "xah...@[EMAIL PROTECTED]
" <xah...@[EMAIL PROTECTED]
> writes:
> > People, closures is effectively just function using global vars,
> > alright?
>
> No, you just can't emulate closures completley by using global vars,
> because your global vars have to be defined at compile time but new
> closures may be generated at run time.
>
> The only way to make your statement true, is to rub out all common
> meaning of global vars and substitute it's meaning with something like
> 'my global var is a complex machinery, that may store dynamically an
> unbound number of data'.
>
> A closure is, to try a more formal, mathematical definition, an object
> consisting of two components: a function body (the code) and an
> accompanying environment (just a bunch of data). The im****tant issue
> here is that a single function body (=3D piece of code found in the
> sources) may be used to create (unbound) many *different* closures
> (each with quite different data), all existing at the same time in
> parallel (so just resetting global state before each function call
> based on a bound, static number of global variables, is not enough to
> simulate this -- you need at least something like a (global)
> dictionary and quite some bookkeeping code).
>
> No Common Lisp, even no source code. I hope, now you are satisfied and
> you see, you misunderstood the concept.
>
> BTW: I find it really exceptional to reason about programming concepts
> and at the same time to declare concrete examples with source code to
> be a hindrance in understanding -- every other people I know of see
> this quite the other way round: Concrete examples are helpful to
> better understand programming concepts. (And in a group like
> comp.lang.lisp examples in Lisp came quite naturally, don't you think
> so?)
>
> --
> Stefan.
 




 66 Posts in Topic:
A question (confusion) about closure
Samik <samikc@[EMAIL P  2008-05-02 01:31:18 
Re: A question (confusion) about closure
"xahlee@[EMAIL PROTE  2008-05-02 02:02:14 
Re: A question (confusion) about closure
lisp2.3.CalRobert@[EMAIL   2008-05-04 02:44:05 
Nigerian spammer harvesting from these newsgroups (was: A questi
lisp2.3.calrobert@[EMAIL   2008-05-28 13:41:29 
Re: Nigerian spammer harvesting from these newsgroups (was: A qu
Stan <spamblock@[EMAIL  2008-05-28 23:18:11 
Re: A question (confusion) about closure
"xahlee@[EMAIL PROTE  2008-05-05 02:16:48 
Re: A question (confusion) about closure
Ken Tilton <kennytilto  2008-05-05 07:10:48 
Re: A question (confusion) about closure
pjb@[EMAIL PROTECTED] (P  2008-05-05 15:15:36 
Re: A question (confusion) about closure
Stefan Nobis <snobis@[  2008-05-05 17:01:04 
Re: A question (confusion) about closure
usenet1.3.CalRobert@[EMAI  2008-05-08 02:13:13 
Re: A question (confusion) about closure
"xahlee@[EMAIL PROTE  2008-05-05 20:33:02 
Re: A question (confusion) about closure
George Neuner <gneuner  2008-05-06 02:48:19 
Re: A question (confusion) about closure
pjb@[EMAIL PROTECTED] (P  2008-05-06 09:46:34 
Re: A question (confusion) about closure
Aaron Brown <arundelo@  2008-05-05 22:36:11 
Re: A question (confusion) about closure
Didier Verna <didier@[  2008-05-06 09:57:41 
Re: A question (confusion) about closure
viper-2 <visionat@[EMA  2008-05-06 08:14:08 
Re: A question (confusion) about closure
Didier Verna <didier@[  2008-05-06 18:14:43 
Re: A question (confusion) about closure
viper-2 <visionat@[EMA  2008-05-06 11:32:54 
Re: A question (confusion) about closure
Rainer Joswig <joswig@  2008-05-06 21:00:50 
Re: A question (confusion) about closure
pjb@[EMAIL PROTECTED] (P  2008-05-07 09:13:02 
Re: A question (confusion) about closure
Didier Verna <didier@[  2008-05-06 21:05:03 
Re: A question (confusion) about closure
pjb@[EMAIL PROTECTED] (P  2008-05-07 09:24:00 
Re: A question (confusion) about closure
viper-2 <visionat@[EMA  2008-05-06 12:45:55 
Re: A question (confusion) about closure
Rainer Joswig <joswig@  2008-05-06 22:00:36 
Re: A question (confusion) about closure
Didier Verna <didier@[  2008-05-07 09:33:21 
Re: A question (confusion) about closure
Didier Verna <didier@[  2008-05-07 10:01:58 
Re: A question (confusion) about closure
"John Thingstad"  2008-05-07 12:22:42 
Re: A question (confusion) about closure
Didier Verna <didier@[  2008-05-07 13:55:10 
Re: A question (confusion) about closure
pjb@[EMAIL PROTECTED] (P  2008-05-07 17:29:51 
Re: A question (confusion) about closure
viper-2 <visionat@[EMA  2008-05-07 06:50:30 
Re: A question (confusion) about closure
"xahlee@[EMAIL PROTE  2008-05-07 07:50:06 
Re: A question (confusion) about closure
Didier Verna <didier@[  2008-05-07 17:48:02 
Re: A question (confusion) about closure
pjb@[EMAIL PROTECTED] (P  2008-05-07 17:56:46 
Re: A question (confusion) about closure
Didier Verna <didier@[  2008-05-07 17:51:56 
Re: A question (confusion) about closure
Didier Verna <didier@[  2008-05-07 18:02:00 
Re: A question (confusion) about closure
Rainer Joswig <joswig@  2008-05-07 18:29:09 
Re: A question (confusion) about closure
pjb@[EMAIL PROTECTED] (P  2008-05-13 14:29:41 
Re: A question (confusion) about closure
viper-2 <visionat@[EMA  2008-05-07 11:35:16 
Re: A question (confusion) about closure
Rainer Joswig <joswig@  2008-05-07 20:57:00 
Re: A question (confusion) about closure
"John Thingstad"  2008-05-02 12:44:36 
Re: A question (confusion) about closure
Alan Crowe <alan@[EMAI  2008-05-02 13:02:48 
Re: A question (confusion) about closure
pjb@[EMAIL PROTECTED] (P  2008-05-02 17:25:23 
Re: A question (confusion) about closure
"joswig@[EMAIL PROTE  2008-05-02 16:11:11 
Re: A question (confusion) about closure
Tim X <timx@[EMAIL PRO  2008-05-07 20:02:30 
Re: A question (confusion) about closure
Edward <edward.dodge@[  2008-05-02 16:19:56 
Re: A question (confusion) about closure
"xahlee@[EMAIL PROTE  2008-05-02 18:07:31 
Re: A question (confusion) about closure
George Neuner <gneuner  2008-05-03 01:47:52 
Re: A question (confusion) about closure
George Neuner <gneuner  2008-05-03 03:42:16 
Re: A question (confusion) about closure
"xahlee@[EMAIL PROTE  2008-05-03 01:34:52 
Re: A question (confusion) about closure
"joswig@[EMAIL PROTE  2008-05-03 02:24:05 
Re: A question (confusion) about closure
viper-2 <visionat@[EMA  2008-05-03 07:24:04 
Re: A question (confusion) about closure
Tim X <timx@[EMAIL PRO  2008-05-04 17:21:38 
Re: A question (confusion) about closure
"xahlee@[EMAIL PROTE  2008-05-04 08:02:23 
Re: A question (confusion) about closure
Ken Tilton <kennytilto  2008-05-04 16:56:33 
Re: A question (confusion) about closure
George Neuner <gneuner  2008-05-04 22:28:19 
Re: A question (confusion) about closure
Ken Tilton <kennytilto  2008-05-05 00:13:14 
Re: A question (confusion) about closure
Kent M Pitman <pitman@  2008-05-05 03:06:50 
Re: A question (confusion) about closure
"John Thingstad"  2008-05-05 09:30:22 
Re: A question (confusion) about closure
Rainer Joswig <joswig@  2008-05-05 10:08:40 
Re: A question (confusion) about closure
George Neuner <gneuner  2008-05-06 17:12:20 
Re: A question (confusion) about closure
George Neuner <gneuner  2008-05-05 05:01:16 
Re: A question (confusion) about closure
Don Geddis <don@[EMAIL  2008-05-06 09:52:22 
[OT] Re: A question (confusion) about closure
Tim X <timx@[EMAIL PRO  2008-05-07 19:55:55 
Re: [OT] Re: A question (confusion) about closure
dkcombs@[EMAIL PROTECTED]  2008-06-07 01:37:57 
Re: [OT] Re: A question (confusion) about closure
Tim X <timx@[EMAIL PRO  2008-06-07 18:16:36 
Re: Nigerian spammer harvesting from these newsgroups (was: A
wooks <wookiz@[EMAIL P  2008-07-17 13:22:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 6 10:52:13 CDT 2008.