[Ecls-list] An array becomes a list ?

Marco Antoniotti marcoxa at cs.nyu.edu
Wed Jan 18 07:10:06 UTC 2006


David Creelman wrote:
> On Tue, 2006-01-17 at 10:50 -0500, Marco Antoniotti wrote:
> 
>>On Jan 16, 2006, at 9:55 PM, David Creelman wrote:
>>
>>
>>>Hi List,
>>>
>>>cl_object SendBuffer = c_string_to_object("(defvar *SendBuffer*
>>>(make-array 6 0))");
>>>cl_type check = type_of(SendBuffer);
>>>
>>>The above code gives back t_cons, not t_vector. Is there some way I can
>>>force it to be an array so I can use aref directly from C ?
>>
>>
>>Well, the code does exactly what you tell it to do.
>>
>>	"(defvar *sendbuffer* (make-array 6 0))"
>>
>>is a string that contains a CONS (hence a t_cons; and BTW, you have one 
>>misfeature in your code and a error :) )
> 
> Hmmm, it does parse, so I'm not sure what the error is.

Check the argument list for MAKE-ARRAY.

  Also I'm not
> sure what the misfeature is. I'd be interested if you could point them
> out.

Like it or not, the standard settings for CL uppercase your symbols. 
Therefore, unless you have taken steps to ensurte that the symbol name 
of the string bit *SendBuffer* has its case preserved, you will end up 
with *SENDBUFFER*.  In other words, StUdLycAps are not-so-kosher style 
in CL.  But this is just nitpicking.

> 
>>Consider the string
>>
>>	"(I am a cons)"
>>
>>What should
>>
>>	type_of(c_string_to_object("(I am a cons)")
>>
>>return?  
> 
> I think this would return a cons. If you ran it, you'd get an error
> unless you've defuned a function "I".

Yes.  But, AFAIU the code snippet is not running it.

>>Also, what about
>>
>>	type_of(c_string_to_object("42"))
> 
> I think this would be t_fixnum ?

Exactly.

Cheers
--
Marco




More information about the ecl-devel mailing list