Search found 35 matches

by danb
Fri Oct 03, 2008 11:08 pm
Forum: Common Lisp
Topic: How to turn function into a list?
Replies: 11
Views: 14417

Re: How to turn function into a list?

Hello, My nick is Methusala and I am a recovering Javaholic. We're here for ya, buddy! :D how do you use a function like a list? You don't. You define a macro that returns a function call* as a list, and then you call the macro. (see below) CL-USER> (defun h (x) (+ x x)) H CL-USER> (h 2) 4 CL-USER>...
by danb
Tue Sep 23, 2008 10:39 pm
Forum: Common Lisp
Topic: Discussion on possible lambda syntax: Good or Evil?
Replies: 17
Views: 23266

Re: Discussion on possible lambda syntax: Good or Evil?

#f(push _ xs) => (lambda (#:G1) (push #:G1 xs)) #f[_ + 1] => (lambda (#:G2) (+ #:G2 1)) #3f(foo) => (lambda (#:G3 #:G4 #:G5) (foo #:G3 #:G4 #:G5)) Personally, I find this syntax confusing. What's confusing about it? Each underline represents a distinct argument, and the number between the # and the...
by danb
Tue Sep 23, 2008 10:22 am
Forum: Common Lisp
Topic: Discussion on possible lambda syntax: Good or Evil?
Replies: 17
Views: 23266

Re: Fanboyism

Kompottkin wrote:
danb wrote:Everybody likes their own code ;)
No. Definitely not.
So I exaggerated :)
Anyway, in most cases, if you don't like your own code, you don't have to use it. So it's common to see people touting their own favorite systems, which may or may not appeal to others.
by danb
Mon Sep 22, 2008 7:57 pm
Forum: Common Lisp
Topic: Discussion on possible lambda syntax: Good or Evil?
Replies: 17
Views: 23266

KISS

{and $1 $2} #$(and $1 $2) I use a simpler but less powerful system called #func . It's more like partial application in ML: #f(push _ xs) => (lambda (#:G1) (push #:G1 xs)) #f[_ + 1] => (lambda (#:G2) (+ #:G2 1)) #3f(foo) => (lambda (#:G3 #:G4 #:G5) (foo #:G3 #:G4 #:G5)) Goo has something similar in...
by danb
Sat Sep 13, 2008 5:36 am
Forum: Common Lisp
Topic: Depth First Search traversal of this list
Replies: 3
Views: 7909

Re: Depth First Search traversal of this list

I am trying to traverse the list (A (B (D E) C)) in a way that the print output should be in the following order D, E, B, C, A aka depth first traversal. This is a depth-based ordering of the nodes, but you need to collect elements breadth-first. Try writing a function that takes a tree as its only...
by danb
Sat Aug 23, 2008 11:00 pm
Forum: Common Lisp
Topic: Symbols
Replies: 5
Views: 6045

Re: Symbols

So, the question is, if you try to find the symbol 'walker in package :general-walker, will it return the inherited method symbol from arnesi or that from general-walker? Why? As qbg said, GENERAL-WALKER uses the existing symbol in ARNESI. It doesn't create a new one. So general-walker:walker is EQ...
by danb
Sat Aug 23, 2008 9:49 am
Forum: Common Lisp
Topic: Symbols
Replies: 5
Views: 6045

Re: Symbols

Basically, i'm trying to automatically define a method What do you mean "automatically"? Are you trying to do it at runtime? This code is in another package. Why? i want to be able to find multiple symbols in a package which have the same name You can't do that. Within one package, any particular n...
by danb
Sun Aug 17, 2008 3:40 pm
Forum: Common Lisp
Topic: batch macro creation
Replies: 3
Views: 4900

Re: batch macro creation

(labels ((define-square-accessor (accessor-name slot-name) (eval `(defmacro ,accessor-name (x y &optional (level '*level*)) `(slot-value (aref (level-data ,level) ,x ,y) ',',slot-name))))) (dolist (slot +square-slots+) (define-square-accessor (intern (concatenate 'string "SQUARE-" (string slot))) s...
by danb
Sun Aug 17, 2008 11:36 am
Forum: Common Lisp
Topic: defstruct and included slots
Replies: 2
Views: 3714

Re: defstruct and included slots

I'm cross-posting this to this forum from comp.lang.lisp ... The CL spec is mute on this point. If a destruct definition includes another struct and the new struct has a slot with the name of a slot in the included struct, what happens? Pascal C. answers the question in response #3. Looking farther...
by danb
Thu Aug 07, 2008 6:00 pm
Forum: The Lounge
Topic: LispForum recruiting
Replies: 2
Views: 3997

Re: LispForum recruiting

findinglisp wrote:I'd really like to bring people in and continue to increase the amount of discussion.
Don't worry, they'll come. It takes time. Quality before quantity, plz :D