libera/#commonlisp - IRC Chatlog
Search
1:45:25
Josh_2
Does anyone have an example of using multiple :around methods combined with call-next-method?
1:45:53
Josh_2
I only just realized that call-next-method when inside of an :around looks for the next most applicable :around method before executing the primary (by default) :facepalm:
2:21:23
zacque
Josh_2: You can play around with it using hierarchical classes like animal, dog, poodle, cat, persian-cat
2:22:23
zacque
Then define a generic function like MAKE-SOUND or PRINT-NAME for specialising it on different classes
2:24:18
zacque
The trick in understanding the `Standard Method Combination` is to understand the interplay of "shadowing" and "accumulative" effects for both primary and auxiliary methods
2:25:29
Josh_2
I though (call-next-method) invokes the primary method when in :around, but it doesn't, it looks for the next most applicable :around and if it doesn't find one then it calls the most applicable primary
2:27:41
zacque
Also, I suppose you can always define a "non-crazy" order with DEFINE-METHOD-COMBINATION
2:28:34
Bike
but usually if i don't understand a method combination thing i just figure out what the form looks like based on the method combination definition
2:30:11
Bike
like if your applicable methods are two arounds, two primaries, a before, and an after, what you get is (call-method #<around1> #<around2> (make-method (progn (call-method #<before>) (multiple-value-prog1 (call-method #<primary1> #<primary2>) (call-method #<after>)))))
2:31:00
Bike
in other words, if you use call-next-method and the next method is an around, you call that, but otherwise you call the whole before/primary/after situation
2:35:06
Bike
if you get this system https://github.com/sellout/method-combination-utilities you can use method-combination-expand to get that tree i wrote out manually
11:17:28
mfiano
What is a good way to transform a string repeatedly given a list of cons of translation characters. For example given the list ((#\, . #\-) (#\; . #\:)) and the string "foo,bar;baz", it should produce "foo-bar:baz"
11:20:58
semz
Although this may run into issues if one character is replaced with another character that is to be replaced later
11:33:14
lisp123
this week going to have about 5000 people using my CL app (for a few minutes each at a conf)
11:35:30
mfiano
Something like this maybe is sufficient: https://gist.github.com/mfiano/5616e646ad101334ff4c4938872caaa7
11:39:14
mfiano
I do not want subsequent passes to mutate previous passes. I want to do it all in one pass to avoid that
11:40:32
jackdaniel
what is a testimony that replace is perhaps not the best name for that particular function
11:41:42
rotateq
I always see what I didn't use yet so often. Or today, that NTH-VALUE is actually a macro.
11:44:37
mfiano
Maybe I should be looping over STRING instead of NEW-STRING. I have to read to iteration restrictions in the CLHS again
12:01:00
jackdaniel
clisp payed a dear price for rlwrap integration - it had to change its own license
12:17:40
Mrtn[m]
<lisp123> "one day I will learn C" <- What will you do in the afternoon of that day?
12:45:58
rotateq
trev: It's really one of the most impressive talks I know, due to the idea of translating the metaprogramming for chemistry.
12:56:09
mfiano
jackdaniel: How would you modify your example such that if the cdr is nil, it means trim the original character without replacing (shorter string)?
13:07:38
jackdaniel
I'd probably have a string with a fill pointer along with the index closed over (map nil …)
13:10:37
jackdaniel
(let ((string (make-it size :fill-pointer 0))) (map nil (lambda (c) (when-let ((val (assoc-value …))) (vector-push-extend val string))) *the-other-string*)