libera/#commonlisp - IRC Chatlog
Search
12:15:21
lisp123
pjb: Is there a way to use both IBCL & CL-STEPPER together? I tried it and it seems to work, but I have to resolve some conflicts during the ASDF load process (which may just be some incorrect setup on my end)
14:21:00
Fade
Bell is the conglomeration of telecommunications companies (the baby bells) that resulted from the US federal government breaking up AT&T
14:22:04
Fade
anyhow, I was just commenting on the network resets that cascaded through the channel.
14:24:04
Fade
perhaps your client ignores the messages. they can get quite noisy, but I usually enable them.
15:40:04
pjb
lisp123: indeed, since CL-STEPPER replaces CL, and IBCL shadows some symbols from CL, and replaces CL too, (but in a hidden manner), you would have to make an IBCL-STEPPER package that chooses carefully its symbols from one or the other. And since there are some collisions, eg. DEFUN you will have to merge the functionalities by definiting our own IBCL-STEPPER:DEFUN (similarly, DEFGENERIC, DEFMETHOD, etc).
15:40:43
pjb
lisp123: note: if you wanted to use CLIM, you'd also have to merge the behaviors, CLIM shadows CL:defclass and CL:defmethod…
16:30:02
saltrocklamp[m]
eric: thanks for doing that!! i also managed to get c2ffi working in the meantime
16:41:53
rotateq
So I remembered today how to escape when (setq *read-base* 36) was accidentally written.
16:45:14
kagevf
pjb: and lisp123: that command would be even more useful if it got the last command from the currently active repl ... exercise left for the user, I guess :) it's a good start, though :)
16:46:37
etimmons
salt rock lamp: Nice! I had some issues getting c2ffi working, but can't remember them at the moment
16:48:02
rotateq
hmm salt rock lamp, sounds like a variation of the game scissors, paper, rock, lizard, spock
16:49:10
saltrocklamp[m]
rotateq: it's one of these :) https://i.ebayimg.com/images/i/262430307343-0-1/s-l1000.jpg
16:50:40
rotateq
pjb: we had this some weeks ago in #lispcafe and gilberth told me the thing with 10. vs 10.0
16:51:43
Arcsech
Are the reader things CL supports by default (e.g. `|symbol name|`, `#xdeadbeef`, etc) in the hyperspec anywhere? I can't find them
16:52:32
Arcsech
Sure, yeah, but I'm bad at remembering things and would like a list I can reference of the built in "reader macros" or special reader symbols or whatever they're called
16:54:24
Arcsech
Much appreciated, I think I was having difficulty b/c they're not in the symbol index (...because they're not symbols AIUI, but still)
16:55:26
rotateq
Arcsech: so it's opens the eyes when you realize that ", ;, (, ), ... are readmacros. but maybe you first want to learn way simpler dark magic :)
16:55:38
pjb
Arcsech: indeed, don't forget to read the sections before the symbols in each chapter ;-)
16:56:29
pjb
indeed, the only hardwired lisp syntax is for integer, floats, and symbols. And even that could be shadowed by writing reader macros on all the characters.
17:01:30
Arcsech
To ask what is perhaps a silly question, why don't you see a lot more of that? e.g. with Racket, one can write a prolog clone in Racket with completely different syntax (not s-exp based), then call prolog-clone code from Racket and vice-versa. Seems like that should be possible with CL as well, but I don't recall any instances of having seen it
17:02:49
rotateq
the first step writing the macros you need to have prologish things, like described in "On Lisp"
17:20:15
Arcsech
I've read most of Practical Common Lisp (though a bit ago now), currently reading Programming Algorithms in Lisp. I think a macro book is probably next
17:28:39
Arcsech
It's definitely on the more casual end of algo textbooks but does a good job of showing how Lisp makes implementations pretty clean and easy to understand
18:13:39
rotateq
ahh okay so with an array when you imagine the circuit from above with fields and some are empty
18:14:39
rotateq
yes maybe writing a simple digital simulation program where you can put circuits with wires in McCLIM
18:20:23
rotateq
like when you do (defclass triangle (shape) (x y z)) so you store the three defining points, but for example the area is computed by a method
18:41:07
rotateq
okay makes sense, I imagine the #b, #x, #o, #r work internally in a way to set the *read-base* temporarily to the one the specify
19:26:58
lisp123
kagevf: Hmmm good question :) Something like this should do the trick (will leave parts of it unsolved for the reader :) ) --> (let* ((buffer-names (loop for buffer in (buffer-list) collect (buffer-name buffer))) (new-buffer-list (remove-if-not [slime-repl-buffer-p] buffer-names))) (with-current-buffer (car (sort new-buffer-list #'string-greaterp.....
19:49:37
lisp123
Yes (although it has a mistake it but pretty easy to figure it out once one tries). Let me know if you want me to write it out fully
19:52:39
kagevf
lisp123: would it be (easily) possible to get the list of slime connections from the *slime-connections* buffer? then one could parse for the active one ...
19:53:54
kagevf
I don't think your elisp actually determines which connection is the active one, but maybe it would be easy if it's possible to grab the same list used to render *slime-connections*
19:54:02
lisp123
kagevf: Have a look at the SLIME code and see if its possible, its pretty well documented
19:54:56
lisp123
kagevf: Yes, but I think its relatively trivial (that was the error), your buffer-list variable in Emacs should be already sorted so that the active one will be the earliest (so basically remove the SORT in the code above)
19:56:56
lisp123
No worries, I think learning SLIME is a good thing. I will send you the updated code in a few days in any case, glad you brought it up because this way it can be made implementation independent too (the earlier one was hardcoded to SBCL)...will think of the best way to do it
19:58:59
kagevf
lisp123: oh, really? oh, nice ... thank you for the snippet .... I'll play around with it and see how far I can get :)
20:00:07
kagevf
lisp123: and looking forward to that update ... that would be a nice way to take something you've been experimenting with and get it quickly into your actual code buffer ... great idea!
20:01:43
lisp123
kagevf: Great :) Enjoy! Yes, I'm loving this function. Now I want to add 'clear Slime REPL' as well and some other ones so that no more switching to the REPL and back
20:03:26
kagevf
lisp123: btw, I just checked the output of (loop for buffer in (buffer-list) collect (buffer-name buffer)), and it appears to sort by most recently accessed
20:04:19
kagevf
so, IOW, if I have to slime buffers opened 1 and 2, and 1 is the active one and 2 is some other random one, if I access slime-2 then run that code, slime-2 will be at the top
20:05:45
kagevf
my goal would be to have the repl that's connected to C-c C-z (slime-switch-to-output-buffer)
20:20:24
pjb
rotateq: and (list #C(1/2 3/4) 'and #C(#7r10/3 #12rA/5)) #| --> (#C(1/2 3/4) and #C(7/3 2)) |#
20:30:17
rotateq
hm till now I'm not so fit with the extra parameters in the format directives ~d, ~b, ~x, ...
20:31:24
rotateq
pjb: do you know from memory how I can print a number as binary with four groups and underscore, namely for example 0110_1110_0000_0110 ? :)
20:34:27
mfiano
an octet vector can be printed similarly on SBCL but is non-standard behavior: (format nil "~b" #(10 122 102 84))
20:36:09
pjb
(format nil "~,,'-,4:B" (random (expt 2 32))) #| --> "101-1011-1010-0110-0010-1011-0111-1001" |#
20:37:12
pjb
(format nil "~48,'_,',,4:B" (random (expt 2 32))) #| --> "_________1011,1010,1100,1111,0010,0111,1111,1011" |#
20:38:44
pjb
(format nil "~48,'0,',,4:B" (random (expt 2 32))) #| --> "0000000001100,1101,0001,0101,0010,0000,0000,1110" |#
20:40:07
pjb
(format nil "~{~A~^,~}" (group-by (format nil "~48,'0B" (random (expt 2 32))) 4)) #| --> "0000,0000,0000,0000,1111,0001,1110,0011,1110,1001,1000,0110" |#
20:41:43
pjb
and you're right, it's not done for zero-pad, but for padding the field with spaces or * or # etc…
20:45:59
mfiano
I think it would be nice to build up a string with a series of generic function calls, with each step being a method that could be specialized by the user to change/augment its behavior
20:48:13
mfiano
THis is half me wanting to be able to extend FORMAT for cases like the above, and half me never remembering the different directives and their parameters.
20:48:57
mfiano
With the latter being a side-effect of me usually not being able to easily understand a format string at a quick glance, with such a compressed DSL
20:54:10
mfiano
Yes, regex is similar. IIRC there was a simple solution to that in Sussman's recent book
20:55:40
mfiano
I guess it's just preference. I often care much more about human-readable code and extensibility, than playing some sadistic form of obfuscated code golf
20:59:41
pjb
mfiano: well, either ~/ or indeed, write a format-2.0 and (defpackage … (:use "CL") (:shadowing-import-from "FORMAT-2.0" "FORMAT") …)