phoe 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/>
shka has quit [Ping timeout: 250 seconds]
ggoes has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
ski has joined #commonlisp
ggoes has joined #commonlisp
mgl has quit [Ping timeout: 256 seconds]
<neominimum> standard doesn't require it then implementations may not implement it. Does that make recursive code non-portable? Although my understanding is the standard doesn't require compilers to be optimising, professional users would not consider using one that lacked that facility. Like wise, I am interested to know if there is anyone that would consider a compiler that lacks support for TCO to be "Not Sufficiently Smart (tm)". I'm genuinely
<neominimum> mzan: I'm a perpetual newbie even though I've been casually using CL for a few years, my style suck-- I mean, my style is unconventional due my solitary practice. I'm trying now to be more conventional, so it's been great to get some specific feedback. Thanks for your suggestions. I wonder what is the reason why TCO needs to be supported by the standard, I mistakenly thought it was an implementation detail. I think I get it though... If the
<neominimum> curious, not attempting to start an argument.
morganw has quit [Remote host closed the connection]
<jasom> first you need to define "what is tail position" (defun foo () (let ((*bar* 3)) (baz)) ; <-- the call to baz here will likely *not* be tail optimized on any CL compiler due to the dynamic binding of *bar*
jdz_ is now known as jdz
<jasom> Then once you've done that, you need to ensure that the function is compiled, as most interpreters will not eliminate the stack frame for tail calls
<jasom> Then once you've done that, you need to ensure that the "optimize" declaration is set sufficiently high (in either the absolute or relative sense; some compilers may use the relative values of optimize v. debug, for example)
<jasom> Or you could just use iteration
<jasom> The one place I like to rely on TCO is when implementing state-machines; in that case the non-tail call approach is less readable IMO and will involve passing either closures or a list of function and arguments, both of which are more unweildy than a tail-call
mrmr has quit [Quit: The Lounge - https://thelounge.chat]
Everything has joined #commonlisp
pmwals09 has joined #commonlisp
<jasom> I should also point out that non-tail-recursive code is *definitely* non-portable; the maximum recursion depth may vary not just from implementation to implementation, but from machine to machine even when using the same implementation
nij- has left #commonlisp [#commonlisp]
<neominimum> Ok, so it's definitely not feasible in some situations due to environmental factors and the use of some language features.
<neominimum> I do like recursion, more because I find it challenging. To me it definitely looks better than some iterative implementations sometimes, but as they say "When in Rome..."
<jasom> Oh, there are times when recursion is more readable than iteration, but, in my experience, few of those cases are tail-recursive
<jasom> The most obvious example is any sort of tree walker; the recursive form is almost trivial, the iterative form involves an explicit stack.
igemnace has joined #commonlisp
<jasom> The naïve fibonacci is the most readable way to do fibonacci; I think the iterative vs. tail-recursive are of similar readability.
<EdLangley[m]> Anything that's automactically TCOable can be manually TCOed with a TAGBODY
<sm2n> for state machines, why not use tagbody?
<sm2n> hah
<EdLangley[m]> Clojure's LOOP/RECUR is an example of an abstraction that makes this a bit nicer.
<jasom> sm2n: tagbody doesn't let you pass arguments
<EdLangley[m]> If you (psetf arg1 (step arg1) arg2 (step2 arg2)) (go start) you can "pass arguments"
<EdLangley[m]> This is just making TCO explicit
aeth has quit [Ping timeout: 240 seconds]
<jasom> EdLangley[m]: right, but that's far less clear and sm2n was asking "why not use tagbody"
<EdLangley[m]> Yeah, but you can solve this with a macro
<EdLangley[m]> (defun-tco foo (arg1 arg2) ... (recur (step arg1) (step arg2)))
<neominimum> If I understand correctly now. In the iterative form, walking a non-linear data structure, requires the use of an explicit stack. Compared to the recursive form utilising the implicit call stack.
<jasom> also if you break in the middle of the state-machine, you more quickly get the information you want with most implementations it will show the current function
aeth has joined #commonlisp
<jasom> neominimum: right, my comment was that most of the times that recursion is more clear than iteration, it's due to the implicit call-stack, which means it's not a tail-call.
<EdLangley[m]> Hmm, expanding to (defun foo (...) (macrolet ((foo () `(go start))) (tagbody start ...))) would mean you could just turn recursive calls into GOs
raeda has quit [Ping timeout: 260 seconds]
<neominimum> jasom: I see, that's helpful
<jasom> EdLangley[m]: at that point I'd rather just do a loop/apply/funcall and return a function/args list from each state
<EdLangley[m]> I personally like the tagbody form
<EdLangley[m]> I've used it in PHP before when the recursive version of a function was significantly easier to write than the iterative one.
<jasom> I've done both and I find the tagbody gets unweidly quickly for complicated state machines
<jasom> macros help a lot, but then can make debugging a bit more "exciting"
<jasom> anyway, i am off to dinner now.
raeda has joined #commonlisp
igemnace has quit [Quit: WeeChat 3.4]
occ has joined #commonlisp
lispy has quit [Ping timeout: 250 seconds]
lispy has joined #commonlisp
akoana has joined #commonlisp
jgkamat- is now known as jgkamat
pieguy128 has quit [Ping timeout: 240 seconds]
jealousmonk has quit [Read error: Connection reset by peer]
jealousmonk has joined #commonlisp
kevingal has quit [Remote host closed the connection]
kevingal_ has quit [Read error: Connection reset by peer]
pieguy128 has joined #commonlisp
s-liao has joined #commonlisp
jealousmonk has quit [Remote host closed the connection]
[smlckz] has joined #commonlisp
[smlckz] has quit [Changing host]
[smlckz] has joined #commonlisp
aeth has quit [Ping timeout: 256 seconds]
aeth has joined #commonlisp
danilo` has joined #commonlisp
danilo` has quit [Remote host closed the connection]
lispy has quit [Changing host]
lispy has joined #commonlisp
waleee has quit [Ping timeout: 250 seconds]
akoana has quit [Quit: leaving]
aartaka has quit [Ping timeout: 250 seconds]
mon_aaraj has quit [Ping timeout: 256 seconds]
mon_aaraj has joined #commonlisp
aartaka has joined #commonlisp
lispy has quit [Quit: O/]
pmwals09 has quit [Remote host closed the connection]
pmwals09 has joined #commonlisp
pmwals09 has quit [Ping timeout: 250 seconds]
pmwals09 has joined #commonlisp
Krystof has quit [Ping timeout: 250 seconds]
<beach> Good morning everyone!
igemnace has joined #commonlisp
<s-liao> Morning
jealousmonk has joined #commonlisp
Oddity has joined #commonlisp
semz_ has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
semz has quit [Ping timeout: 250 seconds]
semz_ is now known as semz
contrapunctus_ has joined #commonlisp
igemnace has quit [Remote host closed the connection]
tyson2 has quit [Remote host closed the connection]
Bike has quit [Quit: sleepin]
s-liao has joined #commonlisp
mon_aaraj has quit [Ping timeout: 240 seconds]
mon_aaraj has joined #commonlisp
azimut_ has quit [Remote host closed the connection]
azimut has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
pmwals09 has quit [Remote host closed the connection]
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pmwals09 has joined #commonlisp
pranavats has joined #commonlisp
jealousmonk has quit [Read error: Connection reset by peer]
jealousmonk has joined #commonlisp
artchad has joined #commonlisp
jealousmonk has quit [Remote host closed the connection]
pmwals09 has quit [Ping timeout: 250 seconds]
Oladon has joined #commonlisp
lisp123 has joined #commonlisp
rain3 has joined #commonlisp
Jing has joined #commonlisp
aartaka has quit [Ping timeout: 256 seconds]
s-liao has joined #commonlisp
aartaka has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
Fare has quit [Ping timeout: 256 seconds]
lisp123 has joined #commonlisp
occ has quit [Ping timeout: 256 seconds]
asarch has joined #commonlisp
aeth has quit [Ping timeout: 256 seconds]
<asarch> If you have: '(:beers 20 :tacos 3), how would you add the property :pizza 4 to the list?: (:beers 20 :tacos 3 :pizza 4)
aeth has joined #commonlisp
<beach> asarch: Does the order matter?
<asarch> (push :pizza *the-list*) (setf (getf *the-list* :pizza) 4) overwrites a property name: (:pizza 4 20 :tacos 3)
<asarch> No, it doesn't
<beach> Then (list* :pizza 4 list)
<beach> Possibly with (setf list (list* :pizza 4 list)).
<moon-child> you can simply (setf (getf *the-list* :pizza) 4)
<beach> Or that.
<mfiano> The problem might be the original question made a literal list as its example to be mutated.
<moon-child> this will behave slilghtly differently to beach's suggestion, if pizza happens to already be contained within the property list
<mfiano> But I didn't read everything, and I'm now out for the night
<moon-child> mfiano: good point
Oladon has quit [Quit: Leaving.]
<asarch> Thank you!
<beach> asarch: Also, I would start using more interesting food examples, like :SUSHI, :MAGRET-DE-CANARD,
<asarch> Thank you very much! :-)
<beach> etc.
<asarch> I will
<lisp123> Now I am hungry..
<asarch> Iguana
<asarch> Do you like iguana?
<beach> Never tried it. Probably tastes like chicken, right?
<asarch> Never tried either
<beach> I had dog meat in Vietnam once.
* beach stops the off-topic now.
artchad has quit [Read error: Connection reset by peer]
artchad has joined #commonlisp
artchad has quit [Read error: Connection reset by peer]
mgl has joined #commonlisp
<asarch> Auf wiedersehen und bis bald! :-)
occ has joined #commonlisp
asarch has quit [Quit: leaving]
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
pve has joined #commonlisp
artchad has joined #commonlisp
Algernon69 has joined #commonlisp
<lisp123> Is DEFCONSTANT faster than DEFVAR / DEFPARAMETER?
artchad has quit [Read error: Connection reset by peer]
<phoe> usually, yes
<beach> I would think at least as fast.
s-liao has quit [Ping timeout: 256 seconds]
<beach> DEFCONSTANT means the compiler can substitute the value for the name when references are compiled.
<phoe> with constants, the compiler doesn't need to do variable access, it is allowed to splice literal constant values wherever the constant is used
<moon-child> on sbcl, at least, defconstant improves the quality of code generation
<lisp123> Thanks!
<phoe> and that means no global value lookup and no dynamic binding lookup, which speeds things down, and that the compiler can always figure out the type of the value ahead of time
Algernon69 has quit [Ping timeout: 268 seconds]
<lisp123> That all makes sense
s-liao has joined #commonlisp
<lisp123> I was thinking of this idea, let me know if there are any flaws in it: I USE a package, say CLIM, and then I don't use any package qualifiers.
<lisp123> Later on, I run a function that reads a file, and adds package qualifiers for all symbols not in the current-package or in CL
<lisp123> Then I simply remove the starting USE PACKAGE
<phoe> adds package qualifiers? as in, it reads a Lisp file and prints back out package-qualified symbols wherever applicable?
<beach> lisp123: Certain re-evaluations of the DEFPACKAGE form with different options exposes undefined behavior.
<beach> lisp123: And why would you intentionally make life harder for the person reading your code by omitting package prefixes the first time around?
<lisp123> It would be outside of the Lisp Image / System. As in destructively modify the file to add in package prefixes
<beach> What purpose would that serve?
cage has joined #commonlisp
<beach> Then you have source code that doesn't correspond to what's in the image.
<lisp123> Not having to write package qualifiers while I'm developing. And once I'm "done" M-x insert-package-qualifiers
<beach> So you are lying to the person reading the source code.
<lisp123> Well they would only receive the "final file" with all the package qualifiers
<beach> lisp123: So you mean, you magically add package prefixes to all your imported symbols later on?
<lisp123> Yes, then restart the image
<phoe> I guess it would work, but I wouldn't trust such a piece of software
<phoe> mostly because wouldn't trust myself that I'd tell it to get all package qualifiers right
d4ryus has quit [Quit: WeeChat 3.4]
<beach> But if you restart the image, you need to re-evaluate the DEFPACKAGE form, no?
<phoe> this, plus I generally dislike the :USE option because is dangerous even if you get all package qualifiers right
pranavats has left #commonlisp [Error from remote client]
<beach> There is no such thing as a "package qualifier".
<lisp123> beach: Yes. So I would manually remove the :USE option before reloading the files (including packages.lisp), although I'm sure there would be a way of finding the defpackage form then destructively modifying the file
<lisp123> This is basically like a clean up exercise, not meant to be part of the image. Just to save having to type package prefixes during development
<beach> lisp123: So if you accidentally use an imported symbol as a lexical variable, this symbol is going to have a package prefix later?
<beach> It sounds like a horrible idea to me. And for what? Avoiding some typing?
mon_aaraj has quit [Ping timeout: 240 seconds]
<beach> I mean, use an emacs abbrev instead.
<lisp123> So if you accidentally use an imported symbol as a lexical variable, this symbol is going to have a package prefix later? -> Thanks
<lisp123> Didn't think of that :D
<lisp123> Toss this idea out then
<beach> Good!
pranavats has joined #commonlisp
mon_aaraj has joined #commonlisp
shka has joined #commonlisp
mon_aaraj has quit [Ping timeout: 250 seconds]
mon_aaraj has joined #commonlisp
aartaka has quit [Ping timeout: 240 seconds]
aartaka has joined #commonlisp
s-liao20 has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
d4ryus has joined #commonlisp
traveller3141 has joined #commonlisp
chrnybo has joined #commonlisp
random-nick has joined #commonlisp
varjag has joined #commonlisp
<chrnybo> I'm golfing on parsing four letters in a-z into a single number; is there a "shift left and add" operation in CL?
<beach> That would be two operations.
mgl has quit [Quit: Client closed]
kevingal has joined #commonlisp
<moon-child> beach: shift and add can be conceived of as a unitary 'append digits' operation. Most things can be decomposed; that does not mean it is not worthwhile to think of them as atomic in some context
<beach> moon-child: Why are you telling me this?
cosimone has joined #commonlisp
<moon-child> because you said that 'shift left and add' is two operations
mon_aaraj has quit [Ping timeout: 250 seconds]
<beach> moon-child: Do you have a Common Lisp operation that will do both? I can't think of any.
<moon-child> I do not know of any either
<beach> That is precisely what I said, no?
<beach> "That would be two operations."
mon_aaraj has joined #commonlisp
<moon-child> that was not how I interpreted it. chrnybo asked 'is there a "shift left and add" operation in CL?' Your response I interpreted as 'that is not an operation, but two', not 'CL has no such operation'
<phoe> (+ integer-1 (ash integer-2 shift))
<phoe> should be good enough for practical use™
<beach> chrnybo: There is not a single Common Lisp operator that will do both those operations. So in Common Lisp you need to use two operators to achieve the effect you want.
<beach> moon-child: ^ better?
<moon-child> I find that clearer
lisp123 has quit [Quit: Leaving...]
Dynom has joined #commonlisp
Krystof has joined #commonlisp
attila_lendvai has joined #commonlisp
Algernon69 has joined #commonlisp
Everything has quit [Quit: leaving]
Algernon69 has quit [Ping timeout: 268 seconds]
<chrnybo> parse-integer n :radix 36 and format t "~36R" killed the fun, though.
<beach> chrnybo: You did not include digits in your possible characters, so it was not clear that your letters meant the same as they do in Common Lisp.
s-liao20 has quit [Ping timeout: 256 seconds]
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 240 seconds]
Lord_of_Life_ is now known as Lord_of_Life
<chrnybo> beach: You're right, of course.
s-liao has joined #commonlisp
<scymtym> Xach: phoe: i would like to move lparallel to sharplispers. any objections?
<phoe> scymtym: no objections, let's do it
<scymtym> phoe: great. let's see wait Xach thinks
varjag has quit [Ping timeout: 240 seconds]
s-liao has quit [Ping timeout: 256 seconds]
varjag has joined #commonlisp
lisp123 has joined #commonlisp
rogersm has joined #commonlisp
varjag has quit [Ping timeout: 250 seconds]
traveller3141 has quit [Quit: ChatZilla 0.10 [SeaMonkey 2.53.10.2/20211220132845]]
<lisp123> If I need to check if a character is one of a list of characters
<lisp123> Whats the most efficient way to do it?
<lisp123> Hash Table?
<semz> lisp123: Efficient in what sense?
<lisp123> Speed, I guess
<ns12> lisp123: Just use a plain list. Hash table has some additional overhead.
<semz> I don't think optimizing this for runtime is worth it unless your list is huge (in that case a hash table would be a good idea)
<semz> just use find/position or whatever is convenient and clear
<lisp123> Looks like SBCL uses arrays
<lisp123> to determine ALPHANUMERICP
<lisp123> semz: Because its a low-level function I need (a varaint on ALPHANUMERICP), optimisation is important
mon_aaraj has quit [Ping timeout: 240 seconds]
<pjb> lisp123: it depends on the list of characters.
<lisp123> I'll use a Hash Table for now, unless someone has a better idea. I assume the char-codes were ordered in a way that allowed SBCL and other implementations to use an array
<pjb> lisp123: in general the fastest would be to index a vector giving the answer: (aref answer (char-code ch))
<lisp123> pjb: Thanks!
<lisp123> I will do that
<pjb> lisp123: since character sets are usually small (less than 256), a bit-vector would be quite small (only 32 bytes, less than a hash-table memory overhead!)
<pjb> lisp123: but if you consider unicode, then the bit-vector will have to be bigger: 139264 bytes.
mon_aaraj has joined #commonlisp
<lisp123> pjb: Thanks. Looking again at the SBCL code, now I suspect they may be doing the same thing you suggest
<semz> That too depends on the exact set though. Honestly I suspect that optimizing this is a waste of time, but I don't know what lisp123 is using it for.
<pjb> lisp123: this can be compensated if you can restrict them to some range.
<lisp123> pjb: Got it
<lisp123> semz: I have to search for next word in an editor command I am writing, without using the underlying version of Emacs / whatever
<lisp123> Or go to the next paragraph (which has much more characters to search through). And I don't want to keep a history of start/end points since they can change if the buffer changes
rogersm has quit [Quit: Leaving...]
nij- has joined #commonlisp
tyson2 has joined #commonlisp
<lisp123> ;; An implementation using ASCII character encoding might return these values:
<lisp123> (char-code #\$) => 36
<lisp123> Do all implementations return the same value for CHAR-CODE for a given character or does it depend on some file or system level encodings?
<beach> The standard doesn't specify it.
<beach> clhs char-code
<lisp123> So would I be safe to define it in code, like (defconstant +space-char-code+ (char-code #\Space)) and then use that constant elsewhere to check if a particular character is a space?
<lisp123> Or is there some weird way the char code may change in between retrieving it, storing it in a constant and then using it in code
<phoe> no
<beach> I think you can safely define it as a constant. I can't see how it could possibly change over time.
<phoe> AFAIK an implementation should always return a constant char-code for a given character
<phoe> and you are not going to load one impl's compiled files into another impl
<phoe> so you can't worry about cross-pollination of any kind
<lisp123> Thanks!
skeemer has joined #commonlisp
<lisp123> Okay, so here's a bit of a trivia question: Are both of these forms equivalent in speed: (eql char #\Space) and (eq (char-code char) +space-char-code+)
<Xach> lisp123: No
<Xach> (maybe)
<Xach> lisp123: i would strongly expect the former to perform better
<beach> lisp123: They *could* generate the same code, but the compiler would have to be good.
<lisp123> Xach: I think so too, but wonder how char equality is actually done
<beach> lisp123: But don't use EQ though.
<beach> lisp123: It is a comparison of a register in a good implementation.
<lisp123> beach: Not a good idea to use eq for comparing numbers?
<beach> lisp123: Exactly.
<lisp123> Thanks, well noted
<scymtym> Xach: would you be fine with maintaining lparallel in sharplispers?
Oddity has quit [Ping timeout: 250 seconds]
artchad has joined #commonlisp
<phoe> what is the best way of checking whether a symbol has ever been the name of a DEFTYPE or DEFCLASS or DEFINE-CONDITION or DEFSTRUCT?
<phoe> the latter, FIND-CLASS can do; I have an issue with DEFTYPE though
<phoe> typexpand-1 works, thanks
nij- has quit [Ping timeout: 250 seconds]
s-liao has joined #commonlisp
morganw has joined #commonlisp
<Xach> scymtym: yes
<Xach> scymtym: in general fine with anything
<scymtym> Xach: i see, thanks
<mzan> neominimum: you said " In the iterative form, walking a non-linear data structure, requires the use of an explicit stack. Compared to the recursive form utilising the implicit call stack."
<skeemer> people i was reading practical common lisp, and i was so excited about the higher order function trick that is being used here https://gigamonkeys.com/book/practical-a-simple-database.html
<skeemer> more precisely this piece of code: https://bpa.st/OYXA
<mzan> as beach already said, in practice a lot of nested data structures are trees or similar. In these cases you have often a not extremely deep hierarchy, so probably in these case you can write some recursive code, and use the iterative form only for the final leaf.
<skeemer> i was wondering, are there other of these cool tricks with Higher order functions that can be used in more day-to-day applications?
<phoe> skeemer: yes
<phoe> this is a function that returns a closure
<phoe> and these are very commonly used, e.g. in CL-PPCRE
<yitzi> skeemer: Its a natural part of CL. Examples are closure construction are all over.
<skeemer> phoe, i understand the coolness, but probably i cannot come up with other examples where i could use such things...
<skeemer> can somebody make me other practical examples?
<skeemer> or how can i practice this? are there any programming exercises online for me to train this ability to code like that?
mon_aaraj has quit [Ping timeout: 256 seconds]
<mzan> neominimum: for example I wrote a rather classical code-formatting function. It accepts as parameter the indentation level, and for each nested scope, it calls itself increasing its parameter. It i recursive. But how many nested scope are there usually? Less than thousands. Then for the instructions inside the current scope, I use a normal iterative loop.
<mzan> So in many cases you can combine recursion with explicit iterative loops. You use recursion for the hierarchy part, and recursion for the leaf/final-data.
<skeemer> mzan, why should one use iteration for the final leaf?
<skeemer> and not again recursion?
<mzan> *and iteration for the leaf/final-data
mon_aaraj has joined #commonlisp
<mzan> skeemer: because CL does not support in the standard tail-call optimization, so recursion of potentially many data can overflow the stack
<skeemer> okok
<Xach> skeemer: i have been very happy with a query system based on simple functions that return object matchers, and then a few logical glue functions that compose simpler functions into arbitrary expressions.
<Xach> i'm working with a system that produces thousands of sets of change records for certain objects, and i want to select only certain objects of interest interactively at the REPL
<Xach> so i can write something like (=and (=matches-text "Foo") (=score> 100) (=not (=color "purple")))) -- here the "=" prefix indicates a function that returns a function.
lisp123 has quit [Remote host closed the connection]
<skeemer> Xach, ok so instead of writing a single where function, you have that dispatched to different functions right?
<skeemer> i meant a single "where" function as in PCL
<skeemer> Xach, are there other tricks for closures? i mean other cool uses like this one?
<Xach> skeemer: sicp has a number of examples
<Xach> like a sort of message-passing object system with closures
<Xach> not that i'd use that specifically with CLOS handy, but it is educational
<skeemer> okok Xach
<Xach> also delayed streams and things like that
alvaro121_ has quit [Ping timeout: 245 seconds]
_73 has joined #commonlisp
lisp123 has joined #commonlisp
<_73> In a function docstring is the backquoute/single-quote convention meant to be used to denote any symbol that is not local the function? For example: (defun foo (arg) "This function calls `baz'" ...)
<beach> _73: There is no such convention.
<_73> Oh is it just an elisp thing then?
Bike has joined #commonlisp
dra has joined #commonlisp
mgl has joined #commonlisp
<phoe> some Lisp code uses it, but it isn't widespread in CL code
<phoe> in particular, CL docstring formatting is Wild West
<_73> I started using it cause emacs highlights it for me so I figured it was a thing in CL. But then I couldn't find anyone elses code out there using it.
<lisp123> highlights as in allows you to go to its source?
<_73> highlights as in applies a face
<lisp123> ah
<_death> the elisp reader is case preserving, so `bar' is often used, while CL's reader is upcasing by default so we just say BAR.. some elisp code uses the latter and some CL code uses the former as well
<lisp123> I find upcasing a good way to write docstrings in CL
<chrnybo> _73: care to point to relevant emacs documentation on the backquoute/single-quote convention? I don't see it mentioned in (elisp) Function Documentation, but I notice that it works in practice, i.e. a phrase such as `ssh' get highlighted and is a clickable link to the documentation of the function ssh.
s-liao90 has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
<phoe> I am upcasing stuff, but e.g. Serapeum uses `foo'
<lisp123> But then, you have systems like LW, who like to use natural language commands (strings), which is not a bad idea too for end user functions. Not sure if CLIM / Lisp Machines followed the same convention
McParen has joined #commonlisp
<Josh_2> Good afternoon
<lisp123> The best advice Emacs Documentation Guidelines gave was to prempt likely follow-on questions and include them in the docstring. E.g. one could add to the docstring for NTH "To access elements of a Sequence, use ELT."
<lisp123> gave to me*
lisp123 has quit [Remote host closed the connection]
s-liao has joined #commonlisp
s-liao90 has quit [Ping timeout: 256 seconds]
alvaro121 has joined #commonlisp
hobo has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
s-liao has joined #commonlisp
McParen has left #commonlisp [#commonlisp]
nij- has joined #commonlisp
s-liao50 has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
domovod has joined #commonlisp
s-liao50 has quit [Quit: Client closed]
kevingal has quit [Remote host closed the connection]
dra has quit [Remote host closed the connection]
_73 has left #commonlisp [ERC 5.4 (IRC client for GNU Emacs 28.0.90)]
nij- has quit [Remote host closed the connection]
nij- has joined #commonlisp
treflip has joined #commonlisp
igemnace has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
* phoe shaves a yak, sighs, relaxes
<nij-> Anyone uses parenscript? While it supports some lisp constructs (e.g. let, defun, loop), it misses some too (e.g. mapc, mapcar). Is there a way to extend parenscript to support those without hacking the code base?
cosimone has quit [Remote host closed the connection]
cosimone has joined #commonlisp
ultera has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
ultera has joined #commonlisp
igemnace has quit [Remote host closed the connection]
scymtym has quit [Read error: Connection reset by peer]
tyson2 has joined #commonlisp
<phoe> nij-: just define mapcar yourself
<phoe> (parenscript:ps (defun mapcar (function list) (loop for element in list collect (funcall function element))) (mapcar (lambda (x) (+ x 10)) '(1 2 3)))
<nij-> good idea @@
josrr has joined #commonlisp
frodef has joined #commonlisp
frodef_ has quit [Ping timeout: 240 seconds]
<nij-> josrr Do you understand how to use it? That section is written pretty minimally..
<josrr> nij-: I think you need to compile ps:*ps-lisp-library*
<josrr> nij-: (ps:ps* ps:*ps-lisp-library*)
<nij-> !Nice! I can start writing my own "scripts" and push into *ps-lisp-library* :D
<josrr> nij-: or not, load somehow the runtime library in the browser
<nij-> What does the runtime mean here @@?
<josrr> nij-: the result of (ps:ps* ps:*ps-lisp-library*)
<nij-> Well.. the lib only contains 7 functions. I suppose I need to write some of the ones i like.
<josrr> nij-: oh, the word "scripts" confused me
Fare has joined #commonlisp
foxfromabyss has joined #commonlisp
scymtym has joined #commonlisp
<foxfromabyss> hi! is it possible to get something like `:a :b` as a result of a macro expansion, is opposed to `(:a :b)` ?
Bike has quit [Quit: Connection closed]
<nij-> Use ,@
<foxfromabyss> as the outer form?
<foxfromabyss> *at the
<foxfromabyss> `(defmacro splice-into-outer (foo) ,@foo)` ?
<foxfromabyss> sbcl says "comma not inside backquote"
<foxfromabyss> and omitting the comma breaks the variable obviously
<foxfromabyss> i want to basically achieve the following
<foxfromabyss> `(defparameter foo (list 1 2 3))`
<foxfromabyss> `(splice-into-outer foo)` `=>` `1 2 3`
<beach> You mean three values?
<foxfromabyss> three variables
<beach> I see no variables.
<foxfromabyss> i mean..
<beach> I see three numbers, 1, 2 and 3.
<foxfromabyss> I know i know
<foxfromabyss> let me come up with a better example
<Josh_2> you want to convert a list into multiple-values ?
amb007 has quit [Ping timeout: 250 seconds]
<beach> Josh_2: Let's see the example first.
<beach> Josh_2: It doesn't look like foxfromabyss clearly knows what is wanted.
<beach> Unfortunately I can't stick around. I need to go fix dinner for my (admittedly small) family. Sorry.
<foxfromabyss> what i want to achieve in the bigger scope is this:
<foxfromabyss> `(splice-into-outer (x y z)` `=>` `:x x :y y :z z`, where the keys have the same name as the variables, and it supports multiple variables
<Josh_2> Cya beach
<foxfromabyss> all good
<foxfromabyss> cya
<Josh_2> uh
<phoe> foxfromabyss: you need the outer form to have a ,@
<Josh_2> maybe you should just keep the list and then use apply
<phoe> a single macro call can only expand into a single form
amb007 has joined #commonlisp
<phoe> when a macro needs to "contain" multiple forms, it usually expands into a (progn ...)
<foxfromabyss> i'll make an ever better example of what i want to achieve :P
<phoe> in particular, something like (list 1 (foo) 3) then this is always a list of length 3 - (FOO) can only expand to a single Lisp value
<foxfromabyss> i really want to deduplicate this :(
<Josh_2> You can make a macro to access the jsown then apply with make-instance
<phoe> doesn't jsown have some sort of semiautomated facility to turn json objects into CL instances?
<foxfromabyss> only with extra libs
<foxfromabyss> and i am not using the conversion lib on purpose
<foxfromabyss> > You can make a macro to access the jsown then apply with make-instance
<foxfromabyss> can you elaborate?
<Josh_2> foxfromabyss: you do not need to remove the list from (:x x ..) you can simply use (apply #'make-instance <your plist>)
<foxfromabyss> oh hm, interesting
<foxfromabyss> very smart
<foxfromabyss> i see, thanks!
<Josh_2> (apply #'make-instance '%api-call-failure '(:object 1 :processor 1 :hash 1 :c 1)) => <%API-CALL-FAILURE {1008694863}>
<foxfromabyss> big thanks
<Josh_2> No problem
<chrnybo> /join #scala
<foxfromabyss> is it possible to map between keyword and string? i.e. `:key` => `"key"` ?
<phoe> yes
<foxfromabyss> how do I achieve that? :D
<phoe> grab the symbol name, :key → "KEY"
<phoe> and then frob the symbol case properly
<foxfromabyss> but how do I grab the symbol name though?
<phoe> you'll likely want some function to convert from Lisp's kebab-case to JSON camelCase
<phoe> clhs symbol-name
<foxfromabyss> super cool, big thanks!
Algernon69 has joined #commonlisp
varjag has joined #commonlisp
Algernon91 has joined #commonlisp
Jing has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Algernon69 has quit [Ping timeout: 268 seconds]
[w] has joined #commonlisp
treflip has quit [Quit: good night!]
pmwals09 has joined #commonlisp
Bike has joined #commonlisp
<foxfromabyss> Josh_2 `(defclass testobj () ((x :accessor x :initarg :x)))`
<foxfromabyss> `(apply #'make-instance 'testobj (:x 5))` this fails with `:x` being an undefined function
<foxfromabyss> i can quote it it this example, but if i do smth like `(apply #'make-instance 'testobj (get-values-for-x))`, i can't quote the values for `apply` :(
<Josh_2> '(:x 5)
<foxfromabyss> yes but if i do `get-values-for-x` that returns `(:x 5)` then that fails
<foxfromabyss> where `get-values-for-x` is actually a macro
<Josh_2> well thats why
<Josh_2> use a function
<Bike> or have (get-values-for-x) expand into '(:x 5)
<Bike> and not (:x 5)
<Bike> (list :x 5) would also be fine
<foxfromabyss> oh hm .. thanks :)
<Bike> you can do (macroexpand-1 '(get-values-for-x)) to see what ends up there
nij- has quit [Remote host closed the connection]
<Xach> Someone keeps emailing me questions about Vecto and fonts, but their email box is full and my replies keep getting held up :(
<skeemer> what common lisp library do you suggest to plot stuff... i need something similar to matplotlib, or ggplot
<Josh_2> There are libraries that work for gnuplot
Bike has quit [Quit: Connection closed]
varjag has quit [Ping timeout: 260 seconds]
pmwals09 has quit [Remote host closed the connection]
pmwals09 has joined #commonlisp
chrnybo has quit [Ping timeout: 250 seconds]
varjag has joined #commonlisp
Brucio-92 has joined #commonlisp
Algernon91 has quit [Read error: Connection reset by peer]
Guest74 has joined #commonlisp
pmwals09 has quit [Remote host closed the connection]
pmwals09 has joined #commonlisp
domovod has quit [Ping timeout: 268 seconds]
jealousmonk has joined #commonlisp
<edgar-rft> skeemer: I usually write gnuplot data into a file and then use gnuplot from the commandline, but here are some other alternatives -> https://www.cliki.net/plotting
pmwals09 has quit [Read error: Connection reset by peer]
pmwals09 has joined #commonlisp
molson__ has joined #commonlisp
pmwals09 has quit [Remote host closed the connection]
molson_ has quit [Ping timeout: 240 seconds]
shozo has quit [Remote host closed the connection]
pmwals09 has joined #commonlisp
<edgar-rft> hmm, from where do I get a literate that I can program?
<White_Flame> isn't literate programming usually about being documentation with code interspersed?
pmwals09 has quit [Ping timeout: 250 seconds]
<phoe> White_Flame: I think it is - I kind of abuse this idea to also include stuff that teaches writing Lisp in general
pmwals09 has joined #commonlisp
pmwals09 has quit [Remote host closed the connection]
shozo has joined #commonlisp
pmwals09 has joined #commonlisp
rogersm has joined #commonlisp
pmwals09 has quit [Ping timeout: 256 seconds]
<moon-child> phoe: 'we did not supply the second argument to LOAD-TIME-VALUE, which creates constant data' I think this would be clearer as 'we did not supply a second argument to LOAD-TIME-VALUE, which lets us create constant data'
tfeb has joined #commonlisp
Bike has joined #commonlisp
waleee has joined #commonlisp
<moon-child> I'm also not sure if the use of the uninterned symbol clarifies or obscures intent. Depends on your audience, probably, but
ldb has joined #commonlisp
<phoe> moon-child: all fixed, thank you
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
pmwals09 has joined #commonlisp
tfeb has quit [Quit: died]
ldb has quit [Quit: ERC (IRC client for Emacs 27.2)]
pmwals09 has quit [Ping timeout: 240 seconds]
tyson2 has quit [Remote host closed the connection]
artchad has quit [Read error: Connection reset by peer]
lisp123 has joined #commonlisp
aartaka has quit [Ping timeout: 256 seconds]
hobo has quit [Read error: Connection reset by peer]
nij- has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
pmwals09 has joined #commonlisp
pmwals09 has quit [Remote host closed the connection]
pmwals09 has joined #commonlisp
pmwals09 has quit [Remote host closed the connection]
amb007 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
thomaslewis has joined #commonlisp
attila_lendvai has quit [Ping timeout: 268 seconds]
akoana has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
josrr has quit [Read error: Connection reset by peer]
jealousmonk has quit [Remote host closed the connection]
jealousmonk has joined #commonlisp
Dynom has quit [Quit: WeeChat 3.4]
notzmv has quit [Ping timeout: 260 seconds]
lispy has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 27.1]
nij- has quit [Remote host closed the connection]
dra has joined #commonlisp
pmwals09 has joined #commonlisp
pmwals09 has quit [Ping timeout: 240 seconds]
Oddity has joined #commonlisp
lisp123 has joined #commonlisp
Algernon69 has joined #commonlisp
Algernon91 has joined #commonlisp
lisp123 has quit [Ping timeout: 250 seconds]
Algernon69 has quit [Ping timeout: 268 seconds]
dra has quit [Quit: Leaving]
perrierjouet has joined #commonlisp
<phoe> flip214: https://github.com/armedbear/abcl/issues/433 looks like Alexandria might need to adjust its TYPE= tests for cases where one SUBTYPEP returns T T and the inverse SUBTYPEP returns NIL NIL
Algernon91 has quit [Ping timeout: 268 seconds]
Bike has quit [Quit: Connection closed]
perrierjouet has quit [Quit: WeeChat 3.4]
foxfromabyss has quit [Ping timeout: 256 seconds]
aeth has quit [Ping timeout: 256 seconds]
aeth has joined #commonlisp
Bike has joined #commonlisp
varjag has quit [Quit: ERC 5.4.1 (IRC client for GNU Emacs 29.0.50)]
shka has quit [Ping timeout: 256 seconds]
aeth has quit [Ping timeout: 240 seconds]
aeth has joined #commonlisp
morganw has quit [Remote host closed the connection]
cosimone has quit [Ping timeout: 250 seconds]
<Shinmera> I'm very sad that gray-streams does not include file-length and file-position
dra has joined #commonlisp
notzmv has joined #commonlisp