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/>
neshtea has quit [Ping timeout: 256 seconds]
tevo has quit [Read error: Connection reset by peer]
tevo has joined #commonlisp
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 245 seconds]
nij- has joined #commonlisp
<nij-> bike.. the inner thing gets expanded first?
<nij->
<nij-> I just changed the compiler macro in a stupid way, but it doesn't take effect at all.. https://bpa.st/7B2A
<ixelp> View paste 7B2A
szkl has joined #commonlisp
neshtea has joined #commonlisp
NotThatRPG has joined #commonlisp
<nij-> jcowan I'm still a bit confused.. but lemme first understand this easier point ^
neshtea has quit [Ping timeout: 260 seconds]
fosskers has joined #commonlisp
neshtea has joined #commonlisp
karlosz has quit [Quit: karlosz]
neshtea has quit [Ping timeout: 256 seconds]
skin has left #commonlisp [#commonlisp]
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<bike> oh, yeah, the outer would be expanded first actually
<bike> it could just be your implementation doesn't expand compiler macros, so it's just using the square function
neshtea has joined #commonlisp
<nij-> !! Hmm.. I'm using sbcl. That's quite surprising.
<nij-> Did I use it wrong? Are compiler macros supposed to be called in other ways?
<bike> no? it's just that compiler macros are essentially optional. there's no guarantee the implementation ever uses them.
<bike> if you're just putting this code in your repl, sbcl probably evaluates it without expanding anything, since that's easy
<bike> putting it in a compiled file might convince it to do more work
Spawns is now known as Spawns_Carpeting
<fosskers> Should it be assumed that `labels` will always be a more consistent choice vs tail recursion? I know SBCL does TCO but in general it's not guaranteed in CL, yeah?
<bike> it is not guaranteed in CL, no
<bike> i'm not sure what you mean by labels vs tail recursion
neshtea has quit [Ping timeout: 246 seconds]
<jcowan> Something I don't know is whether nested compiler macros are evaluated inward or outward, but I suspect it is inward.
<fosskers> bike: `labels` lets one simulate the benefits of tail recursion, no?
<fosskers> In SBCL `labels` appears to be a special form, but in Emacs Lisp `cl-labels` expands out into a while loop
<fosskers> Basically giving you tail-recursion in a language that doesn't otherwise support it
neshtea has joined #commonlisp
rtypo has quit [Ping timeout: 245 seconds]
neshtea has quit [Remote host closed the connection]
neshtea has joined #commonlisp
<nij-> bike you meant here? - "compiler macro n. an auxiliary macro definition for a globally defined function or macro which might or might not be called by any given conforming implementation and which must preserve the semantics of the globally defined function or macro but which might perform some additional optimizations." http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compiler_macro
<ixelp> CLHS: Glossary-Section C
<nij-> Ok.. I better stop investigating into this. I thought this would be helpful. But if it's not even working in sbcl, it's not going to work for what I want..
neshtea has quit [Ping timeout: 256 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 260 seconds]
neshtea has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
habamax has quit [Ping timeout: 246 seconds]
neshtea has quit [Ping timeout: 246 seconds]
habamax has joined #commonlisp
neshtea has joined #commonlisp
thuna` has quit [Remote host closed the connection]
neshtea has quit [Remote host closed the connection]
neshtea has joined #commonlisp
nij- has quit [Ping timeout: 245 seconds]
neshtea has quit [Ping timeout: 245 seconds]
eddof13 has joined #commonlisp
NotThatRPG has joined #commonlisp
eddof13 has quit [Client Quit]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 260 seconds]
amb007 has joined #commonlisp
neshtea has joined #commonlisp
amb007 has quit [Ping timeout: 246 seconds]
lucasta has joined #commonlisp
neshtea has quit [Ping timeout: 256 seconds]
masinter has quit [Ping timeout: 260 seconds]
masinter has joined #commonlisp
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 246 seconds]
neshtea has joined #commonlisp
jsomedon has joined #commonlisp
neshtea has quit [Ping timeout: 240 seconds]
masinter has quit [Remote host closed the connection]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 246 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 256 seconds]
neshtea has joined #commonlisp
neshtea has quit [Remote host closed the connection]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 246 seconds]
neshtea has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
neshtea has quit [Ping timeout: 256 seconds]
ldb has joined #commonlisp
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 245 seconds]
neshtea has joined #commonlisp
akoana has joined #commonlisp
neshtea has quit [Ping timeout: 246 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 240 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 246 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 256 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 260 seconds]
waleee has quit [Ping timeout: 245 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 260 seconds]
neshtea has joined #commonlisp
lucasta has quit [Quit: Leaving]
ldb has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1)]
<jsomedon> paredit, parinfer, lispy, which one to use?
<beach> fosskers: LABELS is a special operators as required by the standard. So it is not a way to get tail-call optimization in an implementation that does not otherwise support it. And SBCL does not seem to to tail-call optimization at high DEBUG values.
neshtea has quit [Ping timeout: 245 seconds]
<fosskers> beach: thanks for the clarification
<fosskers> jsomedon: try parinfer-rust
<beach> Sure.
<jsomedon> kk, will take a look into that.. I am fairly new to emacs and lisp in general
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
neshtea has joined #commonlisp
Demosthenex has quit [Quit: leaving]
neshtea has quit [Ping timeout: 246 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 246 seconds]
splatt990 has quit [Ping timeout: 250 seconds]
habamax has quit [Ping timeout: 246 seconds]
neshtea has joined #commonlisp
semarie has quit [Quit: WeeChat 4.0.2]
neshtea has quit [Ping timeout: 246 seconds]
semarie has joined #commonlisp
neshtea has joined #commonlisp
habamax has joined #commonlisp
amb007 has quit [Remote host closed the connection]
amb007 has joined #commonlisp
akoana has quit [Quit: leaving]
Demosthenex has joined #commonlisp
neshtea has quit [Ping timeout: 245 seconds]
neshtea has joined #commonlisp
neshtea has quit [Remote host closed the connection]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 260 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 245 seconds]
amb007 has quit [Read error: Connection reset by peer]
semarie has quit [Ping timeout: 256 seconds]
neshtea has joined #commonlisp
amb007 has joined #commonlisp
semarie has joined #commonlisp
neshtea has quit [Ping timeout: 244 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 245 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 246 seconds]
neshtea has joined #commonlisp
igemnace has joined #commonlisp
neshtea has quit [Remote host closed the connection]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 245 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 260 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 256 seconds]
neshtea has joined #commonlisp
neshtea has quit [Ping timeout: 246 seconds]
neshtea has joined #commonlisp
azimut has quit [Ping timeout: 240 seconds]
neshtea has quit [Remote host closed the connection]
neshtea has joined #commonlisp
neshtea has quit [Remote host closed the connection]
rgherdt has joined #commonlisp
neshtea has joined #commonlisp
neshtea has quit [Remote host closed the connection]
speskk0 has joined #commonlisp
speskk has quit [Ping timeout: 260 seconds]
speskk0 is now known as speskk
blackshuck has joined #commonlisp
<fosskers> I'm having an issue with writing a macro. Part of its expansion is not working when used in a package other than the one it was defined in. While in the package it was defined in, there's no issue.
<fosskers> Since it's a macro, it seems like Sly Stickers don't work for step-debugging it, so I'm confused as how to proceed.
<beach> fosskers: The entire macro code is read in a particular package. If you have that kind of issue, it is about what you pass it as input rather than the macro itself.
<beach> fosskers: Perhaps you assume that the input will somehow be read in the same package as the one in which the macro is defined?
<fosskers> It's a simple lambda shorthand, let me show you the two expansions
<beach> You can use plaster.tymoon.eu
<fosskers> Oh I'm sure something exists, I just wanted to try it. But thanks I will look at that too
<beach> For pasting, I mean.
<fosskers> Ah I see
jsomedon has quit [Quit: Connection closed for inactivity]
<fosskers> Somehow, when used imported in another module, the lambda arg list isn't populated
<beach> Can you show the macro as well?
* |3b| guesses the %1 and %2 symbols are different symbols, and the macro only works with ones from the original package
<|3b|> so either use the correct symbols, or rewrite the macro to work by symbol name rather than identity
Gleefre has joined #commonlisp
<beach> Sounds right.
<fosskers> Let me throw a repo up
<|3b|> (the instances of %1 and %1 are different, i mean. %1 and %2 are obviously different even if in the same package)
<beach> fosskers: It is a common newbie mistake to think that the package is really a module system. But the Common Lisp package system is really just about the reader.
<ixelp> ~fosskers/fn-macro: src/fn-macro.lisp - sourcehut git
<fosskers> I've certainly been assuming that packages were modules/namespaces in the "usual" sense, yeah
<mfiano> Side note: #+nil is wrong. There could be a feature by that name. Use #+(or)
<beach> So, |3b| is very likely right. If in the different package, you use symbols %1 and %2, they will not be the symbols in the FN-MACRO package.
<beach> fosskers: You would have to type FN-MACRO:%1 and FN-MACRO:%2
* |3b| thinks #+nil is a good enough test for "user likes to do strange things" that letting it break is fine :p
<mfiano> One solution is to pass a symbol as input to the macro, and check #'symbol-package at macro-expansion time. You can then use that with #'find-symbol or similar.
<|3b|> not sure why you would type out NIL though, if you are willing to risk that
shka has joined #commonlisp
<mfiano> The symbol passed will be from a package the user specified.
<|3b|> for a macro like this i'd just check by symbol name
<mfiano> I agree.
<fosskers> So you can see that I'm setting the "property list" of the `fn-crawl` symbol there, and the notion here is that those symbols are not the same as the ones written in the other package (say, fn-macro:%1 vs tests:%1)?
<fosskers> One lesson here being that symbols, even bare-looking ones, are in fact namespaced.
<beach> fosskers: The package of a symbol is determined when the symbol is read.
<mfiano> Try macro-expanding a call to your macro from another package, like CL-USER
<|3b|> also, using symbol plists is uncommon style these days, just put a hash table in a variable
<fosskers> mfiano: that's what I was doing (in a test module)
<mfiano> If you have literal symbols in the package that defines the macro that are part of the expansion, they will be identical to any expanded use of that macro.
<fosskers> |3b| that might solve the issue eh. How to compare for equality in that case?
<beach> fosskers: Again, it helps to think about how Common Lisp handles code. The code is read first, and symbols don't usually have their packages changed after that.
<|3b|> it isn't exactly that symbols are namespaced, but that READing them finds a symbol from a particular package, and past that point it is an object with identity
paulapatience has joined #commonlisp
<|3b|> it can be removed from that package, added to others, removed again, etc arbitrarily and it still maintains that identity (it just might be harder to find again)
<beach> Well put.
<|3b|> there can be multiple ways to find a particular symbol, like if you :use #:fn-macro in test, fn-macro::%1 is the same as test::%1
<fosskers> So, are there two %1 floating around in this case or just the one?
<|3b|> %1 may or may not know it lives in fn-macro, depending on how things were created
<fosskers> |3b| I had `use`d it yeah, but was still seeing the problem
<|3b|> in your failing example, there are most likely 2
<mfiano> Two, as you can see by macro-expanding it in a package that doesn't use-package either package.
<|3b|> actually, i was wrong there
<beach> fosskers: Unless you export those symbols, there is one symbol with the name %1 in each package where a symbol with that name appears.
<|3b|> and as you noticed :use doesn't work because you didn't export the symbols :)
<fosskers> Ah tricky
<|3b|> :use only imports symbols exported from the package
<beach> |3b|: Sort of. :)
<fosskers> Hm, exporting those willy-nilly seems like a burden on the user. Can I get away with not doing that?
<beach> In fact :USE does not import anything at all.
<mfiano> (use :import-from if you want to pull symbols not meant for human consumption :))
<|3b|> ^listen to beach if we differ, i'm obviously not coherent enough to get details right at the moment :)
<|3b|> :use only /makes accessible/ symbols exported from the package :)
<mfiano> Common Lisp Recipes, first chapter, first recipe. Read it thoroughly.
<beach> The package system is indeed tricky. I know, because I am implementing Parcl, which is an implementation of the Common Lisp package system.
<mfiano> Edi Weitz did a great job.
<|3b|> fosskers: not needing to import/export was why comparing by name was suggested (just got sidetracked before answering about how to actually do that)
<fosskers> |3b| right, that's what I'd like to circle back to
<|3b|> but pretty much would just be using string= as a test instead of eql
<fosskers> Oh and indeed we have a `symbol-name` function
<|3b|> (symbols are string designators, so work with string=
<mfiano> fosskers: If you #'inspect any old symbol, you will see they are objects with 5 cells. There is 1 function for each.
<|3b|> symbols designate the string naming the symbol, so using symbol-name would be equivalent
<beach> fosskers: As |3b| pointed out, if you look at the definition of STRING=, you will see that it takes "string designators" which can be strings or symbols (and some other stuff).
nij- has joined #commonlisp
dino_tutter has joined #commonlisp
<beach> fosskers: I recommend you join #clschool. This channel is not really meant for newbie questions like these, though they are tolerated to some extent, especially if things are otherwise quiet here.
<nij-> fosskers I have been / am still a noob who has been benefited by #clschool. It has been helpful to me :)
* |3b| might even just parse symbols with names that start with #\% to see if the remainder is digits, and use that number directly
<|3b|> instead of bothering to make specific names for a specific # of them
<mfiano> Or just use the equivalent macro in that one utility library
<|3b|> (though then i'd have to think about what %0001 should do, and thinking is hard, so maybe not :p )
<fosskers> Thanks beach I didn't know that channel existed
<fosskers> Indeed `string=` seems to work on symbols
<beach> fosskers: I see. It's a good one because there are some people hanging out there that are not necessarily present here, and the reason they hang out there is precisely to help.
paulapatience has quit [Remote host closed the connection]
paulapatience has joined #commonlisp
amb007 has quit [Ping timeout: 244 seconds]
<|3b|> and some random comments on the code: you don't need a PROGN with LOOP DO, and it seems somewhat odd for fn-crawl to walk vectors (which would include strings, bitvectors, and literal vectors that wouldn't evaluate the symbol even if they did contain it)
* |3b| supposes there is a slight chance it could also include backquoted vectors, but probably not portably enough to rely on
<fosskers> Thanks I suspected about the progn but decided to play it safe, haha
<|3b|> looks like it does on sbcl, but you also wouldn't be able to see the spliced variable since it is inside a struct
jeffrey has joined #commonlisp
<|3b|> and instead of using elt to work around the inability to (portably) loop over arbitrary sequences, you could use (map 'nil (lambda (a) (fn-crawl a args)) data) instead and avoid the n^2 on lists
<|3b|> (though hopefully any use of this macro would be small enough n^2 wouldn't matter)
<fosskers> Yeah it's assumed that they're passing 10 or fewer args
<|3b|> N is size of body, not # of args
<|3b|> (but anything large enough to matter should probably be a real function anyway)
<fosskers> Ah gotcha
* |3b| also would always use setf and eql rather than setq and eq
<nij-> While calling `echo -a "aa\rb"` in my terminal, I see `ab` got printed out because of carriage return \r.
<nij-> However, (uiop:run-program "echo -e \"aa\rb\"" :output *standard-output*) prints `-e aarb` in my repl..
<nij-> How should I fix the difference?
<|3b|> \\ ?
<nij-> |3b| oh yeah I missed that.. But this time I get `-e aa^Mb`.
<|3b|> configure your repl to move the cursor the way you want when it sees that character
<|3b|> and/or see if -e vs -a matters
<|3b|> and/or if using the same echo matters
<|3b|> actually i guess run-program with a string argument is probably calling a shell, so probably the same echo
<jdz> Also carriage return character is interpreted by the terminal, and SLIME repl is not a terminal, so it is not interpreted.
<jdz> nij-: There's nothing special about `echo' here, try this in SLIME and in plain terminal: (format t "aa~Cb" #\return)
<|3b|> fosskers: actually one other thing about matching symbols by name in that macro, make sure you use the user's symbol in the expansion, not your own symbols from the macro's package, so for example build (%rest %*) using the %* passed into the macro if any
* |3b| supposes you might also want to notice and complain if they have more than one version of a particular symbol (unless it is a constant, in which case it should be ignored)
<|3b|> for example (fn (list :%1 %1)) could reasonably be expected to work
<|3b|> but to do so it would need to make sure it doesn't generate (lambda (:%1) ...)
<|3b|> but (fn (list foo:%1 bar:%1)) probably should be an error unless (eql 'foo:%1 'bar:%1)
<|3b|> (or unless one of both of those %1 name constants, in which case accepting it is reasonable)
habamax has quit [Ping timeout: 260 seconds]
<|3b|> and then there are symbol macros, though i'd probably lean to wards explicitly not supporting them, with a similar argument that they indicate the macro shouldn't have been used in the first place so it isn't worth extra code to support
molson has quit [Remote host closed the connection]
molson has joined #commonlisp
ronald has quit [Quit: leaving]
louis77 has joined #commonlisp
cbjuju has joined #commonlisp
habamax has joined #commonlisp
cbjuju has quit [Quit: Quit]
nij- has left #commonlisp [Using Circe, the loveliest of all IRC clients]
AetherWind has joined #commonlisp
morganw has joined #commonlisp
cosimone has joined #commonlisp
<fosskers> Alright, I got it working! Thanks for the help
karlosz has joined #commonlisp
anticomputer_ has joined #commonlisp
anticomputer has quit [Remote host closed the connection]
fosskers has quit [Quit: #doomemacs]
fosskers has joined #commonlisp
fosskers has quit [Remote host closed the connection]
fosskers has joined #commonlisp
loke has quit [Ping timeout: 246 seconds]
fosskers has quit [Ping timeout: 260 seconds]
<beach> Sure. Congratulations!
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 256 seconds]
Lord_of_Life_ is now known as Lord_of_Life
easye has quit [Ping timeout: 245 seconds]
MetaYan_ is now known as MetaYan
pony has left #commonlisp [#commonlisp]
haku has quit [Ping timeout: 246 seconds]
sellers has quit [Ping timeout: 252 seconds]
jfb4 has quit [Ping timeout: 252 seconds]
easye has joined #commonlisp
blackshuck has quit [Remote host closed the connection]
sellers has joined #commonlisp
jfb4 has joined #commonlisp
haku has joined #commonlisp
Brucio-61 has quit [Remote host closed the connection]
Brucio-61 has joined #commonlisp
jon_atack has quit [Read error: Connection reset by peer]
agm has joined #commonlisp
jon_atack has joined #commonlisp
cosimone has quit [Remote host closed the connection]
<agm> how does a destructuring lambda list like (&rest (foo)) works? I don't get what ends in foo and when it fails
fosskers has joined #commonlisp
<beach> It means that you can give exactly one additional element beyond the required and optional. And that element will be bound to foo.
<beach> agm: Try (defmacro foo (bar &rest (baz)) `(list ,bar ,baz)) and then (macroexpand-1 '(foo 234)) (macroexpand-1 '(foo 234 345)), and (macroexpand-1 '(foo 234 345 456))
jfb4 has quit [Quit: ZNC 1.8.2+deb3+b4 - https://znc.in]
haku has quit [Ping timeout: 246 seconds]
<beach> agm: You can consider (foo) in your example (or (baz) in mine) as a lambda list with a single required parameter, and the input, i.e. the remaining arguments to your macro, must match that lambda list.
sellers has quit [Ping timeout: 252 seconds]
kevingal has joined #commonlisp
<agm> oh, now I get it
<agm> thanks
<beach> Pleasure.
amb007 has joined #commonlisp
jfb4 has joined #commonlisp
igemnace has quit [Read error: Connection reset by peer]
Lycurgus has joined #commonlisp
sellers has joined #commonlisp
agm has quit [Ping timeout: 245 seconds]
haku has joined #commonlisp
fosskers has quit [Remote host closed the connection]
Lycurgus has quit [Quit: Tschüss]
cosimone has joined #commonlisp
pve has joined #commonlisp
borodust has quit [Ping timeout: 250 seconds]
igemnace has joined #commonlisp
borodust has joined #commonlisp
edgar-rft has quit [*.net *.split]
gjvc has quit [*.net *.split]
jmiven has quit [*.net *.split]
cinerion has quit [*.net *.split]
alip has quit [*.net *.split]
nxtr has quit [*.net *.split]
pl has quit [*.net *.split]
boigahs has quit [*.net *.split]
phoe has quit [*.net *.split]
jmiven has joined #commonlisp
pl has joined #commonlisp
nxtr has joined #commonlisp
phoe has joined #commonlisp
cinerion has joined #commonlisp
boigahs has joined #commonlisp
edgar-rft has joined #commonlisp
gjvc has joined #commonlisp
alip has joined #commonlisp
tyson2 has joined #commonlisp
jfb4 has quit [Quit: ZNC 1.8.2+deb3+b4 - https://znc.in]
splatt990 has joined #commonlisp
sellers has quit [Ping timeout: 244 seconds]
haku has quit [Ping timeout: 246 seconds]
jfb4 has joined #commonlisp
sellers has joined #commonlisp
haku has joined #commonlisp
fosskers has joined #commonlisp
rgherdt has quit [Ping timeout: 256 seconds]
paulapatience has quit [Remote host closed the connection]
tyson2 has quit [Remote host closed the connection]
fosskers has quit [Ping timeout: 244 seconds]
fosskers has joined #commonlisp
cosimone has quit [Remote host closed the connection]
lucasta has joined #commonlisp
rgherdt has joined #commonlisp
jsomedon has joined #commonlisp
<jsomedon> what's the difference between `c-m-x`ing a function defintion and `c-c c-c`ing a function definition using sly?
habamax has quit [Remote host closed the connection]
paulapatience has joined #commonlisp
<beach> I don't know SLY but I guess it is the same as in SLIME. The first one uses EVAL, and the second one COMPILE.
<beach> jsomedon: It may very well be that the Common Lisp implementation you use compiles when you use EVAL, so you may not see the difference.
<jsomedon> yes, the doc says same, one is eval one is compile
<edgar-rft> also c-m-x has better chances to be used by your window manager for something completely different before it even reaches emacs
Gleefre has quit [Remote host closed the connection]
<jsomedon> uh
<jsomedon> I see
Gleefre has joined #commonlisp
<jsomedon> so, I guess my question is, when should I use one over the other?
<jsomedon> these two commands seem to do same work
<jsomedon> eval is faster?
<beach> jsomedon: It probably doesn't matter. It is likely that your Common Lisp implementation does the same thing.
<jsomedon> I see
<jsomedon> I use sbcl
<beach> I always use C-c C-c to make sure the function is compiled, but that's because I don't really the situations where SBCL would do something else.
<beach> *I don't really know
paulapatience has quit [Ping timeout: 245 seconds]
<edgar-rft> EVAL *might* be different from COMPILE with Common Lisp implementations that have an interpreter as well as a compiler but SBCL compiles everything anyway
paulapatience has joined #commonlisp
<jsomedon> hmm okay well, then c-c c-c all the way then
<beach> Also, C-c C-c is faster to type.
<jsomedon> haha yes
<jsomedon> is coding in common lisp very different from coding in scheme, racket, clojure etc? I see people saying lisp dialects are very different with each other except they all share parenthesis..
<beach> jsomedon: It is not clear what is considered a "Lisp dialect". The thing that I find very useful in Common Lisp is CLOS. As I recall, nothing similar exists in most other "Lisp dialects".
<beach> jsomedon: Also, if you consider a commercial project, it is important to use a standardized language. Otherwise, you might find yourself having to catch up with annual updates to the language definition.
<jsomedon> didn't run into CLOS yet, just heard it's very different oop
<edgar-rft> IMO Common Lisp has the better infrastructure because most things I need are builtin with behaviour defined by the Common Lisp standard. That means my code behaves the same no matter which Common Lisp implementation I use. In Scheme only the core language is exactly specified while everything else variies wildly between Scheme implementations.
<Josh_2> Afternoon :trumpet: and edgar-rft
* edgar-rft trumpets loudly at Josh_2
<beach> jsomedon: I think you will find that CLOS is part of most modern programs using Common Lisp.
<edgar-rft> in Common Lisp (+ 1 1) is an OOP program because fixnums are system classes :-)
<jsomedon> btw talking about commercial project, is common lisp being a non-statically-typed language making it difficult to work with large code base?
<edgar-rft> error: FIXNUM is exactly *one* system class, not several
<jsomedon> uh, (+ 1 1) is oop? 😅
<yitzi> static typing...meh ;)
<fosskers> jsomedon you can add static type declarations if you want
<jsomedon> fosskers: oh that's part of syntax?
<ixelp> ~fosskers/cl-transducers: transducers/transducers.lisp - sourcehut git
<jsomedon> so, it's like `(declaim (ftype type variable))`?
<fosskers> Check out the chapter on types in the Cookbook
fosskers has quit [Remote host closed the connection]
cage has joined #commonlisp
nij- has joined #commonlisp
<beach> edgar-rft: Actually, I think FIXNUM is one of the few things not defined as a class.
jfb4 has quit [Quit: ZNC 1.8.2+deb3+b4 - https://znc.in]
<beach> jsomedon: Common Lisp does not make the mistake of confusing object representation and encapsulation in the same concept (i.e., a class). They are separate in Common Lisp. Encapsulation is handled by the package system, and classes determine object representation only.
tyson2 has joined #commonlisp
<beach> jsomedon: So what edgar-rft hinted was that every Common Lisp datum is an instance of some class, including numbers, characters, etc.
jfb4 has joined #commonlisp
sellers has quit [Remote host closed the connection]
sellers has joined #commonlisp
tyson2` has joined #commonlisp
tyson2` has quit [Read error: Connection reset by peer]
tyson2 has quit [Read error: Connection reset by peer]
<jsomedon> hmm soo what's the thing that, I can achieve with separating encapsulation with representation but I can't with them in same concept
waleee has joined #commonlisp
<beach> It is not that you can't achieve it. It is that the confusion makes programs much harder to write an maintain. There are tons of videos on YouTube telling you to avoid inheritance for instance, and I am convinced that those recommendations depend on this confusion.
<beach> jsomedon: Also, the fact that methods in Common Lisp are not part of any class makes things much easier. You can just whip up a method and dispatch on any class.
<beach> jsomedon: (defmethod foo ((x integer)) ...)
Nilby has joined #commonlisp
<edgar-rft> beach: thank you, as usual you were right, FIXNUM is a type, INTEGER is a class
<jsomedon> uh, if a method is not part of a class, then is it much different from a regular function?
tyson2 has joined #commonlisp
<beach> jsomedon: Yes, you can have several methods in the same generic function, separated into different components.
<beach> jsomedon: (defmethod foo ((x vector)) ...) elsewhere.
<beach> jsomedon: So dispatch happens when you call the generic function FOO. (foo 234) will invoke the first method and (foo "hello") the second.
<beach> No need to create subclasses of integer and vector to make that work.
<jsomedon> oh, so here method means different thing
dino_tutter has quit [Ping timeout: 246 seconds]
<beach> In Common Lisp, methods are attached to generic functions, not to classes.
<beach> And that makes all the difference.
<jsomedon> it does look a little bit similar to what java's interface does
<beach> I doubt it, but I don't remember enough Java to compare.
tyson2 has quit [Remote host closed the connection]
<jsomedon> uh I am not claiming they are very similar, I m just saying comparing with inheritance, it's more like what interface does
<jsomedon> like, same name but different implementation
<jsomedon> somthing liek that
<jsomedon> but still, like you said, here the implementations seem to be tied to function, not a class or interface or trait or whatnot
<beach> edgar-rft: I am working on implementing Common Lisp, so I have more things like that fresh in memory than your average user.
<jsomedon> okay, so I wonder, say if you are library author and you defined this foo function and you also provided some implementation as this methods on several types, and I as a user, I find that you didn't implement for a case that I am interested, does common lisp allow me to extend foo in my code?
<beach> Absolutely.
cosimone has joined #commonlisp
<beach> You just define another method on FOO.
<jsomedon> oh, that simple
<jsomedon> nice
<beach> Indeed.
pranavats has left #commonlisp [Error from remote client]
<jsomedon> I feel like, common lisp's approach and those interface/trait based approach, these all solve the problem of dynamically adding behaviors, but the difference is, where they add
<jsomedon> not really sure they are practically too different though. interface/trait one does have some more verbosity I guess
<beach> I suggest you learn to use CLOS and then you can tell us what the differences are.
<jsomedon> haha okay
dino_tutter has joined #commonlisp
nij- has quit [Ping timeout: 246 seconds]
<jsomedon> this cookbook's cover, seems to show `O RLY`, is this, the ebook cover skipped letters inbetween when it was rendered, or this is some joke?
<jsomedon> I mean isn't this supposed to be oreilly
<Josh_2> Is there a library that implements https://opentelemetry.io around?
<ixelp> OpenTelemetry
robin has joined #commonlisp
pranavats has joined #commonlisp
nij- has joined #commonlisp
cosimone has quit [Read error: Connection reset by peer]
nij- has quit [Ping timeout: 246 seconds]
dino_tutter has quit [Ping timeout: 246 seconds]
<louis77> jsomedon: that is a joke
<louis77> jsomedon: you could read it "Oh, really?"
pranavats has left #commonlisp [Error from remote client]
Gleefre has quit [Remote host closed the connection]
<jsomedon> I see 😂
Gleefre has joined #commonlisp
pranavats has joined #commonlisp
phadthai has quit [Ping timeout: 245 seconds]
<Josh_2> proto3 JSON :facepalm:
nij- has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
thuna` has joined #commonlisp
<nij-> I want to write a program that helps me backtest investing strategies in CL. The data is large.. which database would you pick? It'd be great if there are CL wrappers for it.
<nij-> Note that it's not just a huge 2D matrix. It's even more.. for each ticker and time there should be more than its price.
rtypo has joined #commonlisp
pranavats has joined #commonlisp
<edgar-rft> nij-: A database like SQL or similar is usually only needed to avoid read/write collisions when several users (or computer programs) need to access the data at the same time. If you're the *only* user then simple text files often are a good enough.
AetherWind has quit [Quit: leaving]
<nij-> I thought about that, but the database will be really large..
<nij-> so reading from a file will be very inefficient
<nij-> Imagine that I have to jump to the Nth row Mth column every time for a cell, and I need to repeat that very often.
eddof13 has joined #commonlisp
<Josh_2> Postgres
<nij-> oh, there's postmodern for CL+postgres :)
<edgar-rft> nij-: Common Lisp has a SXHASH function that can be used to create indices for filenames from data. This way you can split your data into huge hash-table-like file stuctures on disk with tolerable access time.
phadthai has joined #commonlisp
<nij-> hmmm..? Would that be as fasat as using postgres?
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<edgar-rft> nij-: not sure, but code you write yourself is always easier debuggable than code from external libraries
<louis77> nij-: how "large" will the database? Number of Rows, estimated size?
<nij-> edgar-rft fair enough
Inline has joined #commonlisp
<nij-> louis it will be growing.. but at least 3000 (days) * (3000) tickers * 6 attributes
<nij-> I may have 3000*24 (hours or even minutes) in the future instead of 3000 (days)
<louis77> ok, so you have a lot of writes too... well I've made quite good experiences with SQLite even for very huge datasets. Migrated databases with 200 GB from Postgres to SQLite and ended up with faster read/write times, but of course it was just a single process so no concurrent writes.
<louis77> Advantage of SQLite is that it is super portable and everything is stored in one file, you don't have to manage a separate database server. Then there is cl-sqlite + Miro, which makes the dev experience very nice.
<edgar-rft> the downside of sqlite is that every file system has a maximum-file-size limit
<louis77> true
<louis77> for older systems that could be an issue
skin has joined #commonlisp
jmdaemon has quit [Ping timeout: 244 seconds]
<beach> nij-: It looks to me like your data will fit quite well in RAM.
lucasta has quit [Quit: Leaving]
<beach> nij-: And RAM is much faster than any database that stores data on disk. Much easier to program too.
NotThatRPG has quit [Ping timeout: 260 seconds]
paulapatience has quit [Ping timeout: 245 seconds]
<nij-> No writes.. the only time I will write is when I collect data.
<nij-> But I expect to go through the same fields often again and again. There will be chances of optimization, but one can only do to some extent.
ldb has joined #commonlisp
<beach> nij-: Another argument in favor of main memory.
<nij-> beach - 3000 * 3000 * 24 * 20 * 8 bytes = 35GB
<nij-> Oh, instead of 6 numbers I use 20 here.. I see your point now.
<nij-> 6 is a lower bound.. there will be more..
<nij-> and if I want to get to minutes instead of hours, I gotta times that by 60 again.
<nij-> In any case, even if it fits in RAM, it's at GB level. That means it's very close to the limit.
<nij-> I can optimize by loading things partially into RAM though.
<beach> Buy more RAM if you have to, i.e., if you access all your data all the time, so that your virtual memory system won't cope.
Oladon has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
<beach> I am assuming your computer has virtual memory.
<nij-> The only machine I have is an Mac M2. Do you think I can extend it with RAM?
<nij-> (I'm not aware of a way..)
<nij-> ofc I can start running the computation on other machines - that could be a way too
<beach> I wouldn't know. And it would be cheaper to buy a new computer than to spend all that programmer time trying to do it with a database manager.
<nij-> Hmm interesting point..
<beach> I remember a lecture I gave after the university I worked for had just spent 150k€ on a commercial database management system for managing student data. I showed them how 100 years worth of data would fit in RAM on the (very small) laptop I used to project slides from. The students were furious, because it was contrary to what they had been told.
<beach> There is a tendency to jump to a database solution without doing some simple arithmetic first. The result is a huge waste of time and money, and often also performance of the result.
tyson2 has joined #commonlisp
eddof13 has joined #commonlisp
<nij-> Huh.. lesson learnt.
<nij-> I didn't know that db is much harder to tackle with than memory :-(
<beach> Oh?
morganw has quit [Read error: Connection reset by peer]
<beach> In memory, all you have to do is invoke the accessor.
morganw has joined #commonlisp
yvm has joined #commonlisp
<beach> On a database, you need to use entirely different functions, like SQL.
molson has quit [Remote host closed the connection]
molson has joined #commonlisp
<beach> Plus, if you use non-trivial objects to represent your data (as opposed to just numbers and strings), then you lose object identity when you do the database.
<nij-> Right..
<beach> The distinction between primary and secondary memory (which we knew how to eliminate in the 1960s) screws up a lot of things.
<nij-> And I can always migrate to db if I really need that some day
<beach> There is also a tendency to think that everything must fit in RAM, even when the access pattern is such that the virtual memory system will page most things out to disk anyway.
<Josh_2> Gonna take a stab at implementing some of that opentelemetry
<Josh_2> It would be nice if we could store our beautiful lisp objects into a db that comes with the nice features that allow for scaling like transactions :(
<Josh_2> But I have to say I have a commercial project that uses bknr and I am not impressed. I might not be using it properly though
<Josh_2> When you try to change-class with bknr it complains about class indexes and how you need to snapshot and restore, if you dont do this you can lose your entire store which is fun. If you do it and you make lots of use of change-class then next thing you know your VPS has no more disk :shrug:
<edgar-rft> it's time that someone formats the Magellanic Cloud so that we can use it as a huge memory pool
NotThatRPG has joined #commonlisp
ldb has quit [Ping timeout: 256 seconds]
lucasta has joined #commonlisp
azimut has joined #commonlisp
tyson2 has quit [Ping timeout: 256 seconds]
paulapatience has joined #commonlisp
ldb has joined #commonlisp
<ldb> lol, after emacs supported SQLite I learned SQL to evaluate the feasibility of convert my email address book to use SQLite instead of two hash tables
<ldb> and found I need to build many different tables because SQLite has no list data type
jsomedon has quit [Quit: Connection closed for inactivity]
<nij-> ldb :-( was it worths it?
<Josh_2> You can store lists as strings in a db
<ldb> which means make nasty regexp based solutions when compare and test for lists, yes
ldb has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1)]
lucasta has quit [Quit: Leaving]
<White_Flame> why did you need list datatypes to store an address book?
<White_Flame> oh they left
kevingal has quit [Ping timeout: 245 seconds]
<edgar-rft> to make it moar complicated od course
<edgar-rft> *of course
Oladon has quit [Quit: Leaving.]
paulapatience has quit [Ping timeout: 246 seconds]
markb1 has quit [Remote host closed the connection]
attila_lendvai has joined #commonlisp
Oladon has joined #commonlisp
azimut_ has joined #commonlisp
azimut has quit [Ping timeout: 240 seconds]
jsomedon has joined #commonlisp
dino_tutter has joined #commonlisp
rtypo has quit [Ping timeout: 256 seconds]
amb007 has quit [Ping timeout: 245 seconds]
attila_lendvai has quit [Quit: Leaving]
attila_lendvai has joined #commonlisp
azimut_ has quit [Ping timeout: 240 seconds]
triffid has quit [Quit: triffid]
waleee has quit [Ping timeout: 246 seconds]
Oladon has quit [Quit: Leaving.]
fosskers has joined #commonlisp
androclus has joined #commonlisp
androclus has quit [Quit: Leaving]
androclus has joined #commonlisp
waleee has joined #commonlisp
yvm has quit [Ping timeout: 260 seconds]
yitzi has quit [Remote host closed the connection]
haoms has joined #commonlisp
paulapatience has joined #commonlisp
avocadoist has joined #commonlisp
igemnace has quit [Read error: Connection reset by peer]
dino_tutter has quit [Ping timeout: 256 seconds]
morganw has quit [Remote host closed the connection]
rtypo has joined #commonlisp
yitzi has joined #commonlisp
jsomedon has quit [Quit: Connection closed for inactivity]
igemnace has joined #commonlisp
Oladon has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 28.2]
tyson2 has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
fosskers has quit [Ping timeout: 245 seconds]
haoms has left #commonlisp [#commonlisp]
amb007 has joined #commonlisp
igemnace has quit [Quit: WeeChat 4.0.2]
tibfulv has quit [Remote host closed the connection]
tibfulv has joined #commonlisp
shka has quit [Ping timeout: 245 seconds]
dino_tutter has joined #commonlisp
Oladon has quit [Quit: Leaving.]
tyson2 has joined #commonlisp
Oladon has joined #commonlisp
yitzi has quit [Remote host closed the connection]
<viaken> beach: How do you persist data that's in RAM?
paulapatience has quit [Remote host closed the connection]
notzmv has quit [Ping timeout: 246 seconds]
dcb has joined #commonlisp
<Josh_2> Does local-time let me export the unix time but in ns?
<Josh_2> I need "Value is UNIX Epoch time in nanoseconds
<Josh_2> Idk if thats possible with local-time
<White_Flame> viaken: usually a save-lisp-and-die to preserve the entire image
<White_Flame> for individual pieces of data, there's no real general solution if you want to save closures, function objects, etc. You have to choose a serialization format, which for simple data might just be readable printed form
<viaken> I was more thinking for disaster recovery.
<viaken> I realize there are several strategies. I was asking what beach uses, since they seem to have experience with in-memory DBs.
<Josh_2> What about just #'save-lisp :joy:
<White_Flame> well, save-lisp-and-die then resuming from that does leave a snapshot of your entire working system on your hard drive, and you can archive those in time
<White_Flame> yeah, I wonder if some implementations do that
<Josh_2> No need for a db if you can periodically dump your image to disk
<White_Flame> well, dbs do offer things things like transactions, permission management, rich queries, etc
<Josh_2> Postgresql :heart:
dtman34 has quit [Quit: ZNC 1.8.2+deb3.1 - https://znc.in]
dtman34 has joined #commonlisp
<Josh_2> How do I get unix time in ns? Can I do that :thinking:
<Josh_2> That's going to be implementation dependent
<Josh_2> sbcl internal-time-units-per-second is 1000000
<White_Flame> if you snoop into the time functions in your implementation, you can see how they access the raw system time
<Josh_2> I really hate this opentelemetry API, I dont think they could have made it any harder to figure it out
<louis77> Josh_2: Try this:
<louis77> (defun timestamp-to-unixnano (timestamp)
<louis77> (+ (* (+ (* (+ (day-of timestamp) 11017) +seconds-per-day+) (sec-of timestamp)) 1000) (nsec-of timestamp)))
<louis77> (declare (type timestamp timestamp))
<Josh_2> They have described the entire system like its some sort of Java program... They provide 7 examples, 4 of them seem to be out of date and its not like they annotate the other 3
<Josh_2> louis77: I dont know if its correct but it looks correct :)
<louis77> Well I took that from the local-time source and just added the nano-sec part
<louis77> I think it should be added to the library
<Josh_2> I can make an issue or if you do I will add a :thumbsup: asking for it
<louis77> Probably better to make a PR, what do you think?
Oladon has quit [Read error: Connection reset by peer]
<Josh_2> :shrug:
Oladon has joined #commonlisp
NotThatRPG has quit [Remote host closed the connection]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Ping timeout: 245 seconds]
azimut has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blackshuck has joined #commonlisp
<Josh_2> What is gbbopen for?
eddof13 has joined #commonlisp
<Josh_2> I see, I completely misunderstood what "blackboard system" meant
* White_Flame uses a blackbeard system instead, and pirates instead of leases
son0p has quit [Remote host closed the connection]
amb007 has quit [Ping timeout: 256 seconds]
dino_tutter has quit [Ping timeout: 245 seconds]
jmdaemon has joined #commonlisp
paulapatience has joined #commonlisp
rgherdt has quit [Remote host closed the connection]
Oladon has quit [Quit: Leaving.]
tyson2 has quit [Remote host closed the connection]
Devon has joined #commonlisp
attila_lendvai has quit [Ping timeout: 245 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
amb007 has joined #commonlisp
johnjaye has quit [Quit: WeeChat 4.0.0-dev]
amb007 has quit [Ping timeout: 256 seconds]
johnjaye has joined #commonlisp
habamax has joined #commonlisp
pve has quit [Quit: leaving]
nij- has left #commonlisp [Using Circe, the loveliest of all IRC clients]
notzmv has joined #commonlisp
NotThatRPG has joined #commonlisp
jeffrey has quit [Quit: Client quit]
Gleefre has quit [Ping timeout: 246 seconds]