## Re: [clisp-list] List conversion and string eval

 Re: [clisp-list] List conversion and string eval From: Sam Steingold - 2001-02-26 16:09:08 ```> * In message > * On the subject of "[clisp-list] List conversion and string eval" > * Sent on Mon, 26 Feb 2001 08:05:25 -0600 > * Honorable "Justice, Randy -CONT" writes: > > I have a list of 1 and 0s. An example is (1 0 1). This is a binary > number not a base 10 number. please see `poly' in clocc/src/cllib/math.lisp (;) (reduce (lambda (r d) (+ (* r 2) d)) '(1 0 1) :initial-value 0) ==> 5 -- Sam Steingold (http://www.podval.org/~sds) Support Israel's right to defend herself! ; Read what the Arab leaders say to their people on ; ((lambda (x) (list x (list 'quote x))) '(lambda (x) (list x (list 'quote x)))) ```

 [clisp-list] List conversion and string eval From: Justice, Randy -CONT - 2001-02-26 14:05:18 Attachments: Message as HTML ```Hi. I am having a difficult time converting a list to "string"-- my real goal is to a number. I have a list of 1 and 0s. An example is (1 0 1). This is a binary number not a base 10 number. How do I get the list to the form of "#B101". I have tried to place the "nth" element to a string. 4. Break [6]> (setf (aref s 0) (nth 0 x)) *** - SYSTEM::STORE: 0 does not fit into " ", bad type where x is ( 1 0 1) and s is string of length 5 I am not sure this will get me to my goal. I have tried to "eval" a string without luck. What is the trick to this? 10. Break [12]> (setf t1 "#b101") "#b101" 10. Break [12]> t1 "#b101" 10. Break [12]> (eval t1) "#b101" Thanks in advance.... Randy Justice ```
 Re: [clisp-list] List conversion and string eval From: Sam Steingold - 2001-02-26 16:09:08 ```> * In message > * On the subject of "[clisp-list] List conversion and string eval" > * Sent on Mon, 26 Feb 2001 08:05:25 -0600 > * Honorable "Justice, Randy -CONT" writes: > > I have a list of 1 and 0s. An example is (1 0 1). This is a binary > number not a base 10 number. please see `poly' in clocc/src/cllib/math.lisp (;) (reduce (lambda (r d) (+ (* r 2) d)) '(1 0 1) :initial-value 0) ==> 5 -- Sam Steingold (http://www.podval.org/~sds) Support Israel's right to defend herself! ; Read what the Arab leaders say to their people on ; ((lambda (x) (list x (list 'quote x))) '(lambda (x) (list x (list 'quote x)))) ```