[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Engineering numbers again ...



    Date: Fri, 23 Apr 1993 08:33 EDT
    From: staley@carnap.srl.ford.com (Scott M. Staley)


    I have listen in on the engineering numbers discussion, but missed where
    one could get the Lisp code???? Did you find out where it is???

    Thanks,
    Scott

I haven't any code yet Scott. I was asking how to write the code. I
haven't heard anyone say they have done exactly what I was looking for,
but the offer of the code from moeller@informatik.uni-hamburg.de (Ralf
Moeller):

Ralf> Hi,
Ralf> 
Ralf> I think we have exactly the read macros you asked for. My colleague
Ralf> Roman Cunis developed a measures package that even handles conversions
Ralf> between different units. I already convinced him to make his code
Ralf> public. However, the documentation is in German.
Ralf> 
Ralf> Maybe he will translate it if someone would like to have the code.
Ralf> The code has been tested in Allegro CL, Symbolics CL, Macintosh CL,
Ralf> and Harlequin CL.
Ralf> 
Ralf> Example:
Ralf> 
Ralf> (in-package :cl-user)
Ralf> 
Ralf> (use-package :measures)
Ralf> 
Ralf> (define-unit |m| :base length :metric)
Ralf> 
Ralf> (define-unit |qm| |m| |m| :base area)
Ralf> (define-unit |qkm| |km| |km|)
Ralf> (define-unit |ar| 100 |qm|)
Ralf> (define-unit |ha| 100 |ar|)
Ralf> 
Ralf> (define-unit |m3| |m| |m| |m| :base volume)
Ralf> (define-unit |ccm| |cm| |cm| |cm|)
Ralf> (define-unit |l| 1000 |ccm|)
Ralf> 
Ralf> (define-unit |s| :base time)
Ralf> (define-unit |min| 60 |s|)
Ralf> (define-unit |h| 60 |min|)
Ralf> (define-unit |ms| 0.001 |s|)
Ralf> 
Ralf> (define-unit |m/s| |m| |/s| :base speed)
Ralf> (define-unit |km/h| |km| |/h|)
Ralf> 
Ralf> (define-unit DM :base currency)
Ralf> (define-unit |Pfg| 0.01 DM)
Ralf> (define-unit $ 1.85 DM)
Ralf> (define-unit |c| 0.01 $)
Ralf> 
Ralf> (define-unit-format time :step |h| |min| |s|)
Ralf> (define-unit-format speed :unit |km/h|)
Ralf> (define-unit-format length :base)
Ralf> 
Ralf> 
Ralf> 
Ralf> Application:
Ralf> 
Ralf> ? (dim+ 1m 4cm)
Ralf> 1.04m
Ralf> 
Ralf> ? (dim+ 1min 46s 4ms)
Ralf> 1min:46.004s
Ralf> 
Ralf> ? (dim+ 3h (dim+ 1min 46s 4ms))
Ralf> 3h:1min:46.004s
Ralf> 
Ralf> ====================================================================
Ralf> 
Ralf> Interested?
Ralf> 
Ralf> 
Ralf> Ralf 
Ralf> 
Ralf> 
Ralf> ========================================
Ralf> 
Ralf> Ralf Moeller
Ralf> University of Hamburg
Ralf> Bodenstedtstr. 16
Ralf> 2000 Hamburg 50
Ralf> Germany
Ralf> 
Ralf> Phone: ++40 4123 6134
Ralf> Fax ++40 4123 6530
Ralf> Email: moeller@informatik.uni-hamburg.de
Ralf> 

was too good to miss, I am waiting for it to be sent.

Looks like its going to end up in an accessible library someplace -
Vincent Keunen [keunen@montefiore.ulg.ac.be] suggested the
"Lisp Utilities Repository" which I hadn't heard off before now.

My plan is to wait a few days and see if anything else comes up; if not
try to write my own based on a suggestion from Luigi Semenzato
<luigi@paris.cs.berkeley.edu>:

Luigi> Prefixes is all Common Lisp gives you.  A general mechanism for
Luigi> fiddling with the reader would be overkill.
Luigi> 
Luigi> You can still do what you want, perhaps a bit laboriously, by defining
Luigi> your own reader functions for all tokens starting with a digit or -
Luigi> (see SET-MACRO-CHARACTER).  You'll have to do some parsing yourself,
Luigi> but you can get help from the standard reader using READ-FROM-STRING
Luigi> with the standard readtable on selected parts of your token.

I'll let you know if thats what I end up doing.

By the way, Chuck Irvine irvine@lks.csi.com asks:

Chuck> Martin,
Chuck> 
Chuck> Just out of curisoity, what's so bad about having #E3.4K mean 3.4K?
Chuck> After all, Lisp is a programming language. Is it for yourself or for
Chuck> others that you want to create this esthetic? Like I said, just
Chuck> curious.

I guess my answer is that I am trying to build a set of tools for
electronic design engineers (we make and sell a bench-top mixed signal
test system - we are a small start up company just getting going) and
they can't understand what the #E is all about. In my previous
incarnation as a design engineer at Analog Devices, I was part of a
small group using LISP to do the same thing. I loved it, as did all the
others in the group. Funny thing happened. To LISP or not to LISP became
a "black and white"/"good guys and bad guys" issue. You either loved or
hated it. The lovers said LISP is SO cool and I know why we need things
like "()" and #E and "'" and those oh-so-wonderful "lambda"'s etc etc.
The basic "mathematical foundation", core concept, just "clicked"
with them. If you never bought the foundation you never used it - it
became a "religious" debate. For this reason my new company offers a C
and C++ interface to our tester: C has been accepted as a necessary evil
by design engineers. They attend courses and learn how to use it because
their managers see "C" and "C++" everywhere (who could loose when you
bet on the side of ATT, Berkeley, SUN and HP they reason).

I am working to get a LISP interface in there because I know its just
plain better than C for these applications. (Interpreter, no data
typing, tremendous math capability, generic post processing functions,
GC etc).  

Things like #E I know would kill it!  I'd be back into selling the
coolness of the underlying substrate rather than giving the guy a tool
that fits naturally into his way of thinking. Cadence have this figured
out - SKILL is LISP of course with a choice of parser. Autocad did this,
and I think Interleaf did too - a gentle introduction to LISP by just
doing the job better.

--------------------------------------------------------------------------------
Martin Mallinson                                martin@cmt.dialnet.symbolics.com

Crimble Micro Test Inc.                              
5 Tomahawk Drive                                Phone: 508 667 9405
Billerica MA 01821                              Fax:   508 667 0192
--------------------------------------------------------------------------------