thelamecamel wrote:
> Thanks all for speedy help!
> 
> On Jan 7, 4:25 pm, Jason Grout <[email protected]> wrote:
>> These are not the right way to do this, but they seem to give results
>> for right now, at least until someone fixes this:
>>
>> sage: a=mathematica([1,2,3])
>> sage: [a[i] for i in range(1,a.Length()+1)]
>> [1, 2, 3]
>>
>> Or
>>
>> sage: a=mathematica(slist)
>> sage: a._Expect__sage_list
>> [1, 2, 3]
> 
> I think I can get a variant of the first tactic working in my program
> - I've actually dealing with non-rectangular multidimensional
> mathematica lists, e.g. {1, {2, 3}}, which are not handled by either
> approach.  By explicitly coding for the structure of my lists I think
> I can get it working in my case; but it would be great if sage could
> handle nested lists such as this - it looks like a case of just
> replacing curly brackets by square ones.


Yes, you can get the above to work with nested lists using recursion. 
Your other idea is good too (well, again, not the "right" way to do it, 
but until someone fixes it).  Note that there are security implications 
in the code below since we call eval.

sage: a=mathematica([1,2,[3,4]])
sage: sage_eval(repr(a).replace('{','[').replace('}',']'))
[1, 2, [3, 4]]

Jason






> 
> Thanks again,
> Felix
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to