freenode/lisp - IRC Chatlog
Search
5:41:53
gabbiel
Hey guys, I'm trying to create this 2 macros called "synonymize-macro" and "synonymize-function"
5:43:03
gabbiel
I'm trying to really make it a synonym, i.e. have the new synonyms inherit documentation and arglists
5:44:20
gabbiel
I thought of using trivial-args, and then processing the return value of the arglist function in the trivial-args package
5:44:25
no-defun-allowed
eg (setf (fdefinition 'bar) (fdefinition 'foo)) worked here, copied function and documentation
5:55:25
gabbiel
on a similar note, I also have a macro called funmacro, which turns a function into a macro
5:59:29
gabbiel
sounds dumb, but I have this function I use for my hobby which uses only lists and its annoying to have to quote a bunch of lists
6:01:37
gabbiel
I also wrote a macro "nq" which doesn't define anything, but calls a function with args quoted, maybe I should use that, but idk, funmacro is useful because it also allows for defining with anonymous functions
6:09:58
gabbiel
no-defun-allowed: is there a function akin to fdefinition/macro-function for special operators?
6:15:03
pillton
I am skeptical about your synonym anyhow. You are only considering the function namespace.
6:22:31
gabbiel
quick question, I learned I have to do (eval-when (compile load execute) ...) when I need to use macros within the same file. if I macro that away, will it eval-when, or wont it do anything as its a macro?
8:40:46
pjb
afidegnum: you cannot install quicklisp in emacs. emacs implements emacs lisp. quicklisp is written in Common Lisp.
8:41:42
pjb
afidegnum: there was a (partial) Common Lisp implemented in emacs lisp, but it bit rot since introduction of lexical bindings in emacs lisp. You might want to work on it, it's emacs-cl. Then a port of quicklisp to emacs-cl would be envisageable.
8:44:36
pjb
afidegnum: slime is a kind if IDE letting you develop CL programs using emacs as an editor and user interface for the CL debugger, the CL repl, the CL inspector, etc. So indeed, you could install quicklisp using the CL you access thru slime. But it would be simplier to start at the terminal with quicklisp, since quicklisp also has tools to install slime.
8:48:47
pjb
Ah,sorry, I don't know anything about portacle. Shouldn't everything be already installed and available with it?
8:52:51
pjb
Is quicklisp already installed in your home director? Is there a file ~/quicklisp/setup.lisp ?
8:53:54
pjb
(load #P"~/quicklisp/setup.lisp") is all that is required to load quicklisp if it's already installed. You could add this form to your rc file.
9:33:26
Nilby
Just set the pixels, e.g: (loop for i from 0 below (length (zpng:image-data image)) do (setf (aref (zpng:image-data image) i) #xff))
9:38:10
flip214
but array allocation is likely to write some "sane" value into all pixels anyway, so why write twice?
10:01:25
flip214
still, it looks like a very common use-case to me, so IMO the library should support that.
10:02:05
Nilby
I like the simplicity of the library. Also transparent black is my favorite "sane" value.
10:23:39
pjb
oni-on-ion: I'm sorry, but I always assume people mean what they say. Not my fault if they're not able to say what they mean.
10:24:31
pjb
(If they were able to say what they mean, they wouldn't have to say it in the first place anyways).
10:31:22
dim
pjb: being able to say what you mean is a very rare gift, or only happens to people who never ever try to say anything complex, or open themselves to talking about their emotions and perceptions, so maybe try to be more a human than an english compiler?
10:32:35
dim
anyway that's off-context, my backlog doesn't show me the relevant conversation, but I still though it's important to say that
10:35:06
paule32
dim: i you point to me, .. i have a disscusion, and with my poor slengsh, and i was banned in #clschool
10:37:32
jackdaniel
paule32: I saw quite a few discussions with you and what I've noticed is that you ignore given advices, so while I'm not on #clschool I can guess where the ban may come from
10:42:03
paule32
the problem is, you (all) give me advices, and i tried to transform in do it your (me) self, so i am a little bit lame, and waste some time in playing with lisp, in this time, an other lisper give me hints, and as i was not answer, the lispers are wait and wait on reply of me, but i have some times no part back informations (most of things i am in a newbie
10:43:35
jackdaniel
the thing is that you ask for advice, then you reject it and person who spend time trying to educate you, well, wasted their time
10:44:44
jackdaniel
(and you reject it based on nothing, so it doesn't make really sense) - I'm saying it in good faith that you will try to reconsider this attitude (and I have nothing more to say on this topic)
11:04:40
moldybits
(defun f (&rest keys) (apply #'g keys)) ; this works, but how could i specify the key parameters properly for f, and then only apply them to g if they were set? (defun f (&key a b c) ...)
11:07:42
no-defun-allowed
it was surprising to me when i learnt about it, but it is correct CL surprisingly
11:10:12
pjb
(defun g (&key (a 0) (b 0) (c 0)) (list a b c)) (defun f (&key (a 1) (b 1) (c 1)) (g :a a :b b :c c) #|different defaults|#) (list (g) (f)) #| --> ((0 0 0) (1 1 1)) |#
11:10:40
pjb
(defun f (&rest keys &key a b c) (declare (ignore a b c)) (apply #'g keys)) (list (g) (f)) #| --> ((0 0 0) (0 0 0)) |#
11:12:06
White_Flame
the nuclear option would be to use a macro instead, which forces the syntax onto g right at the call site
11:17:00
Nilby
jackdaniel: Maybe that's why I seem to need to start with something ugly to make any improvement.
11:18:03
jackdaniel
Nilby: that was a joke. the point was that macros often obfuscate the code making it hard to read
11:18:15
Nilby
Perfect lambda list re-passing of complicated defaulting, etc, aguments seems like a little bit of glitch in CL.
11:23:37
jackdaniel
sometimes something is and sometimes something isn't, what means that something may be something different than something ,-)
11:25:21
moldybits
i want to be able to access slots as groups, for example the slots `x' and `y' as `position'. i wrote a macro that works but i wonder if it could be done better. for one, i'm not sure how to think about :before methods ...
11:26:16
no-defun-allowed
The method dispatcher picks the next applicable method in the same generic function, calls it, and returns its value(s).
11:26:32
jackdaniel
it could have been implemented by means of local functions, but afair there is some code walking involved to eliminate unnecessary closures
11:27:04
jackdaniel
(portable common lisp - base for sbcl's and ecl's implementation of CLOS module)
11:28:39
Nilby
I think I wish for a funcall-like-me or something, that works semi-magically like call-next-method.
11:30:44
flip214
Nilby: If I understand you correctly, you want to pass the same argument to another function?
11:30:55
mfiano
Keep in mind you may experience different behavior across implementations by changing the arguments for the next applicable method. The safety level determines whether it will error or not, and different implementations have different default safety levels. CCL is more strict than SBCL in this regard for example.
11:31:03
moldybits
samlamamma: something like (defclass point () ((x :accessor x :initarg :x) (y :accessor y :initarg :y))) (make-slots-group point (x y) position vector elt) (position (make-instance 'point :x 1 :y 2)) => #(1 2)
11:31:58
Nilby
Yes, but getting every nuance of argument defaulting, supplied-p-parameters, etc, exactly correct.
11:33:14
Nilby
shka_: I'm not really trying to do it, just thinking about it. I usually use an "ugly" macro workaround if I have to.
11:34:11
flip214
Nilby: (APPLY #'fn rest-arguments) should do the trick, as fn has to parse keyword arguments out anyway
11:34:32
shka_
if function wants to invoke other function, it may introspect lambda list of the function it is about to invoke
11:36:38
Nilby
shka_: That's interesting, I suppose one could make a "defun" that does that, similar to the code walking of defmethod to get call-next-method right.
11:37:07
samlamamma
moldybits: So (defmethod position ((point point)) (with-slots (x y) point (apply #'vector x y))) ?
11:37:59
Nilby
flip214: That works most of the time, but if you have arguments that weren't suppiled and got defaulted, then the are passed to the next function with the default values, instead of being not supplied.
11:37:59
shka_
Nilby: i would not bother with advance macro-magic, instead i would build object oriented protocol around funcallable objects
11:39:37
shka_
next, i would add something like "invoke" that would actually attempt to introspect whatever it is about to funcall
11:40:20
shka_
but again, i think that it is very complicated and expensive solution to very hypothetical problem
11:40:22
Nilby
shka_: That sounds like a cool idea, and is indeed like the MOP. But so far I'm not bothered enought by it to do so.
11:42:03
shka_
anyway, my point is that you can literally embedd almost anything in the CL, and it may not need to be super extra macro heavy
11:43:52
jackdaniel
Nilby: there is work on that. Fast Generic Dispatch by Robert Strandth to improve runtime dispatch, inlined generic functions to resolve dispatch at compilation time, implementations may have optimizations for simple methods (which doesn't involve too much hacks)
11:45:26
mfiano
I would also like to mention specialization-store for compile-time generic dispatch, even allowing specialization on optional/keyword arguments
11:51:57
Nilby
mfiano: I hope someday I'll have my code working well enough that specialization-store would help. It looks cool.
12:28:19
flip214
Nilby: if some arguments weren't supplied, your &rest won't have them, and so they'll not passed on either
12:52:57
Nilby
flip214: Thank you. But I've decided to just do (defmacro nil (&rest x) `(lambda ,@x)) and write the rest of my code using only quasi-quote.
13:06:15
Xach
heisig: what is the license for https://github.com/marcoheisig/sealable-metaobjects/ ?
13:13:43
heisig
Xach: Do you have a script that checks whether a project is well formed (license, description etc.)?
13:17:24
heisig
Something that library authors can run before submitting their project to quicklisp-projects.
13:21:41
Xach
i need :license, :author, and :description. some form of README file is not checked but would be useful to highlight.
13:23:41
heisig
One could also include some other community guidelines, e.g., how the :author argument should be formatted to make Quickref happy.
13:27:23
heisig
Xach: Should I hack a prototype and make a PR on quicklisp-client? Or should such a style guide be moved to a separate library?
13:29:37
Xach
heisig: I think it is suitable for quicklisp-client. I think it best to keep it extremely simple: check an asdf system for those three fields
14:34:53
pjb
You NEED to qualify symbols with a package where they are accessible, when they're not accessible in the current package.