Search found 35 matches

by imba
Fri Dec 24, 2010 2:38 am
Forum: Common Lisp
Topic: macro for looping over functions in a list
Replies: 12
Views: 3927

Re: macro for looping over functions in a list

Thank you very much for your patience!
by imba
Thu Dec 23, 2010 1:27 pm
Forum: Common Lisp
Topic: macro for looping over functions in a list
Replies: 12
Views: 3927

Re: macro for looping over functions in a list

So what's wrong with the following code? (defconstant +Functions+ '(1+ 1-)) (defun compile-Function (Function) `((let ((val (funcall ,Function 4))) (if (>= val 0) val (return-From evaluate -100))))) (defun compile-Functions (Functions) `(defun evaluate () (+ ,@(loop for Function from Functions appen...
by imba
Thu Dec 23, 2010 10:06 am
Forum: Common Lisp
Topic: macro for looping over functions in a list
Replies: 12
Views: 3927

Re: macro for looping over functions in a list

Only explicit calls to a function can be inlined. If you are holding functions in a variable, how can the compiler know which function that variable will be holding so that it can inline it? Well, because +functions+ is a constant? Is there no possibility to write a macro that translates this code ...
by imba
Thu Dec 23, 2010 4:53 am
Forum: Common Lisp
Topic: macro for looping over functions in a list
Replies: 12
Views: 3927

Re: macro for looping over functions in a list

In the following code,

Code: Select all

(defconstant functions '(1+ 1-)) 
(defun foo ()
  (loop for fun in functions 
           summing (funcall fun 4)))
1+ and 1- aren't inlined in foo. How can I achieve this?
by imba
Wed Dec 15, 2010 1:20 pm
Forum: Common Lisp
Topic: macro for looping over functions in a list
Replies: 12
Views: 3927

Re: macro for looping over functions in a list

I want the functions to be called to be inlined.
by imba
Wed Dec 15, 2010 12:39 pm
Forum: Common Lisp
Topic: macro for looping over functions in a list
Replies: 12
Views: 3927

macro for looping over functions in a list

Given

Code: Select all

(defconstant functions
  '(1+
    1-))
,

I want to define a macro that expands into

Code: Select all

(+
(1+ 1)
(1- 1))
How do I manage this?
by imba
Fri Dec 10, 2010 6:45 am
Forum: Common Lisp
Topic: help creating a simple word scramble program
Replies: 8
Views: 3603

Re: help creating a simple word scramble program

What about this function? (Doesn't preserve first and last letter, though.) (defun random-shuffle (lis) (let ((len (length lis))) (loop for i from 0 to (1- len) do (let ((temp (elt Liste i)) (Position (random len))) (setf (elt lis i) (elt lis Position)) (setf (elt lis Position) temp)))))
by imba
Tue Nov 30, 2010 12:59 pm
Forum: Other Tools
Topic: ECL: Compile Lisp to C
Replies: 8
Views: 18184

Re: ECL: Compile Lisp to C

I found a working Windows version: http://ecls.wikispaces.com/VCExpress
by imba
Tue Nov 30, 2010 8:06 am
Forum: Other Tools
Topic: CL->C compiler
Replies: 5
Views: 16411

CL->C compiler

Is there another CL->C compiler besides ECL? (thinlisp and CLiCC appear to be dead projects.)
by imba
Mon Nov 29, 2010 1:12 pm
Forum: Other Tools
Topic: ECL: Compile Lisp to C
Replies: 8
Views: 18184

Re: ECL: Compile Lisp to C

I wrote a bash script, which creates a backup of the .c/.h files after being written to them.

Now I have another question: Did anyone manage to compile ECL on Windows using MSVC++? I get the error "msvcrt.lib" not found (by nmake), although ...\VC\lib is in PATH.