I am completely new to common lisp.
recently,I exercise one example and eval (make-point)
output error as following :
[code]
The function MAKE-POINT is undefined.
[Condition of type UNDEFINED-FUNCTION]
[/code]
I guess make-point should be a function of lisp core.
Thanks a lot.
QinGW king
QinGW wrote:
> I am completely new to common lisp.
> recently,I exercise one example and eval (make-point)
> output error as following :
> [code]
> The function MAKE-POINT is undefined.
> [Condition of type UNDEFINED-FUNCTION]
> [/code]
> I guess make-point should be a function of lisp core.
What makes you think so?
The HyperSpec doesn't mention it.
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
On 4ÔÂ13ÈÕ, ÏÂÎç5ʱ05·Ö, Pascal Costanza <····@p-cos.net> wrote:
> QinGW wrote:
> > I am completely new to common lisp.
> > recently,I exercise one example and eval (make-point)
> > output error as following :
> > [code]
> > The function MAKE-POINT is undefined.
> > [Condition of type UNDEFINED-FUNCTION]
> > [/code]
> > I guess make-point should be a function of lisp core.
>
> What makes you think so?
>
> The HyperSpec doesn't mention it.
>
> Pascal
>
> --
> My website:http://p-cos.net
> Common Lisp Document Repository:http://cdr.eurolisp.org
> Closer to MOP & ContextL:http://common-lisp.net/project/closer/
because I can't find the definition in the context.
I think it is possible to define that function according to the count
of parameter pairs.
okay, thank you very much.
I will define it self and look at HyperSpec now.
··········@gmail.com wrote:
> [ ... ]
> because I can't find the definition in the context
> [ ... ]
Sometimes functions may be defined behind the scenes,
namely accesors to structures and objects.
Check for DEFSTRUCT and/or DEFCLASS.
Example:
CL-USER> (defstruct point (x) (y))
==> POINT
CL-USER> (make-point :x 0 :y 0)
==> #S(POINT :X 0 :Y 0)
Regards, Szymon.
In article <············@nemesis.news.tpi.pl>,
Szymon <···········@o2.pl> wrote:
> ··········@gmail.com wrote:
>
> > [ ... ]
>
> > because I can't find the definition in the context
>
> > [ ... ]
>
> Sometimes functions may be defined behind the scenes,
> namely accesors to structures and objects.
> Check for DEFSTRUCT and/or DEFCLASS.
>
> Example:
>
> CL-USER> (defstruct point (x) (y))
>
> ==> POINT
>
> CL-USER> (make-point :x 0 :y 0)
>
> ==> #S(POINT :X 0 :Y 0)
>
>
> Regards, Szymon.
(ed 'make-point) should work in most better IDEs and find
such an corresponding DEFSTRUCT definition.
In an editor, place the text cursor on MAKE-POINT and
type M-. . This should also find the definition.
M-. is used in all Emacs-like Lisp editors for
locating source code for symbols. Works also in Emacs+SLIME
for me.
--
http://lispm.dyndns.org
I'm going to go out on a limb and assume that this question is not
related to a homework assignment. If creating a point is a challenge,
then one should not be taking a class that involves using Lisp.
I've seen a couple of "make-point" functions in different Lisp
packages. The version of Allegro Common Lisp I use that is attached to
ICAD has one for creating a 3D point.
I'm not sure what the point of of make-point is that came with my
version of MCL running in OS9, but I've redefined it to create a 3D
point (I do a lot of geometric work). Note that a 3D point and a 3D
vector are the same thing: A point is a vector extending from 0,0,0.
Here's a definition:
(defun make-point (x y z)
"
make-point
FUNCTION
----------------------------------------------------------------------------
DESCRIPTION:
Make a 3D vector (or 3D point) instance.
SYNTAX:
make-point X Y Z
PARAMETERS:
X, Y, Z ::= <number>. Magnitudes.
RETURNS:
(SIMPLE-ARRAY DOUBLE-FLOAT (3))
"
(make-array
3
:initial-contents (mapcar
#'(lambda(num)(coerce num 'double-float))
(list x y z))
:adjustable nil
:element-type 'double-float))
If you need something besides an array, you will have to implement it
differently.
········@comcast.net wrote:
> I'm going to go out on a limb and assume that this question is not
> related to a homework assignment. If creating a point is a challenge,
> then one should not be taking a class that involves using Lisp.
>
> I've seen a couple of "make-point" functions in different Lisp
> packages. The version of Allegro Common Lisp I use that is attached to
> ICAD has one for creating a 3D point.
>
> I'm not sure what the point of of make-point is that came with my
> version of MCL running in OS9,
The M in MCL is for Macintosh, and Macintosh OS9 used QuickDraw to
render to the screen, and MCL came with bindings to the QuickDraw API,
and one often needed to speak to QD about screen locations. IIRC, @ was
a macro character for make-point, ie, "put this thing /at/ this 2D
location", so one could just say @(42 42).
kxo
--
http://www.theoryyalgebra.com/
"Algebra is the metaphysics of arithmetic." - John Ray
"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts
"Stand firm in your refusal to remain conscious during algebra."
- Fran Lebowitz
"I'm an algebra liar. I figure two good lies make a positive."
- Tim Allen
Ken Tilton wrote:
>
>
> ········@comcast.net wrote:
>
>> I'm going to go out on a limb and assume that this question is not
>> related to a homework assignment. If creating a point is a challenge,
>> then one should not be taking a class that involves using Lisp.
>>
>> I've seen a couple of "make-point" functions in different Lisp
>> packages. The version of Allegro Common Lisp I use that is attached to
>> ICAD has one for creating a 3D point.
>>
>> I'm not sure what the point of of make-point is that came with my
>> version of MCL running in OS9,
>
>
> The M in MCL is for Macintosh, and Macintosh OS9 used QuickDraw to
> render to the screen, and MCL came with bindings to the QuickDraw API,
> and one often needed to speak to QD about screen locations. IIRC, @ was
> a macro character for make-point, ie, "put this thing /at/ this 2D
> location", so one could just say @(42 42).
I should have added the punch line, which was that the result was
suitable for passing as-was to QD. IIRC, the representation was a 32-bit
longword with the vertical component in the high-order word and the hz
component in the low-order word.
kt
--
http://www.theoryyalgebra.com/
"Algebra is the metaphysics of arithmetic." - John Ray
"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts
"Stand firm in your refusal to remain conscious during algebra."
- Fran Lebowitz
"I'm an algebra liar. I figure two good lies make a positive."
- Tim Allen