Raymond Toy | 1 Apr 2004 16:16
Picon
Picon

Re: unicode


>>>>> "William" == William Brew <bill.brew <at> oracle.com> writes:

    William> It is my understanding that there is a project to add support for
    William> unicode characters to CMUCL.  Does
    William> anyone know the status of this project, estimated completion, etc.

Yes, the unicode changes are on a branch.  I do not know the current
state, but it seems no work has been done on that branch in quite some
time.

Ray

Jan Rychter | 4 Apr 2004 06:06
Gravatar

Type of the result of a log


In the following snippet of code:

		    #'(lambda (v1 v2)
			(values (- (the double-float (log v1)) 
				   (the double-float (log v2)))
				0))

Is there a better way to tell CMUCL that I'm really sure that v1 and v2
are greater than 0.0d0 and are double-floats, so that the compiler
doesn't have to worry about the result of the logs becoming a COMPLEX?

I've tried things like:

  (declare (type (double-float 0.0d0) v1))

But that doesn't seem to work for me.

thanks,
--J.

Raymond Toy | 4 Apr 2004 06:36
Picon
Favicon

Re: Type of the result of a log


Jan Rychter wrote:
> In the following snippet of code:
> 
> 		    #'(lambda (v1 v2)
> 			(values (- (the double-float (log v1)) 
> 				   (the double-float (log v2)))
> 				0))
> 
> Is there a better way to tell CMUCL that I'm really sure that v1 and v2
> are greater than 0.0d0 and are double-floats, so that the compiler
> doesn't have to worry about the result of the logs becoming a COMPLEX?
> 
> I've tried things like:
> 
>   (declare (type (double-float 0.0d0) v1))
> 

That declaration means the v1 can be +/- 0.0 to +infinity, and CMUCL 
thinks log of -0.0 is a complex number.  You probably want

(declare (type (double-float (0d0)) v1)

This means v1 is strictly positive.  If v1 can also be +0.0, you can say

(declare (type (or (double-float (0d0) (member 0d0)) v1)

Ray

(Continue reading)

Jan Rychter | 4 Apr 2004 07:41
Gravatar

Re: Type of the result of a log


Raymond Toy:
> Jan Rychter wrote:
> > In the following snippet of code:
> > 
> > 		    #'(lambda (v1 v2)
> > 			(values (- (the double-float (log v1)) 
> > 				   (the double-float (log v2)))
> > 				0))
> > 
> > Is there a better way to tell CMUCL that I'm really sure that v1 and v2
> > are greater than 0.0d0 and are double-floats, so that the compiler
> > doesn't have to worry about the result of the logs becoming a COMPLEX?
> > 
> > I've tried things like:
> > 
> >   (declare (type (double-float 0.0d0) v1))
> > 
> 
> That declaration means the v1 can be +/- 0.0 to +infinity, and CMUCL 
> thinks log of -0.0 is a complex number.  

Indeed! You are right. I have completely forgotten about negative
zeroes.

> You probably want
> 
> (declare (type (double-float (0d0)) v1)
> 
> This means v1 is strictly positive.  If v1 can also be +0.0, you can say
(Continue reading)

Christophe Rhodes | 4 Apr 2004 09:54
Picon
Picon
Favicon

Re: Type of the result of a log


Jan Rychter <jan <at> rychter.com> writes:

> By the way, where does one find out about the (double-float (0d0))
> syntax (with parentheses around 0d0)? Having reread the CMUCL manual
> chapters on compiler and optimization and having looked at the HyperSpec
> again, I cannot seem to find a description of this anywhere?

In the Common Lisp standard, in the description of the DOUBLE-FLOAT
type specifier.  (It might be worth adding as a FAQ somewhere or
other, too).

Cheers,

Christophe
--

-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)

Jan Rychter | 4 Apr 2004 21:44
Gravatar

Re: Type of the result of a log


>>>>> "Christophe" == Christophe Rhodes <csr21 <at> cam.ac.uk>:
 Christophe> Jan Rychter <jan <at> rychter.com> writes:
 >> By the way, where does one find out about the (double-float (0d0))
 >> syntax (with parentheses around 0d0)? Having reread the CMUCL manual
 >> chapters on compiler and optimization and having looked at the
 >> HyperSpec again, I cannot seem to find a description of this
 >> anywhere?

 Christophe> In the Common Lisp standard, in the description of the
 Christophe> DOUBLE-FLOAT type specifier.  (It might be worth adding as
 Christophe> a FAQ somewhere or other, too).

Ah, yes, I've finally found section 12.1.6 (Interval Designators) in the
CLHS. Yes, it definitely is worth adding as a FAQ.

Many thanks for your help!

--J.

R Alemi | 6 Apr 2004 15:02
Picon
Favicon

Network card MAC address

Dear List members,
Can anyone tell me where can I find information about accessing hardware specific information in cmucl? I
particularly need to get the MAC address of my network card.
Lots of thanks,
Balto

Thomas Fischbacher | 6 Apr 2004 15:40
Picon
Favicon

Re: Network card MAC address


On Tue, 6 Apr 2004, R Alemi wrote:

> Can anyone tell me where can I find information about accessing 
> hardware specific information in cmucl?

You do it as every other program: either by using a helper
(i.e. calling ifconfig or such), or if you really want
to do it yourself (assuming Linux), by opening a 
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) and doing lots of
arcane ioctl()s to it. See include/linux/sockios.h and a strace on
ifconfig for details.

> I particularly need to get the MAC address of my network card.

What on earth do you need _that_ for?!?

--

-- 
regards,               tf <at> cip.physik.uni-muenchen.de              (o_
 Thomas Fischbacher -  http://www.cip.physik.uni-muenchen.de/~tf  //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)

Jonathan Bailleul | 7 Apr 2004 20:24
Picon

Re: Primitives for fast fixnum arithmetics


Alexey Dejneka wrote:
> 
> Ivan Boldyrev <boldyrev+nospam <at> cgitftp.uiggm.nsc.ru> writes:
> 
> > On 8689 day of my life Raymond Toy wrote:
> > > If you really MUST have fast fixnum, here is one way to do it in
> > > cmucl.
> > >
> > > (in-package :vm)
> > > (defknown fixnum+ (fixnum fixnum)
> > >   fixnum
> > >   (movable foldable flushable))
> > >
> > > (define-vop (fixnum-add fast-+/fixnum=>fixnum)
> > >   (:translate fixnum+))
> > >
> > > (defun fixnum+ (x y)
> > >   (declare (fixnum x y))
> > >   (fixnum+ x y))
> > >
> > > Then
> > >
> > > (vm:fixnum+ most-positive-fixnum 1) => -536870912
> >
> > It's exactly what I want!  But when I try (fixnum+ anything1
> > anything2), it just loops and cons a memory...  I can't fix it without
> > your help, because I don't understand anyting here :(
> 
> Wrap (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) ...)
(Continue reading)

Raymond Toy | 8 Apr 2004 02:24
Picon
Favicon

Re: Primitives for fast fixnum arithmetics


Jonathan Bailleul wrote:
> 
> 
> Sorry to rush in the topic, but can someone give me exact code for this
> module? (especially concerning the eval-when)
> I would like to see it running and then look in the documentation what
> means what (eval-when, defknown, define-vop... )
> 

Seems backwards, but I think this is what you want (untested):

(in-package :vm)
(eval-when (:compile-toplevel :load-toplevel :execute)

(defknown fixnum+ (fixnum fixnum)
   fixnum
   (movable foldable flushable))

(define-vop (fixnum-add fast-+/fixnum=>fixnum)
   (:translate fixnum+))
)

(defun fixnum+ (x y)
   (declare (fixnum x y))
   (fixnum+ x y))

Ray

(Continue reading)


Gmane