jackdaniel changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook> | Pastebin: <https://plaster.tymoon.eu/>
<avocadoist> can I dispatch with defgeneric/method like in Clojure? like, dispatch based on a dynamic variable, not on object type/etc
waleee has quit [Ping timeout: 240 seconds]
<edwlan[m]> No, multimethods in clojure are a different strategy from CL's
waleee has joined #commonlisp
waleee has quit [Ping timeout: 240 seconds]
chrcav has quit [Ping timeout: 240 seconds]
chrcav has joined #commonlisp
Stefanovic67 has joined #commonlisp
Stefanovic67 has quit [Client Quit]
bilegeek has joined #commonlisp
xristos has joined #commonlisp
random-nick has quit [Ping timeout: 250 seconds]
<mfiano> avocadoist: You can with if you define your own method combination. There are a couple libraries that do what Clojure does, or I should say, Clojure does what they do.
<char[m]> Bike gilberth: Just to clarify that when you mean with macroexpand-all being not possible, you mean without extension libraries like cl-environments?
<Bike> char[m]: without a language extension, yes. cl-environments does the cltl2 stuff looks like, which is an extension to the standard
<edwlan[m]> I don’t think method combinations can implement Clojure’s version of multimethods
<Bike> i dunno how clojure works, but method combinations can do pretty much arbitrary code
<edwlan[m]> Maybe it can work, but it’s hard for me to see how: Clojure uses a function that takes all the arguments passed to the multimethod and then returns a value
<edwlan[m]> That value is then used to pick a specialization of the method
<edwlan[m]> And there’s also a first-class hierarchy concept that can be used to control which values are “subtypes” of which other values.
<Bike> ah, i see. then that's less about combining methods then it is about selecting methods. you'd want to specialize compute-applicable-methods instead, or something.
<edwlan[m]> The thing I’m not sure about is how the checks for overlapping methods would interact with them
<edwlan[m]> I have an implementation somewhere, but it took a bit of adjustment for me to figure out how they worked when I first learned Clojure
<Bike> you can specialize compute-discriminating-function and in so doing implement pretty much totally arbitrary semantics, but then you're just doing everything yourself
<edwlan[m]> One thing I like about Clojure is you can dispatch on optional arguments
<Bike> how does that work with defaults?
<Bike> i can understand dispatchinig on argument count, though
<mfiano> edwlan[m]: See filtered-functions. It falls back to a hash table for the slow path, but it allows you to write your own dispatching function.
<mfiano> Also the old paper about it
<mfiano> If you want to get into bending it too much (imo) there is always specialization-store (for dispatching on those optional arguments)
akoana has quit [Quit: leaving]
jeosol has quit [Quit: Client closed]
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
ryanbw has joined #commonlisp
kurfen has quit [Ping timeout: 240 seconds]
kurfen has joined #commonlisp
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pranavats has joined #commonlisp
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pranavats has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
pranavats has joined #commonlisp
nij- has joined #commonlisp
ym has joined #commonlisp
<nij-> I want to test if the output of a function matches a long string S. Currently, I store S in a file F within my project directory. When loading the whole system, I would like to assert if they are string equal. The problem is I don't know how to refer F other than its absolute path.. Any ideas how to solve this issue?
lucasta has quit [Quit: Leaving]
<hayley> asdf:system-relative-pathname
Lycurgus has joined #commonlisp
<nij-> Wow, perfect. Thank you, hayley!
cmack has quit [Ping timeout: 240 seconds]
nij- has quit [Ping timeout: 240 seconds]
ym has quit [Ping timeout: 265 seconds]
Lycurgus has quit [Quit: Exeunt: personae.ai-integration.biz]
bilegeek has quit [Quit: Leaving]
rgherdt has joined #commonlisp
NicknameJohn has joined #commonlisp
bird_ has quit [Ping timeout: 248 seconds]
dcb has quit [Quit: MSN Messenger v2.16.1]
gko` has joined #commonlisp
gko has quit [Read error: Connection reset by peer]
gko`` has joined #commonlisp
gko` has quit [Ping timeout: 250 seconds]
shka has joined #commonlisp
msavoritias has joined #commonlisp
igemnace has joined #commonlisp
azimut has quit [Ping timeout: 240 seconds]
nij- has joined #commonlisp
pjb has joined #commonlisp
alendvai__ has joined #commonlisp
alendvai__ is now known as attila_lendvai
pve has joined #commonlisp
Inline has quit [Quit: Leaving]
luna-is-here has quit [Ping timeout: 264 seconds]
luna-is-here has joined #commonlisp
nij- has quit [Ping timeout: 250 seconds]
mgl has joined #commonlisp
luna-is-here has quit [Read error: Connection reset by peer]
luna-is-here has joined #commonlisp
gko`` has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.2)]
gko has joined #commonlisp
attila_lendvai has quit [Ping timeout: 240 seconds]
Lord_of_Life has quit [Ping timeout: 240 seconds]
Lord_of_Life_ has joined #commonlisp
Lord_of_Life_ is now known as Lord_of_Life
jmdaemon has quit [Ping timeout: 240 seconds]
luna-is-here has quit [Read error: Connection reset by peer]
luna-is-here has joined #commonlisp
luna-is-here has quit [Quit: luna-is-here]
luna-is-here has joined #commonlisp
<pve> Hi, does the eval-when situation ":load-toplevel" mean "only when a fasl is being loaded"?
<jackdaniel> no, it means also when "when a source is being loaded" is loaded
<jackdaniel> mind that only when eval-when is toplevel
<jackdaniel> (there is :execute for other cases)
<pve> jackdaniel: ok, that's what I thought, but if I put (eval-when (:compile-toplevel :load-toplevel) (print 'hello)) and load the file, I get no HELLO.
<pve> with :execute, I do get a HELLO
<jackdaniel> is your eval-when a top-level form?
<pve> yes
<pve> the file contains only the eval-when form and I load it with sbcl --no-userinit --load foo.lisp
<jackdaniel> sorry, I've misguided you. both compile-toplevel and load-toplevel control code that appears as processed by compile-file
<jackdaniel> so you were right from the beginning (that is - loading fasl, that is a compiled file)
<pve> no problem, thanks
<jackdaniel> dbotton_: are you around?
<pve> so now my actual question was, If I for some strange reason wanted to temporarily use a package, I could sandwich some code between (eval-when (:compile-toplevel :execute) (use-package :some-lib)) and (eval-when (:compile-toplevel :execute) (unuse-package :some-lib))?
<pve> so no :load-toplevel needed there
<pve> not that I have any intention of doing so right now, it just occurred to me for the first time that it could be done
<dbotton_> jackdaniel: yes
kevingal has joined #commonlisp
<dbotton_> I've been dealing last three weeks with flood damage but around
<jackdaniel> ah, that explains it. I've pinged you because I saw no recent activity of yours recently (i.e in clog and otherwise)
<jackdaniel> (so I got a little concerned)
<dbotton_> Hopefully back on things next week. Appreciated
<jackdaniel> good luck (and sorry to hear about the flood)
shka has quit [Read error: Connection reset by peer]
shka has joined #commonlisp
shka has quit [Read error: Connection reset by peer]
shka has joined #commonlisp
shka has quit [Quit: Konversation terminated!]
shka has joined #commonlisp
abrantesasf has joined #commonlisp
luna-is-here has quit [Quit: luna-is-here]
luna-is-here has joined #commonlisp
nij- has joined #commonlisp
rgherdt has quit [Read error: No route to host]
rgherdt_ has joined #commonlisp
MajorBiscuit has joined #commonlisp
kevingal has quit [Ping timeout: 240 seconds]
Major_Biscuit has joined #commonlisp
random-nick has joined #commonlisp
MajorBiscuit has quit [Quit: WeeChat 3.6]
rgherdt has joined #commonlisp
rgherdt_ has quit [Read error: No route to host]
<nij-> Anyone using roswell, and running into its slow launch time?
<nij-> sbcl takes around 0.03 seconds to launch and exit, while roswell/sbcl takes around 0.3 seconds..
rgherdt has quit [Ping timeout: 265 seconds]
<yitzi> The solution that I have found to work...is to not use roswell. ;)
<nij-> I'm about to make the same conclusion...
<nij-> Hmm.. but if I run an sbcl with roswell, save-lisp-and-die, then the core again only takes 0.03s to start and exit.
<nij-> yitzi How about cl-launch, have you used it?
cage has joined #commonlisp
rendar has quit [Ping timeout: 240 seconds]
luna-is-here has quit [Quit: luna-is-here]
<Nilby> nij-: I load in all my commands, save-lisp-and-die with a :toplevel that dispatchs on (first *posix-argv*), and make a bunch of ln -s to the image. You could use a defcommand and fancy option parser even. Seems quick enough.
<jackdaniel> if you are parsing command line arguments, then net.didierverna.clon is a very pleasent software to work with
abrantesasf has quit [Ping timeout: 248 seconds]
abrantesasf has joined #commonlisp
abrantesasf has quit [Ping timeout: 246 seconds]
_abrantesasf_ has joined #commonlisp
<nij-> Nilby what is ":toplevel"?
<nij-> Do you happen to have your scripts open to read?
_abrantesasf_ has quit [Ping timeout: 265 seconds]
<ixelp> SBCL 2.3.4 User Manual
piethesailor has joined #commonlisp
<yitzi> nij-: Its a keyword argument to save-lisp-and-die.
<nij-> Oh, I see. I thought it's something else in CL. Thanks.
<nij-> Wow, Nilby, you create a core for each command? A core is like ~40MB large!
<beach> Yeah, several cents worth of disk space.
<Nilby> nij-: no. just one core to rule them all.
<nij-> I see, like a busybox.
<Nilby> yes
<nij-> I do that now too. Was exploring alternatives.
<nij-> Thanks for sharing!
<Nilby> but i guess i do have a few: for shell comamnds, web server, window manager
nij- has quit [Ping timeout: 240 seconds]
overclucker has quit [Ping timeout: 246 seconds]
overclucker has joined #commonlisp
rgherdt has joined #commonlisp
theBlackDragon has quit [Ping timeout: 240 seconds]
rendar has joined #commonlisp
rendar has quit [Changing host]
rendar has joined #commonlisp
theBlackDragon has joined #commonlisp
gxt__ has quit [Remote host closed the connection]
gxt__ has joined #commonlisp
david` has joined #commonlisp
kevingal has joined #commonlisp
jeosol has joined #commonlisp
rogersm has joined #commonlisp
msavoritias has quit [Remote host closed the connection]
bird_ has joined #commonlisp
<phantomics> Hi beach, if you're around I had some Cluster questions
dbotton_ is now known as dbotton
<phantomics> In particular: for a fixed-width instruction set, I find it's simple to build instructions by adding numbers, like adding 64-bit numbers to compose an 8-byte instruction.
<beach> I see.
<phantomics> I could apply this technique to Cluster methods for fixed-width architectures and then decompose the large numbers into byte vectors, does this make sense to you? Anticipate any problems with it?
<beach> I don't think I am able to think through the issues. I would have to see the code. But you should do what you think best.
<beach> I am not sure what you want the decomposition into byte vectors for though.
<beach> Oh, for the final binary code?
<beach> Sure.
nij- has joined #commonlisp
<nij-> Nilby sometimes I do regret migrating to macos, especially about its windows manager.. I miss stumpwm so much :-(
<phantomics> Cluster's system outputs byte vectors, in binary there isn't a difference between a vector of bytes or a vector of 64-bit values, but it would cause minimal friction with the existing Cluster system
<beach> Yes, I understand. Sounds good.
<phantomics> Also, what do you think of extending the system for instruction prefixes in the instruction-descriptor class? Currently it has rex.w as a property, but the class will balloon out of control if you add properties for every prefix
<phantomics> There could instead be a system of prefix lists, where the list may contain symbols like 'rex.w that denote certain prefix values and formats
<beach> Sure, if you can find a way to do that, go ahead.
<phantomics> The prefixes themselves could be functions outputting values, for instance IIRC rex.w always starts with 0100 and the last 4 bytes vary depending on the instruction parameters
mgl has quit [Quit: Client closed]
<phantomics> I'll give it a try then, maybe see about adding some SIMD instructions
<beach> Great!
nij- has quit [Ping timeout: 256 seconds]
zxcvz has joined #commonlisp
<phantomics> Btw, if anyone could use a progress bar that prints in the REPL, April now includes a highly customizable function to generate one: https://github.com/phantomics/april/blob/master/novelties.lisp#L64
<ixelp> april/novelties.lisp at master · phantomics/april · GitHub
<phantomics> Inside the April package, you can test it by running (let ((advancer (april-print-progress-bar 100))) (loop :for i :below 100 :do (funcall advancer) (sleep 0.05)))
<phantomics> You can use it to monitor the advance of a download, generating a big data structure or anything else where you can measure the progress and you can pass a character string to "reskin" the meter
zxcvz has quit [Client Quit]
szkl has joined #commonlisp
ec_ has quit [Remote host closed the connection]
festerdam has joined #commonlisp
<festerdam> Hi, all.
<beach> Hello festerdam.
<beach> festerdam: Are you new here? I don't recognize your nick.
edgar-rft has quit [Quit: Leaving]
ec_ has joined #commonlisp
<festerdam> I just started reading Practical common lisp, and chapter 3 confused me a bit. Specifically the "Improving the user interaction" section. In this section the author has this procedure: (defun prompt-read (prompt) (format *query-io* "~a: " prompt) (force-output *query-io*) (read-line *query-io*)). I'm a bit confused by the use of *query-io*. I read in the docs that it is a bidirectional stream, which
<festerdam> explains why it can be used for both input and output, but why does Common have *query-io* to begin with, if *standard-output* and *standard-input* exist?
<festerdam> beach: Yes, I'm new here.
<beach> Great! Welcome!
<Bike> festerdam: sometimes it is convenient to pass around a single bidirectional stream object. for example, prompt-read could take the stream to use as a parameter.
<beach> festerdam: Because *standard-input* and *standard-output* may be redirected from/to a file.
<beach> festerdam: And then you wouldn't want interactions to be from/to that file.
<festerdam> Bike: Thanks. That makes sense.
<festerdam> beach: So *query-io* can't be redirected? So it isn't bound to the stdout and stdin file descriptors?
<beach> Sure it can, but you typically don't want to do that.
<Bike> it's common to redirect standard-output or input without redirecting query-io
<Bike> standard-output is conceptually just an output stream, so it can be a terminal or a file or whatever. but query-io is supposed to be for interactive queries. so you can rebind standard-output but keep using query-io.
<pjb> pve: jackdaniel is wrong; try it yourself: https://termbin.com/uj4e :load-toplevel is only for loading fasl. Loading sources is :execute.
<beach> festerdam: I am pretty sure that redirecting *standard-input* or *standard-output* from/to a file does not affect the underlying OS file descriptor, and instead a new file descriptor is created.
<pjb> festerdam: the point is that when you boot a lisp image, it's set up for you such as *terminal-io* reaches the terminal, and *query-io* reaches the human operator. *standard-input* and *standard-output* are "batch" streams that may be connected to files or other devices, perhaps the terminal, but no guarantee about reaching the user.
dcb has joined #commonlisp
<pjb> festerdam: note that the *terminal-io* may not reach the user. It may just be a console in a broom closet. On the other hand, the implementations must make all possible effort to connect you to a human when you use *query-io*.
ym has joined #commonlisp
nij- has joined #commonlisp
<festerdam> Thanls, all. The explanations given are really hepful. I'm a bit curious about how it is done internally now on posix platforms? If I'm not mistaken what shells generally do to redirect data is to make the dup2 syscall with the oldfd as the file being redirected to and newfd being the redirected fd. How does the implementation of Common know how to write to the original file that it's being
<festerdam> redirected from?
<Bike> like beach said, you don't really need to screw around with the underlying fds
<festerdam> Bike: I know Common has streams, I was just curious about how it is implemented.
<pve> pjb: yep, we cleared it up
<Bike> you can make a new stream with a different fd or whatever, and then bind the *standard-output* variable to that new stream, without touching the old stream or its fd
<pjb> festerdam: consider platforms such as Android or macOS. They are unix platforms, so they have a stdin stdout and stderr. But when you launch an application from the GUI, those streams are closed. So *standard-input* *standard-output* and *error-output* must go to /dev/null. On the other hand, the application has access to the user thru the GUI. so *query-io* will display output in a GUI window, and get input from a GUI dialog.
<pjb> festerdam: but if you launch an app from the terminal, you may have *terminal-io* available, and depending on the redirections you gave at the shell, *standard-input* *standard-output* and *error-output* too.
<pjb> Eg. if you run from Terminal.app: /Applications/MyCLApp.app/Contents/MacOS/MyCLApp < some.input > some.output 2> some.log
<pjb> You could use *terminal-io* to read a password from the terminal, and *query-io* to interact with the user thru the GUI.
<beach> festerdam: To redirect (say) *STANDARD-OUTPUT* to a file, you would use the OPEN Common Lisp function (directly or indirectly). This function will return a Common Lisp stream. That stream can then be made the value of *STANDARD-OUTPUT*.
<beach> festerdam: Doing that does not influence the underlying file descriptors of the operating system, nor does it influence the value of other Common Lisp variables containing streams.
wooldoor has quit [Quit: WeeChat 3.8]
<festerdam> Ok, I just tried simply doing a (format *query-io* "test~%") and ran «sbcl --script test.cl > /dev/null» and nothing was printed, so *query-io* does seem to be redirected. So what you mean is could thechnically configure *query-io* to point somewhere else besides stdin and stdout, a GUI or another file or a pipe for instance?
<masinter> most of the common lisp file system specs were written by people designing lisp machines -- no unix or any other os around
<pjb> festerdam: you forgot to flush the buffers!!!
<pjb> festerdam: https://termbin.com/azr9
ec_ has quit [Ping timeout: 240 seconds]
<beach> festerdam: I think you are confusing redirection at the OS level and redirection at the Common Lisp level.
<festerdam> pjb: Weird. When I add the finish-output line to the file it still doesn't print anything when redirected to /dev/null, and which I should have previously mentioned prints to stdout when not redirecting.
<festerdam> But as the single shell line as written in the pastebin, it does print even with redirection.
<beach> festerdam: It is entirely possible that both *standard-output* and the output part of *query-io* are connected to the underlying stdout initially.
<beach> festerdam: But, again, the redirection at the Common Lisp level does not do anything to the OS file descriptors.
jmdaemon has joined #commonlisp
<pjb> festerdam: in my example, it prints on the terminal when >/dev/null…
<pjb> In the terminal, you should have *query-io* = *terminal-io* = /dev/tty, not /dev/stdout /dev/stdin.
nij- has quit [Ping timeout: 240 seconds]
<festerdam> beach: (in response to the confusing redirection message) That's what I understand under redirection. I'm still in the first chapters, so I'm not aware of any kind of feature in Common also known as redirection. That's why I was a bit confused on how it would be possible to print to stdout even when the shell redirects the output, unless there's some standard way for the child to the acquire the
<festerdam> duplicate of the original file descriptor before it was overwriten
<Bike> nobody's overwriting file descriptors, is the thing.
<Bike> i mean, you can redirect stdout to /dev/null in the shell like you did, but that's not what you're doing in lisp.
<festerdam> I guess I should just continued reading.
<festerdam> But thanks, all!
<Bike> like - making a new stream is like making a new C variable that holds a fd. you can change what fd is in the variable without doing posix anything.
kevingal has quit [Ping timeout: 240 seconds]
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
azimut has joined #commonlisp
rogersm has quit [Quit: Leaving...]
nij- has joined #commonlisp
Major_Biscuit has quit [Quit: WeeChat 3.6]
jmdaemon has quit [Quit: ZNC 1.8.2 - https://znc.in]
mgl has joined #commonlisp
jmdaemon has joined #commonlisp
karlosz has joined #commonlisp
<cpli> why isn't there specific predicates for dotted lists? http://sprunge.us/phULQn
<Bike> they're not used much.
morganw has joined #commonlisp
_dcb_ has joined #commonlisp
dcb has quit [Read error: Connection reset by peer]
_dcb_ has quit [Client Quit]
dcb has joined #commonlisp
szkl has quit [Quit: Connection closed for inactivity]
david` has quit [Ping timeout: 240 seconds]
karlosz has quit [Quit: karlosz]
<phantomics> Is there an accepted way to detect system properties like the availability of AVX, AVX2 etc. under x86 or other CPU or memory features? *features* doesn't tell me more than whether I have an x86-64 CPU
mgl has quit [Quit: Client closed]
waleee has joined #commonlisp
masinter has quit [Ping timeout: 240 seconds]
<beach> cpli: It is easy to write it yourself. The language can't possibly provide everything that everybody needs. Instead, it provides the tools.
masinter has joined #commonlisp
<beach> cpli: Something like (not (null (nth-value 1 (ignore-errors (list-length list)))))
attila_lendvai has joined #commonlisp
lucasta has joined #commonlisp
edgar-rft has joined #commonlisp
waleee has quit [Ping timeout: 246 seconds]
waleee has joined #commonlisp
dcb has quit [Ping timeout: 265 seconds]
dcb has joined #commonlisp
dcb has quit [Ping timeout: 268 seconds]
dcb has joined #commonlisp
simendsjo has joined #commonlisp
Inline has joined #commonlisp
igemnace has quit [Remote host closed the connection]
tyson2 has joined #commonlisp
nij- has quit [Ping timeout: 240 seconds]
semz has quit [Quit: ZNC 1.8.2+deb2build5 - https://znc.in]
semz has joined #commonlisp
rgherdt_ has joined #commonlisp
rgherdt has quit [Remote host closed the connection]
jmdaemon has quit [Ping timeout: 240 seconds]
remexre has quit [Ping timeout: 248 seconds]
rgherdt_ has quit [Ping timeout: 265 seconds]
simendsjo has quit [Ping timeout: 240 seconds]
cage has quit [Quit: rcirc on GNU Emacs 28.2]
Fade has quit [Quit: leaving]
ym has quit [Ping timeout: 264 seconds]
Fade has joined #commonlisp
Fade is now known as Fade
lucasta has quit [Remote host closed the connection]
attila_lendvai has quit [Ping timeout: 265 seconds]
abrantesasf has joined #commonlisp
dcb has quit [Ping timeout: 248 seconds]
tyson2 has quit [Remote host closed the connection]
dcb has joined #commonlisp
jmdaemon has joined #commonlisp
nij- has joined #commonlisp
jeosol has quit [Quit: Client closed]
remexre has joined #commonlisp
festerdam has quit [Ping timeout: 256 seconds]
mgl has joined #commonlisp
mariari has quit [Ping timeout: 240 seconds]
rgherdt has joined #commonlisp
tyson2 has joined #commonlisp
mgl has quit [Quit: Client closed]
nij- has quit [Quit: Using Circe, the loveliest of all IRC clients]
mariari has joined #commonlisp
jeosol has joined #commonlisp
luna-is-here has joined #commonlisp
NicknameJohn has quit [Ping timeout: 240 seconds]
piethesailor has quit [Remote host closed the connection]
abrantesasf has quit [Remote host closed the connection]
pve has quit [Quit: leaving]
NicknameJohn has joined #commonlisp
lucasta has joined #commonlisp
NicknameJohn has quit [Ping timeout: 240 seconds]
morganw has quit [Remote host closed the connection]
jmdaemon has quit [Ping timeout: 264 seconds]
rgherdt has quit [Remote host closed the connection]
pjb has quit [Ping timeout: 240 seconds]
jmdaemon has joined #commonlisp
random-nick has quit [Ping timeout: 250 seconds]
NicknameJohn has joined #commonlisp
shka has quit [Ping timeout: 240 seconds]