freenode/#lisp - IRC Chatlog
Search
1:28:22
libertyprime
hey guys. could someone please write a macro for me pretty please. I just want something that's analogous to this emacs lisp. http://ix.io/1LhA ie.e it should run some code but first pass the code through another function
1:32:36
libertyprime
essentially i just need something which i can wrap around some syntax form and run a side effect using the raw code, then pass the raw code through transparently
1:34:11
Bike
i mean, i don't really get this, if run is apply then the func is actually called at macroexpansion time, and not at r untime
1:40:40
oni-on-ion
i think it does not matter what the meaning is. why are there two? it would work the same in common lisp as emacs lisp.
1:41:06
Bike
okay, so your macro applys func at macroexpansion time. is it supposed to? that seems like a very strange thing to do
1:41:54
libertyprime
i think im not good enough at emacs lisp to optimise it. all i know is it does the job for me. id just like to know how to achieve what i want, properly, in common lisp
1:44:21
Bike
yeah that really doesn't make sense. IDENTITY only takes one argument but it'll get a whole bunch of them here.
1:45:24
libertyprime
identity is used in 2 different ways here. when i macro expand the sideeffect function, i could expand it into a (progn) or an (identity), identity is able to handle the case where the body expands into a literal string, say
1:47:14
libertyprime
bike: that's alright. i havent found a way yet to handle multiple things. currently, it only handles a single argument, sexp or literal
1:48:08
Bike
It's not alright. In order to translate this for you we need to understand what it does, but what it does is incoherent.
1:48:45
libertyprime
if you cant handle a bit of incoherent code then you shouldnt be *helping* newer prammers
1:49:11
Bike
That's why I'm asking you what it does, but you haven't answered my macroexpansion question. Do you understand the question?
1:50:37
libertyprime
sorry, id like it to happen at macro expansion time because if i were to say make a trace function, i want to see the expression before its evaluated
1:52:41
Bike
So what you want is a macro that takes an operator and a body. At macroexpansion time it applies the operator to the unevaluated body. The macroexpansion then runs the body while suppressing errors. Is that right?
1:54:34
libertyprime
sigh sorry im sitting next to this girl i asked out -- demonstrating for computer science school
1:55:00
pjb
(defmacro m (operator &body body) (apply operator body) `(ignore-errors (progn ,@body)))
1:55:14
Bike
(defmacro sideffect (operator &rest body) (when operator (apply operator body)) `(ignore-errors ,@body)) (sideeffect print (error "hey")) => prints (error "hey") at macroexpansion time, then returns NIL, #<SIMPLE-ERROR>
1:55:49
Bike
in general you should avoid side effects at macro expansion time, though, since the implementation can macroexpand things as many times as it feels like
3:45:05
beach
Or does it mean that if get-setf-expansion does not return anything useful, then the SETF macro itself returns (SETF F)?
3:49:54
Bike
i don't think any implementations don't have the default be returned by get-setf-expansion, at least.
3:54:56
Bike
in the other case, get-setf-expansion would signal an error or return gibberish or something if the operator did not have a defined expansion.
3:58:05
oni-on-ion
but that is what it says: ' Any compound form is a valid place, since any compound form whose operator f has no setf expander are expanded into a call to (setf f). ' --- if no expander.. ?
3:59:47
beach
oni-on-ion: Suppose you are implementing the specification. What do you return from GET-SETF-EXPANSION, if it is given a place (F ...) that does not have an expander associated with it?
4:04:40
mfiano
oni-on-ion: It's a recurring problem that you reply nonsense and disrupt otherwise constructive conversations. please just stop.
4:09:20
oni-on-ion
whoa.. and i am actually trying to learn this stuff. way to shame someone publically ! now what do i do? never talk? or think that everything i say is disruptive and destructive? i will understand if my words disturb you but it is not fair to myself or others to make something personal like this. why have you not told me earlier something like this??
4:10:11
oni-on-ion
does everyone really think i am always a fool, and nonsense ? i am not sure what i am supposed to do or think here.
4:15:58
oni-on-ion
mfiano, in the meantime i will take this lightly and assume this is some carry-over from #lispgames and possibly a kind of personal issue with me you have not discussed or mentioned or hinted at. i would appreciate if you would discuss your problems with me, with just me personally. i will carry on as i was otherwise.
4:16:22
oni-on-ion
i can't imagine this feels good for either of us right now, whatever it is. i can learn to talk smarter at least, i will tr.
4:22:15
mfiano
This has nothing to do with #lispgames, and more to do with all the complaints from multiple channels I've heard about you recently, but this is not the forum for that discussion, so that's all I have to say.
4:48:10
libertyprime
oni-on-ion is super helpful in all the cool chat rooms #haskell #lisp #emacs. oni-on-ion we love you. haters will hate
4:51:30
libertyprime
as a side note, my phone is locked in lost property, my car key is snapped like the shards of narsil. i didnt get the job, i didnt get the girl, she has a boyfriend. im a little on edge!
7:50:16
no-defun-allowed
you still would have to be better than her bf. +most-negative-fixnum, and this isn't really a place for talking about relationships so i should shut up. +#c(0 #.most-positive-fixnum)
11:07:36
moldybits
libertyprime: why do you want to print the expression at macroexpansion time, though? why not just have it print the expression right before it is evaluated? (progn (print 'expr) expr)