From: Luky10
Subject: Another help request... :(
Date: 
Message-ID: <951153943.252609@fire-int>
Define an abstraction POINT in a bidimensional space.
Give a representation for the POINT of type (x.y)
define the x and y function to access the coordinates and the
@ function to create a point.

How can i representate the (x.y) with lisp???
Thank you!

From: Axel Schairer
Subject: Re: Another help request... :(
Date: 
Message-ID: <fm9wvnymlv1.fsf@methven.dai.ed.ac.uk>
Luky10 <······@iname.com> writes:

> Define an abstraction POINT in a bidimensional space.
> Give a representation for the POINT of type (x.y)
> define the x and y function to access the coordinates and the
> @ function to create a point.
> 
> How can i representate the (x.y) with lisp???
> Thank you!

I am not sure what `POINT of type (x.y)' is supposed to mean.  Anyway;
you could use a structure, or simply put the two components in a list
or a cons cell.

For structures, see http://psg.com/~dlamkins/left/sl/html/, Chapter 3,
Lesson 10 and Chapter 8, and if you need the specification, it is at
http://www.harlequin.com/support/books/HyperSpec/Body/, look for the
chapter on structures.

For lists: you surely know how to construct lists and use FIRST,
SECOND and so on to access elements.  For conses: you have (CONS x y)
==> (x . y), play around in your lisp system with this and CAR and
CDR.  Using these you can define @, X, and Y.  Again there is material
on this in, I think, one of the lessons of Chapter 3 of
http://psg.com/~dlamkins/left/sl/html/.  Note that nowadays lists are
generally considered inappropriate for representing complex data
structures in most cases.  In CL that is.  But for an exercise they
might just be what you are expected to use.

At any rate, I would choose names different from X and Y for the
accessor functions; but then you might be required to use these names,
who knows.  

Hope this helps.

Cheers,
Axel
From: Robert Monfera
Subject: Re: Another help request... :(
Date: 
Message-ID: <38B18BC0.70D0A62@fisec.com>
How about complex numbers?  Check out the numerical chapter of the
Hyperspec.

Robert

Luky10 wrote:
>
> Define an abstraction POINT in a bidimensional space.
> Give a representation for the POINT of type (x.y)
> define the x and y function to access the coordinates and the
> @ function to create a point.
>
> How can i representate the (x.y) with lisp???
> Thank you!
From: Fernando D. Mato Mira
Subject: Re: Another help request... :(
Date: 
Message-ID: <38B1A3C7.DE282BD@iname.com>
Robert Monfera wrote:

> How about complex numbers?  Check out the numerical chapter of the

Only works for subsets of R2

--
Fernando D. Mato Mira
Real-Time SW Eng & Networking
Advanced Systems Engineering Division
CSEM
Jaquet-Droz 1                   email: matomira AT acm DOT org
CH-2007 Neuchatel                 tel:       +41 (32) 720-5157
Switzerland                       FAX:       +41 (32) 720-5720

www.csem.ch      www.vrai.com     ligwww.epfl.ch/matomira.html
From: Fernando D. Mato Mira
Subject: Re: Another help request... :(
Date: 
Message-ID: <38B3A567.17ABE291@iname.com>
"Fernando D. Mato Mira" wrote:

> Robert Monfera wrote:
>
> > How about complex numbers?  Check out the numerical chapter of the
>
> Only works for subsets of R2

This is misleading. This works for any bidimensional space for which
you've set up a real coordinate system.

Never used complex coordinates. Or quaternion, that should be pretty
wacky!

[Hey, BTW, quaternions should be first-class citizens in CL!]

--
Fernando D. Mato Mira
Real-Time SW Eng & Networking
Advanced Systems Engineering Division
CSEM
Jaquet-Droz 1                   email: matomira AT acm DOT org
CH-2007 Neuchatel                 tel:       +41 (32) 720-5157
Switzerland                       FAX:       +41 (32) 720-5720

www.csem.ch      www.vrai.com     ligwww.epfl.ch/matomira.html
From: Tim Bradshaw
Subject: Re: Another help request... :(
Date: 
Message-ID: <ey366vgb2en.fsf@cley.com>
* Fernando D Mato Mira wrote:
> This is misleading. This works for any bidimensional space for which
> you've set up a real coordinate system.

Assuming the coordinate system is suitably well-behaved (non-singular,
topology preserving, and perhaps differentiable for added value),
those are all pretty much equivalent (homeomorphic or diffeomorphic if
the map is differentiable?) to R2 I think. I might have forgotten
something of course, it's been a while.  Even if I haven't,
mathematicians will gleefully point out some pathological case: come
the revolution you people will be second ... (just after the
linguists).

--tim
From: Fernando D. Mato Mira
Subject: Re: Another help request... :(
Date: 
Message-ID: <38B3DE75.C00D1D9B@iname.com>
Tim Bradshaw wrote:

> * Fernando D Mato Mira wrote:
> > This is misleading. This works for any bidimensional space for which
> > you've set up a real coordinate system.
>
> Assuming the coordinate system is suitably well-behaved (non-singular,
> topology preserving, and perhaps differentiable for added value),
> those are all pretty much equivalent (homeomorphic or diffeomorphic if
> the map is differentiable?) to R2 I think. I might have forgotten
> something of course, it's been a while.  Even if I haven't,
> mathematicians will gleefully point out some pathological case: come
> the revolution you people will be second ... (just after the
> linguists).

Bad wording above. `bidimensional' is relative. Basis size depends on the
scalars:
2n R-dimensional = n C-dimensional
4n R-dimensional = n quaternion dimensional
8n R-dimensional = n octonion-dimensional

--
Fernando D. Mato Mira
Real-Time SW Eng & Networking
Advanced Systems Engineering Division
CSEM
Jaquet-Droz 1                   email: matomira AT acm DOT org
CH-2007 Neuchatel                 tel:       +41 (32) 720-5157
Switzerland                       FAX:       +41 (32) 720-5720

www.csem.ch      www.vrai.com     ligwww.epfl.ch/matomira.html
From: Steve Long
Subject: Re: Another help request... :(
Date: 
Message-ID: <38B3E75E.1D543E0A@isomedia.com>
You should both be forced to wear tape on your glasses! Such language
is what keeps engineers and their bretheren at home on Friday nights!
From: Michael Hudson
Subject: Re: Another help request... :(
Date: 
Message-ID: <m33dqkt9ia.fsf@atrus.jesus.cam.ac.uk>
Tim Bradshaw <···@cley.com> writes:

> * Fernando D Mato Mira wrote:
> > This is misleading. This works for any bidimensional space for which
> > you've set up a real coordinate system.
> 
> Assuming the coordinate system is suitably well-behaved (non-singular,
> topology preserving, and perhaps differentiable for added value),
> those are all pretty much equivalent (homeomorphic or diffeomorphic if
> the map is differentiable?) to R2 I think. I might have forgotten
> something of course, it's been a while.  Even if I haven't,
> mathematicians will gleefully point out some pathological case: come
> the revolution you people will be second ... (just after the
> linguists).

M�bius strips spring to mind as a counter example.  Tori (toruses?
don't think so) and Klein bottles too, come to think of it.  Locally
diffeomorphic to R2 (as R2 is a covering space of all these spaces -
and that's why two coordinates are all you need to specify a point on
each of these surfaces), to be sure, but certainly not as whole
spaces.

In fact given any group that acts "freely and properly
discontinuously" on R2 you can form a manifold R2/G, and I think any
two such manifolds will be {homeo,diffeo}morphic iff the defining
groups are isomorphic.

What was this thread about again?

Cheers,
Michael

-- 
very few people approach me in real life and insist on proving they are
drooling idiots.                         -- Erik Naggum, comp.lang.lisp
From: Tim Bradshaw
Subject: Re: Another help request... :(
Date: 
Message-ID: <ey3snyj7bwy.fsf@cley.com>
* Michael Hudson wrote:

> M�bius strips spring to mind as a counter example.  Tori (toruses?
> don't think so) and Klein bottles too, come to think of it.  Locally
> diffeomorphic to R2 (as R2 is a covering space of all these spaces -
> and that's why two coordinates are all you need to specify a point on
> each of these surfaces), to be sure, but certainly not as whole
> spaces.

I think I need some side-condition about the global topology
not being unreasonable don't I?  I kind of thought it was enough to
assert that you were only allowed one coordinate patch, which works
for stuff like S2 but not for Moebius strips.  Is it being orientable
enough?  Toruses (Toroi?) are orientable though.

Well, anyway, as a physicist, even a non-practicing one, I am licensed
by the highest authority to assume that everything is always
sufficiently well-behaved to make everything I claim true in all
interesting cases. (Opens coat to reveal silver star engraved with the
Einstein field equations, and impressively large handgun, shoots pesky
mathematician.  Rides off into sunset.)

--tim
From: Rolf-Thomas Happe
Subject: Re: Another help request... :(
Date: 
Message-ID: <r5g0ui7l4y.fsf@bonnie.mathematik.uni-freiburg.de>
Tim Bradshaw:
> * Michael Hudson wrote:
> 
> > M�bius strips spring to mind as a counter example.  Tori (toruses?
> > don't think so) and Klein bottles too, come to think of it.  Locally
> > diffeomorphic to R2 (as R2 is a covering space of all these spaces -
> > and that's why two coordinates are all you need to specify a point on
> > each of these surfaces), to be sure, but certainly not as whole
> > spaces.

[There are surfaces not covered by the plane R2, for instance the
sphere S2.  Nonetheless, they are surfaces / can be described locally
by two real parameters.]

> assert that you were only allowed one coordinate patch, which works
> for stuff like S2 but not for Moebius strips.  Is it being orientable
> enough?  Toruses (Toroi?) are orientable though.

The Moebius strip isn't orientable.  (I. e., it isn't orientable wrt
singular homology with integral coefficients, but there is a unique
Z/(2) orientation.)  As for S2 and the single coordinate patch: when
you approach the pole your nose is freezing.

rthappe
From: Tim Bradshaw
Subject: Re: Another help request... :(
Date: 
Message-ID: <ey3itze7dxx.fsf@cley.com>
* Rolf-Thomas Happe wrote:
> The Moebius strip isn't orientable.  (I. e., it isn't orientable wrt
> singular homology with integral coefficients, but there is a unique
> Z/(2) orientation.)  As for S2 and the single coordinate patch: when
> you approach the pole your nose is freezing.

I meant that you need 2 patches for S2 (don't you?) but toruses are
orientable and only need one patch.  So I lose basically.

--ti,
From: Rolf-Thomas Happe
Subject: Re: Another help request... :(
Date: 
Message-ID: <r57lft8k69.fsf@bonnie.mathematik.uni-freiburg.de>
Tim Bradshaw:
> * Rolf-Thomas Happe wrote:
> > Z/(2) orientation.)  As for S2 and the single coordinate patch: when
> > you approach the pole your nose is freezing.
> 
> I meant that you need 2 patches for S2 (don't you?) but toruses are
> orientable and only need one patch.  So I lose basically.

Then I misinterpreted your statement.  Btw, the single coordinate
patches you mean to concede to tori would relate the whole surface
to a subset of the plane that is neither open nor homeomorphic, so
there is some room for debate on the definition of `coordinate
system.'

rthappe
From: David Thornley
Subject: Re: Another help request... :(
Date: 
Message-ID: <L1Yu4.2560$%A3.59853@ptah.visi.com>
In article <················@fisec.com>,
Robert Monfera  <·······@fisec.com> wrote:
>
>How about complex numbers?  Check out the numerical chapter of the
>Hyperspec.
>
>Robert
>
As long as it maps onto the complex plane, you get some nice things
for free.  Well, as long as the original is a 2-D metric flat space.
Distance measurement between two points becomes a subtraction and
an absolute value, rotation around the origin is a simple multiplication,
that sort of thing.

Obviously, with the wrong sorts of mappings, all of this fails in a
very ungraceful way.  This is not an extensible technique.  It worked
very nicely for me when I wanted to manipulate points on a plane.  If
I were working in 3-D, or on a curved plane, or a manifold with more
than one coordinate system, I'd have to take all of this out and
replace it.  (Fortunately, in CL, this isn't as painful as in other
languages.)

--
David H. Thornley                        | If you want my opinion, ask.
·····@thornley.net                       | If you don't, flee.
http://www.thornley.net/~thornley/david/ | O-
From: Robert Monfera
Subject: Re: Another help request... :(
Date: 
Message-ID: <38BC7D07.26011136@fisec.com>
David Thornley wrote:

> As long as it maps onto the complex plane, you get some nice things
> for free.  Well, as long as the original is a 2-D metric flat space.

Yes, 2D is what the OP asked for (so it's probably not the ray-tracing
example in Graham's book :-).  Didn't you mean linear instead of metric
though?

Robert
From: David Thornley
Subject: Re: Another help request... :(
Date: 
Message-ID: <jicx4.93$_5.999@ptah.visi.com>
In article <·················@fisec.com>,
Robert Monfera  <·······@fisec.com> wrote:
>
>David Thornley wrote:
>
>> As long as it maps onto the complex plane, you get some nice things
>> for free.  Well, as long as the original is a 2-D metric flat space.
>
>Yes, 2D is what the OP asked for (so it's probably not the ray-tracing
>example in Graham's book :-).  Didn't you mean linear instead of metric
>though?
>
Could be.  I know what I was thinking, but I've forgotten much of the
terminology.  What you mean by "linear" was probably what I was meaning
by "flat".  



--
David H. Thornley                        | If you want my opinion, ask.
·····@thornley.net                       | If you don't, flee.
http://www.thornley.net/~thornley/david/ | O-
From: Janos Blazi
Subject: Re: Another help request... :(
Date: 
Message-ID: <38b1981d$1_2@goliath.newsfeeds.com>
You can also take vectors, for example #(1 2/3) would be the point with the
(cartesian) coordinates x=1 and y=2/3. Of course you do not have the name
POINT then.

I would not take lists on principal reasons: The number of entries will
never change and it is more important to access the components in constant
time. But of course this plays absolutely no role if you have only 2
components.

Whether to prefer structures to vectors is a principal matter of programming
style. In my opinion you can take either.

Janos Blazi

Luky10 <······@iname.com> schrieb in im Newsbeitrag:
················@fire-int...
> Define an abstraction POINT in a bidimensional space.
> Give a representation for the POINT of type (x.y)
> define the x and y function to access the coordinates and the
> @ function to create a point.
>
> How can i representate the (x.y) with lisp???
> Thank you!




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----
From: Pierre R. Mai
Subject: Re: Another help request... :(
Date: 
Message-ID: <87r9e65fnn.fsf@orion.dent.isdn.cs.tu-berlin.de>
"Janos Blazi" <······@netsurf.de> writes:

> You can also take vectors, for example #(1 2/3) would be the point with the
> (cartesian) coordinates x=1 and y=2/3. Of course you do not have the name
> POINT then.
> 
> I would not take lists on principal reasons: The number of entries will
> never change and it is more important to access the components in constant
> time. But of course this plays absolutely no role if you have only 2
> components.

When you only represent points in discrete 2 dimensional space, then
you can use a single cons cell, which will usually have less memory or
access overhead than a vector, if you can constrain your coordinates
to fixnums.  If you need more general coordinates, then complex
numbers or specialized vectors will be preferable.  For dimensions
larger than 2, specialized vectors will probably be the data structure 
of choice for speed/memory overhead.

Regardless of this, for most applications it might be preferrable to use
structures or classes because of the documentation and type-checking
aspects, since maximum speed is less important.

Regs, Pierre.

-- 
Pierre Mai <····@acm.org>         PGP and GPG keys at your nearest Keyserver
  "One smaller motivation which, in part, stems from altruism is Microsoft-
   bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]
From: Barry Margolin
Subject: Re: Another help request... :(
Date: 
Message-ID: <qDfs4.58$ep4.1212@burlma1-snr2>
In article <················@fire-int>, Luky10  <······@iname.com> wrote:
>Define an abstraction POINT in a bidimensional space.
>Give a representation for the POINT of type (x.y)
>define the x and y function to access the coordinates and the
>@ function to create a point.
>
>How can i representate the (x.y) with lisp???

DEFSTRUCT is used for defining abstract data types in Common Lisp.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Marco Antoniotti
Subject: Re: Another help request... :(
Date: 
Message-ID: <lw3dql61ye.fsf@parades.rm.cnr.it>
Luky10 <······@iname.com> writes:

> Define an abstraction POINT in a bidimensional space.
> Give a representation for the POINT of type (x.y)
> define the x and y function to access the coordinates and the
> @ function to create a point.
> 
> How can i representate the (x.y) with lisp???

(defstruct point x y)

Then go back to your instructor and tell him/her to read some more
recent Common Lisp literature.

Cheers

-- 
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26
http://www.parades.rm.cnr.it/~marcoxa
From: Johan Kullstam
Subject: Re: Another help request... :(
Date: 
Message-ID: <m2itziymik.fsf@sophia.axel.nom>
Luky10 <······@iname.com> writes:

> Define an abstraction POINT in a bidimensional space.
> Give a representation for the POINT of type (x.y)
> define the x and y function to access the coordinates and the
> @ function to create a point.
> 
> How can i representate the (x.y) with lisp???

look at your own notation!  you can use a CONS.  perhaps this is a
hint by your instructor?

(CONS 'X 'Y) is (X . Y)

to extract, just use CAR and CDR.

(LET ((POINT (CONS 'X 'Y)))
  (CAR POINT)                ; X
  (CDR POINT)                ; Y
  ....)

other options are
1) a vector/array
2) a structure
3) a complex number
4) property lists
5) a hash table (if you are a glutton for punishment)
6) a CLOS class
7) a normal list (X Y)

-- 
J o h a n  K u l l s t a m
[········@ne.mediaone.net]
Don't Fear the Penguin!