phoe changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language | <http://cliki.net/> <https://irclog.tymoon.eu/freenode/%23lisp> <https://irclog.whitequark.org/lisp> <http://ccl.clozure.com/irc-logs/lisp/> | SBCL 1.4.14, CMUCL 21b, ECL 16.1.3, CCL 1.11.5, ABCL 1.5.0
sjl has joined #lisp
Bike has joined #lisp
ntbre has joined #lisp
svillemot has quit [Ping timeout: 252 seconds]
<fiddlerwoaroof> Speaking of which, nyef used to be really active here and in #sbcl, but I haven't seen them around in a year or so
DGASAU has quit [Ping timeout: 264 seconds]
svillemot has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
devon has joined #lisp
sjl has quit [Quit: WeeChat 2.2-dev]
sjl has joined #lisp
mrcom has quit [Read error: Connection reset by peer]
r13l has quit [Remote host closed the connection]
marusich has joined #lisp
karlosz has joined #lisp
<Josh_2> am I missing something here because unwind-protect isn't shutting the socket when test crashes Q_Q https://plaster.tymoon.eu/view/1109#1109
karlosz has quit [Client Quit]
<Bike> where does test crash?
<Bike> are you checking from the debugger?
<Josh_2> It crashes when I send it some data from my phone
<Josh_2> Over that socket
adolby has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<Bike> i mean, is it in the establish-tcp-connection call, or the receive-resolution call
<Josh_2> O
<Josh_2> receive-resolution
<Bike> and are you stil in the debugger as you check?
adolby has joined #lisp
<Josh_2> I don't understand what you mean
<Bike> i mean, you say test "crashes", but that means it signals an error and the debugger comes up, right?
<Josh_2> O yeh
<Josh_2> Sorry
<Bike> so are you still in the debugger as you check whether the socket is still open
atgreen has joined #lisp
<Josh_2> No just checking in repl by trying to run (test) again
<Josh_2> and it tells me that its still open
<Josh_2> which I thought unwind-protect closed but rip
<Bike> odd
<Josh_2> The object is a CONDITION of type USOCKET:ADDRESS-IN-USE-ERROR.
<Josh_2> SOCKET: NIL
<Josh_2>
<Josh_2> Not sure if that is relevant and didn't mean to spam :(
X-Scale has quit [Ping timeout: 244 seconds]
<Josh_2> I shall restart Sly
<dlowe> is this the listening socket?
<Josh_2> It sure is
<dlowe> You need to set the SO_REUSEADDR socket option if you want to reuse it right afterward.
<dlowe> TCP mandates a waiting period for closed listeners
<Josh_2> O, well I set it now
<dlowe> The documentation says that it makes TCP less reliable, but in practice I've never had trouble with it
mejja has quit [Quit: mejja]
devon has quit [Ping timeout: 250 seconds]
<Josh_2> Stupid thing, the address is still in use when it crashes *sigh*
<fiddlerwoaroof> Hmm, one thing you have to be a bit careful about is the stream keeping things open
<fiddlerwoaroof> I don't know if this is relevant here, but I've had issues with drakma where I eventually run out of fds when I do (drakma:http-request "///" :want-stream t) because, unless I close the stream, the socket never gets released.
<Josh_2> I have added another unwind-protect hopefully that'll fix it
<fiddlerwoaroof> :)
thinkpad has quit [Ping timeout: 272 seconds]
thinkpad has joined #lisp
<Josh_2> Frick
<Josh_2> Even with two unwindprotects it doesn't do much protecting
<Xach> so_so_reuseaddr
dale has quit [Quit: dale]
<fiddlerwoaroof> I have a suspicion that additional unwind-protects won't make a difference, unless there's an error in establish-tcp-connection
<Josh_2> fiddlerwoaroof: I think you got it right
zotan has quit [Ping timeout: 268 seconds]
zotan has joined #lisp
orivej_ has quit [Ping timeout: 246 seconds]
zotan has quit [Ping timeout: 245 seconds]
zotan has joined #lisp
mrcom has joined #lisp
aindilis has quit [Ping timeout: 240 seconds]
zotan has quit [Ping timeout: 252 seconds]
zotan has joined #lisp
markoong has quit [Read error: Connection reset by peer]
X-Scale has joined #lisp
marusich has quit [Remote host closed the connection]
igemnace has joined #lisp
zotan has quit [Ping timeout: 252 seconds]
zotan has joined #lisp
marusich has joined #lisp
akoana has left #lisp ["Leaving"]
r13l has joined #lisp
aindilis has joined #lisp
zotan has quit [Ping timeout: 252 seconds]
yangby has joined #lisp
zotan has joined #lisp
anewuser has joined #lisp
smokeink has quit [Quit: Leaving]
esrse has joined #lisp
notzmv has joined #lisp
r13l has quit [Remote host closed the connection]
quazimodo has quit [Ping timeout: 246 seconds]
Lord_of_Life has quit [Ping timeout: 246 seconds]
quazimodo has joined #lisp
Lord_of_Life has joined #lisp
quazimodo has quit [Ping timeout: 244 seconds]
r13l has joined #lisp
quazimodo has joined #lisp
<r13l> is it correct that there’s no way to kill processes started by uiop:run-program (e.g. if one receives a SIGTERM oneself)? maybe i should try to add support for uiop:launch-program to inferior-shell …
Arcaelyx has quit [Quit: Textual IRC Client: www.textualapp.com]
Lycurgus has joined #lisp
yangby has quit [Quit: Go out for a walk and buy a drink.]
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
mrcom has quit [Read error: Connection reset by peer]
mrcom has joined #lisp
scymtym has quit [Ping timeout: 244 seconds]
Lycurgus has quit [Quit: Exeunt]
ealfonso has joined #lisp
phoe has quit [Ping timeout: 272 seconds]
milanj has quit [Quit: This computer has gone to sleep]
quazimodo has quit [Ping timeout: 246 seconds]
devon has joined #lisp
Khisanth has quit [Ping timeout: 246 seconds]
Oladon has joined #lisp
space_otter has joined #lisp
dale has joined #lisp
Khisanth has joined #lisp
wigust- has joined #lisp
marvin2 has quit [Ping timeout: 244 seconds]
wigust has quit [Ping timeout: 246 seconds]
iAmDecim has quit [Read error: No route to host]
iAmDecim has joined #lisp
Kaisyu has joined #lisp
karlosz has joined #lisp
<beach> Good morning everyone!
<devon> Good evening.
karlosz has quit [Quit: karlosz]
karlosz has joined #lisp
karlosz has quit [Client Quit]
ntbre has quit [Quit: ntbre]
iovec has quit [Quit: Connection closed for inactivity]
gravicappa has joined #lisp
Bike has quit [Quit: Lost terminal]
devon has quit [Ping timeout: 246 seconds]
test1600 has joined #lisp
dale has quit [Quit: dale]
Inline has quit [Quit: Leaving]
karlosz has joined #lisp
_whitelogger has joined #lisp
ravenousmoose has joined #lisp
Oladon has quit [Quit: Leaving.]
<fiddlerwoaroof> morning beach
jello_pudding has joined #lisp
<beach> fiddlerwoaroof: Hey, what's up?
ravenousmoose has quit [Ping timeout: 252 seconds]
phoe has joined #lisp
madrik has joined #lisp
<madrik> Greetings.
<beach> Hello madrik.
<madrik> beach: Hello. How is Lisp treating you today?
<beach> Not bad, thanks. My favorite coauthor is coming over for lunch, and then we will work on our ELS paper submissions for this year.
<beach> What about yourself?
<madrik> Good to know.
<madrik> I'm working on a small project to analyze BIND logs.
<madrik> It's progressing.
<beach> What is a BIND log?
<madrik> Oh, BIND is a DNS server.
<beach> Ah, OK.
<madrik> I've got to the point where I can ask my system which client IP made how many connections; what domains has a given IP visited frequently; etc.
<beach> Sounds good.
<madrik> What about your paper?
<beach> We think this one is pretty much ready to go: http://metamodular.com/bootstrapping.pdf
marusich has quit [Remote host closed the connection]
<beach> This one is still being worked on: http://metamodular.com/make-method-lambda.pdf
<beach> We have another week, probably two before the deadline.
anewuser has quit [Ping timeout: 268 seconds]
<madrik> beach: They look nice.
pierpal has joined #lisp
<beach> Thanks!
<madrik> In abstract, wasn't this one of the motivations in the birth of SBCL -- that its ancestor, CMUCL, had a rather involved bootstrapping procedure to build it?
<beach> Correct.
copec has quit [Ping timeout: 252 seconds]
<beach> And Xof's paper is about that.
<madrik> Okay.
<beach> We are taking it one step further by bootstrapping CLOS first, rather than last, as is common with implementations that were started before CLOS was part of the standard.
copec has joined #lisp
<madrik> Wouldn't that be very hard -- going CLOS-first, I mean?
<beach> Hard enough that we think it deserves a paper. :)
<madrik> Of course.
<beach> There is this widespread idea that bootstrapping has to be done from a subset of the language to the full language in well defined increments.
<beach> But that is obviously not the case if you bootstrap on an existing conforming Common Lisp implementation. Because then, you already have the full language at your disposal.
<beach> Having said that, I should add that the procedure for doing it is pretty involved, mainly because of the way that Common Lisp defines compilation differently from other languages.
<madrik> beach: Sounds challenging but rewarding.
<beach> That summarizes it nicely, yes.
<madrik> Well, I wish you all the best for it.
<beach> Thanks!
<beach> Are you thinking of going to ELS?
<beach> Oh, nice keynote talks this year.
karlosz has quit [Quit: karlosz]
DGASAU has joined #lisp
hhgbot has joined #lisp
dddddd has quit [Remote host closed the connection]
varjag has joined #lisp
hhgbot has quit [Quit: leaving]
DGASAU has quit [Ping timeout: 272 seconds]
* beach is guessing that madrik is thinking hard about going before answering his question.
<LdBeth> Is it possible initialize a class without initialize the correspondent type?
<beach> Sure.
<beach> Just don't do the (setf (find-class ...) ..)
Necktwi has joined #lisp
orivej has joined #lisp
space_otter has quit [Remote host closed the connection]
copec has quit [Ping timeout: 272 seconds]
<LdBeth> So in this case (typep object class) still works properly?
<LdBeth> I mean use the class object as type specifier
<beach> You mean if CLASS is a class metaobject as opposed to a name?
<beach> That should work, yes.
<LdBeth> Very Well. Thanks
copec has joined #lisp
varjag has quit [Ping timeout: 245 seconds]
aluminum1425 has quit [Remote host closed the connection]
<beach> LdBeth: Here is how you can test it:
<beach> (defparameter *c* (defclass bla () ()))
<beach> (defparameter *b* (make-instance 'bla))
<beach> (setf (find-class 'bla) nil)
<beach> (typep *b* *c*) => T
<beach> (typep *b* 'bla) => error, no such type
<LdBeth> Wow, then (type-of c) can still return the class instance
test1600_ has joined #lisp
test1600 has quit [Ping timeout: 240 seconds]
<beach> I suppose. I didn't check. It seems reasonable since TYPE-OF must call CLASS-OF or something like that for standard objects.
<LdBeth> May different classes that don’t have same superclasses except t share same type?
<beach> I don't know what that means.
<beach> I don't know what sharing the same type means.
<LdBeth> from Design Patterns: An object can have many types, and objects of different classes can have the same type.
<beach> An object in Common Lisp can have many types, sure. In particular, that is the case for numbers.
<beach> And I assume you meant the type of the instances of the classes that share only T as superclass.
<LdBeth> Yes
<beach> Then T would be the only type that an instance of either class can be a type of.
<beach> Er, hold on...
<beach> You can define your own type with DEFTYPE.
<LdBeth> Ah, like a predicate type
<beach> If you define it as (or class-1 class2) then you have what you want.
<beach> What is a predicate type?
<beach> So..
<beach> (defclass a () ())
<beach> (defclass b () ())
<beach> (deftype ab () '(or a b))
<beach> (typep (make-instance 'a) 'a) => t
<beach> (typep (make-instance 'a) 'ab) => t
<beach> (typep (make-instance 'b) 'ab) => t
<LdBeth> I don’t know if CL use the same term, but predicate type is type defined by a predicate function
<beach> DEFTYPE does not define a function, so it would not be a predicate type with that definition.
<LdBeth> Well, function in mathematical sense
<beach> I'm lost. If you think the answer is important, you need to figure it out yourself.
<LdBeth> Okay
<beach> TYPE-OF is defined as a function in Common Lisp. But, in general the type of an object is not a mathematical function, since it has several values.
heisig has joined #lisp
gravicappa has quit [Ping timeout: 246 seconds]
gravicappa has joined #lisp
ealfonso has left #lisp ["ERC (IRC client for Emacs 26.1)"]
jello_pudding has quit [Quit: Leaving, Quit]
varjag has joined #lisp
mrcom has quit [Read error: Connection reset by peer]
schweers has joined #lisp
froggey has quit [Ping timeout: 250 seconds]
<heisig> What is the recommended way to pass additional initialization arguments to a custom generic function?
<heisig> Ideally, I'd like to be able to extend DEFGENERIC to accept additional arguments.
<heisig> But I think the standard forbids it.
scymtym has joined #lisp
<fiddlerwoaroof> The standard allows it: "Implementations can extend defgeneric to include other options. It is required that an implementation signal an error if it observes an option that is not implemented locally."
mrcom has joined #lisp
<heisig> But is there a somewhat portable hook for me as a user to extend it?
<beach> Maybe, hold on...
<beach> Hmm, no, not specified apparently.
<beach> But I suspect that DEFGENERIC would just pass it on to ENSURE-GENERIC-FUNCTION.
<heisig> SBCL signals a simple-program-error at macroexpansion time when I supply an unknown option.
<madrik> beach: Hey. Sorry. Got busy all of a sudden.
<fiddlerwoaroof> heisig: Do you have a custom generic-function metaclass?
<beach> heisig: Oh, that's surprising.
<fiddlerwoaroof> Anyways, I think this might rule out user extension: http://metamodular.com/CLOS-MOP/the-defgeneric-macro.html
<shka_> heisig: you can create custom function class for your defgeneric
<madrik> To your question, no, I won't be attending ELS. The lineup looks very nice, though.
<fiddlerwoaroof> "The arguments received by ensure-generic-function are derived from the defgeneric form in a defined way..."
mingus has joined #lisp
<beach> HAH!
<fiddlerwoaroof> The rest of that page seems to specify how DEFGENERIC translates to ENSURE-GENERIC-FUNCTION but doesn't really say anything about extra init args
mrcom has quit [Read error: Connection reset by peer]
<beach> Implementations can extend defgeneric to include other options.
jprajzne has joined #lisp
<beach> But no way for programmer extensions.
<heisig> fiddlerwoaroof: Yes, I have a custom generic metaclass. (My goal is to implement sealable metaobjects: https://github.com/marcoheisig/sealable-metaobjects )
<heisig> Things look good, so far. But I would prefer another mechanism for supplying initialization arguments than hidden use of special variables.
<beach> Sure.
<shka_> woha
<shka_> heisig: so you figured this out!
<shka_> that is pretty awesome
<beach> I don't think there is a portable way.
<fiddlerwoaroof> Yeah, sbcl's definition of defgeneric doesn't have any extension points
<shka_> heisig: is there need for anything beyond supplying proper metaclass?
iovec has joined #lisp
<shka_> also, there is also option to provide accessor for options
<shka_> so you would (setf (some-option #'foo) :new-val)
<shka_> and reinitialize
<shka_> and/or
<heisig> Yes, I will probably go for a custom macro DEFINE-SEALABLE-GENERIC-FUNCTION that expands into DEFGENERIC plus some further initialization.
<beach> Yeah. Too bad though.
<fiddlerwoaroof> The other option (which would probably be a lot of work) you could also have something like defgeneric* that has a defined mapping between unrecognized options and calls to accessors?
<beach> note to self: For WSCL, investigate the possibility of extending DEFGENERIC with additional options.
<fiddlerwoaroof> You might be able to delegate to defgeneric for most of the work
<madrik> Is it explained anywhere why CMUCL could not or has not moved to 64-bits?
<beach> madrik: CMUCL has more-or-less been replaced by SBCL.
<beach> madrik: There are probably very few maintainers left.
<madrik> beach: Okay. It just seemed a very comprehensive system, with a compiler, an interpreter, /and/ a byte-code subsystem.
<fiddlerwoaroof> yeah, sbcl is a fork of it
<beach> madrik: I think "comprehensive" also means "highly redundant", thus requiring additional maintenance for which no manpower is available.
<madrik> Could I assume that SBCL is the de facto free Common Lisp now?
<loke> madrik: Definitely the most popular
<fiddlerwoaroof> CCL is pretty widely-used too
<madrik> fiddlerwoaroof: Clozure?
<fiddlerwoaroof> yeah
<beach> madrik: Different implementations have different characteristics.
<loke> ECL is popular in certain areas.
<heisig> fiddlerwoaroof: defgeneric* could work. Maybe one could supply all excess options as an additional plist to ensure-generic-function. I will think about it.
<heisig> Thanks everyone!
<madrik> Wasn't CCL MCL at one point?
<fiddlerwoaroof> yeah
<fiddlerwoaroof> heisig: a defgeneric* macro would also be useful on its own, for other people that want to do similar things
<fiddlerwoaroof> madrik: here's the history of CCL: http://thisoldlisp.com/talks/els-2018/
<madrik> fiddlerwoaroof: Thanks.
<fiddlerwoaroof> I generally make sure as much of my code as possible runs on at least sbcl and ccl
<fiddlerwoaroof> And, on Macs, ccl has better integration out of the box with Objective-C and Cocoa
<madrik> Do you guys use the commercial Lisps -- Allegro and LispWorks -- for any purpose?
<fiddlerwoaroof> I use Lispworks occasionally for GUI programming
<heisig> fiddlerwoaroof: Here I go, developing a utility library for a utility library of a module of a Lisp implementation on which I want to develop a utility library for parallel programming :D
<heisig> Can someone pass me the yak shaver :)
<fiddlerwoaroof> :) sounds like all my lisp projects
<beach> Heh.
<fiddlerwoaroof> I occasionally write "real" code, but mostly I write one or two stages away from the problem I want to be working on.
<fiddlerwoaroof> Most recently, I've been working on a way to treat an emacs buffer as an output stream
<madrik> Oh, just for fun, I was writing a naive function to compute e, when I came to point where I thought, "Why isn't there a MULF by analogy to INCF?"
<fiddlerwoaroof> clhs DEFINE-MODIFY-MACRO
<fiddlerwoaroof> (define-modify-macro mulf (num) *) I think defines such a thing
<loke> Shouldn't it be called *F?
<loke> +F, *F, /F and -F
<madrik> So, that should be preferred to this?
<fiddlerwoaroof> :)
<madrik> (defmacro mulf (multiplicand multiplier)
<madrik> `(setf ,multiplicand (* ,multiplicand ,multiplier)))
<madrik>
<loke> madrik: That's incorrect. It evaluates multiplicand twice
crsc has quit [Remote host closed the connection]
<madrik> loke: Okay. So, not as simple as it sounds.
<beach> madrik: I recommend you read the book On Lisp that discusses macro definitions at length.
<loke> madrik: DEFINE-MODIFY-MARCRO will help you.
<loke> It's there for that specific reason.
<fiddlerwoaroof> It's almost always better to use abstractions like this because they hide the noise and just let you express your intent
<loke> You can do the same using DEFINE-SETF-EXPANDER, but in this case the former is much easier.
<heisig> (define-modify-macro *f (&optional (&rest more-numbers)) *)
<heisig> Upps, (define-modify-macro *f (&rest more-numbers) *)
<madrik> Very nice. Thanks.
q3d has joined #lisp
<madrik> As I said, I had a naive function to compute e:
<madrik> (defun compute-e (n)
<madrik> "Determine the value of e using the formula (1 + 1/n)^n."
<madrik> (loop with e = 1
<madrik> for i from 1 to n
<madrik> do
<madrik> (mulf e (1+ (/ n)))
<madrik> finally (return (float e))))
<fiddlerwoaroof> you shouldn't paste long things in IRC
<fiddlerwoaroof> use something like gist.github.com or a pastebin
<madrik> fiddlerwoaroof: Noted.
<loke> madrik: It doesn't have to be that long: (loop for i from 1 to n for e = #1=(1+ (/ n)) then (* e #1#) finally return e)
<loke> or even:
<loke> madrik: (loop for i from 0 to n for e = 1 then (* e (1+ (/ n))) finally return e)
<loke> oh wait, i isn't used
<loke> madrik: (loop repeat (1+ n) for e = 1 then (* e (1+ (/ n))) finally return e)
<shka_> heisig: so from what i understand this is like final keyword from java?
<heisig> shka_: Somewhat. But if it would be like final, I would have called it sealed-metaobjects. The idea is that you can manipulate and, most importantly, subclass sealable metaobjects until they are explicitly sealed.
<heisig> Hence the name sealable-metaobjects.
<shka_> oooh
<shka_> sounds like something i should try
<loke> heisig: What is the benefit of this?
<heisig> shka_: It is still work in progress. Give me a few more days before you try it.
<heisig> loke: Inlining of discriminating functions.
<heisig> I want GENERIC-BINARY-+.
<heisig> Maybe also inlining of effective methods, for that.
mrcom has joined #lisp
<heisig> The idea is that you get calls with built-in (or sealed) instances as fast as regular +, but that you can still extend such a generic function it in the general case.
<heisig> Primarily, I want to use this technique to implement SICL sequence functions.
<shka_> heisig: just realized that i made my code resistant to this form of optimization few months ago ;-)
smokeink has joined #lisp
<shka_> though i may still figure out how to workaround this
<madrik> loke: Wow. Thanks.
ym555 has joined #lisp
<loke> heisig: That could be done even with the current spec. What is simply needed is a way to uncompile code. The JVM does that, and nothing wuld, in theory prevent the same for being done in Lisp.
<heisig> loke: I am not sure about that. If you allow, e.g., :around methods on built-in addition, you will have a bad time.
smokeink has quit [Remote host closed the connection]
<loke> when adding an :AROUND method, of course every single callsite has to be recompiled.
<heisig> Right, giving you insane pause times, at best :)
<loke> heisig: Sure.
orivej has quit [Ping timeout: 244 seconds]
<loke> But that should be expected.
shka_ has quit [Ping timeout: 250 seconds]
<loke> Also, the pause times wouldn't be overly bad, sicne you wouldn't be recompiling the functions until they are called (or, as is the case with the JVM, until the function has been called more than N times (configurable, with a default value in the thousands))
crsc has joined #lisp
madrik has quit [Remote host closed the connection]
gxt has quit [Quit: WeeChat 2.3]
smokeink has joined #lisp
m00natic has joined #lisp
shka_ has joined #lisp
Bronsa has quit [Remote host closed the connection]
themsay has joined #lisp
Kaisyu has quit [Quit: Connection closed for inactivity]
nowhere_man has quit [Ping timeout: 252 seconds]
nowhere_man has joined #lisp
marvin2 has joined #lisp
ym555 has quit [Quit: WeeChat 2.3]
amerlyq has joined #lisp
Kaisyu has joined #lisp
gravicappa has quit [Ping timeout: 246 seconds]
orivej has joined #lisp
ebrasca has joined #lisp
test1600 has joined #lisp
makomo has joined #lisp
<splittist> morning (ish)
test1600_ has quit [Ping timeout: 272 seconds]
Essadon has joined #lisp
Essadon has quit [Max SendQ exceeded]
slyrus1 has joined #lisp
<shka_> splittist: hi!
<shka_> how do you call a complete set of mathematical operations?
<shka_> calculus?
esrse has quit [Ping timeout: 240 seconds]
<no-defun-allowed> I would say arithmetic or algebra probably.
slyrus has quit [Ping timeout: 245 seconds]
<no-defun-allowed> As far as I know, calculus is reserved for derivatives and integrals of expressions.
<dim> I'd say algebra, with groups and corps and semi-things and monads
Essadon has joined #lisp
<shka_> ok, thanks
notzmv has quit [Ping timeout: 272 seconds]
<dim> a group is like (N, +, 0) for integers (naturals) with addition and neutral-element zero, with well defined meaning such as commutativity, associativity etc
<dim> the next classic example would be (N, *, 1) IIRC
<dim> after that, well, please read more about it, I don't remember ;-)
themsay has quit [Ping timeout: 268 seconds]
<Xof> rings
<dim> ah yeah that'd be the English name for “Anneaux”, thanks
<dim> tbh I mainly remember about groups, dimly remember about other strates and names
gxt has joined #lisp
smokeink has quit [Remote host closed the connection]
jmercouris has joined #lisp
test1600 has quit [Quit: Leaving]
marvin2 has quit []
markoong has joined #lisp
shrdlu68 has joined #lisp
pierpal has quit [Read error: Connection reset by peer]
dddddd has joined #lisp
<r13l> i’m working on using lisp to replace shell scripts, so am taking a look at e.g. INFERIOR-SHELL &c. man-oh-man do i wish that the standard had gone with case-preservation. oh well, i’m sure that it made sense in the 80s, and by the 90s they were stuck with it
beach has quit [Remote host closed the connection]
<shka_> r13l: i think that idea back in the day was that interactive systems should be case insensitive because this makes them more convinient
<shka_> that's the reasoning behind SQL as well IIRC
<r13l> i think it’s because some systems back then were still caps-only. makes it a chore to use symbols to represent strings intended for the shell. either one leaves the case as-is (bad, because to a first order of approximation _nothing_ on a Unix system is uppercase); one downcases everything (bad, because a few things _may_ be uppercase); one inverts (bad, because the reader already had a chance to invert); or one plays with special
<r13l> read-macros (bad, because then it uses a character the user might have wanted to use).
<r13l> i look at scsh, and i’m so envious that it could just preserve case. and use | & |+ (if you’re case-preserving, there’s a lot less need for multiple-escaping …)
smokeink has joined #lisp
<jackdaniel> nb: you may have case-preserving reader without much hassle by modifying readtable-case
<jackdaniel> *but* then you'll need to call things from the cl package and "ordinary" librarires like that: (CL:LIST 1 2 3) ; (or if you "USE" CL package, then (LIST 1 2 3)
<jackdaniel> )
<r13l> yeah, but then one has to write lisp symbols in upper-case, which is a pain (have to hold down the shift key) and also difficult to read. i think it’s ugly, too, but that may just be me
<r13l> i really like allegro’s modern mode, but sadly it doesn’t seem to have caught on elsewhere, e.g. with SBCL
<jackdaniel> you may set this readtable-case globally and it will most likely work with most libraries
<jackdaniel> as of CL symbols: writing a piece which creates |common-lisp| package and creating symbol-macros which refer to COMMON-LISP symbols seems like a dozen of minutes hack
<jackdaniel> or, even better, utility which takes *any* package, creates its evil twin in lowercase and having there lowercase symbol macros which reflect original upcase symbols
<jackdaniel> just saying
hhdave has joined #lisp
CrazyEddy has quit [Remote host closed the connection]
<jackdaniel> hm, symbol macro won't cut a quote
<r13l> yeah, and e.g. one would want (echo t) to return "t", not "T" — but one would also want "t" to be read as T, in order for e.g. (find-class 't). corner cases are fun
<jackdaniel> *print-case* is meant for that, no?
<r13l> https://franz.com/support/tech_corner/modern.mode.lhtml gives good details on the approach franz took
<jackdaniel> (let ((*print-case* :downcase)) (print t))
<r13l> not in this case, where (echo t) is supposed to be interpreted as a call to a Unix binary
<jackdaniel> uhm
<r13l> e.g. (my-special-read-from-string "(echo t)") → (|echo| |t|). (run '(|echo| |t|)) then searches PATH for a binary named (symbol-name '|echo|) and then calls it with arguments (mapcar #'symbol-name '(|echo| |t|))
<r13l> see what i mean?
smokeink has quit [Remote host closed the connection]
smokeink has joined #lisp
<r13l> e.g. https://pastebin.com/m8iWpFDp (there’s an example of what scsh would look like; getting to lisp version is … tricky). oh well, i’ll probably just copy INFERIOR-SHELL and downcase symbols. it’s probably the least bad solution
<jackdaniel> I like the solution used in shelisp
<jackdaniel> you have a special reader macro which switches you to sh syntax (and vice versa)
<jackdaniel> i.e: "!echo $(+ 2 3) zuzu"
<jackdaniel> or (dotimes (i 7) (princ [echo $i])) ;(from the manual)
<dim> I think a scsh comparable tooling already exists in CL, along with asdf/uiop facilities, by Fare again, right?
<r13l> ooh, i hadn’t found SHELISP or CLESH. not a huge fan of shell syntax (i like that INFERIOR-LISP & scsh use s-expressions to represent commands), but still — really cool!
CrazyEddy has joined #lisp
<dim> apparently inferior-shell and cl-scripting go a long way
<r13l> dim, Faré wrote INFERIOR-SHELL (not INFERIOR-LISP … sigh)
<dim> yeah so ok you're already using those tools, sorry
m00natic has quit [Ping timeout: 268 seconds]
<r13l> oh, no worries! thanks for the link. the big problem i had just using INFERIOR-SHELL is that — for some reason — programs it launches don’t get killed when their parent is killed, so e.g. typing C-c kills my lisp process but not the long-running command _it’s_ running (which is weird, because i’d expect them to all be in the same process group). which sent me down the rabbit hole …
<jackdaniel> on unix orphaned children are adopted by the /init process
<jackdaniel> it is standard behavior
<Xach> i have a t-shirt that says "CHILD OF INIT"
<jackdaniel> :-)
<jackdaniel> I think that SIGHUP signal is sent to each dhild
<jackdaniel> child*
<jackdaniel> when parent exits
notzmv has joined #lisp
<r13l> yes, but e.g. a shell script does the right thing here. i haven’t (yet) read the source of e.g. zsh to see, but i imagine that it installs a SIGINT/SIGTERM handler which signals each child process, then terminates (so the children would only be orphaned if that handler isn’t run)
<jackdaniel> you may also keep child processes in your collection and on sigint send them the same thing before exitting
<r13l> yeah, i’m doing that now. i use UIOP:LAUNCH-PROGRAM instead of UIOP:RUN-PROGRAM, and install a signal handler (thanks to your advice yesterday) which kills each running process. i guard the list of running children with SB-SYS:WITHOUT-INTERRUPTS
<jackdaniel> I've looked at UIOP:*-PROGRAM source code a few times and each time I was horrified
<r13l> as you can imagine, my simple little script has gotten a bit unwieldy, hence my desire to find or write something which abstracts away some of the messy details *grin*
<Xach> I use sb-ext:run-program directly most of the time.
<Xach> But I go through a layer called "commando" which works for me
<shka_> r13l: what is your script doing, btw?
<Xach> so I ought not to have said "directly"
<jackdaniel> Xach: I sometimes use external-program (which is also a simple wrapper around implementation native run-program)
<jackdaniel> UIOP puts some abstraction on /everything/, including streams and files, even if implementation handles them better than UIOP
<r13l> it’s actually a dirt-simple backup script: sets up some environment variables, runs borg to backup ~, runs notmuch dump | borg to backup my email tags, then runs borg backup twice. i’ve spent _way_ more time lispifying it than i should have, but … it’s fun *grin*
milanj has joined #lisp
<jackdaniel> (and all that stream slurping is very inefficient)
<Xach> r13l: yes!
<Xach> I have some build stuff that has to run git in a lot of different ways and it is really nice to be able to do it with lisp functions and macros instead of shell scripts.
<Xach> And sometimes I feel like people want to bind to libraries to work like that, but I have had good success and have been very happy with run-program to get started. And much of the time it's more than enough for ever.
<shka_> r13l: heh, cool
<Xach> i had a system that processed thousands of images per day with imagemagick and i just spawned "convert" - no need to mess with binding to libmagick or anything else.
Bike has joined #lisp
kajo has quit [Ping timeout: 268 seconds]
kajo has joined #lisp
notzmv has quit [Ping timeout: 240 seconds]
SaganMan has joined #lisp
atgreen has quit [Remote host closed the connection]
atgreen has joined #lisp
notzmv has joined #lisp
kajo has quit [Ping timeout: 240 seconds]
<dlowe> modeling microservices as spawned processes operating on local files
<dlowe> craziness!
<Xach> ahead of my time by half
DGASAU has joined #lisp
<jmercouris> lol microservices
<jmercouris> can this just die already?
<jmercouris> that and "serverless"
DGASAU has quit [Read error: Connection reset by peer]
DGASAU has joined #lisp
SaganMan has quit [Ping timeout: 250 seconds]
ebrasca has quit [Ping timeout: 246 seconds]
DGASAU has quit [Remote host closed the connection]
DGASAU has joined #lisp
smokeink has quit [Remote host closed the connection]
smokeink has joined #lisp
DGASAU has quit [Ping timeout: 240 seconds]
notzmv has quit [Ping timeout: 246 seconds]
milanj has quit [Quit: This computer has gone to sleep]
xkapastel has joined #lisp
c4droid has joined #lisp
<c4droid> Hello :)
ntbre has joined #lisp
beach has joined #lisp
heisig has quit [Quit: Leaving]
ntbre has quit [Client Quit]
kajo has joined #lisp
froggey has joined #lisp
Lord_of_Life_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 245 seconds]
Lord_of_Life_ is now known as Lord_of_Life
LiamH has joined #lisp
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
sjl_ has joined #lisp
<shrdlu68> "Quick test: if you create a new namespace and import another file within that namespace, do its contents end up in that namespace?"
<dlowe> I read about half of that and it's just a list of peeves
c4droid has left #lisp [#lisp]
<shrdlu68> What's the answer for CL?
<shrdlu68> Would that be (in-package :foo) (load "bar.lisp")?
FreeBirdLjj has joined #lisp
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
<dlowe> By convention, bar.lisp usually has its own package
<dlowe> and packages aren't hierarchical in CL, so importing another file "within" that namespace doesn't make any sense
rippa has joined #lisp
<pjb> shrdlu68: symbols can be qualified, so the question is rather meaningless.
<dlowe> sorry, I meant bar.lisp usually has its own in-package form
<pjb> shrdlu68: if your file contains (cl:defun cl-user::foo (cl-user::x) (cl:+ cl-user::x 42)) and assuming no foul play with the *readtable*, then you can set the *package* to any package, loading the file will always read the same sexps!
<pjb> shrdlu68: Similarly, as soon as the file contains a toplevel in-package form, it controls the package in which the following unqualified symbols are interned.
<pjb> dlowe: usually, people write (in-package "BAR"). But if FOO::IN-PACKAGE is not CL:IN-PACKAGE, (in-package "BAR") can have different effects.
<pjb> dlowe: see for example IBCL.
dale_ has joined #lisp
dale_ is now known as dale
<shrdlu68> It's all down to the that C has no concept of namespaces.
<dlowe> It has the same namespaces as elisp :D
_whitelogger has joined #lisp
Mr-Potter has joined #lisp
slightlycyborg has joined #lisp
<slightlycyborg> Hi. I have x predicate calls. What is the best way to sum up the number of predicates evaluated as true?
<slightlycyborg> Current code looks like (+ (if pred 1 0) (if ....) ...)
<slightlycyborg> I am thinking maybe using a reduce
<dlowe> do these predicates have arguments?
<sjl_> something like (count-if #'identity (list (pred foo) (pred2 bar))) could work
<slightlycyborg> whoa! I love this language
<slightlycyborg> thnx
igemnace has quit [Quit: WeeChat 2.3]
moei has joined #lisp
<loke> sjl: I'm not sure I understand what you did there
makomo has quit [Ping timeout: 246 seconds]
<sjl_> clhs count-if
<dlowe> I was trying to think of a way that didn't involve a temp list, but I didn't think of anything without macrology
<loke> I know what count-if does. I just don't know what you try to do with it
<dlowe> identity returns its argument
<loke> I know.
<dlowe> and the goal is to count the number of true results
<loke> oh wait... somehow I read that as the list being quoted
<sjl_> What I was trying to do with it was answer slightlycyborg's question...
milanj has joined #lisp
<loke> slightlycyborg: If every comparison uses the _same_ pred, you want to do: (count-if #'pred LIST-OF-VALUES)
monokrom has joined #lisp
<slightlycyborg> Ya, the #'identity raised an interupt in my mind and I saw that pattern. I am not using the same pred for this instance though.
<Xach> slightlycyborg: same value?
<dlowe> If every comparison uses the same value and different preds, (count-if (lambda (p) (funcall p value)) LIST-OF-PREDICATES)
<Xach> i have a utility function callfun that does your lambda p. it is handy. so handy.
<dlowe> (defmacro prog-count-if (&body forms) (let ((counter-sym (gensym "COUNTER"))) `(let ((,counter-sym 0)) ,@(mapcar (lambda (f) `(when ,form (incf ,counter-sym))) forms) ,counter-sym)))
<dlowe> that'll do it without consing a temp list :p
<Xach> now do a tagbody!
<dlowe> not sure that would help?
<Xach> it would help me laugh in these times
<sjl_> functional version: (defun flip (function) (lambda (x y) (funcall function y x)))
<sjl_> (count 10 '(minusp plusp evenp oddp) :test (flip #'funcall))
<dlowe> (tagbody 5 (defvar count 0) 10 (if (not (pred x)) (go 30)) 20 (incf count) 30 (format t "I am so cool. count=~a~%" count))
<slightlycyborg> Xach: not same value.
<Xach> slightlycyborg: this steady drip-drip-drip of new info is excellent for stretching out the discussion and exploration of solutions!
iovec has quit [Quit: Connection closed for inactivity]
<sjl_> dlowe: oh god I never realized you could use integers as tagbody labels
<Xach> dlowe: see, it was worth more than just a laugh!
<dlowe> ;D
status402 has quit [Quit: status402]
nanoz has joined #lisp
<sjl_> (tagbody #36rLoop (print "foo") (go #36rLoop))
Denommus has joined #lisp
pierpal has joined #lisp
jmercouris has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 268 seconds]
shrdlu68 has quit [Quit: WeeChat 2.3]
Necktwi has quit [Ping timeout: 250 seconds]
jpsa has joined #lisp
sloanr has joined #lisp
peterhil has quit [Read error: Connection reset by peer]
peterhil` has joined #lisp
Inline has joined #lisp
hvxgr has left #lisp [#lisp]
Inline has quit [Read error: Connection reset by peer]
Inline has joined #lisp
hvxgr has joined #lisp
hvxgr has left #lisp [#lisp]
hvxgr has joined #lisp
ntbre has joined #lisp
hvxgr has left #lisp [#lisp]
cage_ has joined #lisp
smokeink has quit [Ping timeout: 244 seconds]
q3d has quit [Ping timeout: 256 seconds]
cgay has joined #lisp
shifty has quit [Ping timeout: 244 seconds]
FreeBirdLjj has quit []
anamorphic has joined #lisp
jpsa has quit [Quit: Leaving.]
Zaab1t has joined #lisp
scymtym has quit [Ping timeout: 268 seconds]
FreeBirdLjj has joined #lisp
JetJej has joined #lisp
anamorphic has quit [Quit: anamorphic]
schweers has quit [Remote host closed the connection]
anamorphic has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
Kaisyu has quit [Quit: Connection closed for inactivity]
FreeBirdLjj has quit [Ping timeout: 240 seconds]
sloanr has quit [Quit: ERC (IRC client for Emacs 27.0.50)]
sloanr has joined #lisp
hhdave has quit [Ping timeout: 250 seconds]
edgar-rft has quit [Quit: Leaving]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Ping timeout: 250 seconds]
<fiddlerwoaroof> Xach: yeah the "backwards" map is underappreciated among FPers
gxt has quit [Ping timeout: 245 seconds]
tumdum has joined #lisp
akoana has joined #lisp
kajo has quit [Quit: From my rotting body, flowers shall grow and I am in them and that is eternity. -- E. M.]
kajo has joined #lisp
<fiddlerwoaroof> (length (flatten (mapcar (lambda (f v) (if (funcall f v) (1) ())) functions values)))
<fiddlerwoaroof> Ah, flatten isn't a thing
<slightlycyborg> (:use :clojure)
<slightlycyborg> cause it has flatten
<fiddlerwoaroof> (length (mapcan (lambda (f v) (if (funcall f v) '(1) ())) functions values)
<fiddlerwoaroof> )
<_death> fiddlerwoaroof: this modifies a literal
<jackdaniel> (:use basic), because it has TRON operator :-)
<fiddlerwoaroof> yeah, just realized that, it'd have to be (list 1) instead of '(1)
<fiddlerwoaroof> that's what I guess for being annoying
<dlowe> (loop for f in functions as v in values when (funcall f v) count t)
<_death> dlowe: you can use count (funcall f v)
<dlowe> ooh, good catch
<dlowe> and this is why loop made it into the standard
<_death> jackdaniel: heh.. at first I was puzzled.. TRON operator? then I recalled TRON/TROFF...
ntbre has quit [Quit: ntbre]
<dlowe> TRON traces for the user
<_death> F6 and F7 iirc
<_death> (for gwbasic)
aindilis has quit [Ping timeout: 250 seconds]
jonh has joined #lisp
lavaflow_ has quit [Ping timeout: 245 seconds]
Mr-Potter_ has joined #lisp
ravenousmoose has joined #lisp
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
Mr-Potter has quit [Ping timeout: 244 seconds]
gxt has joined #lisp
jprajzne has quit [Client Quit]
jprajzne has joined #lisp
ntbre has joined #lisp
iAmDecim has quit [Ping timeout: 245 seconds]
orivej has joined #lisp
makomo has joined #lisp
Lycurgus has joined #lisp
iAmDecim has joined #lisp
Arcaelyx has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
peterhil` has quit [Quit: Must not waste too much time here...]
gxt has quit [Quit: WeeChat 2.3]
ntbre has quit [Quit: ntbre]
gxt has joined #lisp
aindilis has joined #lisp
anamorphic has quit [Quit: anamorphic]
anamorphic has joined #lisp
slyrus2 has joined #lisp
ntbre has joined #lisp
slyrus1 has quit [Ping timeout: 272 seconds]
aindilis has quit [Read error: Connection reset by peer]
Lycurgus has quit [Quit: Exeunt]
aindilis has joined #lisp
ntbre has quit [Quit: ntbre]
iAmDecim has quit [Ping timeout: 272 seconds]
aindilis has quit [Ping timeout: 272 seconds]
ntbre has joined #lisp
edgar-rft has joined #lisp
q3d has joined #lisp
milanj has joined #lisp
Denommus has quit [Read error: Connection reset by peer]
scymtym has joined #lisp
amerlyq has quit [Quit: amerlyq]
ravenousmoose has quit [Quit: Taking a quick nap...ZZzzz]
aindilis has joined #lisp
ravenousmoose has joined #lisp
atgreen has quit [Ping timeout: 250 seconds]
ravenousmoose has quit [Remote host closed the connection]
<LdBeth> is (loop for a = 1 for a = (+ a 1) ...) allowed
<LdBeth> ?
<verisimilitude> Use THEN.
<verisimilitude> (LOOP FOR A = 1 THEN (1+ A) ...)
phoe has quit [Ping timeout: 268 seconds]
ravenousmoose has joined #lisp
<LdBeth> or should I use WITH?
<aeth> LdBeth: If what you said was valid then it would constantly be setting a to 1 and then a to 2 every iteration of the loop. It doesn't seem to be valid in SBCL, it says "duplicated variable". verisimilitude has the answer.
<verisimilitude> All WITH does is provide an initialized binding.
<verisimilitude> In any case, you should be using the integer stepping clauses for this, instead.
<aeth> LdBeth: :with would do the exact same thing, but only once through
<verisimilitude> So, use this: (LOOP FOR A FROM 1 ...)
<aeth> (loop :repeat 5 :for a := 1 :then (1+ a) :do (format t "~A~%" a)) is equivalent to (loop :repeat 5 :for a :from 1 :do (format t "~A~%" a))
<aeth> The advantage of the second form is that you can add a terminating condition right in it instead of writing your own elsewhere.
<aeth> in this case: (loop :for a :from 1 :to 5 :do (format t "~A~%" a))
Zaab1t has quit [Quit: bye bye friends]
<LdBeth> well, Emacs' cl-loop don't signal an error on duplicated variable and just complains "unused variable a" when byte-compiled though
<aeth> You can also count 0-based and by steps greater than 2. (loop :for a :from 0 :below 10 :by 2 :do (format t "~A~%" a))
<aeth> LdBeth: sounds like a bug in the implementation of cl-loop, then.
Zaab1t has joined #lisp
sloanr has quit [Quit: ERC (IRC client for Emacs 27.0.50)]
<LdBeth> Now I see FOR is setq in a tagbody
<aeth> LdBeth: The way I would have interpreted it if it was valid would be to have a set to 1 and then incremented by 1, so both a's would be used, sort of like (let* ((a 1) (a (1+ a))) a)
<aeth> But SBCL says it's not even valid to have duplicated definitions
karlosz has joined #lisp
TMA has quit [Ping timeout: 240 seconds]
<LdBeth> cl-loop exands nearly to (let* ((a nil) (a nil)) (setq a 1) (setq a (+ 1 a)))
TMA has joined #lisp
<LdBeth> which looks meaningless, so I guess it's natural to disallow duplicated for decl
anamorphic has quit [Quit: anamorphic]
anamorphic has joined #lisp
w96k has joined #lisp
<fiddlerwoaroof> Yeah THEN or from ... too ... [by ...] is better here
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<fiddlerwoaroof> s/too/to/
cage_ has quit [Remote host closed the connection]
karlosz has quit [Quit: karlosz]
nanoz has quit [Ping timeout: 240 seconds]
kajo has quit [Ping timeout: 250 seconds]
<fiddlerwoaroof> cl-defgeneric in emacs lisp is kinda interesting
<fiddlerwoaroof> cl-defmethod, that is
<fiddlerwoaroof> it has most of the features of CL's generic functions, but adds &context arguments and a couple additional kinds of specializers
anamorphic has quit [Quit: anamorphic]
<fiddlerwoaroof> the &context arguments let you dispatch based on things like the currently active mode, etc.
anamorphic has joined #lisp
atgreen has joined #lisp
iAmDecim has joined #lisp
Zaab1t has quit [Quit: bye bye friends]
iAmDecim has quit [Ping timeout: 245 seconds]
kajo has joined #lisp
atgreen has quit [Ping timeout: 245 seconds]
iAmDecim has joined #lisp
drolax has joined #lisp
ravenousmoose has quit [Read error: Connection reset by peer]
varjag has joined #lisp
phenethylamine has quit [Quit: ZNC 1.6.5+deb1 - http://znc.in]
phenethylamine has joined #lisp
q3d has quit [Ping timeout: 256 seconds]
smokeink has joined #lisp
q3d has joined #lisp
sloanr has joined #lisp
drolax has quit [Ping timeout: 252 seconds]
orivej has quit [Ping timeout: 240 seconds]
rozenglass has joined #lisp
anewuser has joined #lisp
anamorphic has quit [Quit: anamorphic]
anamorphic has joined #lisp
w96k has quit [Remote host closed the connection]
q3d has quit [Ping timeout: 256 seconds]
orivej has joined #lisp
ntbre has quit [Quit: ntbre]
nalik891 has joined #lisp
LiamH has quit [Quit: Leaving.]
karlosz has joined #lisp
phoe has joined #lisp
sjl_ has quit [Ping timeout: 246 seconds]
karlosz has quit [Client Quit]
monokrom has quit [Remote host closed the connection]
notzmv has joined #lisp
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
Kaisyu has joined #lisp
igemnace has joined #lisp
quazimodo has joined #lisp
anewuser has quit [Ping timeout: 240 seconds]
ntbre has joined #lisp
karlosz has joined #lisp
anamorphic has quit [Quit: anamorphic]
anamorphic has joined #lisp
shifty has joined #lisp