Wednesday 15 January 2014

arrays - How to encode / decode LISP-formatted matrices in python? -



arrays - How to encode / decode LISP-formatted matrices in python? -

i new python. using xml rpc communicate between lisp , python , notice xml encoding of matrices ( passing , forth ) verbose. example, next lisp matrix:

((1 1)(2 2)(3 3)(4 4))

becomes on 20 times longer 1 time encoded in xml:

<array><data><value><array><data><value><int>1</int></value><value><int>1</int></value></data> </array></value><value><array><data><value><int>2</int></value><value><int>2</int></value></data> </array></value><value><array><data><value><int>3</int></value><value><int>3</int></value></data> </array></value><value><array><data><value><int>4</int></value><value><int>4</int></value></data> </array></value></data></array>

so wondering what easiest way create python functions inter-convert between strings “((1 1)(2 2)(3 3)(4 4))” and corresponding python lists.

python arrays matrix

No comments:

Post a Comment