From: Luis Arg�elles
Subject: Producing Executable files on Windows
Date: 
Message-ID: <3A813A66.7F051EAE@wanadoo.es>
Hi all,

After downloading the Personal Edition of Lispworks some weeks ago, I've
developed some "amateur" programs and I've learnt to love LISP language.

Since I enjoy using LispWorks, I'm thinking about purchasing the
Professional Edition. But prior to that and since I use (eval) from time
to time, I'm a bit worried about if LispWorks is able to produce .exe
files from sources that use it (I use Windows environment). The
following is a function that I use in my program:

(defun consult_data(cocpt a-list)
  (let
	((i) (a-symbol) (n) (trapezium) (extrems))

	(setq i 0)
	(setq a-symbol (nth 0 a-list))
	(setq n (length cocpt))
	(while (< i n)
	   (progn
		(setq trapezium (eval (nth i cocpt)))
		(if (equal a-symbol (nth 0 trapezium))
		   (progn
			(setq extrems (list (nth 1 trapezium) (nth 4 trapezium)))
		   )
		); end if
		(setq i (+ i 1))
	   )
	); end while
	extrems ; function returns this list
  );end let
)

Of course, (while) is defined as:

(defmacro while (test &rest body)
  `(do ()
       ((not ,test))
     ,@body)
)

Running this function from inside LispWorks' Personal Edition all works
perfectly. But is there any problem when compiling to an .exe file with
the Professional Edition?

Anticipated thanks,
Luis Arg�elles
··············@wanadoo.es

From: Jochen Schmidt
Subject: Re: Producing Executable files on Windows
Date: 
Message-ID: <95rhes$i8hk8$1@ID-22205.news.dfncis.de>
Luis Arg�elles wrote: 
> (defun consult_data(cocpt a-list)
>   (let
> ((i) (a-symbol) (n) (trapezium) (extrems))
> 
> (setq i 0)
> (setq a-symbol (nth 0 a-list))
> (setq n (length cocpt))
> (while (< i n)
> (progn
> (setq trapezium (eval (nth i cocpt)))
> (if (equal a-symbol (nth 0 trapezium))
> (progn
> (setq extrems (list (nth 1 trapezium) (nth 4 trapezium)))
> )
> ); end if
> (setq i (+ i 1))
> )
> ); end while
> extrems ; function returns this list
>   );end let
> )

There may be some complaints with this code...

1) Use "-" instead of "_" (minor style issue)
2) Better argument names (major style issue)
3) let without inital-value and then setq is bad style
   you should give the inital-values directly in the let (major style issue)
4) Usage of a selfdefined "while" macro instead of (loop ...) (waste of 
ressources)
5) Usage of a "while"-like iteration-constuct where a "for i..."
    construct would be more intuitive. (minor style issue)
6) Is "eval" really needed? (major design issue)
7) Use of "equal" instead of "eq" when comparing symbols (minor efficiency 
issue)
8) Use of lists to simulate structures (maybe) (major design issue)
9) Unusual end-paren indenting (major style issue)
10) redunant progn's (minor style issue)
11) if where "when" would be better (if only one clause) (minor style issue)
12) Looks like some kind of prefix C-Code with parens

A little bit more (Common)Lispy way would probably be:

;;; Untested
(defun consult-data (cocpt a-list)
    (loop  with a-symbol = (first a-list)
             for item in cocpt
             for trapezium = (eval cocpt) do
             (when (eq a-symbol (first trapezium))
                    (setq extrems (list (second trapezium)
                                             (fifth trapezium))))
             finally (return extrems)))

But without knowing the problem at all I cannot say much to this.
I dislike the high grade of consing and the "eval"-part
      
> Running this function from inside LispWorks' Personal Edition all works
> perfectly. But is there any problem when compiling to an .exe file with
> the Professional Edition?

There should be no real problem but a huge executable-size. If you use 
"eval", the interpreter has to be available in the image.

Regards,
Jochen
From: Jochen Schmidt
Subject: Re: Producing Executable files on Windows
Date: 
Message-ID: <95ri58$hurak$1@ID-22205.news.dfncis.de>
Jochen Schmidt wrote:> 
> ;;; Untested
> (defun consult-data (cocpt a-list)
>     (loop  with a-symbol = (first a-list)
>              for item in cocpt
>              for trapezium = (eval cocpt) do
>              (when (eq a-symbol (first trapezium))
>                     (setq extrems (list (second trapezium)
>                                              (fifth trapezium))))
>              finally (return extrems)))
> 

I have forgotten the "extrems". Furthermore the consing can easily reduced 
a bit.

 ;;; Untested
 (defun consult-data (cocpt a-list)
     (loop  with a-symbol = (first a-list)
              with extrems-1 = nil
              with extrems-5 = nil
              for item in cocpt
              for trapezium = (eval cocpt) do
              (when (eq a-symbol (first trapezium))
                     (setq extrems-1 (second trapezium)
                             extrems-5 (fifth trapezium)))
              finally (return (cons extrems-1 extrems-5)))
 
Regards,
Jochen
 
From: Simon Katz
Subject: Re: Producing Executable files on Windows
Date: 
Message-ID: <i4dg6.8$Oh3.1763@news.dircon.co.uk>
"Luis Arg�elles" <··············@wanadoo.es> wrote in message
······················@wanadoo.es...
> Hi all,
>
> After downloading the Personal Edition of Lispworks some weeks ago,
> I've
> developed some "amateur" programs and I've learnt to love LISP
> language.
>
> Since I enjoy using LispWorks, I'm thinking about purchasing the
> Professional Edition. But prior to that and since I use (eval) from
> time
> to time, I'm a bit worried about if LispWorks is able to produce .exe
> files from sources that use it (I use Windows environment).

Yes, you can use EVAL in an executable file produced by LispWorks.

See
http://www.xanalys.com/software_tools/reference/lwl41/deluser/D_1.HTM,
and in particular
http://www.xanalys.com/software_tools/reference/lwl41/deluser/D_107.HTM.
From: Janis Dzerins
Subject: Re: Producing Executable files on Windows
Date: 
Message-ID: <87n1byse85.fsf@asaka.latnet.lv>
"Luis Arg�elles" <··············@wanadoo.es> writes:

> The following is a function that I use in my program:
> 
> (defun consult_data(cocpt a-list)
>   (let
> 	((i) (a-symbol) (n) (trapezium) (extrems))
> 
> 	(setq i 0)
> 	(setq a-symbol (nth 0 a-list))
> 	(setq n (length cocpt))
> 	(while (< i n)
> 	   (progn
> 		(setq trapezium (eval (nth i cocpt)))
> 		(if (equal a-symbol (nth 0 trapezium))
> 		   (progn
> 			(setq extrems (list (nth 1 trapezium)
>                             (nth 4 trapezium)))
> 		   )
> 		); end if
> 		(setq i (+ i 1))
> 	   )
> 	); end while
> 	extrems ; function returns this list
>   );end let
> )

Here's my shot:

(defun consult-data (cocpt a-list)
  (let ((a-symbol (first a-list))
        extremes)
    (loop for item in cocpt
        for trapezium = (eval item)
        do (when (equal a-symbol (first trapezium))
             (setq extremes (list (second trapezium)
                                  (fifth trapezium)))))
    extremes))

or this, if I understand what you're after:

(defun consult-data (cocpt a-list)
  (let ((item (find (first a-list) cocpt
                    :from-end t :test #'equal
                    :key (lambda (item) (first (eval item))))))
    (or item
        (list (second item) (fifth item)))))

(both untested)

You should state your problem (what you want to do) so we can help you
with the design.

Janis Dzerins
-- 
  If million people say a stupid thing it's still a stupid thing.
From: Fernando Rodr�guez
Subject: Re: Producing Executable files on Windows
Date: 
Message-ID: <07638tk5v3n5urq2oaa7lakvonp0lai565@4ax.com>
On Wed, 07 Feb 2001 13:07:02 +0100, "Luis Arg�elles"
<··············@wanadoo.es> wrote:

>Hi all,
>
>After downloading the Personal Edition of Lispworks some weeks ago, I've
>developed some "amateur" programs and I've learnt to love LISP language.
>
>Since I enjoy using LispWorks, I'm thinking about purchasing the
>Professional Edition. But prior to that and since I use (eval) from time
>to time, I'm a bit worried about if LispWorks is able to produce .exe
>files from sources that use it (I use Windows environment). The
>following is a function that I use in my program:

Short answer: Yes
Long Answer: See xanalys knowledge base
Even better answer: Don't use eval unless it's absolutely necesary. If you
think it's absolutely necesary, check it out again cuz you're probably wrong.
;-)

BTW, you seem to speak lisp with a thick C/C++ accent. To further improve your
linguistic skills, get a copy of Ansi Common Lisp from Paul Graham for some
"conversational lisp" classes. ;-)






//-----------------------------------------------
//	Fernando Rodriguez Romero
//
//	frr at mindless dot com
//------------------------------------------------
From: Raymond Wiker
Subject: Re: Producing Executable files on Windows
Date: 
Message-ID: <86vgqla95n.fsf@raw.grenland.fast.no>
Fernando Rodr�guez <·······@must.die> writes:

> BTW, you seem to speak lisp with a thick C/C++ accent. 

        "Your speech impediment has a speech impediment" ?

> To further improve your linguistic skills, get a copy of Ansi Common
> Lisp from Paul Graham for some "conversational lisp" classes. ;-)

        ... and "On Lisp" and "Paradigms of Artificial Intelligence
Programming" and "The Art of the Metaobject Protocol" and
"Object-Oriented Programming in Common Lisp" and...

-- 
Raymond Wiker
·············@fast.no