Search found 6 matches

by implausibleusername
Sat Jan 24, 2009 10:02 am
Forum: Common Lisp
Topic: pos+ function from Paul Graham's "ANSI Common Lisp"
Replies: 12
Views: 22285

Re: pos+ function from Paul Graham's "ANSI Common Lisp"

AlexPaes wrote:The problem with 'implausibleusername' functions is the order of the forms, since the functions return the last evaluated form the functions will return the value of (incf i), you can either wrap a PROG1 form around these, like:
That'll teach me not to use '(1 1 1) as a test case.
by implausibleusername
Fri Jan 23, 2009 4:19 pm
Forum: Common Lisp
Topic: pos+ function from Paul Graham's "ANSI Common Lisp"
Replies: 12
Views: 22285

Re: pos+ function from Paul Graham's "ANSI Common Lisp"

So (let ((i -1)) (mapcar #'(lambda (x) (+ x i) (incf i) ) l ))) should be (let ((i 0)) (mapcar #'(lambda (x) (+ x i) (incf i) ) l ))) Alternatives are: (mapcar (let ((i 0)) (lambda (x) (+ x i) (incf i) )) l )) or (mapcar #'+ list (loop for k in list for i from 0 collect i)) I don't think either of t...
by implausibleusername
Wed Dec 17, 2008 6:15 am
Forum: Common Lisp
Topic: Looking for good examples of Lisp macros
Replies: 6
Views: 13471

Re: Looking for good examples of Lisp macros

Again I'm not sure if this counts as good, but it's both novel and short. The macros generate code typed according to given exemplars. In conjuncture with type inference like SBCL, these constraints will propegate through the function. Disclaimer: I originally posted this on C.L.L. in response to so...
by implausibleusername
Fri Oct 10, 2008 6:34 am
Forum: Common Lisp
Topic: How to turn function into a list?
Replies: 11
Views: 24056

Re: How to turn function into a list?

Hello, My nick is Methusala and I am a recovering Javaholic. I would like to be able to turn a function into a list at the repl, so I can experiment with meta programming in the REPL. I know how to use a list like a function: CL-USER> (setf g '(+ 2 2)) (+ 2 2) CL-USER> g (+ 2 2) CL-USER> (eval g) 4...
by implausibleusername
Wed Aug 27, 2008 3:44 am
Forum: Common Lisp
Topic: Graphical Programming in Lisp?
Replies: 10
Views: 21950

Re: Graphical Programming in Lisp?

I was thinking of it like this: plain lisp macros do this: code :arrow: code Graphical programming does this: graphics :arrow: code Graphical macros do this: graphics :arrow: graphics P.S. Those arrows don't blend in very well, do they :). I'm not sure what the need for graphics macros would be. Ma...
by implausibleusername
Sun Aug 24, 2008 4:01 pm
Forum: Lisp Quiz
Topic: Lisp Quiz #1: Minesweeper
Replies: 10
Views: 76590

Re: Lisp Quiz #1: Minesweeper

Ok, I made a stab at this to kick start the competition. It's a bit horrific, it weighs in at 200ish lines of code + some small commented out tests. I started writing, and never backed up to edit unless the code didn't work. So the algorithm is sub-optimal, it should be rewritten for a better order ...