## Long Live the Minute Difference

Expand Messages
• I had a Structure and Interpretation of Computer Programs class today. The lecturer demonstrated how one can construct a type of a rational number using the
Message 1 of 13 , Dec 17 4:28 AM
• 0 Attachment
I had a "Structure and Interpretation of Computer Programs" class today.
The lecturer demonstrated how one can construct a type of a rational
number using the following notation:

(define (make-rat n d) (cons n d))

(define (numer r) (car r))
(define (denom e) (cdr r))

He then said we can also simply say:

(define make-rat cons)
(define numer car)
(define denom cdr)

And they will behave _exactly_ the same. I told him that they do not
behave exactly the same. The first notation when called will look for the
definition of cons in run-time and call it, so if cons was re-defined as
something else, the re-definition will be called instead. On the other
hand the second notation will always mean the Scheme's user-supplied cons
or whatever cons was defined as in the execution of the statement. The
lecturer did not understand me and insisted that they did exactly the same
thing.

To prove my point I left the class, went to the nearby Computer Networks
Lab and wrote the following snippet on my workstation:

(define (make-rat n d) (cons n d))
;Value: make-rat

(define (cons n d)
(display n)
(newline)
(display d)
(newline)
)
;Value: cons

(make-rat 5 6)
5
6
;Unspecified return value

During the break, I showed it to the lecturer, and after some discussion,
he got convinced that I was right. He corrected himself after the break.

The lecturer is a very good one but he doesn't seem to remember the small
nuances of the Scheme language too well. He also told us (and ... ) and
(or ... ) were functions while in fact they were special forms.

In any case, in a discussion I had with a friend of mine I suggested that
one can protect the functions from a possibility that their utility
functions will be over-riden like this:

(define make-rat (let ((cons cons)) (lambda (n d) (cons n d))))

This is useless in this case but may be useful if the expression is a bit
more complex.

Regards,

Shlomi Fish

----------------------------------------------------------------------
Shlomi Fish shlomif@...
Home E-mail: shlomif@...

"Let's suppose you have a table with 2^n cups..."
"Wait a second - is n a natural number?"
• nice, what language is that? Where do you use it? ... -- Tal Abir The ultimate question: How many T:(Z2)^2--- (Z2)^2 1:1 exists? The ultimate answer: 42 This
Message 2 of 13 , Dec 17 11:09 PM
• 0 Attachment
nice, what language is that?
Where do you use it?

On Mon, 17 Dec 2001, Shlomi Fish wrote:

>
> I had a "Structure and Interpretation of Computer Programs" class today.
> The lecturer demonstrated how one can construct a type of a rational
> number using the following notation:
>
> (define (make-rat n d) (cons n d))
>
> (define (numer r) (car r))
> (define (denom e) (cdr r))
>
> He then said we can also simply say:
>
> (define make-rat cons)
> (define numer car)
> (define denom cdr)
>
> And they will behave _exactly_ the same. I told him that they do not
> behave exactly the same. The first notation when called will look for the
> definition of cons in run-time and call it, so if cons was re-defined as
> something else, the re-definition will be called instead. On the other
> hand the second notation will always mean the Scheme's user-supplied cons
> or whatever cons was defined as in the execution of the statement. The
> lecturer did not understand me and insisted that they did exactly the same
> thing.
>
> To prove my point I left the class, went to the nearby Computer Networks
> Lab and wrote the following snippet on my workstation:
>
> (define (make-rat n d) (cons n d))
> ;Value: make-rat
>
> (define (cons n d)
> (display n)
> (newline)
> (display d)
> (newline)
> )
> ;Value: cons
>
> (make-rat 5 6)
> 5
> 6
> ;Unspecified return value
>
> During the break, I showed it to the lecturer, and after some discussion,
> he got convinced that I was right. He corrected himself after the break.
>
> The lecturer is a very good one but he doesn't seem to remember the small
> nuances of the Scheme language too well. He also told us (and ... ) and
> (or ... ) were functions while in fact they were special forms.
>
> In any case, in a discussion I had with a friend of mine I suggested that
> one can protect the functions from a possibility that their utility
> functions will be over-riden like this:
>
> (define make-rat (let ((cons cons)) (lambda (n d) (cons n d))))
>
> This is useless in this case but may be useful if the expression is a bit
> more complex.
>
> Regards,
>
> Shlomi Fish
>
>
> ----------------------------------------------------------------------
> Shlomi Fish shlomif@...
> Home E-mail: shlomif@...
>
> "Let's suppose you have a table with 2^n cups..."
> "Wait a second - is n a natural number?"
>
>
>
> To unsubscribe from this group, send an email to:
> hackers-il-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>

--
Tal Abir

The ultimate question:"How many T:(Z2)^2--->(Z2)^2 1:1 exists?"

This saying is automaticly composed by Fortune
--------------------------------------------------------------------
File cabinet:
A four drawer, manually activated trash compactor.
• ... [description of how Technion s lecturer missed Scheme details] ... Nice one:) ... -- Omer Mussaev Software Developer Mercury Interactive / Topaz Prism R&D
Message 3 of 13 , Dec 17 11:47 PM
• 0 Attachment
> -----Original Message-----
> From: Shlomi Fish [mailto:shlomif@...]
> Sent: Monday, December 17, 2001 2:29 PM
> To: Hackers-IL
> Subject: [hackers-il] Long Live the Minute Difference

[description of how Technion's lecturer missed Scheme details]

> In any case, in a discussion I had with a friend of mine I
> suggested that
> one can protect the functions from a possibility that their utility
> functions will be over-riden like this:
>
> (define make-rat (let ((cons cons)) (lambda (n d) (cons n d))))

Nice one:)

>
> This is useless in this case but may be useful if the
> expression is a bit
> more complex.
>
> Regards,
>
> Shlomi Fish

--
Omer Mussaev
Software Developer
Mercury Interactive / Topaz Prism R&D
Application Team

There is no IGLU Cabal! The cabal is saving current continuation...
saving current continuation... saving current continuation...
• ... It is Scheme: http://www.schemers.org/ But it applies to other lexically scoped languages too. (and perhaps some that are not lexically scoped) ... Scheme
Message 4 of 13 , Dec 18 12:00 AM
• 0 Attachment
On Tue, 18 Dec 2001, Tal Abir wrote:

>
> nice, what language is that?

It is Scheme:

http://www.schemers.org/

But it applies to other lexically scoped languages too. (and perhaps some
that are not lexically scoped)

> Where do you use it?
>

Scheme can be used for all kinds of stuff. We use it in the EE course of
"Structure and Interpretation of Computer Programs":

http://tiger.technion.ac.il/~ee044261/

Which follows the book by the same name:

http://mitpress.mit.edu/sicp/full-text/book/book.html

Which is a very nice book, BTW.

Regards,

Shlomi Fish

> Tal Abir
>
> The ultimate question:"How many T:(Z2)^2--->(Z2)^2 1:1 exists?"
>
> This saying is automaticly composed by Fortune
> --------------------------------------------------------------------
> File cabinet:
> A four drawer, manually activated trash compactor.
>
>
> To unsubscribe from this group, send an email to:
> hackers-il-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>

----------------------------------------------------------------------
Shlomi Fish shlomif@...
Home E-mail: shlomif@...

"Let's suppose you have a table with 2^n cups..."
"Wait a second - is n a natural number?"
• ... Or a Harry Potter fan? ;-) -- Oleg Goldshmidt | ogoldshmidt@NOSPAM.computer.org If it ain t broken, it has not got enough features yet.
Message 5 of 13 , Dec 18 1:02 AM
• 0 Attachment

> "In effect, we conjure the spirits of the computer with our spells."
>
> I think only a true hacker can understand the last sentence.

Or a Harry Potter fan? ;-)

--
Oleg Goldshmidt | ogoldshmidt@...
"If it ain't broken, it has not got enough features yet."
• ... Yes, all other things being even (execution speed, compilers quality etc. etc.) Scheme will be the laguage I would choose to program everything with... And
Message 6 of 13 , Dec 18 1:53 AM
• 0 Attachment
> > nice, what language is that?
> It is Scheme:
> Scheme can be used for all kinds of stuff. We use it in the EE course of
> "Structure and Interpretation of Computer Programs":
> Which follows the book by the same name:
> http://mitpress.mit.edu/sicp/full-text/book/book.html
> Which is a very nice book, BTW.

Yes, all other things being even (execution speed, compilers quality etc. etc.) Scheme will be the laguage I would choose to program everything with...

And the wizard book is really great - although it does not teach Scheme. Oh, you will catch Scheme fast enough if you use it (note that I didn't say read, I said use) but it'll only be a tool to learn all the really really neat stuff inside which is pure computer programing, not any specific language.

It was written by 2 of the major hackers (from the original group of MIT AI lab) in the world and it shows; the opening paragraph of the book reads:
"We are about to study the idea of a computational process. Computational processes are abstract beings that inhabit computers. As they evolve, processes manipulate other abstract things called data. The evolution of a process is directed by a pattern of rules called a program. People create programs to direct processes. In effect, we conjure the spirits of the computer with our spells."

I think only a true hacker can understand the last sentence.

--
Tel: +972(9)9717330 | Fax: +972(9)9717334 | Cel: +972(54)756701
Kagoor Networks ltd | http://www.kagoor.com |
• ... You are right, of course, and there are more aspects to it than your exercise in lexical scoping. E.g. (define make-rat cons) means not that make-rat
Message 7 of 13 , Dec 18 9:18 PM
• 0 Attachment
Shlomi Fish <shlomif@...> writes:

> I had a "Structure and Interpretation of Computer Programs" class today.
> The lecturer demonstrated how one can construct a type of a rational
> number using the following notation:
>
> (define (make-rat n d) (cons n d))
>
> (define (numer r) (car r))
> (define (denom e) (cdr r))
>
> He then said we can also simply say:
>
> (define make-rat cons)
> (define numer car)
> (define denom cdr)
>
> And they will behave _exactly_ the same. I told him that they do not
> behave exactly the same. The first notation when called will look for the
> definition of cons in run-time and call it, so if cons was re-defined as
> something else, the re-definition will be called instead. On the other
> hand the second notation will always mean the Scheme's user-supplied cons
> or whatever cons was defined as in the execution of the statement. The
> lecturer did not understand me and insisted that they did exactly the same
> thing.

You are right, of course, and there are more aspects to it than your
exercise in lexical scoping. E.g.

(define make-rat cons)

means not that make-rat *calls* cons but that make-rat *is* cons. This
means that there will be only one function call involved in

(make-rat n d)

and not two. And I am not sure if you can easily debug the second
definition of make-rat, in terms of tracing calls to make-rat or
putting a breakpoint in it [surely you don't want to trace or break in
every call to cons].

What your professor probably meant that the two definitions are
functionally equivalent in terms of operations on rational numbers, as
long as cons, car, and cdr are a consistent triplet of pair
constructor and accessors, i.e. for any x, y we have

(car (cons x y)) is x
(cdr (cons x y)) is y

Any triplet of procedures satisfying the above can be used to form
pairs, and both definitions of make-rat and friends will lead to
the same results as far as rational arithmetic is concerned.

--
Oleg Goldshmidt | ogoldshmidt@...
If it aint't broken it hasn't got enough features yet.
• ... Scheme - a dialect of Lisp. ... Of the popular things GIMP and scsh (a shell with scheme-like syntax, written in scheme) come to mind. However, scheme does
Message 8 of 13 , Dec 18 9:37 PM
• 0 Attachment
Tal Abir <faceoff@...> writes:

> nice, what language is that?

Scheme - a dialect of Lisp.

> Where do you use it?

Of the popular things GIMP and scsh (a shell with scheme-like syntax,
written in scheme) come to mind. However, scheme does have a
reputation of an academic language. I'd love to do a serious project
in scheme (or Lisp). Ideas, anyone?

--
Oleg Goldshmidt | ogoldshmidt@...
If it aint't broken it hasn't got enough features yet.
• ... Yes, surely:)) Project management and code browsing extensions for XEmacs. ECB is in right direction, but lacks power:((
Message 9 of 13 , Dec 19 2:29 AM
• 0 Attachment
> -----Original Message-----
> From: Oleg Goldshmidt [mailto:ogoldshmidt@...]
> Sent: Wednesday, December 19, 2001 7:38 AM
> To: hackers-il@yahoogroups.com
> Subject: Re: [hackers-il] Long Live the Minute Difference
>
>
> Tal Abir <faceoff@...> writes:
>
> > nice, what language is that?
>
> Scheme - a dialect of Lisp.
>
> > Where do you use it?
>
> Of the popular things GIMP and scsh (a shell with scheme-like syntax,
> written in scheme) come to mind. However, scheme does have a
> reputation of an academic language. I'd love to do a serious project
> in scheme (or Lisp). Ideas, anyone?
>

Yes, surely:))
Project management and code browsing extensions for XEmacs.
ECB is in right direction, but lacks power:((

> --
> Oleg Goldshmidt | ogoldshmidt@...
> If it aint't broken it hasn't got enough features yet.
>
> ---------------------~-->
> Need new boots for winter? Looking for a perfect gift for
> Zappos.com is the perfect fit for all your shoe needs!
> http://us.click.yahoo.com/ltdUpD/QrSDAA/ySSFAA/saFolB/TM
> --------------------------------------------------------------
> -------~->
>
> To unsubscribe from this group, send an email to:
> hackers-il-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
• ... Maybe you can enlighten me regarding the itch? I recall looking at ECB a while ago, and deciding I was quite happy with dired and function menu (XEmacs is
Message 10 of 13 , Dec 19 3:01 AM
• 0 Attachment
Omer Musaev <omerm@...> writes:

> Project management and code browsing extensions for XEmacs.
> ECB is in right direction, but lacks power:((

Maybe you can enlighten me regarding the itch? I recall looking
at ECB a while ago, and deciding I was quite happy with dired
and function menu (XEmacs is my development environment). I don't
want the extra windows take up the screen real estate from code...

Does ECB have a C++ class browser? That might be useful.

What did you mean by "project management"?

--
Oleg Goldshmidt | ogoldshmidt@...
"If it ain't broken, it has not got enough features yet."
• ... Yes, but there is a catch. ECB uses semantic as code parser, which, in its current incarnation doe s not cope well with C++, especially with templates.
Message 11 of 13 , Dec 19 4:04 AM
• 0 Attachment
> -----Original Message-----
> From: Oleg Goldshmidt [mailto:ogoldshmidt@...]
> Sent: Wednesday, December 19, 2001 1:02 PM
> To: hackers-il@yahoogroups.com
> Subject: Re: [hackers-il] Long Live the Minute Difference
>
>
> Omer Musaev <omerm@...> writes:
>
> > Project management and code browsing extensions for XEmacs.
> > ECB is in right direction, but lacks power:((
>
> Maybe you can enlighten me regarding the itch? I recall looking
> at ECB a while ago, and deciding I was quite happy with dired
> and function menu (XEmacs is my development environment). I don't
> want the extra windows take up the screen real estate from code...
>
> Does ECB have a C++ class browser? That might be useful.
>

Yes, but there is a catch. ECB uses "semantic" as code parser,
which, in its current incarnation doe's not cope well with
C++, especially with templates.

> What did you mean by "project management"?

Warning: long description of ultimate IDE by my views and
desires follows. It is possible to implement all this in
XEmacs. However, it may take a lot of time, and I am not
going to do this by myself.... simply because I can not:(

Note: When I refer to XEmacs, I do that just because I do
not consider XEmacs/Emacs compatibility a goal.

What I mean by "project management"? Here comes the point.

Suppose you are working on a number of projects simultaneously,
and suppose you want to be able to define various operations
on project and its contents.

For example - checkout the whole project, check in the whole project,
rollback the whole project, or roll-forward it after you had rolled
it back. In addition, various projects have ( usually ) various build
options - so one-click-build procedure is supposed to change
according to what project you are working right now.

In addition, there are plenty of operations on file level - source
control operations, annotations ( if those are stored in external
files, or in DB, or whatever - implementation of logic should not
be concerned with that ).

Having cleared the "project management" point, there are additional
properties of "code browsing":

* Cross referencing - etags is an example of cross referencing,
although I would be happier to have something like SNiFF/Retriever.

* Class browsing: what is in some class?

* Hierarchy browsing: what is relationship of my class in whole system?

* Concept/models browsing: What concept is implemented by my template? Is
there any concept coercion? What templates implement my concept?

In addition to that, I would like to see code metrics of my code:

* How many coupling ( in some metric ) there is in my project?

* How those metrics will be affected by refactoring ?

In addition to that, I would like to use refactoring browser - like xref.

In addition to that, I would like to have this ultimate thing making
hints to XEmacs to show me information about my code, just like
Visual Assistant does for Visual Studio.

In addition to that, I want the whole thing be as modular as it can be...

Following projects had been undertaken in past :

EDE - emacs development environment - which should provide the "project
management" part of the story

X/Refactory ( xref ) - which is supposed to be refactoring browser

Speedbar - ultimate tree widget for XEmacs

ECB - Emacs Code Browser - which is nice code browser for C, but is
limited for code browsing only. No hierarchies or such.

>
> --
> Oleg Goldshmidt | ogoldshmidt@...
> "If it ain't broken, it has not got enough features yet."
>
> ---------------------~-->

--
Omer Mussaev
Software Developer
Mercury Interactive / Topaz Prism R&D
Application Team
• ... This is CVS for me. I know as well as I do that there is a nice XEmacs interface to CVS - pcl-cvs ... For me, each project has its own Makefile. Moreover,
Message 12 of 13 , Dec 19 7:39 AM
• 0 Attachment
Omer Musaev <omerm@...> writes:

> For example - checkout the whole project, check in the whole project,
> rollback the whole project, or roll-forward it after you had rolled
> it back.

This is CVS for me. I know as well as I do that there is a nice XEmacs
interface to CVS - pcl-cvs

> In addition, various projects have ( usually ) various build
> options - so one-click-build procedure is supposed to change
> according to what project you are working right now.

For me, each project has its own Makefile. Moreover, I noticed long
ago that 90+% of operations I do on each project are common to all or
most of the projects. So I have a separate "project" under CVS control
that contains boilerplate Makefile that are included in individual
projects' Makefiles.

Different build options are handled via different make targets. Most
are also common to various projects. I managed - with a small effort,
really - to make my boilerplate targets flexible enough that
individual projects (or a particular build) can modify the details
without changing the boilerplate Makefiles.

Of course, make runs quite nicely from inside XEmacs.

> In addition, there are plenty of operations on file level - source
> control operations, annotations ( if those are stored in external
> files, or in DB, or whatever - implementation of logic should not
> be concerned with that ).

Source control is really on a project level for me, via CVS. Actually,
I have a bunch of make targets that roll development and production
releases back and forth nicely. I am not sure what you mean by
annotations - CVS has its log and annotation facilities, so it's there.

> * Cross referencing - etags is an example of cross referencing,
> although I would be happier to have something like SNiFF/Retriever.

I use etags, I have to look at SNiFF/Retriever.

> * Class browsing: what is in some class?
>
> * Hierarchy browsing: what is relationship of my class in whole system?
>
> * Concept/models browsing: What concept is implemented by my template? Is
> there any concept coercion? What templates implement my concept?

These are lacking

>
> In addition to that, I would like to see code metrics of my code:
>
> * How many coupling ( in some metric ) there is in my project?
>
> * How those metrics will be affected by refactoring ?

And so are these

> In addition to that, I would like to use refactoring browser - like
> xref.

It's there, isn't it? Oh, did you mean for C++? Does XCScope help a
bit?

--
Oleg Goldshmidt | ogoldshmidt@...
"If it ain't broken, it has not got enough features yet."
• ... You are right - XEmacs has fine support for one-click-builds, provided you use make or something equivalent, and it has nice CVS integration. The problem
Message 13 of 13 , Dec 20 2:12 AM
• 0 Attachment
> -----Original Message-----
> From: Oleg Goldshmidt [mailto:ogoldshmidt@...]
> Sent: Wednesday, December 19, 2001 5:39 PM
> To: hackers-il@yahoogroups.com
> Subject: Re: [hackers-il] Long Live the Minute Difference
>
>
> Omer Musaev <omerm@...> writes:
>
> > For example - checkout the whole project, check in the
> whole project,
> > rollback the whole project, or roll-forward it after you had rolled
> > it back.
>
> This is CVS for me. I know as well as I do that there is a nice XEmacs
> interface to CVS - pcl-cvs
>
> > In addition, various projects have ( usually ) various build
> > options - so one-click-build procedure is supposed to change
> > according to what project you are working right now.
>
> For me, each project has its own Makefile. Moreover, I noticed long
> ago that 90+% of operations I do on each project are common to all or
> most of the projects. So I have a separate "project" under CVS control
> that contains boilerplate Makefile that are included in individual
> projects' Makefiles.
>
> Different build options are handled via different make targets. Most
> are also common to various projects. I managed - with a small effort,
> really - to make my boilerplate targets flexible enough that
> individual projects (or a particular build) can modify the details
> without changing the boilerplate Makefiles.
>
> Of course, make runs quite nicely from inside XEmacs.

You are right - XEmacs has fine support for one-click-builds,
provided you use make or something equivalent, and it has
nice CVS integration.

The problem is that CVS is just one of possible source-control
mechanisms, and there are others. At work I must use 2 other source
control tools, neither of which is CVS based. Both of them do their
work pretty well, unfortunately, they are not compatible with each
other.

However, they do have similar interface. This leads me to conclusion
that having umbrella tool that would turn to appropriate implementation
will be more appropriate to "XEmacs - the development environment" than
CVS and make integration.

> > In addition, there are plenty of operations on file level - source
> > control operations, annotations ( if those are stored in external
> > files, or in DB, or whatever - implementation of logic should not
> > be concerned with that ).
>
> Source control is really on a project level for me, via CVS. Actually,
> I have a bunch of make targets that roll development and production
> releases back and forth nicely. I am not sure what you mean by
> annotations - CVS has its log and annotation facilities, so
> it's there.

Well, as I mentioned earlier, I do use file-level source control - so
this interface, even if not supported by CVS, is required for a perfect
platform.

> > * Cross referencing - etags is an example of cross referencing,
> > although I would be happier to have something like
> SNiFF/Retriever.
>
> I use etags, I have to look at SNiFF/Retriever.

SNiFF was a tool that did almost all tasks that I mentioned in that mail.
It had 2 versions - more powerful, which was sold for a lot of money, and
less
powerful one ( named "SNiFF/Penguin" ), free for any use ( including
commercial ). Retriever was a sub-tool in a SNiFF that made cross
referencing easy.

The bad thing is that when Take Five Software, manufacturer of SNiFF, was
acquired by Wind River, the Penguin version was discontinued. Pity.

>
> > * Class browsing: what is in some class?
> >
> > * Hierarchy browsing: what is relationship of my class in
> whole system?
> >
> > * Concept/models browsing: What concept is implemented by
> my template? Is
> > there any concept coercion? What templates implement my concept?
>
> These are lacking

ECB 1.50 does kind of class browsing. Doxygen does some kind of hierarchy
browsing. Concept/models browsing is really missing.

> >
> > In addition to that, I would like to see code metrics of my code:
> >
> > * How many coupling ( in some metric ) there is in my project?
> >
> > * How those metrics will be affected by refactoring ?
>
> And so are these

However, those could be very useful when you talk about large and very
large projects....

> > In addition to that, I would like to use refactoring browser - like
> > xref.
>
> It's there, isn't it? Oh, did you mean for C++? Does XCScope help a
> bit?

Did not try that thing...

>
> --
> Oleg Goldshmidt | ogoldshmidt@...
> "If it ain't broken, it has not got enough features yet."

There is no IGLU Cabal. The cabal is trying to compose 1 perfect tool
out of void, where 1000000 not-so-perfect tools were disposed earlier..

--
Omer Mussaev
Software Developer
Mercury Interactive / Topaz Prism R&D
Application Team
Your message has been successfully submitted and would be delivered to recipients shortly.