From: EtherealSoul
Subject: Noob question I think
Date: 
Message-ID: <734e63d4-327b-4810-a510-90bcbf2d3e8f@i29g2000prf.googlegroups.com>
Hi all,

I have a problem with a the passage of structures  well ... I have a
program that makes this

(setf abertos (insereMP abertos (geraNo pai linha coluna (1+ count))))

so I get and error that says nil is not of type NO. No is a structure
that I have that is created by geraNO.
So, putting a print in the geraNO function I see that the function is
returning the right value, but when insereMP is called, it is passed
as nil.

Does anyone had this similar problem and can I solve this?

Thanks
EtherealSoul

From: livingcosmos.org
Subject: Re: Noob question I think
Date: 
Message-ID: <c095c273-d3e5-4372-ba98-f65b36bc6ec2@i72g2000hsd.googlegroups.com>
On Dec 15, 11:00 am, EtherealSoul <·················@googlemail.com>
wrote:
> Hi all,
>
> I have a problem with a the passage of structures  well ... I have a
> program that makes this
>
> (setf abertos (insereMP abertos (geraNo pai linha coluna (1+ count))))

Can we get the code and run it ourselves?
From: Ken Tilton
Subject: Re: Noob question I think
Date: 
Message-ID: <476454db$0$31146$607ed4bc@cv.net>
EtherealSoul wrote:
> Hi all,
> 
> I have a problem with a the passage of structures  well ... I have a
> program that makes this
> 
> (setf abertos (insereMP abertos (geraNo pai linha coluna (1+ count))))
> 
> so I get and error that says nil is not of type NO. No is a structure
> that I have that is created by geraNO.
> So, putting a print in the geraNO function I see that the function is
> returning the right value,...

If youthink about it, that is impossible. I mean for a print statement 
inside a function to prove what a function returns. You should:

   (trace geraNo)

or:

   (setf abertos (insereMP abertos (let ((x (geraNo...)))
                                      <any debug output you like>
                                      x)))

You could also just:

   (setf x (imp (print (geraNo...))))

Probably you are using some form such as dolist or loop that does not 
return the value you think is being returned.

kt



-- 
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Frank Goenninger DG1SBG
Subject: Re: Noob question I think
Date: 
Message-ID: <lzir2zbyw2.fsf@de.goenninger.net>
EtherealSoul <·················@googlemail.com> writes:

> Hi all,
>
> I have a problem with a the passage of structures  well ... I have a
> program that makes this
>
> (setf abertos (insereMP abertos (geraNo pai linha coluna (1+ count))))
>
> so I get and error that says nil is not of type NO. No is a structure
> that I have that is created by geraNO.
> So, putting a print in the geraNO function I see that the function is
> returning the right value, but when insereMP is called, it is passed
> as nil.
>
> Does anyone had this similar problem and can I solve this?
>
> Thanks
> EtherealSoul

Not really knowing what you're up to but:

CL-USER> (defstruct (NO) pai linha coluna id-nr)
NO
CL-USER> (defun geraNO (pai linha coluna id-nr)
           (make-NO :pai pai :linha linha :coluna coluna :id-nr id-nr))
GERANO
CL-USER> (defun insereMP (abertos no)
           (cons abertos no))
INSEREMP
CL-USER> (let ((abertos nil)
               (pai nil)
               (linha 1)
               (coluna 1)
               (count 0))
           (setf abertos (insereMP abertos (geraNO pai linha coluna (1+ count)))))
(NIL . #S(NO :PAI NIL :LINHA 1 :COLUNA 1 :ID-NR 1))
CL-USER> 

So... What does your code look like?

Frank

-- 

  Frank Goenninger

  frgo(at)mac(dot)com

  "Don't ask me! I haven't been reading comp.lang.lisp long enough to 
  really know ..."
From: Alex Mizrahi
Subject: Re: Noob question I think
Date: 
Message-ID: <476416ba$0$90273$14726298@news.sunsite.dk>
 E> (setf abertos (insereMP abertos (geraNo pai linha coluna (1+ count))))

 E> so I get and error that says nil is not of type NO. No is a structure
 E> that I have that is created by geraNO.
 E> So, putting a print in the geraNO function I see that the function is
 E> returning the right value, but when insereMP is called, it is passed
 E> as nil.

 E> Does anyone had this similar problem and can I solve this?

the problem is either in geraNO, insereMP, or in a way you call them.
the best telepats of this newsgroups are now trying to telepatically debug 
your functions.. 
From: Ken Tilton
Subject: Re: Noob question I think
Date: 
Message-ID: <4764ccd2$0$31161$607ed4bc@cv.net>
Alex Mizrahi wrote:
>  E> (setf abertos (insereMP abertos (geraNo pai linha coluna (1+ count))))
> 
>  E> so I get and error that says nil is not of type NO. No is a structure
>  E> that I have that is created by geraNO.
>  E> So, putting a print in the geraNO function I see that the function is
>  E> returning the right value, but when insereMP is called, it is passed
>  E> as nil.
> 
>  E> Does anyone had this similar problem and can I solve this?
> 
> the problem is either in geraNO, insereMP, or in a way you call them.

"or in a way you call them"? (a) the OP showed exactly how they are 
being called; (b) how would the way they are being called keep an 
observed correct value from being returned, and (c) what different ways 
are there of calling a function?

> the best telepats of this newsgroups are now trying to telepatically debug 
> your functions.. 

No, we are teaching the OP how to think about Lisp, where are the common 
pitfalss, and how to debug Lisp.

kt

-- 
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Alex Mizrahi
Subject: Re: Noob question I think
Date: 
Message-ID: <47650173$0$90272$14726298@news.sunsite.dk>
E>>> (setf abertos (insereMP abertos (geraNo pai linha coluna (1+ count))))
 ??>> the problem is either in geraNO, insereMP, or in a way you call them.

 KT> "or in a way you call them"? (a) the OP showed exactly how they are
 KT> being called; (b) how would the way they are being called keep an
 KT> observed correct value from being returned, and (c) what different ways
 KT> are there of calling a function?

you can pass parameters in different ways. for example:

(setf abertos (insereMP (geraNo pai linha coluna (1+ count))  abertos ))

 ??>> the best telepats of this newsgroups are now trying to telepatically
 ??>> debug your functions..

 KT> No, we are teaching the OP how to think about Lisp, where are the
 KT> common pitfalss, and how to debug Lisp.

i guess he just needs to be more attentive