[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Designing interface of a simple elisp function
From: |
gnuist006 |
Subject: |
Designing interface of a simple elisp function |
Date: |
12 Oct 2002 08:39:04 -0700 |
I want to write a function, say converting a binary to decimal in lisp.
For arbitrary length binary, I want the input as a string, which is what
we do in C. Then I want to get "car" of the string and go from there.
This is like getchar or getc in C.
Now this "car" does not apply to a string but to a list. On the other
hand the arbitary length input applies to string. Does there exist
string to list function? But even that also seems cheating. What is the
most elegant way to write such a function so that it is also readible
in use.
(b2d '(1 0 1 0 0 1)) is hardly readible or desirable.
(b2d '101001) is most desirable
(b2d "101001") is tolerable if this is the best that can be done
- Designing interface of a simple elisp function,
gnuist006 <=