Hi, I'm quite new to LISP so I hope someone could help
me with two simple questions. I make use of CLISP for
the moment but I plan to move to Allegro LISP soon.
The first: it would be helpful, for ease of reading,
a line continuation character, that is a character
that joins the next line and make the interpeter
see it as one (as an example the "+" character for
SPICE netlist, for whom is familiar with). I was not
able to find it in the doc. Does it exist in CLISP?
The second: I need to implement the equivalent of
bit fields in C. However, a huge sequence of bits.
I found the structure starting with #* could fit my
needs. Does the interpreter/compiler implement it internally
*really* as a sequence of bits? I mean operations with
this structure (OR, AND etc...) are really efficiently implemented
at register level? I need to perform basic operations such
as AND, OR, bit SHIFT etc.. , but I have not found the
I wonder if I can post other simple question such these
in the next future...
Thank you
maitre Aliboron
it seems one line is missing...
> as AND, OR, bit SHIFT etc.. , but I have not found the
equivalents. Could you provide me with an hint?
maitre Aliboron
(message (Hello 'maitre)
(you :wrote :on '(Sun, 6 May 2007 11:10:52 +0200))
(
mA> it seems one line is missing...
??>> as AND, OR, bit SHIFT etc.. , but I have not found the
mA> equivalents. Could you provide me with an hint?
http://www.lisp.org/HyperSpec/Body/fun_logandcm__rc2cm_logxor.html
http://www.lisp.org/HyperSpec/Body/fun_boole.html
)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"I am everything you want and I am everything you need")
> http://www.lisp.org/HyperSpec/Body/fun_logandcm__rc2cm_logxor.html
> http://www.lisp.org/HyperSpec/Body/fun_boole.html
nice links, I didn't know...
If I understand correctly I don't even need to
make use of the specifier #* to perform bit-wise
operations. I could simply use numbers (in hex
form for ease). I'll try.
maitre Aliboron
In article <············@newsreader.mailgate.org>,
"maitre Aliboron" <········@despammed.com> wrote:
> Hi, I'm quite new to LISP so I hope someone could help
> me with two simple questions. I make use of CLISP for
> the moment but I plan to move to Allegro LISP soon.
>
> The first: it would be helpful, for ease of reading,
> a line continuation character, that is a character
> that joins the next line and make the interpeter
> see it as one (as an example the "+" character for
> SPICE netlist, for whom is familiar with). I was not
> able to find it in the doc. Does it exist in CLISP?
In source code lines are only interesting when you deal with strings.
But for Lisp code
(+ 1 2)
and
(+
1
2)
and
(
+
1 2
)
are all the same. You can layout your code as you want.
READ is the function that READs Lisp data (textual code is
also normal data).
Usually the editor will provide the right indentation.
PPRINT is a function which takes a Lisp form and
will print it nicely.
>
> The second: I need to implement the equivalent of
> bit fields in C. However, a huge sequence of bits.
> I found the structure starting with #* could fit my
> needs. Does the interpreter/compiler implement it internally
> *really* as a sequence of bits? I mean operations with
> this structure (OR, AND etc...) are really efficiently implemented
> at register level? I need to perform basic operations such
> as AND, OR, bit SHIFT etc.. , but I have not found the
There are lots of operations dealing with bits. Checkout
the ANSI CL Hyperspec for reference. How the Lisp system
will execute these functions depends on a few things.
An interpreter will do it differently from a compiler.
The compiler also often will create code differently
based on some settings for SPEED, SAFETY, DEBUG, ...
By default you get high safety, so these functions
will check their arguments and more...
There are bitvectors and their operations:
http://www.lispworks.com/documentation/HyperSpec/Body/f_bt_and.htm
Plus there are bit operations on integers:
http://www.lispworks.com/documentation/HyperSpec/Body/f_logand.htm
You can also DISASSEMBLE functions to see what
the compiler generated. Here is an example.
(compile 'my-function) will compile a function (if there is
a compiler in your implementation). CLISP has one. ACL, too.
(disassemble 'my-function) and see the output
if you have a Lisp compiler.
>
> I wonder if I can post other simple question such these
> in the next future...
Sure. Some people might point you to a good Lisp tutorial, though. ;-)
>
> Thank you
>
> maitre Aliboron
--
http://lispm.dyndns.org
> Sure. Some people might point you to a good Lisp tutorial, though. ;-)
Thanks for the info. I have a lot of tutorials and
I'm reading them at the same time I do experience
(you know, the dear old "learning by doing" concept)
but the info I need are sometimes hidden in hundreds
of pages and are not easy to recover, especially if they
concern specific items: the classical "needle in the haystack"
(and sometimes there is no needle to find).
So I reckon useful (and more proficient) to ask to
someone who is more experienced. The only
drawback is that someone could take myself for a
jerk, but I'll take the risk... Thank you.
maitre Aliboron
In article <············@newsreader.mailgate.org>,
"maitre Aliboron" <········@despammed.com> wrote:
> > Sure. Some people might point you to a good Lisp tutorial, though. ;-)
>
> Thanks for the info. I have a lot of tutorials and
> I'm reading them at the same time I do experience
> (you know, the dear old "learning by doing" concept)
> but the info I need are sometimes hidden in hundreds
> of pages and are not easy to recover, especially if they
> concern specific items: the classical "needle in the haystack"
> (and sometimes there is no needle to find).
I guess that's what newsgroups like this are for.
Lot's of people in comp.lang.lisp are
willing to answer questions
or to point to resources.
> So I reckon useful (and more proficient) to ask to
> someone who is more experienced. The only
> drawback is that someone could take myself for a
> jerk, but I'll take the risk... Thank you.
>
> maitre Aliboron
--
http://lispm.dyndns.org
"maitre Aliboron" <········@despammed.com> writes:
> Hi, I'm quite new to LISP so I hope someone could help
> me with two simple questions. I make use of CLISP for
> the moment but I plan to move to Allegro LISP soon.
>
> The first: it would be helpful, for ease of reading,
> a line continuation character, that is a character
> that joins the next line and make the interpeter
> see it as one (as an example the "+" character for
> SPICE netlist, for whom is familiar with). I was not
> able to find it in the doc. Does it exist in CLISP?
In lisp, you don't need a continuation character, because the lisp
reader will go on reading until it finds a matching closing
parenthesis (or it reads a whole token).
So if your form takes several lines, just type it in:
(let ((x 42) RET
(y 8)) RET
(* x y)) RET
( RET = type RETURN )
> The second: I need to implement the equivalent of
> bit fields in C. However, a huge sequence of bits.
> I found the structure starting with #* could fit my
> needs. Does the interpreter/compiler implement it internally
> *really* as a sequence of bits? I mean operations with
> this structure (OR, AND etc...) are really efficiently implemented
> at register level? I need to perform basic operations such
> as AND, OR, bit SHIFT etc.. , but I have not found the
It's up to the implementation. clisp actually uses the C operators
&, |, ~, etc (see the array.d file, search for bitpack_* functions), so
bit fields will be used if the C compiler you use to compile clisp
uses bit fields.
> I wonder if I can post other simple question such these
> in the next future...
Of course, contrarily to the appearances, it's the purpose of this
newsgroup.
--
__Pascal Bourguignon__ http://www.informatimago.com/
WARNING: This product attracts every other piece of matter in the
universe, including the products of other manufacturers, with a
force proportional to the product of the masses and inversely
proportional to the distance between them.
"maitre Aliboron" <········@despammed.com> writes:
>> Of course, contrarily to the appearances, it's the purpose of this
>> newsgroup.
>
> Thank you too. Are you French?
Oui.
--
__Pascal Bourguignon__ http://www.informatimago.com/
Wanna go outside.
Oh, no! Help! I got outside!
Let me back inside!