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/>
dnhester26 has quit [Remote host closed the connection]
<Kingsy> hmm so I have a problem I am not sure how to solve. I have a bunch of classes, these classes represent tables. so what I want is some kind of logic that can grab all of the classes in a package and add the names of those classes to a list, so I can loop through them and check if they exist in the database.
<Kingsy> The goal those is to do this automatically, I dn't want to have to maintain a list of tables along with the classes themselves. it would be good that if I create a new class it just automativcally knows to check.
<Kingsy> I just cant think of a way to do it
<pfdietz> You can iterate through all the symbols in a package and determine, for each, if it names a class.
<ixelp> CLHS: Macro DO-SYMBOLS, DO-EXTERNAL-SYMBOLS...
<Kingsy> pfdietz: yeah I was looking at that, but how would you determine if it names a class? can you check the name of its base class or something? I don't know how to spot it in the loop
<ixelp> CLHS: Accessor FIND-CLASS
<Kingsy> pfdietz: this is what I have so far -> https://bpa.st/2MUD2
<ixelp> View paste 2MUD2
<pfdietz> This has nothing to do with symbol-value.  That's the value of the symbol, not the class named by the symbol (if any).   This is not a Lisp-1 with only one namespace.
<pfdietz> In Scheme everything would be bound to the name as a value, but this is not Scheme.
<pfdietz> So, instead of (class-of (symbol-value <name>)), use (find-class <name>).
<pfdietz> Or, rather, (find-class <name> nil)
<pfdietz> Because you don't want it to error if <name> does not name a class.
<Kingsy> ok will play around with this! thank so much for the pointers!
<Kingsy> makes sense yep
<pfdietz> yw!
rakka has quit [Remote host closed the connection]
<Kingsy> pfdietz: hmm so that just returns (T) as the list :D
rakka has joined #commonlisp
<pfdietz> Get rid of the boundp form.
<pfdietz> That's asking if the symbol-value is bound, and that's irrelevant.
<Kingsy> pfdietz: if I get rid of the boundp it returns LOTS. https://bpa.st/RQYMI <- my class is in thre though!!
<ixelp> View paste RQYMI
<pfdietz> You might also want to stick to symbols whose symbol-package is the package you're looking at, not imported from other packages.
<pfdietz> Lots of those are class names you're importing from the COMMON-LISP package.
gamaliel has joined #commonlisp
<gamaliel> Hi, I have a question regarding testing. Is it good practice to have separate packages for each testing file? I have one file per component, and define a package there with :cl, :parachute, and import only the symbols that pertain to the component from the main system package. The issue is that I don't know how to make asdf:test-system work with
<gamaliel> this setup.
<Kingsy> pfdietz: I don't see a way of doing that with do-symbols to exclude those
<pfdietz> You have to do it inside.   (eql (symbol-package <name>) (find-package <package-name>)) say.
dnhester26 has joined #commonlisp
<Kingsy> ohhhh
<Kingsy> yep. alright lets see
<jfloren_> So is it kind of assumed these days that if you're writing common lisp, you're probably going to use CLOS? Maybe I've just been writing too much Go lately but I think "ok I want to access a REST API, so I'll make a client class which contains slots for the server hostname, the auth token, etc"
<jfloren_> I keep thinking about how to write my code and coming up with "I'll make a class and define methods on it"
<pfdietz> One can use CL without using CLOS much, if at all.   There's no requirement to define standard classes.
<Kingsy> pfdietz: right this is much much closer, it just prints out a few others that shouldnt be there. NIMBUS-TABLE NIL, nimbus-table is a defvar
<pfdietz> You sure you didn't define a class with that name?
<pfdietz> Or a struct.
<jfloren_> I write CL infrequently, so I guess I'm having a hard time thinking of how else I'd want to structure this REST client code. I want to be able to connect to different servers in the same program with ease; a class seems like a sensible way to hold the state for those connections. What else would be a sensible way to do it?
<Kingsy> hmm don't think so. oh perhaps I did and I renamed it. I'll restart slime
<Kingsy> ooo exciting!
<pfdietz> You'd need to restart lisp (or assign NIL to (find-class 'nimbus-table)).
<Kingsy> isnt restarting slime the same thing as restarting lisp? sbcl isnt a service right?
Inline has quit [Quit: Leaving]
<pfdietz> No, it's not the same.
<pfdietz> slime running in your editor connects to a running lisp.
tyson2 has quit [Remote host closed the connection]
igemnace has quit [Quit: WeeChat 4.2.1]
Inline has joined #commonlisp
<Kingsy> yeah sorted it. pfdietz this is perfect. does exaclty what I need. going to digest the function now so I understand thanks again
<pfdietz> Glad to help
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mulk has quit [Ping timeout: 256 seconds]
<zyd> Most code I see, especially libraries, make some use of CLOS, even if just a little.
mulk has joined #commonlisp
rgherdt_ has quit [Quit: Leaving]
NotThatRPG has joined #commonlisp
yagkasha has quit [Quit: Connection closed for inactivity]
X-Scale has joined #commonlisp
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
Lord_of_Life_ has joined #commonlisp
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Lord_of_Life has quit [Ping timeout: 276 seconds]
Lord_of_Life_ is now known as Lord_of_Life
varjag has quit [Ping timeout: 255 seconds]
Inline has quit [Quit: Leaving]
<aeth> there's using CLOS and then there's really using CLOS
<aeth> a lot of things use classes because why not use them, even if you could, if you were strict about avoiding it, use a struct or a hash table or, heck, even a lexical closure instead
<aeth> and then there's people who dig deep into defmethod (which, yes, technically can be used on structs, too) and the metaobject protocol, etc.
vyrsh has joined #commonlisp
triffid has quit [Remote host closed the connection]
triffid has joined #commonlisp
Inline has joined #commonlisp
tyson2 has joined #commonlisp
random-nick has quit [Ping timeout: 255 seconds]
waleee has quit [Ping timeout: 255 seconds]
ymir has joined #commonlisp
waleee has joined #commonlisp
piglet has joined #commonlisp
vyrsh has quit [Ping timeout: 264 seconds]
Lycurgus has joined #commonlisp
Lycurgus has joined #commonlisp
Lycurgus has quit [Changing host]
gamaliel has quit [Ping timeout: 250 seconds]
piglet has quit [Ping timeout: 264 seconds]
kaskal has quit [Ping timeout: 264 seconds]
kaskal has joined #commonlisp
waleee has quit [Ping timeout: 260 seconds]
josrr has quit [Remote host closed the connection]
varjag has joined #commonlisp
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Client Quit]
gxt has quit [Remote host closed the connection]
gxt has joined #commonlisp
varjag has quit [Ping timeout: 268 seconds]
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #commonlisp
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
mzan has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
taichi has joined #commonlisp
mariari has quit [Ping timeout: 268 seconds]
terrorjack has joined #commonlisp
Guest23 has joined #commonlisp
Guest23 has quit [Client Quit]
X-Scale has quit [Quit: Client closed]
<BrokenCog> so, I want to parse HTML results; will I be happier with plump or something else?
tyson2 has quit [Remote host closed the connection]
pranavats has left #commonlisp [Error from remote client]
piglet has joined #commonlisp
pranavats has joined #commonlisp
rtypo has quit [Ping timeout: 260 seconds]
piglet has quit [Ping timeout: 252 seconds]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Quit: Textual IRC Client: www.textualapp.com]
Inline has quit [Ping timeout: 264 seconds]
igemnace has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Devon has quit [Ping timeout: 240 seconds]
ymir has quit [Ping timeout: 260 seconds]
robin_ is now known as robin
ymir has joined #commonlisp
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 240 seconds]
green_ has quit [Ping timeout: 264 seconds]
igemnace has quit [Remote host closed the connection]
pfdietz has quit [Quit: Client closed]
decweb has quit [Ping timeout: 255 seconds]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
ymir has quit [Remote host closed the connection]
zetef has joined #commonlisp
villageidiot has quit [Quit: Client closed]
zetef has quit [Ping timeout: 260 seconds]
amb007 has quit [Ping timeout: 255 seconds]
semarie has quit [Quit: WeeChat 4.1.3]
Pixel_Outlaw has quit [Remote host closed the connection]
* mfiano wishes there was a bit more flexibility in the range syntax of compound real and subset builtin type specifiers.
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 255 seconds]
amb007 has joined #commonlisp
semarie has joined #commonlisp
Cymew has joined #commonlisp
robin has quit [Remote host closed the connection]
igemnace has joined #commonlisp
amb007 has quit [Ping timeout: 255 seconds]
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
bitmapper has joined #commonlisp
shka has joined #commonlisp
traidare has joined #commonlisp
<splittist> BrokenCog: I'm a happy plump user (and plump-user) for parsing xml. Since its main target is html, you could be happy, too.
Gleefre has joined #commonlisp
mzan has joined #commonlisp
rgherdt has joined #commonlisp
pve has joined #commonlisp
zetef has joined #commonlisp
dino_tutter has joined #commonlisp
dcb has quit [Quit: Connection closed for inactivity]
Inline has joined #commonlisp
mgl_ has joined #commonlisp
<gilberth> splittist, BrokenCog: plump doesn't even attempt to parse HTML.
<splittist> gilberth: fair enough.
<gilberth> E.g. when I parse "<p>foo<p>bar" I get two nested P elements.
<splittist> Should BrokenCog be looking at https://closure.common-lisp.dev/closure-html/ ?
<ixelp> Closure HTML
<gilberth> splittist: Yes, that's mine. It's a HTML4 parser. And it knows about the HTML4 DTD.
<gilberth> Someone should update it to HTML5. There is another HTML5 parser, that I need to find. Maybe cl-html5-parser? I don't recall.
<gilberth> Anyhow, the misconception appears to be that e.g. "<P>foo<P>bar" is malformed or something. It isn't. In both HTML4 and HTML5 it is two P elements, and the same as "<HTML><BODY><P>foo</P><P>bar</P></BODY></HTML>".
jack_rabbit has quit [Ping timeout: 260 seconds]
jack_rabbit has joined #commonlisp
varjag has joined #commonlisp
jack_rabbit has quit [Remote host closed the connection]
jack_rabbit has joined #commonlisp
kurfen has quit [Read error: Connection reset by peer]
<beach> So how does one obtain two nested P elements? Or is that not done?
kurfen has joined #commonlisp
markb1 has quit [Ping timeout: 252 seconds]
szkl has joined #commonlisp
markb1 has joined #commonlisp
<gilberth> beach: You don't. HTML doesn't allow for nested P elements.
<beach> Got it. Thanks!
green_ has joined #commonlisp
<gilberth> I mean it has a grammar. With upto HTML4 it was the DTD as originally HTML was an SGML application. With HTML5 you find the grammar in prose for formal grammars appear to be out of fashion.
<beach> Wow!
<Mondenkind> last I checked, html5 is a 'living standard'
<Mondenkind> ie it can be changed at any time!
<gilberth> Yes, proper standards also appear to be out of fashion.
_cymew_ has joined #commonlisp
danse-nr3 has joined #commonlisp
<mfiano> release early and often (and close communication threads that re-appear)
<gilberth> beach: In a nutshell. Each element has a content model. E.g. It says that an UL or OL may only contain LI children. And it also says that P elements may only contain inline stuff, like text, or font changes (B, I, etc). Then it says that certain open or close tags are optional and are to be inferred as needed. So when the parser is right before the second P in "<P>foo<P>bar", we are inside P inside BODY inside HTML.
<gilberth> The parser then ponders. "Huh, im inside P, and see another P? That's verboten, let's close that P! Now, I'm inside BODY, still have that P, and BODY is fine with it, cool, let's open that P." And you get two P elements, one after another.
Gleefre has quit [Remote host closed the connection]
bendersteed has joined #commonlisp
<gilberth> Same when you have e.g. <UL><LI>foo<LI>bar</UL> LI (list item) elements don't take another LI element as child, the close tag is optional, and UL can take that "<LI>bar", so you get (UL (LI foo) (LI bar)) so to say.
<gilberth> Those examples are not malformed but perfectly legal HTML. Always have been.
<gilberth> Another story is non-sense like "<I><P>foo". Upto HTML4 that is a syntax error. Netscape didn't originally used a parser proper, but rather took <I> as "push italic font" and </I> as "pop font", without making elements proper. HTML5 finally and for me some 20 years too late specifies Netscape's behavior. And this "<I><P>foo" is treated as "<P><I>foo". That <I> would even stick <I><P>foo<P>bar would be <P><I>foo</I><P><I>bar</I>
<gilberth> When writing Closure and its parser a major pain was to measure what Netscape does. There is a list of stack-state transformation rules inside Closure-HTML, much like what know is actually said in the HTML5 "standard". Someone might want to put both in sync eventually.
Gleefre has joined #commonlisp
rogersm has joined #commonlisp
danse-nr3 has quit [Ping timeout: 260 seconds]
<beach> I see.
<beach> I remember you put a lot of effort into fixing incorrect, but common, HTML.
danse-nr3 has joined #commonlisp
<gilberth> Yes, I did. And all I could do is to measure Netscape. Things have improved though. Netscape's behavior is specified now and HTML you find in the wild is a little more sane these days.
<beach> Good to know. I think I'll still stay away from the web; your information about the HTML "standard" reinforced my decision.
<gilberth> However, I still use Closure-HTML these days. Mainly for webscraping and found it pretty robust.
<gilberth> beach: It's not that bad for a content producer. And CSS is actually a very reasonable thing.
<beach> I take your word for it. But I still have plenty of work to do with other domains.
<gilberth> But imagine they had used s-expressions for HTML, CSS, JS, and all the random micro syntax. It would have been a nicer world.
<beach> Yes, and Common Lisp instead of JavaScript.
<gilberth> Doesn't need to be Common Lisp. That's not my point.
<beach> Right, that was my point.
<gilberth> When JS reads a CSS attribute like say "margin-left", it gets a string.
<gilberth> Or it needs to put a string.
<gilberth> It gets more interesting with attributes that have more structure like an affine transformation.
dnhester26 has quit [Remote host closed the connection]
<gilberth> Hence, you end up writing ad-hoc parsers and printers for all kind of micro-syntax that hides in attribute values with both HTML and CSS.
dnhester26 has joined #commonlisp
<gilberth> Or take SVG. That PATH element? The actual path (a sequence of move-to, line-to, curve-to etc like in PS), is a string as well. Another parser to write! Hurrah!
<gilberth> So you need to flip back and forth between internal an external representation all the time with a JS application. Or skip the internal representation entirely and embrace the motto "Everything is a string! Lalala".
zetef has quit [Remote host closed the connection]
<gilberth> And as there is no single common syntax, you can't even write a future-proof parser for any of those microsyntaxes. With s-expressions this wouldn't have been a problem. You might not know what "(CURIOUS-FOO 42)" means, but you can parse it and you can print it readably as well.
X-Scale has joined #commonlisp
<beach> gilberth: Now that I think about it, I asked you for a favor a while back, but you must not have seen it, about contributing the CCL code for Trucler.
<gilberth> beach: I can't read the documentation. Some HTML on some webpage would have been nice. :-)
rendar has joined #commonlisp
<beach> For Trucler, you mean?
<gilberth> Yes. I found some texinfo or such. I can't typeset it, it complains about some missing package and I was not successful to ask my TeX distribution to install it.
<beach> What if I give you a PDF?
triffid has quit [Remote host closed the connection]
<gilberth> Ok. I'll read it and tell you whether I like it.
triffid has joined #commonlisp
<beach> Thanks.
<gilberth> Is there a means to craft a function from an s-expression with a given lexical environment?
Inline has quit [Quit: Leaving]
<beach> In Trucler? I don't think so. We have put that into the compiler code that uses Trucler.
<gilberth> So what does it try to solve? I was under the impression that it is some updated protocol for access to lexical environment for code walking purposes?
<beach> That's correct.
<gilberth> Then I need that feature. Otherwise I can't still write a code walker. How am I supposed to process MACROLET e.g.?
<beach> OK. Thanks for looking.
<gilberth> I haven't look yet. I was just asking for this crucial missing puzzle piece.
Inline has joined #commonlisp
<beach> OK, but then you don't have to look. Because that piece is missing.
<gilberth> My application would be that I implement a macro and hence process a form within some given lexical environment.
yitzi has joined #commonlisp
<gilberth> Even asking simple things like: Is lexical variable X even used somewhere within that body that I have. In theory I could macroexpand all the body. In practice I cannot because even given CLtL2 I cannot implement MACROLET with my code walker.
markb1 has quit [Ping timeout: 256 seconds]
<gilberth> In CLEX, I just look at the program "text". And with friendly SBCL I even need to print that text to tell.
<gilberth> I do this because with POSIX regular expressions each parenthesis introduces a submatch. Recording a submatch address is expensive both
<gilberth> in run-time and compile-time.
Inline has quit [Client Quit]
<gilberth> Often parenthesis are just used for grouping, so I want to tell whether a submatch is addressed.
<gilberth> Likewise in noffi. When the address of a [C] variable is taken by means of &x, I need to allocate heap memory for that variable. When not, (and most often it is not), I can put the value into a Lisp lexical variable and when lucky have it living in a register.
<gilberth> So, I would like to be able to code walk.
<gilberth> For noffi, I also would like to be able to do some form of simple type inference even.
<gilberth> Anyhow, I would prefer a protocol that allows me to fully macroexpand a given body from within some macro. Being able to do so for top-level forms isn't enough and pretty useless IMHO.
<gilberth> This is why I believe EVAL or COMPILE should take an environment argument. This would solve the issue.
Inline has joined #commonlisp
<gilberth> The crucial thing is that a new augmented environment needs to native to the Lisp implementation.
<gilberth> <http://clim.rocks/gilbert/meall.lisp> is an attempt at a more-or-less portable MACROEXPAND-ALL. At the top you'll find PROCESS-IN-ENV which is implementation-specific and is this EVAL/COMPILE wrt a given lexical environment.
markb1 has joined #commonlisp
<gilberth> beach: Next question w/o looking. Is there a means to ask whether a given s-expression names a type? That is when I see (declare (foo x)) can I tell whether that is some type declaration or some FOO declaration?
<beach> I don't remember. It is no longer important.
<gilberth> Why isn't that important. A common task I face as a macro writer is to pull all declarations for a given lexical from a body. And to do so, I need to know.
<beach> No, I mean, it is no longer important to me to ask you to contribute the CCL code.
<gilberth> Oh.
<gilberth> Well, I just wanted to point to the missing puzzle pieces. Those pieces that ANSI-CL lacks. I was under the impression that Trucler wanted to provide those.
Gleefre has quit [Remote host closed the connection]
theBlackDragon has quit [Ping timeout: 264 seconds]
theBlackDragon has joined #commonlisp
Gleefre has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
szkl has quit [Quit: Connection closed for inactivity]
<beach> Your impression was wrong.
luis1903 has joined #commonlisp
gamaliel has joined #commonlisp
green_ has quit [Ping timeout: 252 seconds]
dnhester26 has joined #commonlisp
random-nick has joined #commonlisp
yitzi has quit [Remote host closed the connection]
markb1 has quit [Ping timeout: 255 seconds]
mgl has joined #commonlisp
mgl_ has quit [Ping timeout: 276 seconds]
markb1 has joined #commonlisp
<dnhester26> I'm getting from the docs that functions only support ordinary lambda lists and not destructuring lambda lists https://lisp-docs.github.io/cl-language-reference/chap-3/d-e-lambda-lists#345-destructuring-lambda-lists is that correct?
<ixelp> 3.4 Lambda Lists | Common Lisp (New) Language Reference
<dnhester26> I want to define a generic (defgeneric my-fun (some-input)) which can be specialized as (defmethod my-fun ((some-input symbol))) and (defmethod my-fun ((some-input (class-name &optional a b c))))
<dnhester26> Is that not possible?
<dnhester26> https://lisp-docs.github.io/cl-language-reference/chap-3/d-e-lambda-lists#343-specialized-lambda-lists here it says specialized lambda lists are based on oridnarly lambda lists and doesn't list in the differences the destructuring bind
<ixelp> 3.4 Lambda Lists | Common Lisp (New) Language Reference
szkl has joined #commonlisp
rogersm has quit [Remote host closed the connection]
danse-nr3 has quit [Ping timeout: 264 seconds]
rakka has quit [Read error: Connection reset by peer]
Devon has joined #commonlisp
green_ has joined #commonlisp
yitzi has joined #commonlisp
traidare has quit [Ping timeout: 256 seconds]
epony has quit [Remote host closed the connection]
<varjag> let's say i debug on a remote image via slime but want source code referencing commands work on local source tree on my machine
<varjag> is there any way to do that
<yitzi> logical pathnames maybe
epony has joined #commonlisp
rogersm has joined #commonlisp
rogersm has quit [Ping timeout: 256 seconds]
<beach> dnhester26: Correct, you need to use DESTRUCTURING-BIND yourself in the body of the function.
epony has quit [Remote host closed the connection]
<beach> The lambda list of a generic function and its methods must be congruent. In particular, that means that they must have the same number of required parameters.
<dnhester26> beach: ok thanks, I thought I was missing something. Is there a type for lambda list? so far I've just been specializing on a list, but a loss of this is that I cannot further specialize on different types of lambda lists unless I do a destructuring bind with typecase
dra has joined #commonlisp
dra has quit [Changing host]
dra has joined #commonlisp
<beach> I am not following. Specialization is done in methods and you can specialize to a class or to a particular object, using an EQL specializer.
<scymtym> a destructuring pattern as a specializer would not alter the number of required parameters but it would require very different rules for dispatch, method ordering, etc.
<beach> Lambda lists are not instances of the lambda-list class. They are just lists, so the type of a lambda list is CONS.
<beach> dnhester26: These restrictions were probably chosen for reasons of performance and well definedness. I guess this is one of the aspects where they might have been a bit to conservative at the time, and that it might have been possible to preserve performance with some slightly less severe restrictions. But I haven't investigated.
<dnhester26> ok, thanks
<dnhester26> scymtym: thanks, so to enable it we would have to extend the rules of dispatch and method ordering which I imagine is defined in MOP. Did I understand correctly what you said?
<beach> So you can't even specialize to arbitrary types, because that would be very hard to define an order between applicable methods.
<dnhester26> beach: got it, thanks
<dnhester26> beach: what do you mean by arbitrary types? in contrast to classes?
<beach> Yes.
<scymtym> dnhester26: basically yes, but you would need a few bits and pieces beyond the MOP. one example is the recognizing the new specializer syntax that would be required for your extension. see https://github.com/sbcl/specializable for some previous work
<ixelp> GitHub - sbcl/specializable: generalized specializers work
<beach> You can't specialize to (INTEGER 3 234) for instance.
<beach> ... nor even to FIXNUM, at least not portably, because FIXNUM is not guaranteed to be a class.
<beach> clhs fixnum
<ixelp> CLHS: Type FIXNUM
<dnhester26> beach: I haven't had to deal with the number types thus far so I don't know enough to understand what ,(INTEGER 3 234) means, I imagine it's defining an integer of 3 bits long which can only be those numbers?
<ixelp> (INTEGER 3 234) ERROR: Undefined function INTEGER called with arguments (3 234) .
<dnhester26> scymtym: thanks, looking at the link now
<beach> dnhester26: It means an integer between 3 and 234 inclusive.
jmdaemon has quit [Ping timeout: 256 seconds]
green_ has quit [Ping timeout: 246 seconds]
decweb has joined #commonlisp
<scymtym> dnhester26: sure. check the branches for types-as-specializers and pattern-as-specializers. but note that the code in that repository is for research. it is not portable, nor complete nor does it work with vanilla SBCL
<dnhester26> beach: ah, so you meant before that to decide the order between methods which operate on an integer when there are different types, it would require the interpreter to compare the integer for each definition and decide what the rule for narrowing definitions is and then be able to select it, which is in no way as straight forward as simply the most specific class... I imagine (INTEGER 0 5) and (INTEGER 4 9) for an input of 5 would
<dnhester26> be difficult to resolve without some arbitrary decisions made beforehand. Is that a good example of what you meant by hard to define? I imagine changing the range as well would be hard in terms of how to specialize
<beach> I'll answer later. I will be busy for a while.
<dnhester26> scymtym: thanks, reading it now
<beach> dnhester26: Also, most Common Lisp systems don't use an interpreter at all.
icebarf has quit [Remote host closed the connection]
<beach> But yes, you got the point.
<dnhester26> I didn't know what word to use there so just wrote interpreter, but however is deciding which method to dispatch is what I meant
<dnhester26> whoever* or whatever instead of however
<beach> OK.
<dnhester26> thanks
icebarf has joined #commonlisp
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pranavats has joined #commonlisp
<dnhester26> scymtym: wip-type-specializer or specializer-type-specifier ?
<dnhester26> same for pattern, there are two branches
<dnhester26> I imagine it's the code I have to look at, so that's why I'm asking
piglet has joined #commonlisp
<scymtym> pattern-specializer-ast for patterns and wip-type-specializer for types. i would look at the respective examples directories for a quick impression
<dnhester26> thanks
josrr has joined #commonlisp
danse-nr3 has joined #commonlisp
jonatack has quit [Ping timeout: 260 seconds]
<dnhester26> scymtym: ah wow it looks that your project is exactly what I was thinking about, I didn't fully get the examples here in the asserts, but it seems to basically be the idea with lists and keywords https://github.com/sbcl/specializable/blob/pattern-specializers/examples/cons-specializer.lisp
<dnhester26> How come you never finished it? No research for funding or just other work?
rogersm has joined #commonlisp
rogersm has quit [Remote host closed the connection]
rogersm has joined #commonlisp
zaymington has joined #commonlisp
rakka has joined #commonlisp
rgherdt_ has joined #commonlisp
piglet has quit [Ping timeout: 268 seconds]
anthk_ has quit [Remote host closed the connection]
Inline has quit [Quit: Leaving]
rgherdt has quit [Ping timeout: 260 seconds]
markb1 has quit [Ping timeout: 240 seconds]
agm has joined #commonlisp
cayley53 has joined #commonlisp
zyd has quit [Ping timeout: 268 seconds]
paulapatience has quit [Ping timeout: 268 seconds]
paulapatience has joined #commonlisp
jonatack has joined #commonlisp
nathanb has quit [Ping timeout: 268 seconds]
\f has quit [Ping timeout: 268 seconds]
migalmoreno has quit [Ping timeout: 268 seconds]
jasom has quit [Ping timeout: 268 seconds]
jonlevin has quit [Ping timeout: 268 seconds]
ggb has quit [Ping timeout: 268 seconds]
arpunk has quit [Ping timeout: 268 seconds]
srhm has quit [Ping timeout: 268 seconds]
mhcat has quit [Ping timeout: 268 seconds]
griffinmb_ has quit [Ping timeout: 268 seconds]
lieven has quit [Ping timeout: 268 seconds]
josrr` has joined #commonlisp
josrr has quit [Ping timeout: 268 seconds]
whereiseveryone has quit [Ping timeout: 268 seconds]
cayley5 has quit [Ping timeout: 268 seconds]
smlckz has quit [Ping timeout: 268 seconds]
cayley53 is now known as cayley5
greaser|q has joined #commonlisp
deadmarshal_ has quit [Ping timeout: 268 seconds]
GreaseMonkey has quit [Ping timeout: 268 seconds]
JeromeLon has joined #commonlisp
ggb has joined #commonlisp
mhcat has joined #commonlisp
whereiseveryone has joined #commonlisp
migalmoreno has joined #commonlisp
jonlevin has joined #commonlisp
Inline has joined #commonlisp
\f has joined #commonlisp
srhm has joined #commonlisp
jasom has joined #commonlisp
arpunk has joined #commonlisp
mal1 has joined #commonlisp
green_ has joined #commonlisp
griffinmb_ has joined #commonlisp
rtypo has joined #commonlisp
danse-nr3 has quit [Ping timeout: 276 seconds]
<agm> why does ,(handler-bind ((condition (lambda (e) (print 'ah))) (simple-condition (lambda (e) (print 'oh)))) (signal "w")) print both AH and OH? clhs 9.1.4 says "if the handler declines, no other handler established by that form will be considered for possible invocation"
<ixelp> (handler-bind ((condition (lambda (e) (print 'ah))) (simple-condition (lambda (e) (print 'oh)))) (signal "w")) ;Compiler warnings : ↩ ; In an anonymous lambda form inside an anonymous lambda form: Unused lexical variable E ↩ ↩ ; In an anonymous lambda form inside an anonymous lambda form: Unused lexical variable E ↩ ↩ AH ↩ OH => NIL
jonatack has quit [Ping timeout: 260 seconds]
igemnace has quit [Read error: Connection reset by peer]
markb1 has joined #commonlisp
traidare has joined #commonlisp
gamaliel has quit [Quit: Client closed]
rogersm has quit [Remote host closed the connection]
smlckz has joined #commonlisp
smlckz has quit [Changing host]
smlckz has joined #commonlisp
epony has joined #commonlisp
zyd has joined #commonlisp
jonatack has joined #commonlisp
deadmarshal_ has joined #commonlisp
nathanb has joined #commonlisp
traidare has quit [Ping timeout: 255 seconds]
pfdietz has joined #commonlisp
igemnace has joined #commonlisp
<White_Flame> agm: yet HANDLER BIND says "If the handler declines, the search continues for another handler. "
<Nilby> agm: it's confusing, but i guess it's talking about not invoking handlers estabilshed in handlers, because the normal decline in 9.1 says it goes to the next handler.
tyson2 has joined #commonlisp
<White_Flame> it smells like it wants to say that the other ones aren't considered for _nested_ signals inside the selected handler, but that's not a declining case
attila_lendvai has joined #commonlisp
<agm> yeah, I agree, elsewere it says that other handlers established in the same form are disabled only while executing each, not after
<agm> but that sentence seems misleading
<phoe> agm: (handler-bind ((condition (lambda (c) (declare (ignore c)) (print "haha"))) (condition (lambda (c) (declare (ignore c)) (signal c)))) (signal 'condition))
<phoe> this sentence needs to be read in context: when a handler from a given cluster is executing, all other handlers from the same cluster are not considered for invocation
<phoe> so, in this case, a resignal from the second handler will not invoke the first handler *precisely* because they are in the same cluster
<phoe> you'd need a pair of nested HANDLER-BINDs to change this behavior (since each HANDLER-BIND creates its own cluster)
<phoe> oop, the order of the handlers should be reversed
<White_Flame> then where does "if the handler declines" come in to play?
<phoe> (but the behavior is the same)
attila_lendvai has quit [Ping timeout: 260 seconds]
<phoe> oh, hm
<ixelp> CLiki: ANSI Clarifications and Errata
<phoe> the previous sentence has "While the selected handler runs" and is clear because of that
szkl has quit [Quit: Connection closed for inactivity]
<White_Flame> yeah, it's a literal documentation error
<White_Flame> 9.1.4: "That is, if the handler declines, no other handler established by that form will be considered for possible invocation." should instead say "That is, while the handler is executing, ..."
gxt has quit [Remote host closed the connection]
<agm> oh, it's in the errata...
gxt has joined #commonlisp
jonatack has quit [Ping timeout: 255 seconds]
rogersm has joined #commonlisp
rogersm has quit [Remote host closed the connection]
kevingal has joined #commonlisp
kevingal_ has joined #commonlisp
kathe has joined #commonlisp
<kathe> hello everybody. :-)
<kathe> i'm here after quite some time.
<kathe> hope all has been well with everybody.
rogersm has joined #commonlisp
rogersm has quit [Ping timeout: 252 seconds]
danse-nr3 has joined #commonlisp
kathe has quit [Quit: Leaving]
pfdietz has quit [Quit: Client closed]
dnhester26 has quit []
luis1903 is now known as luis
luis has quit [Changing host]
luis has joined #commonlisp
rogersm has joined #commonlisp
X-Scale has quit [Quit: Client closed]
rgherdt__ has joined #commonlisp
szkl has joined #commonlisp
rgherdt_ has quit [Ping timeout: 268 seconds]
dnhester26 has joined #commonlisp
<scymtym> dnhester26: it seems too hard to make practical
varjag has quit [Quit: ERC (IRC client for Emacs 27.1)]
<dnhester26> scymtym: too hard meaning too much work for the project or too hard for a user to figure out all the details or all of the above? it looked like you made good progress, that's why I ask
dnhester26 has quit []
Gleefre has quit [Remote host closed the connection]
|3b|` is now known as |3b|
<scymtym> dnhester26: i think it would be possible, with a lot of work, to finish and support the various additional specializer kinds, with their respective complications, for use in SBCL. however, i imagine not many projects would be able to use the additional specializers since that would restrict them to recent SBCL versions
Gleefre has joined #commonlisp
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
pfdietz has joined #commonlisp
dcb has joined #commonlisp
villageidiot has joined #commonlisp
<Devon> Any ANSI-TEST wisdom here?
<beach> Devon: What do you want to know?
pfdietz has quit [Quit: Client closed]
<Devon> LOL, which of the many, many versions might work with CCL.
Pixel_Outlaw has joined #commonlisp
<Devon> Whether there's one that's been improved in the past two decades.
<beach> yitzi improved it just a few months ago.
<ixelp> ansi-test / ansi-test · GitLab
<bike> yeah, that's the canonical repo as far as i know.
<bike> it's what we use in clasp (actually we use a mirror, but it's the same repo)
<Devon> Cool. The testing framework crashes a lot in CCL, and the tests I'm interestid in are buggy.
<bike> the tests themselves are buggy? what are you seeing?
<Devon> The framework and tests rely on ANSI-unspecified behavior, e.g. the unpatched ensure-directories-exist.lsp test 8 believes DELETE-FILE works on directories and PROBE-FILE does not.
<Devon> In CCL the opposite is true.
zetef has joined #commonlisp
<bike> maybe you should file bugs with the tracker? do you have patches for this?
<Devon> The unpatched framework crashes because it rashly assumes *LOAD-PATHNAME*, *DEFAULT-PATHNAME-DEFAULTS* and MERGE-PATHNAMES work in ways outside the standard.
<Devon> LOL, I'd be delighted to file my patches where they'll do the most good.
miique has joined #commonlisp
<Devon> Is there an easy way to find the date of the latest change at https://gitlab.common-lisp.net/ansi-test?
<ixelp> ansi-test · GitLab
rdrg109 has quit [Quit: WeeChat 3.8]
<bike> if you click the ansi test repo https://gitlab.common-lisp.net/ansi-test/ansi-test you can see "Merge branch 'extrinsic' into 'master' / Daniel Kochmański authored 5 months ago"
<ixelp> ansi-test / ansi-test · GitLab
<bike> git itself is more specific - that was aug 3
waleee has joined #commonlisp
bendersteed has quit [Quit: bendersteed]
zetef has quit [Ping timeout: 252 seconds]
<Gleefre> FWIW gitlab shows specific dates as well - when hovering over them
pfdietz has joined #commonlisp
<kevingal_> I'm wondering if there's a cross-platform way to pad a file with a certain number of zeros other than manually writing them in -- any ideas?
<pfdietz> I have my own branch of ansi-test, but it's mostly for random testing (which I am constantly doing on sbcl).  I should probably split that off into a separate repo.
<kevingal_> i.e. I want to write something to a file at position 100, but the file is currently empty. Do I have to manually write in those 100 pad bytes?
<yitzi> Devon: I agree that it would have been nice if the spec said explicitly what happened with DELETE-FILE or PROBE-FILE in respect to directories, but I don't think it is unspecified per se. The glossary entry for "file" says "named entry in a file system, having an implementation-defined nature." This means whether directories are considered files is implementation specific.
<bike> Gleefre: ah, i see, i was wondering about that
<splittist> kevingal_: which platforms do you need to 'cross' ?
<kevingal_> splittist: I just want to be able to write it in CL and not care about what system I'm on.
<kevingal_> splittist: But realistically I'll only be running the code on Linux Mint, ha.
rogersm has quit [Quit: Leaving...]
<splittist> kevingal_: it may well depend on the underlying fs, too (: And do you want null bytes actually written, or just returned if you read from the 'hole'? (Not that I can help you either way...)
<Nilby> kevingal_: one should realistically be able to use ‘file-position’ on a file stream with element-type of (unsigned-byte 8)
<kevingal_> splittist: I don't care what values the pad bytes have, and I don't need to read them back.
NotThatRPG has joined #commonlisp
<Nilby> and then use write-byte or write-sequence
ymir has joined #commonlisp
<kevingal_> Oh wow, that worked. I presumed that file-position would signal an error if I tried to move beyond the end of the file. Thanks all :)
<Nilby> but lisp doesn't have portable way without using ffi to automatically have zeros without writing
<kevingal_> "Works on my system" is good enough for now, haha.
danse-nr3 has quit [Ping timeout: 268 seconds]
<aeth> In general, being explicit is better than relying on implicit behavior. It's not hard to do (loop :repeat 100 :do (write-char (code-char 0) stream))
<aeth> Although that isn't the fastest way to do it
tyson2 has quit [Remote host closed the connection]
<aeth> I'd guess the fastest stream-based way to do it is probably some system-specific partial loop unroll like, say, (loop :repeat 10 :do (write-sequence #.(make-array 10 :element-type 'character :initial-element (code-char 0)) *standard-output*))
<Alfr> aeth, so writing a bunch of NIL to standard output?
<aeth> Alfr: *standard-output* because the stream is a required argument to write-sequence.
<aeth> This is really file-based so if you go down this route to optimize you're eventually bringing in an mmap library or something.
<Alfr> aeth, oh, no. It's not about *standard-output*, but code-char.
Eoco_ has joined #commonlisp
ixelp has quit [Ping timeout: 252 seconds]
decweb has quit [Remote host closed the connection]
Eoco has quit [Ping timeout: 252 seconds]
<splittist> 'a bunch of #\nul s'
decweb has joined #commonlisp
<aeth> yes, but... here's where C's awfulness helps
<aeth> both EBCDIC and ASCII have (code-char 0) => #\Nul and probably any possible encoding you'd use does as well so it's probably more reliable than actually writing #\Nul because there's probably some implementation that uses #\Null instead
ixelp has joined #commonlisp
<aeth> Unless it's standardized
<aeth> You can also just use a byte stream rather than a character stream and just use 0. It's probably faster and it probably handles edge cases where e.g. the file is somehow writing out UTF-32 and now you have 4x as many 0s as you want.
<aeth> This is probably the way to go.
mgl has quit [Ping timeout: 268 seconds]
rdrg109_ has joined #commonlisp
<aeth> I guess that means you'd have to open to create the file as an octet stream, write 100 zeros, and then reopen it (with append) as a character stream (or just use something like babel) to write what you want if it's characters you want to write.
<Gleefre> Reading CLHS entry for type specifier VALUES (https://www.lispworks.com/documentation/HyperSpec/Body/t_values.htm)
<Gleefre> > The &optional and &rest markers can appear in the value-type list; they indicate the parameter list of a function that, when given to multiple-value-call along with the values, would correctly receive those values.
<Gleefre> And also reading CLHS entry for special operator THE (https://www.lispworks.com/documentation/HyperSpec/Body/s_the.htm)
<Gleefre> > It is permissible for form to yield a different number of values than are specified by value-type
<Gleefre> ...So it seems that there are actually two versions of VALUES type specifier exist -- one for non-fixed amount of values (i.e. extra values are discarded, missing values are treated as NIL); and one for somewhat fixed amount of values -- with possibility of &optional / &rest parameters.
josrr` has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.2)]
josrr has joined #commonlisp
<Gleefre> That would also mean that (values &optional) is more restrictive than (values) -- first one indicates that no values can be returned; second one indicates that any number of values can be returned.
yitzi has quit [Remote host closed the connection]
<Gleefre> ...but
<Gleefre> ,(subtypep '(function () (values)) '(function () (values &optional)))
<ixelp> (subtypep '(function () (values)) '(function () (values &optional))) => T; T
<Alfr> splittist, no. I do mean NIL. As 0 might simply not have a corresponding character and then code-char returns NIL.
agm has quit [Read error: Connection reset by peer]
agm has joined #commonlisp
<Gleefre> ...This behaviour can be observed on CMUCL, CCL (that's what ixelp runs), ECL, CLASP (at least somewhat old version - 2.2.0), MKCL
<Gleefre> Is that a bug?
<bike> Gleefre: the definitions of VALUES are totally contradictory. Because all type declarations are defined to be equivalent to some use of THE or another, my reading has been that the definition in the VALUES page is just wrong.
<bike> Gleefre: SBCL treats (values) and (values &optional) differently as you describe. I think it's kind of perverse, though.
<splittist> Alfr: OK. But by the time you're worrying about that file-position is already a losing proposition.
<Gleefre> FWIW it allows to tell compiler that "this function returns exactly 2 values", which then can be used for various optimizations.
<Gleefre> I don't see any other way to do that aside from using (values t t &optional)
<Alfr> splittist, admittedly, I haven't encountered one doing that yet.
<bike> yes, i think it's nice to be able to specify that. i just don't think this is a good way to do it.
<bike> that in particular you can do with (values t t &rest nil).
<Gleefre> It *seems* that &rest <type> means the same thing as when used in argument list specifier -- that all arguments are of that type.
<Gleefre> ...which would tell the compiler that no objects are going to be passed, right
<bike> yes. all arguments of type nil, ergo they cannot exist.
<Gleefre> I wonder if hyperspec contains any usage examples for &optional / &rest for the values type specifier
<Gleefre> Also, maybe one of X3J13 Issues covers that?..
<bike> i'm not aware of anything in the spec.
<bike> frankly, i don't think this was thought out enough.
jonatack has joined #commonlisp
<aeth> seems like a loophole that exists just to get the desired behavior?
<bike> thus not thought out enough
<bike> we shouldn't have to rely on loopholes
ronald has quit [Read error: Connection reset by peer]
<Gleefre> FWIW...
<Gleefre> ,(subtypep '(function () (values)) '(function () (values &rest nil)))
<ixelp> (subtypep '(function () (values)) '(function () (values &rest nil))) => T; T
<Gleefre> At least this one should be a bug, right?
<Gleefre> (Same implementations are affected as before)
ronald has joined #commonlisp
<bike> i... think so, yes.
Gleefre has quit [Remote host closed the connection]
X-Scale has joined #commonlisp
Gleefre has joined #commonlisp
<bike> if svalues is the "strict" form of values described under Type Specifier VALUES, you can view (values) as being short for (svalues &rest t), and (values &rest nil) is just (svalues &rest nil)
<bike> i've gone through various iterations of this stuff in the cleavir and ctype systems and gotten it wrong several times. it is a bit confusing.
attila_lendvai has joined #commonlisp
<bike> for example the bottom type among values types is not (values &rest nil), which just means 0 values, but rather (values nil &rest nil), since no set of values matches that. and that means that (values nil nil &rest nil) etc. are also bottom types, as is (values nil cons), (values nil &rest t), etc
bitmapper has quit [Quit: Connection closed for inactivity]
<Gleefre> Well, you could write the bottom type among (usual) types in multiple ways as well
<bike> actually, related open question. THE ignoring extra values is a little annoying for me but convenient for programmers since you can (the single-float (floor ...)) and so on. but what about the defaults in the other direction, when the form doesn't produce enough values? like you can do (the (values integer list) (+ 4 5)) and that's fine
<bike> that's caused me several headaches but it doesn't seem nearly as useful
<Gleefre> Like (and symbol integer), or nil, or (and symbol list (not (eql nil))) r.t.c.
<bike> i suppose that is so
<Gleefre> re THE: it is specified that missing values are treated as NIL
<bike> that's what i was referring to, yes
<bike> i'm just wondering how useful that is inp ractice
<Gleefre> I think it is intended to behave like multiple-value-bind
<Gleefre> ,(multiple-value-bind (a b) (values) (list a b))
<ixelp> (multiple-value-bind (a b) (values) (list a b)) => (NIL NIL)
<bike> probably
<aeth> treating missing values as NIL is mostly useful when some function returns (values) to signal that it has no useful return value, and then its return value is, in some sense, used
<aeth> or at least, that's where it would show up the most I'm guessing
<aeth> 0->1, not 0->2 or 0->4 or whatever
<bike> is that something you use?
<bike> i know you're pretty concerned about type checks
jmdaemon has joined #commonlisp
<aeth> I'm inconsistent about it because I've written a lot of files over a long period of time, but I think I generally return NIL instead of (values) for something that is solely used for its side effects... but (values) defaulting to NIL makes the choice mostly equivalent
danse-nr3 has joined #commonlisp
yitzi has joined #commonlisp
<bike> i meant, do you use this in relation to the behavior of missing values in THE
miique has quit [Quit: Leaving]
<Gleefre> FWIW when sbcl does type-checking based on THE, it uses the VALUES type specifier in the same way as in FTYPE declarations -- if &optional/&rest is supplied, it uses a strict version
<aeth> bike: Do you mean, do I use (the (values &optional) (foo)) at all?
<Gleefre> bike: re bottom type among values types: After thinking for a bit, it seems like (VALUES NIL) would do the job? (And is very similar to NIL being the bottom type among usual types)
wacki has joined #commonlisp
triffid has quit [Remote host closed the connection]
<Gleefre> By the way, found a somewhat relevant link: https://www.cliki.net/Issue%20THE-VALUES
<ixelp> CLiki: Issue THE-VALUES
<Gleefre> Although it only talks about (the (values ...)); and not about (function (...) (values ...))
mgl has joined #commonlisp
pfdietz has quit [Quit: Client closed]
triffid has joined #commonlisp
pfdietz has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
yitzi has quit [Ping timeout: 252 seconds]
yitzi has joined #commonlisp
_cymew_ has quit [Quit: Konversation terminated!]
mgl has quit [Ping timeout: 256 seconds]
<bike> aeth: that is what i was talking about, yes.
<aeth> I don't really use THE very often
tyson2 has joined #commonlisp
<bike> how about ftype declarations (which are defined in terms of THE)
Cymew has quit [Ping timeout: 256 seconds]
pfdietz has quit [Quit: Client closed]
Gleefre has joined #commonlisp
pfdietz has joined #commonlisp
<bike> mostly i'm not sure why you brought this up? i thought i asked a pretty specific question about THE
<aeth> I do use ftype, but not most of the time, because when I add types I usually am only concerned about the input types (which can use DECLARE) and only generate an ftype DECLAIM when I care about the return type as well.
<Alfr> Gleefre, (values nil) as in type specifier?
<aeth> I always do (values ... &optional) in that case, but I don't know if I have a syntax for (values &optional)
<aeth> oh, I do not have a syntax for that.
<Alfr> Gleefre, that likely is a problem, as you're saying that the first thing of what's being specified is something of type NIL.
<Gleefre> Alft: yes, this is a bottom type among values types; it indicates that the function must never return (in usual way)
<Alfr> Gleefre, oh, okay. I thought it was still about returning nothing.
<Alfr> Gleefre, sorry for the noise.
thuna` has quit [Remote host closed the connection]
<bike> Gleefre: (values nil) is a bottom type but so's a lot of stuff, and unlikely with single value types there's no real canonical type, i guess
<bike> no obvious canonical type, rather
thuna` has joined #commonlisp
amb007 has joined #commonlisp
<Gleefre> IMHO (values nil) is a good candidate for a canonical type
<Gleefre> If you allow interpreting usual types as values types (like in (function () <some-type>)), NIL could be the bottom type too.
jmdaemon has quit [Ping timeout: 268 seconds]
<Gleefre> If you are canonicalizating usual types <some-type> to (values <some-type>), NIL would be canonicalizated to (values nil)
greaser|q has joined #commonlisp
greaser|q has quit [Changing host]
greaser|q is now known as GreaseMonkey
cage has joined #commonlisp
<Gleefre> (Also "(values nil)" is a good candidate for a canonical type because it is the shortest bottom type among values types.)
tyson2 has quit [Remote host closed the connection]
<Gleefre> And it seems that all bottom types are of the form (values typespec* nil typespec* [&optional typespec*] [&rest typespec]) ; so (values nil) would be the most siplified one..
<bike> yeah, that is what bottom types are
<bike> but then you have to choose (values nil &rest nil) versus (values nil &rest t) and etc
mzan has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<Gleefre> Why not just (values nil) ? &rest could be just discarded
jmdaemon has joined #commonlisp
mzan has joined #commonlisp
danse-nr3 has quit [Ping timeout: 268 seconds]
varjag has joined #commonlisp
tyson2 has joined #commonlisp
<Mondenkind> is (cons nil nil) a bottom type?
<Mondenkind> ,(subtypep '(cons nil nil) nil)
<ixelp> (subtypep '(cons nil nil) nil) => T; T
<Mondenkind> ccl thinks so
<Gleefre> On SBCL: (alexandria:type= '(cons nil nil) 'nil) => T; T
<Gleefre> sbcl thinks so as well
<random-nick> that makes sense, since both the car and the cdr are always bound to a value
<random-nick> since there are no values of type nil, you can't have a cons with a car and/or cdr of type nil
cage has quit [Quit: rcirc on GNU Emacs 29.1]
tisanae has joined #commonlisp
<bike> Gleefre: so we can canonicalize all values types to have a (possibly empty) &optional and &rest.
<bike> and yeah (cons nil nil) is a bottom type
<bike> makes some things a little annoying, like (subtypep '(cons (satisfies foo)) 'integer) => NIL NIL instead of NIL T
danse-nr3 has joined #commonlisp
jonatack has quit [Ping timeout: 252 seconds]
<Gleefre> Interestingly, on SBCL (subtypep '(cons (satisfies foo)) 'integer) => NIL; T
<Gleefre> Same on CMUCL, CCL, ABCL and Allegro CL
<Alfr> Gleefre, that's because integer is defined to only have two subtypes: fixnum and bignum
<bike> please look at the preceding discussion
<Alfr> bike, I did.
<bike> if (satisfies foo) is empty, (cons (satisfies foo)) is empty, and therefore nil, and therefore a subtype of everything including integer
X-Scale has quit [Ping timeout: 250 seconds]
waleee has quit [Ping timeout: 268 seconds]
<bike> side effect of defining types as sets of objects, i suppose
<Gleefre> Dunno if it is a bug, and if it is, if it was reported & possibly marked wontfix/invalid
jmdaemon has quit [Ping timeout: 260 seconds]
<bike> i mean, practically speaking it doesn't matter
<Gleefre> True
<bike> it's just a fly in the ointment when you try to go about implementing the type system correctly
ymir has quit [Read error: Connection reset by peer]
<Alfr> bike, so, you'd like NIL; NIL for an answer?
<bike> i managed to find a ten year old sbcl bug when testing obscure types like this for ctype
<bike> Alfr: i think that is the correct answer
<Alfr> bike, because for unknown foo, that's the only reasonable one. And even if a particular foo is given, then determining, that no object x will result in (foo x) being something trueish, is rather infeasible too.
<bike> practically speaking there's not much to be done with satisfies types, indeed
<Alfr> (or at least not possible for all imaginable foos.)
waleee has joined #commonlisp
<bike> you could argue that a really good type implementation would no that (satisfies foo) is a subtype of itself, and that it should be able to handle things like (subtypep 't '(or (satisfies foo) (not (satisfies foo)))) => T T, and then you can use subtypep as a 3sat solver
<bike> any sat, rather
Gleefre has quit [Ping timeout: 250 seconds]
<bike> of course it's conformant to just give up and return nil nil
Gleefre has joined #commonlisp
Devon has quit [Remote host closed the connection]
danse-nr3 has quit [Ping timeout: 276 seconds]
danse-nr3 has joined #commonlisp
jmdaemon has joined #commonlisp
<Kingsy> what is wrong with this macro? https://bpa.st/45IF4 <- for some version the make-instance call that is being produced looks like this (MAKE-INSTANCE 'MIGRATION VERSION 1.1 ...) rather than :VERSION 1.1 ... why is the : being trimmed?
<ixelp> View paste 45IF4
Gleefre has quit [Ping timeout: 250 seconds]
<bike> how are you displaying the form?
Gleefre has joined #commonlisp
<bike> cos it looks like :version to me
<Kingsy> oh darn. yep you are right... I had ~A in he format instead of ~S, apologies
Inline has quit [Ping timeout: 264 seconds]
<Kingsy> bike: on this though, can you see a problem with the setf? specifcially this is the expanded progn -> https://bpa.st/UCWK6 <- if I (format t "~S" (gethash 1.1 *MIGRATIONS*)) I get NIL... why is that? that setf looks ok to me.
<ixelp> View paste UCWK6
<bike> what's the hash table test?
agm has quit [Ping timeout: 246 seconds]
<Kingsy> what do you mean? (format t "~S" (gethash 1.1 *MIGRATIONS*)) however I think this is a deadend, I am getting an error from the macro saying :version is undefined. so perhaps I need to fix that first.
<bike> i mean you did make-hash-table, right? what was :test? or was it unspecified?
<Kingsy> ohhh :equal
<bike> ok, so that's not the problem
<Kingsy> sorry
<Kingsy> 'equal
<bike> :version undefined is a very weird error, especially if you get it at macroexpansion time.
mzan has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
thuna` has quit [Ping timeout: 252 seconds]
<Kingsy> ok just fixed that. it was because the macro wasnt being :use <- used in the package properly, so I couldnt call it without the package:macroname. weird it complained about the :version though and not the macro being undefined
<Kingsy> macros just add so much complexity to the language. haha makes me regret doing this with a macro :D
<bike> oh, you mean you had like (defmigration (:version 1.1) ...) and it complained? that's because if it doesn't know what defmigration is, it'll assume it's a function, and try to evaluate the cdr as argument forms
<bike> so it treats (:version 1.1) as a call to a function called :version
<Kingsy> yes but that is in the form (defmigration (:version 1.1)) so wouldnt it throw a fit about defmigration first?
<Kingsy> given that if that form is correct it treats the (:version ..) <_ differently
igemnace has quit [Read error: Connection reset by peer]
ymir has joined #commonlisp
<bike> no, it has to evaluate the arguments before it can do the call anyway, so that's what it tries
mzan has joined #commonlisp
danse-nr3 has quit [Ping timeout: 260 seconds]
villageidiot has quit [Ping timeout: 250 seconds]
<Kingsy> ah well that explains it. but awkward to read though! :D
rendar has quit [Ping timeout: 276 seconds]
villageidiot has joined #commonlisp
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
igemnace has joined #commonlisp
mzan has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
dajole has joined #commonlisp
mzan has joined #commonlisp
amb007 has quit [Remote host closed the connection]
amb007 has joined #commonlisp
ymir has quit [Ping timeout: 268 seconds]
ymir has joined #commonlisp
<BrokenCog> I'm really confused. my file has: (ql:quickload '(:alexandria :jsown :plump) :silent t) and when I do sbcl --load file.lisp I get error: "The name "JSOWN" does not designate any package." on line 23, the quicklaod line. However in the REPL if i manuualy (ql:quickload 'jsown), it works fine.
shka has quit [Ping timeout: 260 seconds]
thuna` has joined #commonlisp
<josrr> (ql:quickload '(:jsown) :silent t)
<josrr> Sorry, don't pay attention to that. wrong window.
<Gleefre> BrokenCog: this is not a problem with quicklisp -- the error most probably comes from a DEFPACKAGE
Inline has joined #commonlisp
<BrokenCog> is (defpackage :mypackage (use :jsown)) generally valid?
<Gleefre> Only if :jsown is already loaded
<zyd> It's probably because of what --script implies.
<BrokenCog> I used --load
<BrokenCog> and I tried --non-interactive --load
<zyd> In your .sbclrc file you probably have the lines to load quicklisp
<BrokenCog> yes.
<zyd> while with --script you don't
<BrokenCog> didn't use --script
<zyd> ah my bad my bad
<zyd> misread
<BrokenCog> but, would --load conflict with the ~/.sbclrc loading ql?
<Gleefre> BrokenCog: I suspect that you are using defpackage before using ql:quickload; especially given that ql:quickload comes quite late -- on line 23 (and not on line 1 as I would do for such "scripts")
<Gleefre> That would mean that you are trying to reference the JSOWN package (by doing (:use jsown)) before it is loaded, which would result in the error you are getting.
Inline has quit [Ping timeout: 252 seconds]
<BrokenCog> I do have a mypackage.ash, with (asdf:defpackage) ... but, honestly, I'm not clear how that works yet so mahybe I don't need it?
<BrokenCog> ah.
ymir has quit [Ping timeout: 268 seconds]
<Gleefre> I think you are confusing packages and asdf systems
<BrokenCog> yeah, I think so.
<BrokenCog> I thought I needed an asd file for QL to load the package
<Gleefre> Systems are what you think packages are
<Gleefre> Packages are namespaces
<BrokenCog> hmm, so (asdf:defsystem :mypack)?
<Gleefre> A package is a runtime object that you can introspect and do stuff.
<Gleefre> ,(find-package '#:keyword)
<ixelp> (find-package '#:keyword) => #<Package "KEYWORD">
<Gleefre> A system is a "library" or a "project"
Inline has joined #commonlisp
<Gleefre> To define your own system you indeed need to create an .asd file containing a system definition (asdf:defsystem "name" ...)
Inline has quit [Client Quit]
Inline has joined #commonlisp
<Gleefre> And then to load it you need to (1) tell ASDF where to find your system (2) and then load it via ASDF:LOAD-SYSTEM
tyson2 has quit [Remote host closed the connection]
<BrokenCog> so then what's QL's role??
<Gleefre> Quicklisp (QL) tells to ASDF how to find a number of systems (i.e. download it if needed & then load from this path)
<Gleefre> Scratch that
ymir has joined #commonlisp
<Gleefre> It doesn't tell ASDF how to download systems -- it can be done only if QL:QUICKLOAD is used
<BrokenCog> right, QL downloads the system for ASDF to load
<BrokenCog> is package.lisp used by ASDF or QL?
anthk_ has joined #commonlisp
<Gleefre> package.lisp is not different from any other file foo.lisp
<Gleefre> It will be loaded as a part of your system if you say so in your system definition
<BrokenCog> oh snap. I think I misunderstood the example ... I only need mypackge.lisp not a mypcakge.lisp and package.lisp
<Gleefre> A very simple library will have a following structure: mylib.asd; mylib.lisp; (maybe) mylib-tests.lisp
<Gleefre> For larger libraries a package.lisp / packages.lisp file is common
Inline has quit [Max SendQ exceeded]
<Gleefre> But essential parts are an .asd file that contains system definition, which describes what parts (components) your project has; and a number (can be 1) .lisp files that contain project's code.
jonatack has joined #commonlisp
<BrokenCog> if I don't have a package.lisp, where would I :export stuff from the package?
<Gleefre> You would just need a (defpackage #:my-package (:use #:cl) (:export #:stuff)) at the top of your file.
<BrokenCog> not in the asd file?
<Gleefre> Packages are very rarely defined in the .asd file.
triffid has quit [Remote host closed the connection]
gxt has quit [Read error: Connection reset by peer]
anticomputer has quit [Remote host closed the connection]
chiselfuse has quit [Read error: Connection reset by peer]
chiselfuse has joined #commonlisp
<BrokenCog> hmm, okay, I think I've gotten it somewhat cleared up, but not quite:
<Gleefre> Mostly those are defined when some complicated ASDF-related logic is needed to load the system; and the package defined is not the main package of the library
<BrokenCog> USE-PACKAGE #<PACKAGE "DEXADOR"> causes name-conflicts in #<PACKAGE "OAUTH2">
gxt has joined #commonlisp
<BrokenCog> between the following symbols:
triffid has joined #commonlisp
<BrokenCog> DEXADOR:GET, COMMON-LISP:GET
anticomputer has joined #commonlisp
<BrokenCog> maybe because I have (defpackaeg (:use :dexador)) and also in the asd file :depends on '(:dexador)
<Gleefre> No, that's fine
<Gleefre> Those are different dexadors
<Gleefre> In .asd it is a name of a *system* (library)
<BrokenCog> does my asd :component need to include :module dexador?
<Gleefre> In the defpackage that would be a name of a *package* (namespace defined by that library)
<Gleefre> No, :module's are a different thing too
<BrokenCog> ah, okay.
<Gleefre> Basically :module is just a subdirectory of your project. (but maybe more interesting things can happen there, dunno)
<Gleefre> (But note that for the say ./src directory you should use another asdf option -- :pathname)
<Gleefre> Anyways, about name-conflicts.
<Gleefre> This is because both COMMON-LISP package (CL) has a symbol named "GET"; and DEXADOR package has its own symbol named "GET"
<Gleefre> You want to either (1) carefully resolve name conflicts (2) or don't :use dexador package at all.
green_ has quit [Ping timeout: 264 seconds]
<Gleefre> In the second case you have a few options: (1) just use dexador:get e.t.c. It is not too long to type/read and enhances readability
<BrokenCog> okay. I don't know how all this working for several days and now isn't - I removed the (use ;dexador) and that resolved the error. I must have been running in a repl with things already loaded I guess?
<Gleefre> The problem is not with loading the *system* dexador.
<Gleefre> The problem is with defining your own package
<Gleefre> Basically, you can't have both CL:GET as GET and DEXADOR:GET as GET, you need to choose only one of them
<BrokenCog> so, as a general summary is this accurate: mylib.asd defines (asdf:defsystem :depends-on 'other-systems)) ... mylib.lisp (defpackage :mylib (use 'other-systems) (:export 'stuffs))
<Gleefre> use 'other-systems is wrong
<BrokenCog> #:other-system
Inline has joined #commonlisp
<Gleefre> It is (use 'other-packages); and it is considered bad style, because if a library exports more symbols, a name conflict can easily arise (which needs to be resolved via :shadow or :shadowing-import-from)
<BrokenCog> so, if I don't (use :cl :dexador), then how are those other systems pulled in?
<Gleefre> Instead you usually either do (:import-from 'other-package #:this-one-symbol #:and-maybe-this-one), or you just use a full package prefix every time your use a function/variable/... from another package
<Gleefre> Those are not systems, those are packages
<Gleefre> And *systems* are pulled in because they are written in the :DEPENDS-ON option in your .asd file
scymtym has quit [Remote host closed the connection]
scymtym has joined #commonlisp
<BrokenCog> but they don't need to explicitly stated in (use)?
<Gleefre> They don't.
<BrokenCog> what's the role of (use) in (defpackage) then?
<Gleefre> You usually do this in your lisp file: (defpackage #:mypackage (:use #:cl)) (in-package #:mypackage)
<Gleefre> Note the IN-PACKAGE
<Gleefre> It means that if the following code defines a function FOO, a MYPACKAGE::FOO is defined.
<BrokenCog> right. I have that.
<Gleefre> (:use #:cl) is needed so that you can use stuff like DEFUN
<BrokenCog> I have that also.
<Gleefre> Otherwise, if you do (defpackage #:mypackage (:use)) (in-package #:mypackage) (defun ...); MYPACKAGE::DEFUN is searched for, and not CL:DEFUN; so no function can be defined unless you define your own defun.
<Gleefre> You could do (:use #:dexador) to make it possible to write (post ...) instead of (dexador:post ...) in your file
<Gleefre> But :use #:dexador creates a conflict, because it is not known what your want GET to be -- CL:GET or DEXADOR:GET?
<Gleefre> Instead you could do (defpackage #:mypackage (:use #:cl) (:import-from #:dexador #:post)); and then in your package (file) you can do (post ...) instead of (dexador:post ...)
<Gleefre> Or you could just use (dexador:post ...)
<Gleefre> (And not specify anything dexador-related in the DEFPACKAGE
<Kingsy> does anyone know postmodern? what is the best way to insert a date into a date column using the dao system and not a raw query?
pve has quit [Quit: leaving]
<BrokenCog> so, I have a app.lisp which (ql:quickload 'mypackage), however I get an error after it loads mypackage:exportedfunction doesn't exist. is that because I did a (in-package 'mypackage) and need to do some sort of (leave-package) ?
<BrokenCog> how does app.lisp know it's not in-package anymore?
decweb has quit [Ping timeout: 264 seconds]
pfdietz has quit [Quit: Client closed]
<Kingsy> BrokenCog: what error did you get? can you show the defpackage for mypackage?
<BrokenCog> one sec
<BrokenCog> (defpackage :oauth2 (use :cl) (:export #:authenticate #:getrequest))
<Kingsy> exportedfunction isnt in there?
<BrokenCog> Package OAUTH2 does not exist.
<BrokenCog> it is.
<BrokenCog> that error comes from line 57 of app.lisp when it tries to (oauth2:getrequest)
<BrokenCog> from oauth2.lisp
<BrokenCog> (defun getrequest (url)
<Gleefre> BrokenCog: did you specify the lisp file in your .asd file?
<Gleefre> > how does app.lisp know it's not in-package anymore? It is a good question -- ql:quickload / asdf:load-system reset the current package (*package* variable) after loading each file.
jmiven has quit [Quit: reboot]
jmiven has joined #commonlisp
jon_atack has joined #commonlisp
jonatack has quit [Ping timeout: 256 seconds]
dino_tutter has quit [Ping timeout: 240 seconds]
<BrokenCog> specificy which lisp file in the asd?
<Gleefre> That contains defpackage and library (or application) code
<BrokenCog> I have to go, but I'll look and answer later this evening.
<BrokenCog> sorry to cut out.
<Gleefre> No problem :)
<Gleefre> FWIW here is a very trivial .asd file as an example: https://plaster.tymoon.eu/view/4127#4127
ymir has quit [Remote host closed the connection]
ymir has joined #commonlisp
rgherdt__ has quit [Quit: Leaving]
<Kingsy> hahaha it really shouldnt be this hard to insert todays date into a table.
<Kingsy> anyone used postmodern before?
pfdietz has joined #commonlisp
zaymington has quit [Ping timeout: 256 seconds]
jon_atack has quit [Ping timeout: 252 seconds]
attila_lendvai has quit [Ping timeout: 256 seconds]
jmdaemon has quit [Ping timeout: 252 seconds]
yitzi_ has joined #commonlisp
yitzi has quit [Ping timeout: 276 seconds]
<josrr> Kingsy: no, but it seems you could use (local-time:now) if you load the system cl-postgres+local-time
green_ has joined #commonlisp
yitzi_ has quit [Remote host closed the connection]
<josrr> and you need to also call (local-time:set-local-time-cl-postgres-readers)
<Kingsy> josrr: so I got it working with (local-time:format-timesting nil (local-time:now)) <- works great.
<Kingsy> josrr: I havent really figured out why I need the readers yet. I think I need tohave a look at that in a little bit. I just wanted to get unblocked. haha that took far too long :D
jonatack has joined #commonlisp