jackdaniel changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language | <https://irclog.tymoon.eu/freenode/%23lisp> <https://irclog.whitequark.org/lisp> <http://ccl.clozure.com/irc-logs/lisp/> | offtopic --> #lispcafe
sm2n has quit [Ping timeout: 265 seconds]
nicktick has joined #lisp
slyrus has quit [Ping timeout: 250 seconds]
sy_ has joined #lisp
Oladon has joined #lisp
elderK has joined #lisp
zzappie has quit [Ping timeout: 240 seconds]
hjudt has joined #lisp
nicktick has quit [Ping timeout: 260 seconds]
nicktick has joined #lisp
casual_friday_ has quit [Remote host closed the connection]
casual_friday has joined #lisp
hjudt has quit [Ping timeout: 265 seconds]
nij has joined #lisp
<nij> Why do some people name their personal systems like this? com.xyz-name.system-name? Should I follow this convention?
<nij>
<White_Flame> it's to avoid collisions. Because only a few people do that, I"m not sure it's really necessary
<White_Flame> but if you do use that, there are nicknames and package-local-nicknames that can give a shorter prefix instead of the fqdn style
<nij> Oh. What does "com." mean?
<White_Flame> it's whatever DNS entry you own
<nij> Oh! I see!
gabiruh has quit [Quit: ZNC 1.7.5 - https://znc.in]
<saturn2> it's reversed so the names are grouped together when sorted alphabetically
gabiruh has joined #lisp
<nij> Yes, the rest makes sense..
<nij> I though COM stands for common-lisp or something.
<saturn2> i'd say it's a good convention to follow if you want to publish a ton of different things and not worry too much about how appropriate they are for general use
<saturn2> it's annoying when someone squats on a generic name with a library that's not very good
<White_Flame> but naming it nij.foo is also likely good enough
shifty has joined #lisp
<saturn2> yes
<White_Flame> I use 'wf' a lot for that
<White_Flame> just to make names unique & websearchable
<nij> yep yep
hjudt has joined #lisp
davros has quit [Remote host closed the connection]
<nij> So as my personal scripts pile up, I will have to make systems that named "nij.scripts.celebrate", "nij.scripts.wordie".. etc? Isn't this a little cumbersome? Is there a better way, like (defsystem "wordie" :inherit "nij.scripts"..)?
monolithic has quit [Remote host closed the connection]
jeosol has joined #lisp
hjudt has quit [Ping timeout: 240 seconds]
<White_Flame> if it's private, name it what you want.
drbluefall has joined #lisp
<nij> Yeah, the great article :) Read it many times.
<nij> Btw.. should I use (:use :cl) or (:use #:cl)?
<nij> I use the former, but the latter shows up more frequently in others work.
<Bike> it's not really important. the latter just means :cl isn't interned as a keyword
drbluefall has quit [Remote host closed the connection]
<nij> Yeah that's what I thought.
cer-0 has joined #lisp
davros has joined #lisp
hjudt has joined #lisp
igemnace has quit [Quit: WeeChat 3.1]
igemnace has joined #lisp
lotuseat` has joined #lisp
remby has quit [Quit: remby]
lotuseater has quit [Ping timeout: 276 seconds]
sm2n has joined #lisp
<nij> Should I consider using SICL over SBCL? I heard that the former is "cleaner" without understanding.
hjudt has quit [Ping timeout: 265 seconds]
wxie has quit [Ping timeout: 260 seconds]
cer-0 has quit [Ping timeout: 240 seconds]
martinodb has joined #lisp
wxie has joined #lisp
<no-defun-allowed> You can't run SICL just yet, so you don't really have an option.
<nij> What do you mean? It's not usable yet?
<no-defun-allowed> No, it is not usable.
<nij> It's totally not my impression after re-reading its readme page.
<no-defun-allowed> Is it not evident that it can only be run in a host Lisp?
<martinodb> hi! i have a question. I'm trying the maiden IRC framework, so this maiden-silly agent connected to an IRC channel, but it doesn't talk to me at all. The documentation says something about activating it. Doesn't it do anything out of the box? do I have to edit the code? thanks!
jeosol has quit [Quit: Connection closed]
<nij> no-defun-allowed: Oh! I thought that's just some way CL-ers would like..
<nij> "Everything should be in a repl cuz that's the coziest place to have fun.. including the repl itself!"
<no-defun-allowed> If you are only interested in cleanliness, then your code would be subject to the ugly parts of both SBCL and SICL.
<mister_m> I accidentally did an infinite recursion in the repl (using slime), I'd like to stop this without killing my inferior lisp process, how can I do that from within the REPL buffer? C-c C-c doesn't seem to do anything
jeosol has joined #lisp
aeth_ has joined #lisp
aeth has quit [Disconnected by services]
aeth_ is now known as aeth
terpri has quit [Remote host closed the connection]
terpri has joined #lisp
martinodb has quit [Quit: Leaving]
terpri has quit [Remote host closed the connection]
<mister_m> oh wait does C-c C-c start LDB in the inferior lisp buffer?
nij has quit [Remote host closed the connection]
terpri has joined #lisp
<no-defun-allowed> It shouldn't.
vms14 has joined #lisp
vms14 has quit [Changing host]
vms14 has joined #lisp
terpri has quit [Remote host closed the connection]
terpri has joined #lisp
<mister_m> maybe I just missed the SLDB buffer that was created on C-c C-c in the REPL buffer.
indathrone has joined #lisp
remby has joined #lisp
frost-lab has joined #lisp
hjudt has joined #lisp
theothor` has joined #lisp
theothor` has quit [Ping timeout: 260 seconds]
hjudt has quit [Ping timeout: 260 seconds]
shifty has quit [Ping timeout: 240 seconds]
shifty has joined #lisp
remby has left #lisp ["Good Bye"]
mindCrime_ has quit [Ping timeout: 240 seconds]
sy_ has quit [Quit: sy_]
ebrasca has quit [Remote host closed the connection]
aartaka has joined #lisp
<beach> Good morning everyone!
aeth has quit [Ping timeout: 252 seconds]
sy_ has joined #lisp
aeth has joined #lisp
asarch has joined #lisp
<asarch> (format t "Konnichiwa, Sekai!~%")
<asarch> Does anybody know what's wrong with Melpa?
<asarch> Is it dead?
hjudt has joined #lisp
Bike has quit [Quit: Lost terminal]
<waleee-cl> asarch: seems to work here
<asarch> Oh :-(
<asarch> I did a downgrade to Debian Stable and its Emacs 26.1 has been failing to get the M-x 'package-refresh-contents' to install Slime
semz has quit [Ping timeout: 276 seconds]
hjudt has quit [Ping timeout: 265 seconds]
asarch has quit [Quit: Leaving]
DHARMAKAYA has joined #lisp
semz has joined #lisp
semz has quit [Changing host]
semz has joined #lisp
lotuseat` has quit [Remote host closed the connection]
lotuseat` has joined #lisp
aeth has quit [Ping timeout: 260 seconds]
igemnace has quit [Quit: WeeChat 3.1]
igemnace has joined #lisp
aeth has joined #lisp
Josh_2 has quit [Ping timeout: 245 seconds]
andrei-n has joined #lisp
long4mud has joined #lisp
sy_ has quit [Quit: sy_]
slyrus has joined #lisp
hjudt has joined #lisp
<White_Flame> mister_m: if your inferior-lisp gets dropped into ldb, you probably blew the heap, or the stack twice
<dieggsy> asarch: melpa has been odd recently. I don't use it as my package repo but I search their website sometimes and it's been extremely slow
slyrus has quit [Ping timeout: 252 seconds]
hjudt has quit [Ping timeout: 252 seconds]
hypercube has quit [Quit: WeeChat 3.1]
hypercube has joined #lisp
raeda_ has quit [Ping timeout: 246 seconds]
hjudt has joined #lisp
raeda has joined #lisp
indathrone has quit [Quit: Leaving]
hjudt has quit [Read error: Connection reset by peer]
add^_ has quit [Ping timeout: 248 seconds]
hjudt has joined #lisp
vms14 has quit [Ping timeout: 252 seconds]
narimiran has joined #lisp
ordoflammae has quit [Ping timeout: 252 seconds]
hjudt has quit [Ping timeout: 265 seconds]
hjudt has joined #lisp
<dieggsy> there's no way to start swank on a unix domain socket, right ?
<dieggsy> is there a popular alternative for this or
<White_Flame> the lack of interchangeability of different communications stream styles is a general problem, across many domains
<dieggsy> so that's a no
<White_Flame> I don't know enough for it to be a definite "no", but such situations hit me too often between other stream interfaces
shka_ has joined #lisp
varjag has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
varjag has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
add^_ has joined #lisp
hypercube has quit [Ping timeout: 250 seconds]
ukari has quit [Remote host closed the connection]
ukari has joined #lisp
orivej has joined #lisp
pbaille has joined #lisp
<pbaille> Hello, I'm new here.
chipolux has joined #lisp
<beach> Hello pbaille. Welcome!
<beach> What brings you to #lisp?
saganman has joined #lisp
saganman has quit [Changing host]
saganman has joined #lisp
<pbaille> Hi ! What brings me to IRC is picolisp, and what brings me to picolisp is clojure.
gaqwas has joined #lisp
gaqwas has quit [Changing host]
gaqwas has joined #lisp
<beach> I see.
<pbaille> I'm increasingly curious about common lisp for some times too
<beach> That's good, since this channel is dedicated to Common Lisp. :)
<pbaille> :)
theothor` has joined #lisp
theothor` has quit [Remote host closed the connection]
Nilby has joined #lisp
<beach> pbaille: #lisp is not really for trivial questions, but such questions are tolerated, especially if traffic is low. If trivial questions become too annoying, you may get redirected to #clschool which is meant for such questions.
tempest_nox has quit [Read error: Connection reset by peer]
<beach> pbaille: On the other hand, some newbie questions are not trivial, and the answers to them are often worth repeating here, like for instance the semantics of function calls and argument passing.
<pbaille> yes I see ! I will use the channel as intended, no problem.
imode has quit [Ping timeout: 240 seconds]
spacepanda has joined #lisp
<pyc> Does https://plaster.tymoon.eu/edit not work anymore? I tried it many times but it does not return me a link I can share. The input just disappears after posting my snippet.
<no-defun-allowed> Can you see https://plaster.tymoon.eu/view/2414?
<no-defun-allowed> If so, I can't reproduce what is happening to you.
<pbaille> (let ((a 1) (b 2)) (+ a b))
<pbaille> (let ((x 1) (y 2)) (+ x y))
<pbaille> ((lambda (x y) (+ x y)) 1 2)
<pbaille> (+ 1 2)
<beach> no-defun-allowed: I can see it.
<pbaille> I was curious about code equivalence those days. Is there any known works around that. for instance determining the equivalence of those 4 expressions:
<beach> pbaille: That would be an undecidable problem in general, so I think you are out of luck.
<pbaille> sorry I'm discovering IRC... the four expressions posted where intended to be after my question. all my apologies.
<no-defun-allowed> You may reduce the first three to the fourth using substitution in this case, but generally equivalence is equivalent to the halting problem.
<pyc> no-defun-allowed: thanks! I can see your post. I wonder why it does not work for me. When I click post, it goes back to the https://plaster.tymoon.eu/edit and the input disappears. I don't get any link I can share.
<pyc> no-defun-allowed: are you logged into https://plaster.tymoon.eu/edit ? or did you use it without logging in? I am not logged in.
<no-defun-allowed> I don't log in.
<flip214> pbaille: you could try to use macro expansion to rewrite all expressions to a minimal subset - eg. replace LET by a LAMBDA form.
asarch has joined #lisp
<flip214> but then you'd still need quite a few manually defined rules - eg. the order of variables in LET can be different.
<flip214> and what about (+ y x)? You'd need to store that "+" is commutative...
<pbaille> yes, commutativity is a bit out of scope here
<flip214> and you might need an expression simplifier to see that (* (- a b) (+ a b)) equals (- (* a a) (* b b)) and so on.
<flip214> so you can arbitrarily far, depending on how much time/effort you're willing to spend...
<pbaille> but maybe bindings can be ordered using kind of an hash of the value they are bind to
<flip214> OTOH, I can also see an alternative way -- compile the expressions, and try to prove that the machine code gives identical results.
<Nilby> As you may know, there are many undecidable in general problems which are quite worthwile and solvable in specific.
<flip214> Ie. like decompiling back to C or so... that would get rid of many small differences in the sources
<moon-child> that throws away information. It is likely to be harder to prove interesting facts about machine code than about lisp code
<flip214> moon-child: not necessarily... at least that's a well-defined set of basic instructions.
<moon-child> those 'small differences' are things you need to be able to handle anyway. Many of them will result from compiler optimizations, the sorts of analysis underlying which you will need to replicate if you would like to automatically prove things about code
<pbaille> Nilby: thank you for your comment :)
<Nilby> pbaille: You're welcome. I think too many time people are discorged from finding useful solutions to undecidable in general problems.
<pyc> got some clue about the pastebin issue. When I submit in the browser's network tab I see a POST being made to this URL: https://plaster.tymoon.eu/?error=You%20did%20not%20enter%20the%20captcha%20correctly.
<pyc> but I did enter the captcha correctly.
spacepanda has quit [Remote host closed the connection]
spacepanda has joined #lisp
<pbaille> flip214: thank you for your suggestions. I've worked on those kind of things a few months ago (in clojure), I will try discuss it with you guys a bit later. thank you
<saganman> Morning beach!
<saganman> Morning #lisp
<beach> Hey saganman.
chipolux has quit [Quit: chipolux]
<saganman> how is your day beach?
spacepanda has quit [Ping timeout: 276 seconds]
DHARMAKAYA has quit [Quit: Turning off a portion of this simulation.]
<beach> saganman: It just barely started. I need to download some screen-recording program to my new desktop computer and record my ELS talk. What about you?
<saganman> it's okay, still in self imposed lock down.
frost-lab has quit [Ping timeout: 246 seconds]
<beach> Sure.
daphnis has joined #lisp
attila_lendvai has joined #lisp
<susam> Good morning, beach! Good morning, saganman! Good morning, #lisp!
random-nick has joined #lisp
<beach> Hello susam.
gaqwas has quit [Ping timeout: 240 seconds]
thomasb06 has joined #lisp
dickbarends has quit []
hiroaki has quit [Ping timeout: 260 seconds]
spacepanda has joined #lisp
Krystof has quit [Ping timeout: 252 seconds]
asarch has quit [Quit: Leaving]
femi has quit [Ping timeout: 252 seconds]
skapata has quit [Remote host closed the connection]
pankajsg has joined #lisp
<pyc> Is this a good coding style: https://pastebin.ubuntu.com/p/Y7Y35fwjRW/ ? What I am doing here is computing everything in (let* ...) and returning what I need as a separate expression in the end. Does it look odd to experienced Lisp programmers?
orivej has quit [Ping timeout: 252 seconds]
<beach> Looks fine to me.
<beach> I might have left out the last LET* binding.
<jdz> pyc: What if the strings you're looking for are not present (especially the first one)?
hiroaki has joined #lisp
<jdz> pyc: The name of the function feels more like "extract-field".
spacepanda has quit [Ping timeout: 250 seconds]
<jdz> And I think the function should accept a string, and reading file contents into a string should be done somewhere up the call chain.
<pyc> jdz: in that case this code will fail with error. I can definitely improve the error handling. however is my style of doing all computation in (let* ...) and then returning just that one thing I need to return in the end proper coding style? Coming from other languages, it felt odd to me, so wanted the opinion of experienced programmers here.
<pyc> jdz: that's a good point. thanks.
<beach> pyc: Again, you can probably leave out the last binding, because the name of the function should be enough to tell what the result of it would be.
<jdz> You could make this into a generic function, with methods on specializing on STRING and PATHNAME.
surabax has joined #lisp
<jdz> In the end you'll see that there's no need for the LET binding at all.
<pyc> thanks beach
<beach> jdz: I frequently find it better to give names to intermediate results though.
<pyc> jdz: yes, I was considering that alternative too. Certainly the whole thing can be written without let binding. so can I assume that experienced Lisp programmers avoid LET binding whenever possible? Or is it just another alternative and both alternatives (LET or no LET) are equally valid and good?
<jdz> pyc: As beach just said.
<pyc> thanks for your help, jdz and beach!
<beach> Pleasure.
pankajsg has quit [Ping timeout: 268 seconds]
<Nilby> neo-prog style
zzappie has joined #lisp
<pyc> jdz: awesome! thanks for the example
<jdz> In this case I think the body is so simple there's no need to introduce any bindings.
<pyc> jdz: why do you favor less bindings? cleaner code?
ljavorsk has joined #lisp
jeosol has quit [Ping timeout: 240 seconds]
<moon-child> in this case, though, for the purposes of efficiency I might keep track of the position of the {{{, to avoid needing to look over so much of the string for the }}}
<jdz> moon-child has a very good point.
<pyc> moon-child: great point! in fact I do need to ensure that I search for }}} *after* {{{ and ignore any }}} before {{{. so I do need to keep track of its position.
<jdz> pyc: I do not favor _fewer_ bindings, but introducing them unnecessarily just create more clutter and more work for brain.
<pyc> understood. thanks jdz
<flip214> jdz: but it's a kind of comment, so serves some purpose
<moon-child> naming things is difficult. The wrong name is worse than no name at all; the former may mislead, where the latter is self-evident in its use
waleee-cl has quit [Quit: Connection closed for inactivity]
<jdz> flip214: Sure. But that's the thing about commenting—there's no point commenting trivial code.
<moon-child> (self-evidence may be insufficient when the thing being evinced is sufficiently complex. But.)
<flip214> jdz: "trivial" depends on the consumer ;) and a few weeks later the author herself might be glad about one more name
<flip214> moon-child: yeah, right.
<moon-child> flip214: exhibit A: forth
Krystof has joined #lisp
dickbarends has joined #lisp
<Nilby> forth is why we have parens in Lisp
<pyc> moon-child: what is wrong with Forth? we can name variables in Forth too, right?
<Nilby> When coding in a forth-like language I frequently had to comment almost every line with the presumed state of the stack.
femi has joined #lisp
<Nilby> The comments themsleves were frequently cryptic.
<pyc> an off-topic question. Can forth operators act on arbitrary number of arguments. For example, Lisp can do (+ 1 2 3) where + takes any number of arguments. It is of course possible because we can delimit the call with ). Is such a thing possible in Forth?
<jdz> pyc: How about this: https://plaster.tymoon.eu/view/2415#2416
<Nilby> pyc: Yes.
<Nilby> pyc: Any operator can manipulate the argument stack however it wants.
<pyc> Nilby: how would the operator know how many arguments the programmer wants to add for example when there are no delimiters to specify that?
<Nilby> A common thing with varibale arguments is to have a count or a fencepost on the arglist.
<pyc> Nilby: say, I make a Forth operator op, and I write 1 2 3 4 5 op. How would it know if I want op to consume 2 arguments or 3 arguments or 4 arguments?
<pyc> Nilby: by fencepost, you mean, some sort of special value I keep on the stack to mark the end of list of arguments?
<Nilby> you just say 5 is your following arg count.
pankajsg has joined #lisp
<jdz> In the end it seems very unforthy thing to do.
<pyc> Nilby: okay, understood. so the responsibility for that falls on the programmer unlike Lisp where the paren-based syntax itself takes care of it.
Oladon has quit [Quit: Leaving.]
<Nilby> pyc: Yes. In fact can use [ or { as a fencepost thing.
<Nilby> or even (
<Nilby> Execatly. In lisp the syntax makes it mostly obvious.
<pyc> Oh right! That gives me ideas! Write Lispy code in Forth by using ( and ) fenceposts and defining operators to work on them. :-D
<pyc> Postfixy Lispy Unforthy Code.
<jdz> Nilby: How are those "fenceposts"? Aren't they just numbers (ASCII codes for the characters)?
<Nilby> Except it's still hard on the brain, saying { foo } if
<pyc> yes, they will just be numbers (ASCII code for the characters) although there is syntax to specify them as literal characters while the compiler still puts their ASCII codes on the stack.
<Nilby> or rathher { foo } x y eq if
<jdz> pyc: The case when the number of arguments is lexically apparent in the code is not very interesting, is it?
duuqnd has joined #lisp
<Nilby> Interestingly if you do object oriented forth, the order seems revered to prefix, so you say: object message message ...
<Nilby> In some way, Lisp compilers turn Lisp into forth if your hardware is stack-ish.
<moon-child> not really
<moon-child> lisp has local variables that can be referred to randomly
<jdz> Bytecode interpreters are commonly stack based.
<Nilby> forth can have a scope aka dictionary stack
<moon-child> jdz: yes, but they can still have local variables. E.G. examining the python bytecode for 'lambda x, y: x*x+y' reveals LOAD_FAST instructions referring to the parameters
<duuqnd> It does look a bit like forth I guess https://imgur.com/nadIIrx
spacepanda has joined #lisp
saganman has quit [Ping timeout: 268 seconds]
<Nilby> jdz: forth has "words" which are equivalent to lisp symbols which are looked up a dictionary. Like lisp, some symbols evalualte to themselves, like T, so can be used for fenceposts.
spacepanda has quit [Ping timeout: 260 seconds]
anticrisis has quit [Read error: Connection reset by peer]
igemnace has quit [Quit: WeeChat 3.1]
igemnace has joined #lisp
spacepanda has joined #lisp
hendursa1 has joined #lisp
<jdz> Nilby: Yes, I know that much. But you're talking about compile-time fenceposts, not runtime, right?
hendursaga has quit [Ping timeout: 240 seconds]
<jdz> Imagine reading numbers read from a file (or console standard input).
<jdz> s/reading/adding
<Nilby> jdz: I don't think there's as big distinction in forth. It's still just a word on the stack. I suppose in an optimizing forth compiler could optimize the fencepost out in a compiled procedure.
spacepanda has quit [Ping timeout: 276 seconds]
<jdz> Words are for code, and code does not end up on the data stack (as far as I know).
gitgood has quit [Quit: Probably away to do something really awesome]
<jdz> Forth does not have tagged pointers, so there are only numbers.
<jdz> So how would a fencepost number differ from any other number?
duuqnd has quit [Remote host closed the connection]
duuqnd has joined #lisp
frgo has joined #lisp
<Nilby> I think you're right, in pure forth. I guess what I used wan't pure forth, so it did have tagged objects and garbage collection.
aartaka_d has joined #lisp
<Nilby> The most pure forth coding I did was in a bootloader and I can't remember if it had tagged objects or not. The forth-like language I used most was https://en.wikipedia.org/wiki/NeWS
aartaka has quit [Ping timeout: 268 seconds]
<no-defun-allowed> Most Lisp, Python, Smalltalk, Java, etc VMs look like the SECD machine more precisely, which has an explicated environment of some sort.
contrapunctus has left #lisp ["Disconnected: Replaced by new connection"]
contrapunctus has joined #lisp
contrapunctus has left #lisp ["Disconnected: Replaced by new connection"]
contrapunctus has joined #lisp
heisig has joined #lisp
pve has joined #lisp
frost-lab has joined #lisp
lotuseat` is now known as lotuseater
igemnace has quit [Quit: WeeChat 3.1]
igemnace has joined #lisp
igemnace has quit [Client Quit]
igemnace has joined #lisp
kevingal has joined #lisp
uweee has joined #lisp
uweee has left #lisp [#lisp]
pankajsg has quit [Read error: Connection reset by peer]
pjb has quit [Ping timeout: 260 seconds]
hiroaki has quit [Ping timeout: 260 seconds]
pankajsg has joined #lisp
hiroaki has joined #lisp
shifty has quit [Ping timeout: 268 seconds]
shifty has joined #lisp
orivej has joined #lisp
duuqnd has quit [Ping timeout: 246 seconds]
duuqnd has joined #lisp
liberliver has joined #lisp
frost-lab has quit [Ping timeout: 252 seconds]
<pyc> what is wrong with this code? https://pastebin.ubuntu.com/p/NRWXCB87tk/ - From my reading of http://clhs.lisp.se/Body/m_w_out_.htm , I should be able to specify a variable name that is not defined yet. What am I doing wrong here?
<flip214> pyc: with-output-to-STRING or -to-STREAM?
<pyc> ohh! big typo. I meant with-output-to-string but I typed with-output-to-stream. let me fix that and try again
<loke[m]> There is no macro defined called with-output-to-stream
<pyc> sorry to waste your time, folks! let me fix it and try again
<loke[m]> Thus, it's first trying to call a function called STREAM before calling a function called with-output-to-stream
<loke[m]> It may be that you're looking for with-output-to-stribg
<lotuseater> haha I even wondered too ^^
<loke[m]> String
<pyc> fixed it now and works fine. thanks!
<loke[m]> Oh sorry. Didn't see the you already figured it out.
<loke[m]> The hazards of using a phone
snits has quit [Ping timeout: 252 seconds]
<White_Flame> pyc: tab completion is nice to ensure longer names are correct
<White_Flame> Esc-Tab in the editor buffers, or some other combinations
bjorkintosh has quit [Remote host closed the connection]
pranavats has quit [Ping timeout: 240 seconds]
contrapunctus has quit [Ping timeout: 265 seconds]
nicktick has quit [Ping timeout: 240 seconds]
irc_user has quit [Quit: Connection closed for inactivity]
<beach> phoe: http://metamodular.com/SICL/call-site-optimization-talk.mkv is my talk. It is a bit more than 20 minutes long. There is a typo on one of the slides that I have since fixed, but I am not going to re-record the talk.
vegansbane6963 has quit [Quit: The Lounge - https://thelounge.chat]
<phoe> beach: OK; the typo can be worked around via Twitch chat
<phoe> (just like last year, I think!)
rogersm has joined #lisp
pjb has joined #lisp
snits has joined #lisp
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
<beach> Yeah.
daphnis has quit [Ping timeout: 252 seconds]
daphnis has joined #lisp
<pyc> If I have a key name as a string, e.g., "a", can I convert it to :a so that I can use it with functions like getf to look up a plist?
vegansbane6963 has joined #lisp
<pyc> pyc: Here is an example that describes my question in detail: https://pastebin.ubuntu.com/p/2HJD8QDjFW/
<Nilby> (intern (string-upcase string) :keyword)
<Nilby> if use assume the default case
<pyc> Nilby: thanks
<Nilby> or alexandria:make-keyword
<engblom> If I pass an object to a function, is it a reference to the object or a copy of the object that is passed?
<engblom> I mean, if I have (defun foo (obj) ...) and I call it with (foo my-obj), is a copy of my-obj passed or a reference?
<phoe> engblom: thinking C++ doesn't work here
<Nilby> engblom: It's not exactly either. It's a lisp object which can be a reference or a value. E.g. 1 is a value, *readtable* is a reference.
madage has quit [Ping timeout: 240 seconds]
<pjb> engblom: lisp uses exclusively pass by reference. Never pass by value.
<daphnis> if a class's slot symbols are package-specific, how does one export a function that uses the class? i get "When attempting to set the slot's value to ... the slot .... is missing from the object .... It has a slot pac1::slt, while pac2::slt is requested.
<pjb> engblom: (while technically numbers and characters may be passed by value when they're small enough, since they're not mutable, there's no difference).
madage has joined #lisp
<phoe> daphnis: what do you mean, uses the class?
<pjb> daphnis: one cannot export functions from package. packages only deal with symbols. You can export a symbol from a package.
<phoe> if a slot name is not exported then it means that it's internal
<daphnis> phoe: it sets a slot in an object of the class
<phoe> and that you likely should not use it, and instead should use accessor functions whose names are actually by the package in question
<pjb> daphnis: usually we hide the slot behind the accessor.
<engblom> Thanks!
<phoe> if you absolutely need to set it and bypass this, then use the fully qualified name: (setf (slot-value foo 'pac1::slt) ...)
<phoe> but that's ugly code
<_death> pjb: lisp is pass by value!
<pjb> daphnis: the reason why is because accessors are methods, code, they can manage the consistency of the object. Perhaps setting a slot implies modifying another sslot, or sending a messasge to another object? If you use slot-value, this cannot occur. If you use an accessor that is overriden, the class can manage it.
<phoe> pjb: if we use C++ semantics, then we do not have reference passing
<pjb> _death: but all values are references!
<_death> pjb: some values are, yes..
<pjb> The only values that may not be references are as I mentionned numbers and characters, which are not mutable, and therefore makes no difference if they're passed as value (copied) instead of reference.
<pjb> _death: but even in that case, most numbers and most characters may still be passed by reference, because they're big (bignums, complex, ratio, etc).
<pyc> why is progn named so? what does "progn" stand for?
<phoe> in C++, you can assign a refrence and have the referent modified, which is like mutating a place from inside a function in Lisp
<phoe> and you can't do that in Lisp
<pjb> pyc: prog1 prog2 progn
<_death> pjb: right, but saying lisp uses pass by reference is misleading.. the values (which may be references) are copied
<pjb> pyc: (prog1 one-is-the-result and not the rest) (prog2 nope two-is-the-result and not the rest) (progn not this not that but the nth-is-the-result)
<phoe> the same won't work in Lisp because a new variable binding is created
<pyc> pjb: okay, so what does prog1 stand for? program? or something else?
<pjb> yes program feature, returning the result of the first expression.
shifty has quit [Ping timeout: 246 seconds]
<pjb> pyc: there's also prog and progv have a look at them.
<pyc> okay, thank you
shifty has joined #lisp
<pjb> _death: granted, saying that lisp uses pass by reference may be misleading, because in C++, references are references to the variable passed, while in lisp I mean that the value bound to a variable is a reference that is passed. So sorry. lisp is pass by value, but all values are references. (apart a few possible immutable exceptions).
<pjb> lisp is value (object) centered, not (typed) variable centered.
<_death> pjb: I think KMP once suggested "pass by identity"
<phoe> the issue is that there is C++ pass-by-value and C++ pass-by-reference, and the only good answer to "is Lisp pass by value or pass by reference?" is "neither"
<phoe> because Lisp passing does not follow C++ semantics much
ordoflammae has joined #lisp
<_death> phoe: no.. these terms pre-date C++.. ordinary Lisps were always pass by value
<engblom> If I change my question a bit: would passing an object to a function which then modifies the object change the original object?
<engblom> (having a side effect)
<phoe> engblom: yes
<engblom> Okay, thanks! That helps me to understand what I can do and not do with objects.
<pjb> _death: yes, it's a good way to express it, "pass by identity".
<Nilby> I know both pjb and _death know exactly what lisp object is, so it's amusing that thare can be ontological debate about it.
<phoe> _death: yes, but then again, pass-by-value means implicitly copying stuff in C++
<phoe> and CL does not copy objects that are not immutable immediates
<pjb> engblom: there is a single object, it's the original object that is passed.
<phoe> Nilby: that's because of C++ semantics, obviously :D
<pjb> engblom: the reference to the object is copied from the argument to the parameter variable.
<_death> phoe: it does copy, but what is copied is the reference
<Nilby> If you want to put it in C++ terms a lisp object is a union of all possible types.
<pjb> engblom: hence pass-by-value, but since the value is a reference, it's pass-by-identity.
<phoe> _death: and that is also what differs from C++ semantics
<phoe> hence we have all this current mess
<phoe> I think this deserves a blogpost
<phoe> since it's the nth time I've seen this discussion and it would be good to store a compressed version of it somewhere
<Nilby> and then tell minon and colleen about it :)
<pjb> phoe: or just a little drawing, of objects in a heap, with arrows from variables to them and between them.
<pjb> but yes, we should automatize teaching and support!
<phoe> pjb: lemme quickly write down a sketch of what I am thinking about and I'll post it here for review
layerex has joined #lisp
codecaveman has joined #lisp
shifty has quit [Ping timeout: 268 seconds]
shifty has joined #lisp
<_death> phoe: in C (and C++) you can also pass references by value.. if you have an int a, you can pass &a, which is a pointer (a reference).. the pointer is copied and may be dereferenced
* Odin- got the impression from the Lisp 1.5 manual that conceptually all Lisp objects are references.
Spawns_Carpeting has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
<_death> phoe: in C++, you can pass the int by reference.. the callee states that a reference to int should be passed, by taking an int & parameter..
Spawns_Carpeting has joined #lisp
<codecaveman> I want to write an iterative recursive factorial function which does work backwards: I mean my fact(a b) = { (a=0)->b; fact(a-1, a*b) } function multiplies numbers downwards n*n-1*n-2..3*2*1 can I write one which does 1*2*3*...(n-1)*n using only two variables?
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
<pjb> codecaveman: iterative XOR recursive! which will it be?
<phoe> _death: yes, I have linked an example above
<jackdaniel> recursive if the accumulator ,)
<jackdaniel> s/if/with
<codecaveman> (define factorial-product
<codecaveman> (lambda (a b) ; compute a * b! as (a*b) * (b-1)!
<codecaveman> (factorial-product (* a b) (- b 1))))
<pjb> (defun fact (n r) (if (zerop n) r (fact (1- n) (* n r)))) (fact 10 1) #| --> 3628800 |#
<codecaveman> I want to rewrite it so it goes up
<codecaveman> from 1 to n
<phoe> codecaveman: which language is that?
<codecaveman> scheme
<phoe> that doesn't look like CL because of the DEFINE
<phoe> #scheme might be a slightly better fit then!
<phoe> #lisp is a lair of Common Lispers
<pjb> (defun fact (n i r) (if (= i n) (* n r) (fact n (1+ i) (* i r)))) (fact 10 1 1) #| --> 3628800 |#
<pjb> codecaveman: ^ so you want only 2 parameters?
<codecaveman> yes I want to know if its possible to write using only two
<pjb> I don't see how that can be possible.
<pjb> You want i to increment, you want n to set the limit, and you want the accumulator r.
<no-defun-allowed> I would think you could with a cons or a closure to put two values in one argument, but that is following the letter and not spirit of what you asked.
<pjb> codecaveman: but you would wrap any recursive function with accumulator into a normal function: (defun ! (n) (fact n 1 1)) #| --> ! |# (! 10) #| --> 3628800 |#
<codecaveman> yes i would
<pjb> codecaveman: (defun fact (n) (loop for i from 1 to n for r = i then (* i r) finally (return r))) (fact 10) #| --> 3628800 |#
<codecaveman> I just wanted to know if its possible to solve it with only two args
<pjb> The recursive function with accumulator is equivalent to this loop anyways. The compiler can generate exactly the same code for both!
<codecaveman> thanks
<phoe> unless you have a clever trick of sorts to encode three numbers inside two numbers, probably not
<phoe> or unless your function is not tail recursive
<_death> ldb :)
<phoe> (and/or closes over values)
codecaveman has left #lisp [#lisp]
<daphnis> i'm trying to use accessor functions instead of slot-value, but since what slot to access is to depend on arguments, i'm trying (setf (funcall . . . and that doesn't seem to work: "The function (setf funcall) is undefined . . ."
<_death> you can setf apply
vms14 has joined #lisp
vms14 has quit [Changing host]
vms14 has joined #lisp
<phoe> daphnis: what are you trying to call?
<phoe> what are you trying to set?
<phoe> if the accessor looks like (foo bar baz quux), then you should be able to (setf (foo bar baz quux) new-value)
<_death> hmmm.. but yeah, the answer should likely be that you should pass (setf foo) to funcall
<daphnis> yeah, but i want to give the name of the accessor function as an argument to the function that sets it
<Odin-> ... as noted in the original question.
<engblom> When being in repl, is there anything I can write to see the source or description of something. For example if I want to know what arguments map is taking, can I check it from repl?
<pjb> daphnis: (defun function-that-sets (writer object) (let ((new-value 42)) (funcall writer new-value object))) (function-that-sets (function (setf answer)) question)
<_death> engblom: (describe 'map)
<pjb> (defclass question () ((answer :accessor answer))) (let ((q (make-instance 'question))) (function-that-sets (function (setf answer)) q) (answer q)) #| --> 42 |#
<pjb> daphnis: ^
<engblom> _death: Thanks!
<pjb> engblom: also: (documentation 'map 'function) or (documentation 'map t)
<pjb> daphnis: an accessor, it's two functions a reader and a writer…
<engblom> pjb: Thanks!
<_death> if you're using slime, I saw this recently: https://github.com/mmontone/slime-doc-contribs
<pjb> daphnis: with setf apply you need to put (function accessor) literally in the apply place: (let ((q (make-instance 'question)) (a (function answer))) (setf (apply a (list q)) 42)) #| ERROR: Setf of Apply is only defined for function args of form #'symbol. |#
<pjb> (let ((q (make-instance 'question))) (setf (apply (function answer) (list q)) 42) (answer q)) #| --> 42 |#
<pjb> daphnis: so it cannot work in your case (if the accessor is a parameter).
<pjb> engblom: you can also know what argument an operator take, just by typing (map spc in a lisp/slime buffer. Then slime will query the lisp image, and display the required arguments in the minibuffer.
<pjb> daphnis: what are you trying to do, why do you have the accessor in parameter?
<daphnis> so i probably need to use slot-value then? and then it seems that i need to export each slot symbol in order to use the function in a new package. maybe i just put more into one package.
<pjb> daphnis: perhaps you're doing meta protocol stuff, and using the slots directly with slot-value is the right thing in your case. It depends on what you are doing. What are you doing?
<pjb> If the function needs access to the slots, it should be in the same package!
<pjb> It should probably be a method!
<daphnis> yeah, it is a method
<pjb> But again, it depends on what you're trying to do, but this seems to be a state secret.
<daphnis> no, i'm just thinking of how to put it
<engblom> Is there something that is between let and setf, so the scope is limited to the whole function rather than either having a limited scope as in let or then a global variable as in setf?
shifty has quit [Ping timeout: 268 seconds]
<pjb> engblom: what's wrong with (defun foo () (let (…) …))?
shifty has joined #lisp
<engblom> I am asking because I would want to write some code that would require a lot of nested let, and making the variables scope to be the whole fucntion would be handy in this case.
<pjb> engblom: you can also define function local variables with &aux in the lambda-list, but we usually reserve this for macro expansions, since it let you add local variables without having to deal with docstrins and declarations.
<no-defun-allowed> Maybe use LET*?
<pjb> (defun foo (… &aux x y z) (setf x 1 y 2 z 3) (list x y z)) (foo 42) #| --> (1 2 3) |#
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
<pjb> but we prefer the (defun foo (…) (let ((x 1) (y 2) (z 3)) (list x y z))) style (foo 33) #| --> (1 2 3) |#
amb007 has quit [Read error: Connection reset by peer]
<pjb> engblom: also, note how nice LET is, since it lets you bind values to the variables. So you don't need setf.
monolithic has joined #lisp
orivej has quit [Ping timeout: 246 seconds]
<daphnis> i have an object representing a letter and the slots represents various features, like case, accent, name, etc. the method changes one of those features. e.g. (furnish ltr :acute) should lead to the accent slot's being set to :acute
<engblom> no-defun-allowed: Because I would need to do (let ((some thing)) (do-something else) (let((more things)) (do-again-something-else))
<engblom> With only a single assignement per let.
<pjb> daphnis: in that case, I would use case.
amb007 has joined #lisp
<daphnis> pjb: wouldn't slot-value be a lot simpler?
<pjb> (defun furnish (letter trait value) (ecase trait (:case (setf (casse letter) value)) (:accent (setf (accent letter) value)) (:name (setf (name letter) value))))
amb007 has quit [Read error: Connection reset by peer]
<pjb> daphnis: perhaps instead of writing (furnish letter :accent 'grave) you could just write (setf (accent letter) 'grave) ?
<pjb> daphnis: what's the point of furnish beyond setting the attributes of the letter?
amb007 has joined #lisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
<pjb> daphnis: where do the trait and value come from? If that comes from a data file, it's an external source, and it should be validated. This is what ECASE does: if we get a bad trait, it signals an error. And you cannot set slots that are not in the list of cases.
amb007 has quit [Read error: Connection reset by peer]
<pjb> daphnis: using slot-value wouldn't have those protections.
<engblom> What do you think about me using (let ((x nil) (y nil) (z nil)) (some code) (setf x something) (some code) (setf y something) ... )? That would make local variables, but not requiring a lot of nested let.
<pjb> daphnis: now, if there was a lot of cases, or if they were "dynamic" because you'd have different classes, perhaps not know at compilation time, we could have a data structure to map trait keywords to accessors, but we would still go thru this validation and control.
amb007 has joined #lisp
<pjb> engblom: (progn (some code) (let ((x ix) (y iy) (z iz)) (something-else x y z)))
<pjb> note how shorter it is.
<pjb> engblom: and often the progn is not needed, since we have some outer implicit block.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
<pjb> engblom: you can also use let*
<pjb> engblom: (let* ((x (compute-x)) (y (compute-y x)) (z (compute-z x y))) (do-something x y z)) so you can have some code between the binding of the variables with let*.
<pjb> engblom: (let* ((x (progn (something) (compute-x))) (y (progn (something) (compute-y x))) (z (progn (something) (compute-z x y)))) (do-something x y z))
amb007 has quit [Read error: Connection reset by peer]
<daphnis> the traits don't come from an external source. one other thing the furnish method does is that it determines the trait based on the value (if only one trait can have that value)
<engblom> pjb: In this case each definition of let will have a side effect: it will place a form element on a site and the reference to the element is assigned to the variable. Because of that I need to add some code between (spacers, layout, text, etc) between each assignment with let.
<pjb> engblom: typically, when you have to initialize some complex objects, you have to use some mutation. then you can do:
amb007 has joined #lisp
<daphnis> pjb: but you may be right that i could do without it
<pjb> engblom: (let ((rt (let ((rt (copy-readtable))) (set-macro-character #\a (lambda (s c) (char-upcase c)) rt) rt))) (let ((*readtable* rt)) (read-from-string "abc"))) #| --> abc ; 3 |#
<pjb> daphnis: note that even if furnish needs to do something more, this is something you can also do by writing eg. :after or :before methods on the accessors.
<engblom> pjb: So (let ((olt (create-select ....))) ....) would create a dropdown list on the site, and I can read the value by doiing (value olt). But to create a real layout on the site I need to add some more stuff between the form elements, so I am not able to add everything inside of a single let without some tricks.
<pjb> daphnis: eg. (defmethod (setf accent) :before (new-accent letter) (incf *accent-count*)) (defmethod accent :after (letter) (print 'yay))
<pjb> engblom: well, if you call let or progn tricks…
<pjb> engblom: now the thing is that the rule of evaluations in CL are very precise. macros and special operator explicitely specify in what order, and in what scope each subexpression is evaluated, and for function calls, the arguments are evaluated from left to right. Therefore you can wrap any subexpression in a prog1/prog2/progn to add side effects before and/or after computing the subexpression.
<engblom> pjb: Thank you, progn might be the easiest solution in this case
<pjb> And some functions are specified to return their argument on purpose so you can write stuff as : (let ((x 42) (y 33)) (print (+ (print (* (print x) 4)) (print y)))) #| 42
<pjb> 33
<pjb> 168
<pjb> 201 --> 201 |#
igemnace has quit [Quit: WeeChat 3.1]
<pjb> engblom: print is used like that routinely when debugging. But you can use prog1/prog2/progn and add any side effect.
<pjb> or even let/let* if you need temporary variables.
<daphnis> pjb: thanks!
<pjb> (let ((x 42) (y 33)) (+ (* (let ((x/2 (/ x 2))) (+ (expt x/2 2) (expt x/2 1/2))) 4) y)) #| --> 1815.3303 |#
<pjb> daphnis: you're welcome.
<pjb> engblom: and vice versa. If you have an expression too complex, you can always put (defun sub (x) …) around a subexpression and replace it with (sub x)
Adamclisi has quit [Ping timeout: 245 seconds]
<pjb> (defun sub (x) (let ((x/2 (/ x 2))) (+ (expt x/2 2) (expt x/2 1/2)))) (let ((x 42) (y 33)) (+ (* (sub x) 4) y)) #| --> 1815.3303 |#
<pjb> engblom: sexps are very easy to manipulate in the editor, and since lisp operators are very orthogonal, the code (which is actually data) is very maleable.
<pjb> engblom: there are only expressions, and and very little syntax in macros and special operators (eg. you cannot put an expression instead of the name of a variable in a LET; but apart from those few exception, you can put any expression in place of any subexpression.
<pjb> engblom: (if (< delta 0) (- b (sqrt (- delta))) (- b (sqrt delta))) --> (- b (sqrt (if (< delta 0) (- delta) delta))) or even --> (- b (sqrt (funcall (if (< delta 0) (function -) (function +)) delta)))
<engblom> pjb: Thank you! Now I would only need an easy way to send stuff from vim to repl. Now testing stuff has been taking time because every time I made a change I have been (ql:quickload :my-project) in order to update repl, and I have not been able to test any function that is not external.
<pjb> engblom: well, the easiest way, is to type :!emacs RET
<pjb> engblom: there's a slimv but it may be old and bitrotten. Better use emacs and slime.
slyrus has joined #lisp
slyrus has quit [Ping timeout: 252 seconds]
<engblom> pjb: I wonder if using some vim emulation in Emacs would cause any shortcut conflicts if using Slime?
vms14 has quit [Quit: Bye]
vms14 has joined #lisp
shifty has quit [Ping timeout: 252 seconds]
shifty has joined #lisp
<engblom> Is this still valid, as it is from 2016? https://fouric.github.io/posts/2016-05-20-getting-set-up-with-emacs.html
ukari has quit [Remote host closed the connection]
ukari has joined #lisp
shifty has quit [Ping timeout: 268 seconds]
shifty has joined #lisp
<edgar-rft> Common Lisp is more than 25 years old and Emacs is more than 40 years old, so 2016 is like yesterday in other programming languages :-)
layerex has quit [Quit: Leaving]
shifty has quit [Ping timeout: 240 seconds]
Bike has joined #lisp
cage_ has joined #lisp
<engblom> I got emacs installed. In vim I would use :set background=dark to automatically change the colors of highlightning to be readable on a dark background. Is there something similar that can quickly be done in Emacs. Right now I can not read the code with my poor eyes (when running emacs -nw).
<_death> color-theme-select
<beach> pjb: Common Lisp uses pass-by-value.
<beach> Wow, I wish I hadn't been absent.
<beach> Nilby: The semantics is always "uniform reference semantics".
<_death> engblom: well, apparently color-theme is the old, deprecated, obsolete, ex-parrot way nowadays.
<beach> engblom: I am sorry my fellow #lisp participants probably confused the hell out of you.
<engblom> beach: I still think I got the answer :)
<beach> Oh, good. I guess I can't take a break anymore. :)
cer-0 has joined #lisp
<jmercouris> what does it mean anyways to say Lisp uses "pass by x" anyways
<jmercouris> in the context of C I can understand it
<beach> Pass by value means that arguments are evaluated bore a function is invoked.
<jmercouris> I don't see how this applies in Lisp
<jmercouris> beach: aha!
<beach> nothing else.
<jmercouris> I see, but aren't they just nested forms?
<jmercouris> so of /course/ they are evaluated
<jmercouris> so if I do (funcx (qrt)), (qrt) must be evaluated first
<beach> Yes, most languages use call-by-value semantics.
<cer-0> Yup, exactly
<beach> But some weird languages, like C++ and Pascal (with VAR) use call by reference.
<jmercouris> how could (qrt) not be evaluated?
<jmercouris> I don't even understand why that would be possible
<beach> C++ with & parameters.
<beach> It means that you don't evaluate the argument, and instead you pass a reference to a place (or an l-value).
<jmercouris> seems idiotic
<jmercouris> what would be the reasoning behind that?
<jmercouris> performance?
<jmercouris> making programs convoluted?
<beach> It is idiotic, but necessary because they don't use "uniform reference semantics".
<jackdaniel> jmercouris: (qrt) is not evaluated, when it is an argument to a macro
<jmercouris> jackdaniel: that's true, but unrelated to what we were talking about
<jackdaniel> this is simply part of the common lisp evaluation rules, not something "natural" or obvious
<cer-0> IIRC there are some cases when you don't apply this behaviour, take cond for example if you write incorrect code after a valid clause they won't be evaluated.
<jmercouris> I am pretty sure it is natural AND obvious
<beach> Oh, more confusing the hell out of people, great!!!!
<jackdaniel> it is related, because you present it as some natural consequence of some unspecified rule of the universe
<jmercouris> In my eyes, it seems very natural
<jmercouris> perhaps we conceptualize the world differently
<jmercouris> I couldn't see it any other way
* jackdaniel will back down to not confuse people hell out and leave the explanation to beach and jmercouris
<beach> jmercouris: So, C and C++, when you call a function with an "object" will copy the object by default.
<beach> jmercouris: Because C and C++ distinguishes between "objects" and "pointers".
<beach> Let's call that "copy semantics".
<jmercouris> right
<jmercouris> but why? what is the purported advantage?
<beach> So if you call a function with an object, the object will be copied before it is passed to the callee.
<beach> It has to be that way, because they don't have automatic memory management.
<jmercouris> I've never been programming Lisp and thought "Man, if only I had pointers that way"
<beach> Otherwise, they can't know whether an object is live or not.
<jmercouris> is it not possible to make a language without a GC without pointers?
<beach> So they have to copy in order to make sure that the number of references to an object is always 1.
<beach> Sure, but such a language would be pretty useless.
<beach> You could not represent a graph with cycles in such a language.
<Bike> imagine a struct that's small enough to fit in two registers. if you pass it to a function, it's passed in registers without memory being touched. if that function alters a field, it just alters a register. when the function returns, the caller registers are restored from the stack, so the struct in the caller is what it was before the call. ergo, the object is "copied"
<jmercouris> you would need a reference, and simply reinvent pointers in some way
<jmercouris> I see
<Bike> C++ then adds copy constructors and move constructors and prvalues and xvalues and my god it just keeps going
<beach> So, as Bike says, the other consequence of "copy semantics" is that a function can't modify an object that you pass to it, because it is always copied.
<jmercouris> hm, I see
<beach> That's why C++ needs to be able to call by reference.
<Bike> the concept of a "move constructor" is basically what beach is talking about with the number of references only being one. if you "move" an object instead of "copying" it, the old thing referring to it no longer does
<Bike> the semantics are pretty confusing, but that's what you need to do to keep this stuff up efficiently, i guess
<jmercouris> I'm glad to not be a C++ developer today
<beach> Yes, it is necessarily confusing because of the lack of automatic memory management and all the consequences that follow from that decision.
<beach> So, to me, the only sane programming model is "call-by-value" and "uniform references semantics" which is what Common Lisp uses, no matter what other people here might say.
<beach> Granted, most modern languages do the same thing, perhaps with a few exceptional cases like Java that handles machine integers differently, or it used to.
<beach> It is quite amazing to me the snowball effect that lack of automatic memory management creates.
<jmercouris> yeah, pretty fascinating
snits has quit [Ping timeout: 240 seconds]
snits has joined #lisp
<beach> Nilby, pbj: In my opinion, it is pedagogically unhelpful to bring up the performance hack that immediate objects such as fixnums and characters use, since those objects are immutable. The semantics would still be "uniform reference semantics". At least, it is unhelpful to someone who has no clue. You can bring it up when they start asking about references to small objects like characters.
<pjb> Agreed.
saganman has joined #lisp
saganman has quit [Changing host]
saganman has joined #lisp
<pjb> (Yes, I was confused about the pass by reference / pass by value, sorry).
<jmercouris> We all make mistakes, I do it basically nonstop
ukari has quit [Remote host closed the connection]
<pjb> jmercouris: (qrt) could be not evaluated in a lazy language; or if it was a place, and if lisp used pass-by-reference (of places).
ukari has joined #lisp
<Nilby> Yes, but I'm not sure saying "uniform reference semantics" or just saying "pass by value" will help someone familiar with C++. I think the problem with explaining is Lisp is defined by semantics, while C is defined by memory contents and addresses. The closest I can think of to relate to C is that lisp objects are tagged unions with internal pointers which are passed by value, but may have a bunch of built-in access methods
<pjb> jmercouris: the pass-by-reference is normally used for output or in/out parameters. In languages like pascal, modula-2 modula-3, ada, etc.
<jmercouris> I think the best thing to do is wipe your mind when learning lisp
<pjb> jmercouris: note that those languages don't have multiple value results…
<jmercouris> and pretend you've never programmed in your life
<jmercouris> my biggest mistake in the beginning was taking concepts from other programming languages and attempting to apply them
<pjb> in lisp since we have multiple-value results (or we can easily return lists like in emacs lisp), in/out or output parameter are not needed.
wsinatra has joined #lisp
<jmercouris> it's a natural thing to do
<jmercouris> people wish to learn by translation
frost-lab has joined #lisp
<jmercouris> but it is not always possible to translate every word or concept from one language to another
<jmercouris> the biggest problem is that so many programmers, myself included are monolingual (I was, at least)
<jmercouris> perhaps we know 5, 10 languages, but they are all different flavors of the same algol dialect
<pjb> jmercouris: in C, we use pointers to the variables to do that, so it's explicit (but also confusing is that a pointer to a variable for an output parameter, an in/out parameter, or is that just a pointer as input parameter?). So C++ has & references to distinguish it from input pointers.\
<jmercouris> I used many languages before Lisp, and they were all the different, but the same
frost-lab has quit [Client Quit]
<pjb> jmercouris: but of course, C++ and C++ programmers also complexify things up with copy semantics and stuff like that so that references are also used in more "subtil" ways.
<beach> Nilby: It is hard to help people who don't bother to learn standard terminology in the field.
<jmercouris> pjb: subtle*
<beach> Nilby: The only way I can see how to do that, is to start by teaching them such terminology.
<pjb> With lisp, smalltalk, modula-2, prolog, haskell you cover most of it.
<jmercouris> and pronounced "suttle"
<jmercouris> is it "subtil" in French?
<pjb> jmercouris: right. Sometimes by braintranslate skip words, sorry.
<pjb> Yes.
<jmercouris> seems like a French word
<phoe> beach: the main issue is that "pass-by-value" is an overloaded term
<beach> phoe: It is not. Never has been. Never should be.
<beach> It just means that arguments are evaluated before passed to a function.
<jmercouris> I see beach is a fan of double spaces after a period
<beach> Sorry. Old habit.
<beach> From Emacs.
<phoe> beach: yes, it is: in C++, "pass-by-value" means "but alo copy the parameter"
<beach> phoe: Nope, it is not C++ specific. It is simple computer science.
<jmercouris> are we engineers, computer scientists? developers?
<beach> phoe: What the object is that is passed to the callee is an orthogonal issue.
<jmercouris> beach: what do you say?
<Nilby> beach: Also, the first link when searching for "uniform reference semantics" is written by you.
<beach> That is why I use "uniform reference semantics" for that orthogonal issue.
<jmercouris> Nilby: your search results may be customized based on your prior search history
<beach> Nilby: I am well aware that I invented the term.
<pjb> phoe: well, in C copied values are limited to words pushed to the stack, so usually only numbers characters and pointers are copied. But more recently, small structures too (and returned). But in C++ whole objects and structures can be copied. And with the funny thing that if you pass an instance of a subclass, only the slot of the superclass (declared for the parameter) are copied! So you can have half objects!
<beach> Nilby: But when I did, there was nothing else to explain it.
<pjb> This is all silly, and the only reasonable way to program in C or C++ is to use pointers for everything, and start greenspunning.
<phoe> beach: yes, that's the part that is troublesome - answering "Lisp is pass-by-value" does not solve the whole problem
<beach> phoe: Which is why I always bring up "uniform reference semantics" at the same time.
hypercube has joined #lisp
<pjb> Hi, 4-dimensional being!
<pjb> How do you project today?
<jmercouris> we are only three dimensional beings
<Nilby> Maybe we should just tell people to read that when the question comes up.
<jackdaniel> forever young
<jackdaniel> forever static
<pjb> jmercouris: not hypercube.
<phoe> Nilby: a long research paper is hardly a good answer to a simple-seeming question
<pjb> jmercouris: also, since the general relativity we know that we live actually in a 4-dimensional space, and we're interconnected 4-dimensional breads.
<phoe> there should be a distilled version somewhere
<beach> I am tempted to write one.
<pjb> phoe: distilled: 42. the details: millions of years of computing and inferencing…
Eoco has quit [Ping timeout: 240 seconds]
duuqnd has quit [Ping timeout: 260 seconds]
xkapastel has joined #lisp
<phoe> beach: so am I; if you feel like it and have the cycles, please do so
<beach> *sigh* I'll try.
<beach> I can whip something like that up in no time at all, but then there is the drudge: turning into HTML or something like that, figuring out where to put it. Insert references, emphasis, blablabla.
duuqnd has joined #lisp
<phoe> beach: I can edit it
<Bike> i've found markdown pretty good for writing without thinking about that stuff too much
<Bike> wouldn't be good for like an actual paper probably
<phoe> this, me too
<jmercouris> I've found ORG mode to be best
<jmercouris> I just write in org mode, and then org->html via that one haskell program
<jmercouris> can't remember the name...
<Bike> org's good too. i don't know how to put it into html though.
<jmercouris> it's an org mode file converted
<jmercouris> pandoc, there we go
<jmercouris> the program is called pandoc
waleee-cl has joined #lisp
pranavats has joined #lisp
long4mud has quit [Quit: WeeChat 3.0.1]
snits has quit [Ping timeout: 260 seconds]
orivej has joined #lisp
aeth has quit [Ping timeout: 252 seconds]
snits has joined #lisp
aeth has joined #lisp
Inline has joined #lisp
<engblom> I just got Emacs setup and want to begin coding. How I am supposed to load a package so I can access even the functions that are not exported from repl?
<phoe> oh right! I forgot to link this one
hypercube has quit [Quit: WeeChat 3.1]
ebrasca has joined #lisp
monolithic has left #lisp ["Leaving"]
hypercube has joined #lisp
Sheilong has joined #lisp
<engblom> I mean, I have a project under ~/common-lisp/gpon (with gpon.asd in that directory and the source files under ~/common-lisp/gpon/src). Now when editing src/main.lisp I can not compile the whole file with C-c C-k because then it fails to compile, even thou (ql:quickload :gpon) works great and I can run the external functions after that. How do I correctly load a whole package in Emacs+slim, so I also can
<engblom> access the internal functions?
<phoe> hmmm
<phoe> do you have IN-PACKAGE on top of your file?
<jackdaniel> engblom: put (in-package #:asdf-user) in top of the asd file
<phoe> what is the concrete error that is being signaled?
vms14 has quit [Quit: Bye]
<jackdaniel> it is dubbed as a bad thing by the previous asdf maintainer, but oh well
theBlackDragon has quit [Read error: Connection reset by peer]
<jackdaniel> ah, nevermind, I misunderstood the problem
vms14 has joined #lisp
<engblom> phoe: "The name "ALEXANDRIA" does not designate any package."
<beach> engblom: You may have to ASDF or Quickload the Alexandria system first.
<phoe> engblom: do you have ALEXANDRIA in your ASD file's DEPENDS-ON?
<beach> phoe: I went a bit overboard. That text could be split into two different parts with one referring to the other.
<phoe> beach: I'm hacking something up right now
<beach> phoe: Something you wrote, or something derived from mine?
<phoe> beach: my own
<beach> Oh, I could have avoided the effort. Oh well.
<beach> I'll just go prepare dinner instead.
<phoe> I'm trying to note down my own idea for it, and then I'll take a look at yours too
<beach> What a day! *sigh*.
<phoe> it'll be good to have another mind try and tackle this problem independently
<Xach> Please, no more than two minds
<phoe> okay, just me and beach then
slyrus has joined #lisp
ljavorsk has quit [Ping timeout: 240 seconds]
<engblom> So what is the exact procedure that I should do to be able to send stuff over to Slime REPL from emacs? Is it first adding (in-package #:asdf-user), as jackdaniel suggested, then once (ql:quickload :gpon)?
<phoe> I don't think so
<phoe> when I want to hack on e.g. phoe-toolbox, I do (ql:quickload :phoe-toolbox) and then open up one of its source files
<phoe> I write my stuff, then hit C-c C-k, and everything gets compiled just fine
slyrus has quit [Ping timeout: 252 seconds]
<engblom> I got it to compile, but can still not access the functions that are not exported.
<phoe> not exported from where?
<phoe> and access from which package?
<engblom> phoe: The source file is having a defpackage where I export main: (:export :main)
<phoe> so something like (defpackage :my-package ... (:export :main)), right?
<engblom> Yes
<phoe> so from CL-USER you should be able to 'my-package:main
<phoe> and this should not signal an error but instead return the symbol
<engblom> Yes, that I am able to do
<engblom> But I can not test any other function I am currently working on.
<phoe> that's the whole point of exporting things
<phoe> you only export stuff that you want other people to use
<phoe> there are two solutions to that
<phoe> 1) (in-package :my-package)
<phoe> this way your REPL will jump into that package, and you will be able to freely access internal symbols of that package
<phoe> 2) use the doublecolon like my-package::foo when accessing internal symbols
<engblom> phoe: Thanks! Now I think I will get an acceptable work flow. I get to test the stuff much faster, without having to export everything I write (except for what will need to be exported in the end product).
<phoe> yes, that's the point of IN-PACKAGE
<phoe> when you're working on code a given package, it's often beneficial to have the REPL in it exactly for this reason
<phoe> when e.g. doing testing it's worth to jump out of that package, even if only to ensure that the tests are not using unexported functionality and that all symbols that should be exported actually are exported
<engblom> Ok
<engblom> Thank you, you have been to much help!
<phoe> no problem
<phoe> now let me quickly hack up this blogpost sketch before beach returns
<beach> I am here, and I am observing you... :)
<phoe> !!!!!!!
* phoe puts on a fake moustache
<beach> No need. I haven't seen you after the haircut.
<engblom> I have been using cl-project for creating the project skeleton. Each time I create a simple project for experimenting I need to edit the asd file or I will not be able to compile with just asdf:make. Is there a better alternative for creating a project skeleton?
<beach> I don't see the point, really. Projects are not created often, and they all have a different set of file, barring perhaps two such files.
<vms14> engblom: having lisp in your hand, should be easy to make your project builder
<vms14> and would fit your needs much better
<engblom> I guess I am a bit spoiled by lein for clojure...
<beach> You need a my-project.asd file and packages.lisp file. The only thing that you can create by default is the name of the project in the ASDF file, the name of the package in the packages.lisp file, and a singe line in the ASDF file containing (:file "packages").
<engblom> vms14: Yes, I might do that
<vms14> you could try to reproduce that behavior
<beach> It take literally a minute to do.
<vms14> the nice thing of trying other stuff is that you learn new concepts and can apply them later
dickbarends has quit []
<phoe> engblom: I use quickproject
<phoe> (quickproject:make-project #p"~/Projects/Lisp/foo") and then I modify everything else by hand
<engblom> Yes. I with Clojure I just do "lein new whatever-name" for creating a libary skeleton and "lein new app" for making something that will even have a main function and everything ready for compiling something I can run. Lein even takes care of uploading the library to clojars so other can depend on it (in a similar way as with quicklisp).
<vms14> engblom: taking lein as a reference, you could create a nice project builder that would be useful for other lispers
<phoe> IIRC then some roswell people have tried to make something like this
<phoe> I don't know how well they've succeeded though
<vms14> I suppose the main goal of a project builder is just to create boilerplate
aindilis has joined #lisp
orivej has quit [Ping timeout: 240 seconds]
daphnis has quit [Ping timeout: 240 seconds]
<engblom> phoe: Right now I am doing some coding for my workplace and I picked to write it in lisp because I want to learn lisp. Previously I have been coding Clojure, but my motivation for switching from Clojure to Lisp is that programs written in Clojure are very slow to start up on Raspberry Pi. Rosewell will not work at all on Raspberry Pi.
<phoe> yes, I see
<pyc> engblom: Are you your own boss at your workplace? or are you working for an employer? curious how you gained the consensus to write your projects in Common Lisp.
<jmercouris> there is not a lot of boiler plate in Lisp, no need to have a project builder beyond the scope of quickproject
<jmercouris> in my opinion, of course
<engblom> pyc: No, I am not my own boss. This project is a smaller side project as I am not working as a developer.
<phoe> this is a quickly hacked article, I will finish it later today - I need to run and do ELS stuff now
<phoe> please review and leave your remarks here or on github (even if you're not beach)
<vms14> jmercouris: I guess the real reason we don't need boilerplate is the lack of libraries
<jmercouris> how did you come to that conclusion?
<vms14> once you use a library you need to add some init code or alike
<jmercouris> what?
<jmercouris> That is not my experience at all
<vms14> :O
<beach> phoe: Common Lisp is definitely call-by-value.
skapata has joined #lisp
<vms14> for example opengl libraries
<phoe> beach: yes, and I mention that in the chapter while explaining why I coin a different name for that term
<beach> phoe: Call-by-value means that the arguments to a function are evaluated before passed to the function. Nothing else. You can't claim Common Lisp is doing something else.
<phoe> (mostly because the term is already abused by C++ which implies copying, and we don't do visible copying in CL)
<beach> I give up. Do what you want.
<phoe> I mean, I don't know how to solve the problem where I call C++ call-by-value and Lisp call-by-value and then they do different things
<beach> I think it is a huge mistake to cater to people who don't respect terminology that has been standard for 6 decades.
<beach> The do exactly the same things.
<phoe> I think it's a huge mistake to not cater to people who are in the huge majority and would simply like to understand how CL is different from C++
<beach> They both evaluate the argument before passing it to the function.
<phoe> yes, and then mutating that argument gives different results
<phoe> that's not exactly the same thing
<beach> So we bend over and discard 6 decades of terminology for these people?
<beach> Fine.
<Odin-> Well, at the time they discarded it, it had only been standard for a decade or so.
<beach> call-by-value has absolutely no other meaning than the fact that arguments are evaluated before the function is called
<phoe> yes, we do, a huge chunk of the programming world has already partially done that to the point where even Wikipedia mentions that the term is ambiguous
<phoe> that's my opinion
<vms14> I'll never understand why people fights just because terminology
<beach> Fine. I'll go fix dinner instead.
* phoe sigh
<phoe> bon appetit
<beach> vms14: Because otherwise there are interminable debates about the implications.
<phoe> vms14: mostly because inter-human communication is a hard problem that is never solved and is never going to be fully solved
<vms14> it's just the "I have the reason in this term" fight
<phoe> ;; unless we go extinct
theBlackDragon has joined #lisp
<Odin-> phoe: He does have a point in that it's worth noting that the C(++) understanding is not by any means complete.
nij has joined #lisp
daphnis has joined #lisp
<phoe> vms14: we have terms like foo that we first need to define and second need to redefine when there's other people who have their own definitions of foo
<beach> I guess we can also say that Common Lisp is interpreted, because that's what the interaction means, right?
<phoe> Odin-: I think I mention that in the first C++ part
<phoe> but, hmmm
<phoe> I wonder if I can find a name that works better
<phoe> OK, updated https://gist.github.com/phoe/c48b34275cf40bece9dbc5e555555214 - should be a bit better now
<Odin-> phoe: I suspect that part of the problem is that people now think of C as a low level language.
<phoe> Odin-: huh? what does it have to do with parameter evaluation?
<pjb> Actually lisp is also a low level language. If you remove all the macros, and use only special operators and functions… And macros, are just add-on in the standard library (CL package), or from other libraries…
<pjb> try to use tagbody and things like (rplaca k a) vs (setf (car k) a) (ie no setf -> setq), and soon it'll feel like programming in assembler.
<Odin-> phoe: If you think the C compiler and runtime libraries aren't doing fancy stuff for you, it becomes easy to assume that the way that system works is how things are by default and everything that works differently is doing extra work.
<Odin-> pjb: You did notice that I implied that the idea that C is low-level is _wrong_, no?
<pjb> Odin-: Yes. I give you arguments.
<vms14> there will always be different opinions
<vms14> there is people who likes java, for example
<pjb> Odin-: now you can make a comparison of the low-levelness of C and Common Lisp, (and perhaps other languages), and come to the conclusion that it's a matter of libraries and of point-of-view, and that it doesn't mean much.
<vms14> I cannot understand why, but they cannot understand why I like lisp
<vms14> could try to explain why, and they could try to explain too, but no one will understand anyway
<pjb> As for the bits, DPB and LDP are way lower level than << >> | ^ ~.
<pjb> or more precisely, they are better operators to work on bits than what C proposes.
<vms14> and everything is subjective
<vms14> for example java is better is you want to find a job quickly
<vms14> even if you will suffer every day
<nij> vms14 yes you're right and the only thing we can do is to make lisp stronger
<nij> or go make some money and fund lisp when you are successful
<vms14> nij: I'd love if lisp had the same power in market as java does
<Odin-> pjb: So you'd prefer that I say "well, Lisp is low-level too" above "C isn't low-level"?
<vms14> and cannot even understand why not
<vms14> just imagine lisp courses, and enterprises hiring junior lisp devs
<phoe> Odin-: they are doing fancy stuff under the hood, yes - but not in case of passing parameters
<pjb> Odin-: well, forget about low-level. We can agree that C can be used more easily to write code for micro-controllers than lisp. There's even a C substandard for that: n1169
<pjb> Odin-: coding for microcontroller in CL would involve, for the most practical way, writing a code generator and a compiler of a subset of lisp, like GOAL.
<Odin-> pjb: You have to cut less out of C than Common Lisp, certainly.
<jmercouris> how to get the ASDF version of library in a compiled image? possible?
<jmercouris> or do we need the original ASD?
loli has joined #lisp
<Odin-> But that's at least in part because Common Lisp is very comprehensive.
<jmercouris> that is, how to get the :version from a defsystem
<pjb> Odin-: but granted it's not strictly sensu a property of the language, more of the tools and the ecosystems. But they come with the language too, in part.
<nij> vms14: someone may not like the answer but i think this is very true: http://www.winestockwebdesign.com/Essays/Lisp_Curse.html
<pjb> jmercouris: perhaps: asdf/system:system-version
<nij> Imagine you have 20 people in your group, and you are the manager. Now imagine there are 40 groups like this in a team.
<jmercouris> right, but will that work without being able to find-system?
<jmercouris> (asdf:system-version (asdf:find-system :cl-cffi-gtk))
<jmercouris> I might as well just try it
<nij> Too much freedom is good potentially, but it also allows people to do bad things.
<pjb> (asdf/system:system-version (asdf:find-system :alexandria)) #| --> "1.0.1" |#
<pjb> works for me.
<jmercouris> I was asking about in a compiled SBCL image
<pjb> jmercouris: (apropos "VERSION" "ASDF") is what I used.
<jmercouris> but yes, works there too
<nij> So while lisp is better in theory, it might not be better in the eye of a project manager.
<jmercouris> oh I see
Krystof has quit [Ping timeout: 252 seconds]
<jackdaniel> nij: people often try to blame the tool when they are unable to build the thing
<nij> jackdaniel: i understand
<jackdaniel> historical data seems to indicate, that lisp may be very succesful in a corporate setting
<jackdaniel> so there you have it
<Odin-> phoe: So what's the copying?
<pjb> nij: a project manager can easily manage the freedom of CL programmers, by defining packages to be used and forbidding other packages; and he could write the tools to check his rules trivially.
<nij> jackdaniel: you got the point too
<pjb> This seems to be also a strong ethos of Haskell, controlling the programmers…
<pjb> pfft!
<nij> pjb: but they might find it hard to hire good enough programmers to write in lisps
<phoe> Odin-: in case of C, that's allocating a proper sizeof of stack memory and memcpying
varjag has joined #lisp
<phoe> sans any optimizations that might happen, of course
<pjb> nij: IME, all the educated programmers have learned scheme at the university…
<jackdaniel> nij: chicken and egg problem - nothing to do with the language. yet, there are capable cl programmers on the market
<pjb> nij: ie. they know lisp as much as anything else.
* jackdaniel gets back to work
<loli> nij types might offset that effect even more. From what I understand the LISP machine had types everywhere
<Odin-> phoe: Which is the compiler arranging for something to be done in order to keep the semantics.
<loli> that seems to enforce more consistent interfaces among programs
<phoe> Odin-: yes, it's work that needs to be done by the compiler
<nij> I agree. I agree. I still believe there's some truth in Lisp Curse. But most likely, it might just because Lisp is not lucky enough.
<Odin-> phoe: Which is my point - a lot of people seem to be under the impression that C's semantics come about without that.
<phoe> Odin-: oh! I think I understand you better now
<loli> Might be the kind of people that are attracted to lisp. http://metamodular.com/Essays/psychology.html might help explain why?
<phoe> but before I forget - is the stuff at https://gist.github.com/phoe/c48b34275cf40bece9dbc5e555555214 better now with regard to terminology?
<Nilby> I was an impossible to control programmer before I used Lisp. Lisp just removes artificial barriers.
<loli> I think the image system of CL in particular can offer a lot of great documentation and asssitant tools that should make corporate programming a lot easier
<nij> Nilby: ! Could you share your story?
<pjb> phoe: I would start with a paragraph or two about the fundamental difference: lisp is object/value based, while C/C++ are varable/type based.
<nij> Btw, I'm reading LOL, and it says alambda isn't hygienic. I wonder if there's a hygienic version of it?
hjudt has quit [Ping timeout: 240 seconds]
<Odin-> phoe: I don't have an issue with it. I'd probably substitute 'The proper but unsatisfying answer' with something like 'In those terms, the somewhat unsatisfying answer'.
<phoe> pjb: will do
<phoe> Odin-: OK, will fix
<Nilby> nij: My story to far too lengthy, melodramatic, and not yet over. Perhaps I'll write my memoir when I can no longer write code, but more likely I'll die at a Lisp REPL.
<pjb> phoe: 42 in lisp is an object; you can have references to it; variables don't store this object, but keep a reference to it. On the other hand, in C/C++, 42 only represent various bit patterns that can be stored in variables of different types, and that are interpreted, assuming those types to correspond to integer 42 or the floating point 42.0.
<Odin-> phoe: Basically, allowing that we _are_ discussing it on C++'s terms while not conceding that those are necessarily correct.
<phoe> Odin-: yes, I understand now
<pjb> phoe: declaring types in lisp doesn't declare the type of variables or slots, but the types of the objects that are bound to those variables or slots, and without a type declaration variables can hold objects of any lisp type; those lisp types are attached to the object, not the variables or slot that can refer them.
<pjb> This is what gives the security in lisp: you cannot misinterpret bit patterns, or subvert them.
<pjb> In the worst situation, in lisp, if you removed all the program and therefore all the variables, you'd be left with a heap, that you could scan to retrieve all the live objects and their data!
zzappie has quit [Remote host closed the connection]
<Odin-> In theory, numbers aren't that different from keywords.
<Odin-> The underlying hardware just usually has more specific support for particular operations on them.
<pjb> The most you could do with a C heap, is to know the memory blocks allocated, but without the program and the typed variables, you couldn't know what type of object they represent (only guesses).
vegansbane6963 has quit [Ping timeout: 240 seconds]
<vms14> cannot really understand why you are comparing cl with c
<vms14> I suppose you guys are bored xD
<vms14> and if you want to compare them, the answer is easy: Lisp is better
<vms14> but then you need ffi
<Odin-> Because C has become the standard with which most programmers are familiar.
<Nilby> I think C is the language that gives lispers the most trouble, because it dictates how we have to interface with things outside Lisp.
nij has left #lisp ["ERC (IRC client for Emacs 27.2)"]
hypercube has quit [Quit: WeeChat 3.1]
wowzersbrain has joined #lisp
bilegeek has joined #lisp
<Nilby> If C system calls would just use take Lisp objects...
vegansbane6963 has joined #lisp
<Odin-> Nilby: Curiously, at the level being discussed here, it's not even that.
thomasb06 has quit [Remote host closed the connection]
<Odin-> Specifically, C is _specifically_ designed so that it doesn't have to deal with these issues at runtime. At all.
koolkat332 has quit [Ping timeout: 268 seconds]
<Odin-> (Which is one of the reasons it's much easier to shoot yourself in the foot using C than many other languages.)
Inline has quit [Quit: Leaving]
<Nilby> Except for things like the symbol garbage collection/tracing in dynamic linkers, runtime type information in C++,, etc.
Inline has joined #lisp
<Nilby> But yes.
<Odin-> C++ isn't C, and dynamic linkers are a whole another can of worms. :)
hypercube has joined #lisp
imode has joined #lisp
<aeth> You can actually do C-like abuse of the type system. You just have to pretend that you're talking to C when you're not, and use CFFI. https://gitlab.com/-/snippets/1830092
<aeth> Not to mention that declarations are UB and SBCL with (safety 0) probably also permits such things instead of checking (but the solution is to never (safety 0)).
hjudt has joined #lisp
<Nilby> Nice. I've see such code in implementations that can assume to know the float format too.
<DGASAU> Nilby: while I could agree that C presents not the best IDL conventions, other languages provide worse IDL conventions.
Lycurgus has joined #lisp
jeosol has joined #lisp
<Nilby> DGASAU: I agree. Name mangling comes to mind. And maybe JNI?
<DGASAU> JNI is long dead already.
<DGASAU> In my experience, interfacing between any two different paradigms is possible only through something very reminiscent of C.
<DGASAU> I had experience: CL <-> Python, Scheme <-> C, SML <-> C++ and C, Prolog <-> Java.
<Odin-> There are plenty of things to complain about with C; the calling conventions are for the most part not near the top of that list.
<Nilby> Oooh, Prolog to Java is a fun rare one. :)
<DGASAU> The best alternative approach I have seen in papers is "S-net".
gitgood has joined #lisp
gourdhen has joined #lisp
<DGASAU> All the rest usually boils down to "lets' launch XML-RPC/JSON-RPC/some-other-RPC servers and clients, perhaps bidirectional and asynchronous."
mindCrime_ has joined #lisp
<DGASAU> Or... Linda.
<Nilby> Yes, that's seems like the modern way. Ubiquitous heavy and slow.
<DGASAU> Which again is kinda reminiscent of C.
<Nilby> But certainly easier to cross adapt.
<DGASAU> If you wish to experience what it feels, I suggest that you write something trivial on top of libpq.
<DGASAU> You _can_ write C procedures that receive and produce Lisp objects.
<DGASAU> But it is no fun at all.
<DGASAU> (Right, if you wish, you can add C <-> SQL to the list above.)
<shka_> hi all
<shka_> i am seeing something unexpected with the combination of the dexador and alexandria:copy-stream
<Nilby> Right. The problem actually exists on the O/S level. e.g /proc and BSD sysctl.
<shka_> i am downloading some files from the https://hltv.org
<shka_> with dexador, and i want stream in response
<shka_> and then i simply use alexandria:with-output-to-file and alexandria:copy-stream to save the download into a file
<shka_> and it works ALMOST fine
vegansbane6963 has quit [Quit: The Lounge - https://thelounge.chat]
<DGASAU> Nilby: so far, the best approach in my opinion is proper IDL a la S-net, i.e. with non-recursive structures.
ceblan has quit [Remote host closed the connection]
<shka_> but sometimes, and this seems to happen just with the hltv, copy-stream for some reason blocks on what seems to be finish-output
<Nilby> DGASAU: S-net sounds familiar, but I can't remember. Do you have a link for it?
<DGASAU> Nilby: no, unfortunately not.
<shka_> is that at all explainable?
<DGASAU> Nilby: try searching smth like "s-net coordination language".
<DGASAU> Nilby: if you don't find it, tell me, and I'll probably find reference in some time.
<DGASAU> Nilby: actually, it comes up on top in search output. Only it seems more elaborate than what I remember from the past.
nij has joined #lisp
<Nilby> DGASAU: Thanks. I think I found it. Seems an interesting read.
vegansbane6963 has joined #lisp
<nij> Does anyone happen to know if ambrevar will release the code of his "lisp repl shell"? https://ambrevar.xyz/lisp-repl-shell/index.html
<nij> It seems that lots of magics are going on.. I wish I can play with it directly.
<shka_> i will try replace dexador with drakma
<shka_> maybe there is some weird edge case here
<shka_> because i have no idea why this happens with just this one server
<Nilby> nij: Some the magic is at https://gitlab.com/ambrevar , but much of it is emacs/sly customization.
<Nilby> shka_: I don't really know, but some servers keep the socket open, after trasmitting.
<nij> Nilby: yeah.. I'm wondering if he will release his customization
<Nilby> nij: There's quite a lot of it in dotfiles and fof, but it's difficult to use other people dotfiles like that.
<shka_> Nilby: hmmm, this sound unusual
<shka_> let's see if this will be the same with drakma
<shka_> honestly, i use dexador only because i like API better
<loli> a custom lisp shell over unix would be great
<shka_> and honestly, this is kinda stupid reason to use it
<nij> loli: did you read that post :)
<nij> the link that i gave above ^
<shka_> loli: yeah, that's what lisp-repl-shell is actually
<loli> I was skimming through it looking for examples
<shka_> i tried to use it
<loli> the old lisp machines used to auto insert the first () bracket
<shka_> it is actually a good effort, but way to easy to land into the debugger
<shka_> personally, i think that emacs eshell is not even all that stupid
<shka_> not exactly lisp repl like one would want
<shka_> but pretty darn useful
<nij> shka_ I've never been able to tap into the cleverness of eshell..
<nij> would you share why you find it useful?
* Nilby has been using a lisp shell for >10 years.
<nij> completely? you never found a need to go back to a ordinary shell? Nilby
andreyorst[m] has joined #lisp
zzappie has joined #lisp
<Nilby> No
<loli> can you call out to shell utilities easily? That seems to be the main issue
<Nilby> I can never go back now
<nij> How do you `git commit` for example?
<Nilby> yerp
<Nilby> you "git commit" by "git commit"
<Nilby> or (git commit)
<nij> You just type "git commit" in the repl?
<Nilby> or whatever
<loli> I've found with inferior-shell I really like making quick scripts in CL, though the loading of CL as a standalone script is always somehwat painful if you don't ros it up
<loli> yeah that's nice, I'm guessing you have undefined functions just search the bash path?
<Nilby> i don't because I use a git tui
<loli> and can mix and match freely like inferior, shell without any back quoting?
<Nilby> so I just type 'c'
<Nilby> or #\c rather
<nij> I'm eager to know how I get started with lisp shell......
pankajsg has quit [Ping timeout: 252 seconds]
hjudt has quit [Ping timeout: 240 seconds]
hjudt has joined #lisp
<shka_> nij: well, neither did I but the ability to pipe into emacs buffers? legit feature
saganman has quit [Quit: Leaving]
<Nilby> but you can pipe into emacs buffers from any shell
<nij> Yeah..
<shka_> huh?
<shka_> you can?
<shka_> how?
<nij> You just open a shell in an emacs buffer!
<nij> By using vterm or term.
<shka_> eh, ok
<shka_> eshell is tramp aware, that's something as well, right?
<loli> the last feature you'd need to have a nicely working lisp shell on unix, is the ability to smoothly run stuff like ncurses windows, which it seems emacs currently can't easily
<loli> at least I've had issues in the past
<nij> shka_ i'm not familiar with tramp
Krystof has joined #lisp
<nij> loli: yeah i always shy off when it comes to that, or things like ranger
<Nilby> You have to run it outside emacs to do ncurses, or use the thing that links a real terminal library into emacs.
<Nilby> I use it just in a terminal
hjudt has quit [Ping timeout: 240 seconds]
<loli> I tend not to use a base terminal too much outside of n-curses programs, and ranger
hypercube has quit [Ping timeout: 248 seconds]
<loli> I've found for scripting that sometimes I have very short bash scripts, due to how annoying SBCL treats libraries when in shell mode
<shka_> ok, btw, it seems that drakma does not suffer from the same issue
<nij> loli: what's the problem for sbcl in shell mode?
<loli> no packages get loaded, so if you use inferior-shell like I do for scripting
<loli> you have to find a kludge around it, or make a ros program
<Nilby> shka_: Good to know. but is it a bug or a feature to keep the socket open?
orivej has joined #lisp
mindCrime_ has quit [Ping timeout: 260 seconds]
<loli> so I have to do weird loading, that is often more annoying to figure out than otherwise
<shka_> Nilby: i don't know, i suspect that this is somehow related to the dexador using connection pool but i am to tired to debug this right now
<nij> You call `$ sbcl` in shell?
<nij> Why not to use slime/sly?
<loli> exec ros -Q -- $0 "$@", or using sbcl --script or something
<Nilby> sbcl is the shell, then you can run everything
koolkat332 has joined #lisp
Lycurgus has quit [Quit: Exeunt]
wowzersbrain has quit [Ping timeout: 252 seconds]
mindCrime_ has joined #lisp
andreyor1 has joined #lisp
andreyorst[m] has quit [Read error: Connection reset by peer]
Lycurgus has joined #lisp
Lycurgus has quit [Client Quit]
mindCrime_ has quit [Ping timeout: 240 seconds]
hjudt has joined #lisp
hypercube has joined #lisp
DHARMAKAYA has joined #lisp
ceblan has joined #lisp
Josh_2 has joined #lisp
<jcowan> Call by identity is good because it matches with the guarantee of putting something into a slot or variable: what comes out is eql to what went in.
<jcowan> extending "slots" to include the car and cdr of a pair, the elements of an array, etc.
nij has quit [Quit: ERC (IRC client for Emacs 27.2)]
bilegeek has quit [Quit: Leaving]
<Josh_2> anyone had an issue with emacs where it occasionally pops up saying '<keypress> is not a valid command' meaning I have to hit the key twice? Very annoying
<Josh_2> It only happens when I'm using Sly
<Josh_2> Says that in the minibuffer
sy_ has joined #lisp
<jcowan> pbaille: ##lisp is suitable for discussing all Lisps: CL, Scheme, Picolisp, you name it. It's also about the only channel where comparisons between different Lisps fits in.
aeth_ has joined #lisp
aeth has quit [Disconnected by services]
aeth_ is now known as aeth
Noisytoot is now known as \\
\\ is now known as \r\n
\r\n is now known as Noisytoot
hypercube has quit [Quit: WeeChat 3.1]
nij has joined #lisp
gigamonkey has joined #lisp
<gigamonkey> h
<gigamonkey> erp. wrong buffer.
flazh has quit [Ping timeout: 276 seconds]
jeosol has quit [Quit: Connection closed]
charles` has joined #lisp
bilegeek has joined #lisp
vms14 has quit [Remote host closed the connection]
hypercube has joined #lisp
ukari has quit [Remote host closed the connection]
contrapunctus has joined #lisp
ukari has joined #lisp
kpoeck has joined #lisp
hypercube has quit [Quit: WeeChat 3.1]
theothornhill has joined #lisp
nature has joined #lisp
gaqwas has joined #lisp
gaqwas has quit [Changing host]
gaqwas has joined #lisp
long4mud has joined #lisp
rogersm has quit [Quit: Leaving...]
hypercube has joined #lisp
beach` has joined #lisp
theseb has joined #lisp
beach has quit [Read error: Connection reset by peer]
anticrisis has joined #lisp
<theseb> Compilers in general strip the original high level source to an intermediate representation before barfing out assembly. Well since Lisp is a stripped down syntax that might be used for this intermediate representation, isn't it (sort of) true that compilers basically roughly just convert high level source to a lisp like lang and then implement that lisp source in assembly?
<theseb> By lisp i mean a TINY subset of common lisp
mindCrime_ has joined #lisp
<gigamonkey> Insofar as s-exps are a good way to represent ASTs and most compilers generate ASTs and then go from there, yes.
<gigamonkey> For some very small value of "Lisp like".
<theseb> thanks!
<theseb> gigamonkey: lisp is helping me understand and implement a basic compiler
<theseb> another feel good lisp story added to the world
andreyor1 has quit [Remote host closed the connection]
<gigamonkey> awesome!
<theseb> gigamonkey: to run lisp you need an evaluator...so i presume when people say they "compiled a program"...the executable literally has to implement an evaluation engine in assembly EVERY time?
irc_user has joined #lisp
whosit has joined #lisp
charles` has quit [Ping timeout: 276 seconds]
<gigamonkey> Not quite.
<gigamonkey> I mean, yes, EVAL is in there somewhere so you do need an evaluator.
<gigamonkey> But if you take EVAL out of the language it doesn't actually change much and then you can compile a Lisp program down to assembly with no more ability to evaluate arbitrary Lisp.
Inline has quit [Ping timeout: 260 seconds]
jeosol has joined #lisp
cage_ has quit [Quit: Leaving]
bilegeek has quit [Quit: Leaving]
jonatack has quit [Ping timeout: 252 seconds]
andrei-n has quit [Quit: Leaving]
jonatack has joined #lisp
<phoe> OK, I think I got it decently
Eoco has joined #lisp
<phoe> beach`: I think I fixed everything that I needed, please take another look
Lycurgus has joined #lisp
<Odin-> theseb: Well, you can think of the underlying processor's instruction set as the evaluation engine.
theothornhill has quit [Remote host closed the connection]
<theseb> Odin-: true
<Odin-> phoe: First paragraph has a timestamp and other remnants from IRC. :p
<phoe> Odin-: yes, that's the WIP that I still need to fix
<Odin-> ... wait, second. I can't count.
<Odin-> Just making sure you were aware of it.
<phoe> and I actually wonder if I want to talk about this in the introduction
mindCrime_ has quit [Ping timeout: 240 seconds]
<phoe> the static/dynamic typing debate and such
<phoe> it's sorta tangential to the meat of the issue - how to pass parameters, what's copied, how to assign stuff
<Odin-> Probably fits better as part of the specifics.
<Lycurgus> don't forget the "dynamic programming" equivocation
<phoe> Odin-: or as a coda
<phoe> Lycurgus: oh no
<Odin-> phoe: Or that.
susam has quit [Ping timeout: 245 seconds]
susam has joined #lisp
<phoe> edited again
<phoe> moved the paragraph in question to the end
<phoe> please boop me if I forgot to thank someone
duuqnd has quit [Remote host closed the connection]
duuqnd has joined #lisp
narimiran has quit [Ping timeout: 252 seconds]
theseb has quit [Quit: Leaving]
Lord_of_Life_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 240 seconds]
Lord_of_Life_ is now known as Lord_of_Life
hiroaki has quit [Ping timeout: 260 seconds]
<Bike> i would add an "in general" to "this involves allocating new memory" etc
<Bike> it doesn't always touch memory
bilegeek has joined #lisp
<Bike> i might also mention that the only way to detect copying is eq and that it's otherwise an implementation detail
<Bike> honestly i might not mention immediates at all
hiroaki has joined #lisp
albusp has quit [Quit: albusp]
<phoe> Bike: not mention immediates, as in?
<phoe> the only instance of the word is in the tl;dr section
<Bike> don't talk about lisp copying
<phoe> oh
<phoe> I kinda feel compelled to, because C++ people are gonna ask "what is copied then, because I really want to mutate this number like I can do in C"
<phoe> though that is actually the fact that numbers are immutable in CL
<phoe> their places might be mutable, if anything
* phoe thinks
<phoe> I mean, I talk about C/C++ copying; talking about Lisp copying makes sense to me
orivej has quit [Ping timeout: 252 seconds]
<moon-child> I don't think that, in a general sense, c++ makes sense to anyone
orivej has joined #lisp
<Bike> i mean, you could mention it as an afterthought or something
<Bike> it's just not as an important concept in lisp as it is in c
<Lycurgus> moon-child, you had to be there
nij has left #lisp ["ERC (IRC client for Emacs 27.2)"]
<ordoflammae> phoe: it seems like, if you're going to program lisp, you shouldn't want to "mutate" a number location, since that kinda' goes against the whole ideal of functional programming.
<Bike> you can't mutate numbers in C either. phoe was probably joking
<ordoflammae> Bike: It seemed like phoe was talking about mutating what number a particular variable is referencing without using that variable (pointers, etc.)
<ordoflammae> I mean, yeah, you can't actually mutate the actual number (whatever that might mean), but you can mutate a particular address location.
nij has joined #lisp
<ordoflammae> But you really oughtn't be doing that with lisp, you're kind of running against the grain of the entire language.
<ordoflammae> It's just a different language paradigm.
cer-0 has quit [Ping timeout: 260 seconds]
<nij> One thing about CLIM is that.. the interface it produces is not emacs, so all good bindings aren't usable there. Is there a way to make emacs more "CLIM-like"? If so, what kind of work should be done?
vms14 has joined #lisp
aartaka_d has quit [Read error: Connection reset by peer]
vms14 has quit [Remote host closed the connection]
<nij> Bike: is this an attempt to make an editor in which the experience is close to a lisp machine?
* nij is checking its doc..
shka_ has quit [Ping timeout: 240 seconds]
* nij cails to understand..
<nij> s/cails/fails
kpoeck has quit [Ping timeout: 240 seconds]
shifty has joined #lisp
nij has quit [Remote host closed the connection]
Lycurgus has quit [Quit: Exeunt]
<Bike> climacs is an emacs-like editor written in clim.
wsinatra has quit [Quit: WeeChat 3.1]
kevingal has quit [Remote host closed the connection]
<jcowan> gigamonkey: The Chez Scheme compiler works exactly thereseb described: each pass converts Scheme to simpler Scheme, until what's left is an S-expression representation of machine language. But every stage can be run using the Chez interpreter and produces the correct result. SO if a stage is bad, you can just leave it out until you fix it.
jeosol has quit [Quit: Connection closed]
bilegeek has quit [Quit: Leaving]
<phoe> yes, I was joking
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
<phoe> Bike: fixed it up, moved the whole paragraph into an appendix
<jackdaniel> slime incorporated some clim functionalities
<jackdaniel> most notably presentations - note that when in the repl you return an unreadable object, you still can inspect it
CL-ASHOK has joined #lisp
akoana has joined #lisp
<CL-ASHOK> Does anybody know the origin of "Made with Secret Alien Technology"
<CL-ASHOK> was it Land of Lisp?
cipherchess has quit [Ping timeout: 268 seconds]
pve has quit [Quit: leaving]
anticrisis has quit [Read error: Connection reset by peer]
gaqwas has quit [Ping timeout: 246 seconds]
dra_ has joined #lisp
dra_ has quit [Client Quit]
dra has joined #lisp
torbo has joined #lisp
shifty has quit [Ping timeout: 246 seconds]
jeosol has joined #lisp
daphnis has quit [Ping timeout: 246 seconds]
CL-ASHOK has quit [Ping timeout: 240 seconds]
kmeow has joined #lisp
<loli> how does CL deftype work with typep?
<loli> I'm trying to make (deftype list-of (type) ...)
<Bike> deftype is essentially a macro system
<Bike> when typep (or whatever) sees a type specifier defined by deftype, it uses the macro-function deftype defines to expand into a new type specifier to work with
<Bike> as such, recursive definitions do not work, because they will be expanded ad nauseum
<loli> I see
<loli> though in this case it's simple
<loli> I just want to have a generic over a non recursive type
<loli> say we have a list with some sort of type inside of it
<Bike> a generic function?
trokotech has quit [Remote host closed the connection]
<mfiano> You'll have to use SATISFIES and check the contents at runtime
<Bike> those work with classes, not types.
<loli> yes
trokotech has joined #lisp
<kagevf> engblom: you can use invert-face RET default to toggle between light and dark mode in emacs
<loli> well you can have some type declarations that are second order
<loli> for example https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node51.html they give square-matrix
<loli> however I'm unsure of how to ask if something satisfies such a declaration
<loli> it's obvious with say "(deftype list-of-strings () `(satisfies list-of-strings-p))"
<loli> (typep '("a") 'list-of-strings) => t
<mfiano> Why do you need such a type?
<loli> to give nicer doc specs, because having a function from say int to list isn't helpful
<loli> (declaim (ftype (function (context fset:map file-info-extended) list) f))
<loli> for example in this, I know I gewt a list back, but a list of what?
<loli> Ideally I can test my list-of on certain types like I have a list of ints and I can typep it
<Bike> all of the expansions in the square-matrix example eventually terminate
<Bike> if you're defining list-of in the obvious way as (deftype list-of (type) `(or null (cons ,type (list-of ,type)))), it won't terminate
<loli> yes, and the example I wish to give also terminates
<loli> no I don't need to do that
<loli> for example for a fixed type you can write
<loli> (defun list-of-strings-p (list) (and (consp list) (every #'stringp list)))
<Bike> if you're okay with the SATISFIES version you can do that.
<loli> yes, but how do I pass information into typep
<Bike> What do you mean?
<Bike> What information does it need to know?
<loli> well typep takes a string
<loli> (typep '("a") 'list-of-strings)
<loli> ideally I could say
<Bike> Sure. That should work.
<loli> (typep '("a") '(list-of string))
<loli> so I don't have to write a version for every single type
<Bike> SATISFIES works with a global function name, so you probably can't make that work, unfortunately
<loli> so I have to generate every type I care about? How do arrays work with their type specification
<phoe> I remember that someone tried to make it work with a gensym
<phoe> loli: arrays have implementation support unlike list-of
<loli> so it's special in the compiler?
<phoe> and there's a whole thing about array specialization that conses don't need to care about
<phoe> yes
<loli> what a shame, so I guess I'll make a macro definition that spits out order-1 types from a forall
<loli> doing specializtion by hand then?
<loli> wait, are functions fixed as well, cause functions can take types as well?
<phoe> types? what do you mean
<phoe> you can declare argument and return value types for functions if that's what you mean
<loli> (declaim (ftype (function (integer) integer) test))
<phoe> yes
<kagevf> great write-up local package nicknames ... thank you for that, phoe
<loli> we can state it takes an integer and gives back an integer, does this not use the same satifies system, or is it baked in like the array?
<loli> where one can't make their own version
<phoe> kagevf: I need to fix it someday
<phoe> loli: the latter
<kagevf> phoe: what's wrong with it??
<phoe> SATISFIES is the last resort of the type system
<phoe> kagevf: I don't like its rant-ish style
<loli> yeah... satisfies sadly only takes arguments with 1 argument, Maybe I can prop something together with dynamic variables to inject it?
<kagevf> oh ... I see ... thought it was useful fwiw
<phoe> sure
klltkr has joined #lisp
<phoe> I mean, I know it's useful, I got some people say it
<phoe> I just think I can make it more useful, someday™
<kagevf> phoe: right on. btw, are you a fan of "naruhodo za warudo"?
amb007 has quit [Read error: Connection reset by peer]
<loli> I tried this before: (deftype list-of (type) `(and list (satisfies ,(is-type-of type)))). Now let us try dynamic binding
amb007 has joined #lisp
<phoe> kagevf: nope, not that za warudo - but that's already #lispcafe material
<kagevf> right right ... was just curious :)
tophullyte has joined #lisp
random-nick has quit [Ping timeout: 252 seconds]
surabax has quit [Quit: Leaving]
<loli> yeah I could see a gensym approach working if you specalized the type at every single application instance you found
<loli> sadly my dynamic variable technique wasn't enough to get past satisfies
<dieggsy> is it possible to start hunchentoot in a way that does block?
mindCrime_ has joined #lisp
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
gaqwas has joined #lisp
duuqnd has quit [Read error: Connection reset by peer]
<gigamonkey> CL-ASHOK: I think Conrad Barski came up with the "Made with Secret Alien Technology" and the googly-eyed alien logo before he wrote Land of Lisp.
<loli> for those curious about the solution I have. the specalizer looks something like this. https://ghostbin.lain.la/paste/jwg6j Note that the concatenate call is incorrect because I forgot the function to coerce a symbol into a string
<Nilby> dieggsy: block until what? you could bt:join-thread on it's taskmaster thread if that's what you mean.
<dieggsy> Nilby: until i kill the thread i suppose --- that is what i mean, i think. how do i get it's taskmaster thread ?
<saturn2> loli: here's how i would do it https://ghostbin.lain.la/paste/scerb
klltkr has quit [Quit: Textual IRC Client: www.textualapp.com]
trokotech has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
<loli> does get-predicate work on lambda?
<loli> I think i tried that with another approach and it failed
<loli> ahh nevermind you are sending it in the get-predicate
varjag has quit [Ping timeout: 268 seconds]
drl has joined #lisp
cipherchess has joined #lisp
<loli> yeah let me try yours, seems more elegant, rather than having a specalizer
pbaille has quit [Remote host closed the connection]
<loli> ahh perfect that does work
chipolux has joined #lisp
<loli> this works across packages as well, no weird name kludging due to dynamic variables right?
<saturn2> yes, i believe so
<loli> how nice, we can probably make it even slightly nicer by giving it a name so the error messages are nicer
<loli> I'm shocked this works, given you just indirected the lambda
<saturn2> that would be a good idea, yes
<loli> shouldn't it complain about a not global functions ince we are just accessing the lambda inside the gethash
<saturn2> get-predicate calls compile to make it a global function if it does not already exist
<loli> ahh I see, so that's how you're cheating it
<loli> I never really called compile before, if I had I might have thought of that trick
<saturn2> get-predicate does not take an actual function, but a lambda expression
<loli> one last question, how do you use typep with types that take types like this? I never figured that one out
<loli> yes
<loli> compile with a name is what makes it global
drl has quit [Quit: Leaving]
<saturn2> i'm not sure i understand your question about typep
<loli> well in the old way with a deftype of no arguments you can write
<loli> (typep (list 1 2 3 4) 'list-of-strings)
<loli> the odd thing about this form is that it takes the symbol, so I don't see how I can apply it
<loli> testing your function works great for how I actually use it
<loli> (sig test-foo (-> (list-of integer) integer))
<saturn2> oh, you just use a quoted list
<loli> (typep (list 1 2 3 4) '(list-of string))?
<saturn2> yes
<loli> oh you're right... huh it was erroring before
<loli> this is great
<saturn2> glad to help :)
<Nilby> dieggsy: You can do it, but it's not in the API, so I probably shouldn't reccomend it.
<Nilby> dieggsy: This is probably a bad idea, but (bt:join-thread (slot-value (slot-value hunchentoot::*acceptor* 'hunchentoot::taskmaster) 'hunchentoot::acceptor-process))
hjudt has quit [Ping timeout: 265 seconds]
nature has quit [Ping timeout: 246 seconds]
<dieggsy> Nilby: fair. i'm trying to set up a simple server for local Oauth 2.0 authentication. Basically I just need a one time server that waits (blocks), gets a request with some info, sends back "done, close this tab", then dies and other code can go on to do stuff wtih that info
zzappie has quit [Ping timeout: 240 seconds]
<dieggsy> i've done it in CHICKEN, but there I had manual control over the thread the web server started in
<dieggsy> i suppose i could just.. poll some variable or something instead
<dieggsy> or, maybe i'm being an idiot and i just work the entire logic into the easy-handler. .... that would make more sense I think
<loli> hmm one small error, saturn2 it seems when I compile the file it says the type is undefined, is this due to staging?
<loli> it seems to just disappear if you load the entire file
gaqwas has quit [Ping timeout: 246 seconds]
<saturn2> hmm... the gensyms might disappear between compile and load
<Nilby> dieggsy: Another way is just to look for hunchentoot-listener, in bt:all-threads
<loli> ahh that error again, never a fun one to run into
<Nilby> dieggsy: which is probably more stable?
<dieggsy> Nilby: would you happen to know if i can make an easy handler send a response and *then* shut down the hunchentoot server too?
<dieggsy> the way i understand it the easy handler depends on the last return value as opposed to some kind of send-response function, so i don't see that working either
anticrisis has joined #lisp
hypercube has quit [Quit: WeeChat 3.1]
<Nilby> dieggsy: I think you can just call (hunchentoot:stop *acceptor*)
<dieggsy> Nilby: right, but how would i send a response before doing that ?
<dieggsy> So that the page can have some kind of "this worked" text lol
<dieggsy> appreciate the help btw
<loli> I've never really gotten over the gensym issues like this in the past, since the language doesn't help. saturn2 I guess what we could do is declare a package for these functions to live, so it doesn't clash, sadly we can't gensym that namespace
anticrisis has quit [Read error: Connection reset by peer]
anticrisis has joined #lisp
<Nilby> dieggsy: This seemed to work (bt:make-thread (lambda () (sleep 5) (hunchentoot:stop hunchentoot:*acceptor*))) or I guess you could just call (exit) or something.
<dieggsy> Nilby: Oh, that's. yep. that would make sense. I'll try that out. thank you!
dra has quit [Remote host closed the connection]
pbaille has joined #lisp
<loli> I'll complete this extension later, I at least have a plan to fix it, thanks again saturn2
<saturn2> sure
<Nilby> dieggsy: You're welcome. More things "🗲 by 🆑 "
pbaille has quit [Ping timeout: 252 seconds]
<saturn2> loli: i think there's probably a way to make it all work by using load-time-value, but it's tricky...
<loli> oh there is actually a way around it?
acolarh has quit [Ping timeout: 260 seconds]
hjudt has joined #lisp
mindCrime_ has quit [Ping timeout: 252 seconds]
josrr has joined #lisp
hjudt has quit [Ping timeout: 246 seconds]
<josrr> dieggsy: maybe you can use hunchentoot:send-headers; it returns a stream where you cand send de response. https://edicl.github.io/hunchentoot/#send-headers
<dieggsy> josrr: oh cool!! i had sort of glossed over that. thanks
heisig has quit [Quit: Leaving]
hjudt has joined #lisp
<josrr> dieggsy: sure, hope it helps.
acolarh has joined #lisp
bilegeek has joined #lisp
zaquest has quit [Quit: Leaving]
irc_user has quit [Quit: Connection closed for inactivity]
<saturn2> loli: okay i guess i was wrong, there's no way to make the load-time-value trick work in a deftype, it only works in a regular macro or symbol-macro
<loli> how does that work, saturn2, I've had this issue when I tried implementing module functors into CL before IIRC
zaquest has joined #lisp
<loli> I had some weird edge cases IIRC, it's been a while though
<saturn2> well, if you need your macro to have persistent side effects, you can make it expand to (progn (load-time-value (side-effects-here)) (other-stuff))
hjudt has quit [Ping timeout: 240 seconds]
<saturn2> but there seems to be no way to make that work in a type specifier
<loli> huh so that works even through gensym naming?
attila_lendvai has quit [Ping timeout: 252 seconds]
<saturn2> you could still do it if you made a wrapper macro around deftype
<loli> yeah, you could implement a lot if you did it that way
<saturn2> but in that case you might as well just give your custom type predicate a symbol name and use regular defun
<loli> do hygenic macros help at all? I know Racket has a reflective tower with their macro system
<loli> where they can do very heavy lifting and compose macros nicer
<dieggsy> josrr: actually, what's the usual way to write to a binary stream ?
<saturn2> not sure, i'm not really a scheme person
Nilby has quit [Ping timeout: 250 seconds]
<loli> it seems a lot of research has gone into pushing hygenic macros, I think they are much stronger, but I lack enough scheme knowledge to see how they got their tower of abstraction
<dieggsy> i dunno about stronger, pretty much every scheme will provide unhygienic macros as well cause there's some things you can't do with hygienic macros
<dieggsy> ...least not easily
<loli> well from oleg's blog I got a hygenic macro that makes an unhygenic macro system
DGASAU has quit [Read error: Connection reset by peer]
<dieggsy> loli: ok but that man is a wizard
<dieggsy> heh. fair point though
<moon-child> loli: you can do the other way around too :P
<loli> very small amount of code
<loli> but the interesting thing is, he mentions in a number of his articles about better composing macros
<saturn2> i always thought hygenic macros mostly just saved you from having to type alexandria:once-only
<loli> and the hygiene it seems to offer better techniques to preserve lexical scoping
DGASAU has joined #lisp
<saturn2> what you would need is a way for a macro to hook into the loading mechanism and do stuff when the containing file is loaded
<loli> http://okmij.org/ftp/Scheme/macros.html#ck-macros I believe here he mentions the CPS style passing they typically do. But I believe Racket provides good kinds of abstractions for this as well
<loli> for the deftype fix?
<saturn2> yes
<Bike> i think the problem is just that CL's type system can't do what you want it to do, rather than anything about macros exactly
<saturn2> yes, that too
<saturn2> we are being a bit silly here
<loli> sure, but that's fine though
<dieggsy> i know i could just write one, but is there a standard CL way to denote a bytestring
<dieggsy> like, interpret this string as a sequence of bytes instead of a sequence of chars
<dieggsy> #b"eg" or something
<josrr> dieggsy: I have used cl:write-sequence for that (to write to a binary stream)
<Bike> there are no reader macros for element types other than bit, character, and T
<dieggsy> josrr: neat, thanks.
<dieggsy> I suppose (map 'list #'char-code "string") might work
<dieggsy> cool, that does work. send-headers and stopping within the handler also seems to be working. neat
<saturn2> dieggsy: i think you want babel:string-to-octets or similar
<dieggsy> saturn2: eh, it's simple enough i'd rather not pull in another dep, but that's a good library to keep in mind, thanks
<no-defun-allowed> Good luck with non-ASCII characters.
<josrr> dieggsy: hunchentoot depends on flexi-streams; you can use flexi-streams:string-to-octets
<dieggsy> *no-defun-allowed*: it's a hardcoded string literal
<dieggsy> josrr: oh, neat