p_l 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/> | ASDF 3.3.4
cantstanya has quit [Remote host closed the connection]
cantstanya has joined #lisp
Oladon has quit [Quit: Leaving.]
hsaziz has joined #lisp
mason has joined #lisp
pjb has joined #lisp
red-dot has joined #lisp
buffergn0me has quit [Ping timeout: 240 seconds]
hsaziz has quit [Quit: hsaziz]
Necktwi has joined #lisp
Necktwi_ has quit [Ping timeout: 264 seconds]
karswell_ has joined #lisp
zaquest has quit [Quit: Leaving]
zaquest has joined #lisp
karswell_ is now known as karswell
buffergn0me has joined #lisp
bitmapper has quit [Ping timeout: 246 seconds]
Jeanne-Kamikaze has joined #lisp
Xach has quit [Ping timeout: 260 seconds]
Xach has joined #lisp
pjb has quit [Ping timeout: 246 seconds]
MerlinTheWizard has quit [Remote host closed the connection]
MerlinTheWizard has joined #lisp
ArthurStrong has quit [Quit: leaving]
karlosz has quit [Quit: karlosz]
wxie has joined #lisp
Aurora_iz_kosmos has joined #lisp
Aurora_v_kosmose has quit [Disconnected by services]
Aurora_iz_kosmos is now known as Aurora_v_kosmose
gko has joined #lisp
nmg has joined #lisp
pilne has quit [Quit: Tis but a scratch]
Bike has quit [Quit: Lost terminal]
monok has joined #lisp
wxie1 has joined #lisp
mono has quit [Ping timeout: 246 seconds]
wxie has quit [Ping timeout: 240 seconds]
wxie1 is now known as wxie
buffergn0me has quit [Ping timeout: 240 seconds]
wxie has quit [Read error: Connection reset by peer]
nmg` has joined #lisp
nmg has quit [Ping timeout: 240 seconds]
prefixt has quit [Quit: Leaving]
karlosz has joined #lisp
jruiz__ has quit [Ping timeout: 258 seconds]
lxbarbos` has joined #lisp
igemnace has quit [Quit: WeeChat 2.8]
lxbarbosa has quit [Ping timeout: 272 seconds]
turona has quit [Ping timeout: 272 seconds]
turona has joined #lisp
libertyprime has joined #lisp
igemnace has joined #lisp
buffergn0me has joined #lisp
pjb has joined #lisp
efm has joined #lisp
lowryder has quit [Ping timeout: 265 seconds]
lowryder has joined #lisp
_jrjsmrtn has joined #lisp
<beach> Good morning everyone!
nmg` has quit [Remote host closed the connection]
__jrjsmrtn__ has quit [Ping timeout: 264 seconds]
lxbarbos` has quit [Ping timeout: 272 seconds]
karayan has joined #lisp
pjb has quit [Ping timeout: 272 seconds]
toorevitimirp has joined #lisp
slyrus__ has joined #lisp
slyrus_ has quit [Ping timeout: 246 seconds]
madage has quit [Ping timeout: 240 seconds]
Jeanne-Kamikaze has quit [Quit: Leaving]
madage has joined #lisp
ayuce has quit [Remote host closed the connection]
ayuce has joined #lisp
vivit has quit [Ping timeout: 264 seconds]
vivit has joined #lisp
torbo has quit [Remote host closed the connection]
narimiran has joined #lisp
renzhi_ has quit [Ping timeout: 246 seconds]
SGASAU has quit [Remote host closed the connection]
SGASAU has joined #lisp
Oladon has joined #lisp
akoana has left #lisp ["Leaving"]
buffergn0me has quit [Quit: ERC (IRC client for Emacs 26.2)]
<boeg> good morning
krid has quit [Ping timeout: 256 seconds]
MerlinTheWizard has quit [Ping timeout: 240 seconds]
karswell has quit [Remote host closed the connection]
karswell has joined #lisp
patlv has quit [Quit: patlv]
luckless has quit [Remote host closed the connection]
<boeg> think of
<boeg> I have been fighting this weird error I didn't understand anything about for hours, yesterday, and I guess what helped was getting some sleep, because when I looked at it now after waking up, it suddenly occurred, that maybe its not an error i have introduced in my code. Surely enough, trying to run a different project using the same libraries (caveman2 and mito), and the error is suddenly also there. The only thing I can
<boeg> having introduced the bug is that I did a quicklisp dist upgrade yesterday.
<boeg> If any one wants to have a look and see if they can see what is going on, here is the backtrace: https://pastebin.com/9RyRaaFK
<boeg> is it just a bug that has been introduced in the quicklisp version of uax-15-20200325-git, whatever that is?
vlatkoB has joined #lisp
<beach> boeg: Your error is that you are trying to read a stream with an encoding that does not correspond to the contents.
<beach> Perhaps you are reading with an encoding of UTF-8 and the stream contains LATIN-1?
<boeg> right, i see that, but i guess what i'm asking is, what can be the culprit? I haven't changed the code, what has changed is that i did a dist upgrade of quicklisp
<boeg> to be honest, I have changed the code in project A which i was working on, but testing project B now, that i haven't touched for days before the dist upgrade, and it suddenly doesn't work there either
<boeg> obviously, i can be mistaken
<boeg> beach: also, i'm not reading anything. It's when I try to connect to postgres with mito. Its in there the error occurs
<boeg> as far as I can see at least
<boeg> maybe mito was updated
<beach> boeg: Look at the backtrace...
<beach> It says sb-impl::fd-stream-read-n-characters/ascii
<boeg> so it expects UTF-8 but ascii is provided?
<beach> And you are trying to read a character  which is not ascii.
<boeg> as you mentioned?
<beach> It expects ascii and you are giving it  which is not ascii.
<boeg> let me have a look around the code for that
<boeg> 2sec
<beach> It appears that the file CompositionExclusions.txt contains characters that are not ASCII.
<beach> boeg: I mean, look at the backtrace.
<boeg> yeah
<boeg> but its no my file
<boeg> not*
<beach> I can't help you with that.
<boeg> i dunno what that is
<beach> I am just telling you how to interpret the backtrace and the error.
<boeg> I believe it has been introduced with the dist-upgrade, as i said
<boeg> yeah, i udnerstand
<boeg> and thank you for that!
<beach> Sure.
<boeg> beach: looking at the path /Users/cb/.roswell/lisp/quicklisp/dists/quicklisp/software/uax-15-20200325-git/data/CompositionExclusions.txt doesnt it look like its part of uax-15, the library?
<beach> It does.
<beach> If I were you, I would start by looking at that file to make sure it does contain non-ASCII characters.
<boeg> yeah, good idea
<boeg> beach: there was one other filed called DerivedNormalizationProps.txt with same error - if I just empty those two files, the error goes away, so its something in uax-15 that is wrong and was introduced to my system with the dist-upgrade
pjb has joined #lisp
<boeg> is my guess anyways
<beach> I think I have supplied all the information I can for this problem. I don't use any of the software you seem to be using here, so I can't reproduce it.
<boeg> no problem, just wanted to share my findings
<beach> Sure.
MerlinTheWizard has joined #lisp
<boeg> Do you know of a way where I can figure out where the dependency of uax-15 lies in the chain of dependencies? It's not directly with mito, so it must be one of its dependencies, is my guess. So save for going through them by hand, do you know if quicklisp can be utilities to easily show what dependents on a specific library
<boeg> ?
<boeg> utilised*
<beach> I am afraid I don't. But you should be able to look at the ASDF file(s) in the :DEPENDS-ON option.
<boeg> yes indeed, thanks
<boeg> ah, its postmodern that has a dependency on uax-15
* adlai hopes nobody will get too insulted if (defun ql:yolo () (mapcar 'funcall '(ql:update-client ql:update-all-dists)))
<beach> boeg: There is no particular reason that file should contain non-ascii characters. You may want to check that it has not been corrupted.
karayan has quit [Ping timeout: 240 seconds]
<boeg> right, yeah, i ws also thinking that if a "big" library like postmodern uses uax-15, and I have a bug in it, but htere is nothing on the issue tracker about it, which there isn't, it's probably localized to my system
karayan has joined #lisp
milanj has joined #lisp
Oladon has quit [Quit: Leaving.]
nmg` has joined #lisp
libertyprime has quit [Remote host closed the connection]
milanj has quit [Client Quit]
<boeg> beach: nope, overwriting them with those found on the github repository doesn't work, same errors, only emptying the files (or writing something random utf-8) makes it work...
<boeg> and if I empty them, and then add "fkdsjfk Ã" into it, and reload everything, the error is there again, so it seems its because there is some non-ascii in it. Or maybe there should be, but it gets loaded now by mistake?
<Nilby> (setf sb-impl::*default-external-format* :utf-8) ?
gravicappa has joined #lisp
<Nilby> It has a "© 2016 Unicode®, Inc"
<boeg> Nilby: can I just run that in slime before loading the packages?
<boeg> Nilby: indeed, i see that, but i wonder why it errors now, and didn't before - does it get loaded by mistake?
<Nilby> Probably?
<phoe> boeg: what is your SBCL version?
<boeg> phoe: 2sec
<phoe> the newer ones have utf-8 set by default
<Nilby> I've had to do that only on some version windows.
<phoe> (lisp-implementation-version)
<boeg> 2.0.2 via roswell
<Nilby> I seem to have that prefixed by: #+(and sbcl win32) in my .lisprc
<phoe> 2.0.3 and newer defaults to utf-8
<boeg> maybe I should see about upgrading it
quazimodo has quit [Ping timeout: 264 seconds]
hdasch has quit [Ping timeout: 240 seconds]
hdasch has joined #lisp
pjb has quit [Ping timeout: 272 seconds]
quazimodo has joined #lisp
_paul0 has quit [Remote host closed the connection]
toorevitimirp has quit [Ping timeout: 256 seconds]
<boeg> seems to be it - upgrading to sbcl 2.0.2 seems to have fixed the problem with uax-15, so it seems that after me dist-upgrading quicklisp yesterday, something was changed that didn't work with sbcl 2.0.2 anymore. With sbcl 2.0.4, it works, it seems
<boeg> thank you for your help, everybody
paul0 has joined #lisp
<boeg> upgrading to sbcl 2.0.4 seems to have fixed the problem*
theosvoitha has joined #lisp
vivit has quit [Ping timeout: 260 seconds]
lacroixboy_ has quit [Ping timeout: 240 seconds]
lacroixboy has joined #lisp
vivit has joined #lisp
sz0 has joined #lisp
orivej has quit [Ping timeout: 256 seconds]
micro has joined #lisp
duncan_ has joined #lisp
MerlinTheWizard has quit [Ping timeout: 240 seconds]
luckless has joined #lisp
ggole has joined #lisp
zooey has quit [Remote host closed the connection]
zooey has joined #lisp
cyraxjoe has quit [Quit: No Ping reply in 180 seconds.]
cyraxjoe has joined #lisp
ayuce has left #lisp ["ERC (IRC client for Emacs 28.0.50)"]
rgherdt has joined #lisp
nmg`` has joined #lisp
rgherdt has quit [Quit: Leaving]
nmg` has quit [Ping timeout: 246 seconds]
pve has joined #lisp
SGASAU has quit [Remote host closed the connection]
SGASAU has joined #lisp
dddddd has joined #lisp
vivit has quit [Ping timeout: 256 seconds]
karayan has quit [Ping timeout: 246 seconds]
karayan has joined #lisp
duncan_ has quit [Remote host closed the connection]
frgo_ has joined #lisp
pjb has joined #lisp
rwcom has quit [Quit: Ping timeout (120 seconds)]
rwcom has joined #lisp
pve has quit [Quit: leaving]
frgo_ has quit [Remote host closed the connection]
rwcom has quit [Client Quit]
frgo has quit [Ping timeout: 272 seconds]
frgo has joined #lisp
decent-username has joined #lisp
drewc has quit [Ping timeout: 265 seconds]
pve has joined #lisp
elflng has quit [Read error: No route to host]
elflng has joined #lisp
ln^ has joined #lisp
pjb has quit [Ping timeout: 265 seconds]
rgherdt has joined #lisp
drewc has joined #lisp
epony has quit [Quit: reconfiguration]
micro has quit [Quit: Lost terminal]
micro has joined #lisp
epony has joined #lisp
ln^ has quit [Quit: Leaving]
micro has quit [Client Quit]
shka_ has joined #lisp
epony has quit [Max SendQ exceeded]
epony has joined #lisp
sth_ has joined #lisp
<sth_> hey yall. i'm very new to lisp and kinda overwhelmed with how many implementations there are. for 2020, what's the best way to go about getting an environment set up that works well for Practical Common Lisp?
fourier has joined #lisp
<phoe> minion: tell sth_ about portacle
<minion> sth_: portacle: Portacle is a complete IDE for Common Lisp that you can take with you on a USB stick https://shinmera.github.io/portacle/
<phoe> a preconfigured distro of emacs + slime + sbcl + git
<phoe> also contains the Quicklisp package manager if you want to download some Lisp code from the Internet.
<boeg> indeed, it's the answer. Obviously, should come preconfigured with evil-mode, but other than that :)
* boeg hides
<phoe> let's not go into religious debates here
<boeg> :P
<Shinmera> boeg: you aren't the first to say that, but everyone that does tell me that is never ready to actually put in the work and submit a patch to actually include it.
<Shinmera> so it stays not in.
<boeg> Shinmera: indeed! :)
<boeg> seems like the link has changed to https://portacle.github.io, regarding the link the minion posts
<phoe> yes, but the redirect is there
<boeg> indeed
jonatack_ has joined #lisp
* Shinmera is now annoyed
<Shinmera> oh well, better turn to work.
jonatack has quit [Ping timeout: 265 seconds]
<sth_> cool thanks :)
<sth_> evil mode is something i've heard a lot about and would probably appreciate, but i also want to actually learn emacs too so i've never bothered with it
ym has quit [Remote host closed the connection]
<SAL9000> sth_: my view on evil-mode -- basically, if you use emacs as more than just an editor, it'll get in the way of those things somewhat. There's been a lot of work on integrating e.g. org-mode into evil, but it's not the same. However, as an "Emacs-first" user I'm biased :-)
terpri has quit [Remote host closed the connection]
<sth_> that makes sense
terpri has joined #lisp
<boeg> for someone who prefers the vim way of giving commands, evil-mode is a blessing. However it doesn't stand too much in the way with regards to using emacs. It's mostly in the beginning, where you have to remember that if a feature is described in one way, you probably needs to figure out how to use it with evil, which is most likely another way. But other in that, I don't have any problems with it - i much prefer emacs + evil
<boeg> to vim, and
<boeg> I use emacs for everything. I'm in emacs now.
<sth_> well im not interested in emacs as solely an editor so i probably wont bother
<SAL9000> sth_: I wouldn't recommend starting out that way, at least. Give it a try at some point, as boeg said it might work for you. It's a very individual thing.
<phoe> I've heard that slima for atom starts getting good
<boeg> oh my god, i seem to have gotten a stroke while typing that...
<phoe> that's an alternative
<SAL9000> It helps if you're willing to put in the leg-work to customize emacs/evil to YOUR taste/needs.
<sth_> ive been using vi/vim for over a decade but ive always been very envious of people who live in emacs
<SAL9000> welcome to the dark side, we have <s>cookies</s> magit
<boeg> sth_: i used vim for ~10 years before switching 100% to emacs + evil
<boeg> but to make it work, as SAL9000 says, you need to want to spend the time configuring things, understanding things. It wont just work before most things are not evil-natives
doomlist3 has joined #lisp
<doomlist3> it's me
<sth_> it's always just been an issue of pragmatism for me. i use vi because it's on the machines i administer
<sth_> hmm ok
<doomlist3> (list 2 3) is it the same as (quote (2 3)) the same as '(2 3)
<SAL9000> sth_: are you doing remote admin (ssh)?
<sth_> SAL9000: yeah for a lot of my work
<SAL9000> consider Emacs' TRAMP.
<beach> doomlist3: "is the same as" is ambiguous, and the answer is "no".
<SAL9000> i.e. C-x C-f /ssh:user@host:file.py RET
<sth_> SAL9000: cool
<SAL9000> doomlist3: (list 2 3) constructs a new object every time, but '(2 3) or (quote 2 3) returns "the same" object -- constructed at read-time.
<beach> SAL9000: You beat me to it.
<beach> Thanks.
micro has joined #lisp
<SAL9000> sth_: there's some caveats -- unless they've fixed that bug already, watch out for editing as root remotely. In some cases it clobbers /dev/null with the bash history file...
<SAL9000> beach: np :-)
<boeg> sth_: also give eshell a try! although it cannot be used 100% as a shell replacement, it can be used for my usage most of the time, and then you have a emacs-shell with all that entails right in emacs. Its great! Check out these two articles about eshell: https://www.masteringemacs.org/article/complete-guide-mastering-eshell & http://www.howardism.org/Technical/Emacs/eshell-fun.html
luckless has quit [Remote host closed the connection]
<SAL9000> tbh I'm using eshell a lot more now that I'm stuck on Windoze for work
<doomlist3> is quote and ' equivalent?
<beach> doomlist3: To elaborate, when evaluated, the form (list 2 3) produces a fresh list with 2 CONS cells in it. When evaluated, the form (quote (2 3)) also returns a similar list, but it's the same list each time.
luckless has joined #lisp
datajerk has quit [Ping timeout: 256 seconds]
<boeg> sth_: things it cannot be used for properly is for example some git output will not be shown correct, i find. However, for git, you'll probably want to use magit instead anyways
<beach> doomlist3: ' is a "reader macro" so that when READ sees '<something>, it returns the S-expression (quote <something>)
<SAL9000> doomlist3: not 100% equivalent, but for most purposes yes. You only need to care about that difference if you're implementing a LISP yourself and/or doing seriously advanced macrology.
<phoe> doomlist3: yes, 'foo = (quote foo)
<beach> phoe: Not true.
<phoe> beach: oh! what's the difference?
<beach> phoe: Only true in a context of evaluation.
<beach> That is why I don't want the words "same as", "equivalent" etc.
<SAL9000> ''foo vs '(quote foo) will evaluate differently on most lisps, iirc
<phoe> SAL9000: huh, it's the same on Lisp, MIT Scheme, and Racket
<phoe> beach: I don't understand "context of evaluation"; the reader macro processing is done at read time
<SAL9000> maybe it was only in the context of a macro arg? but I remember sbcl giving me different things
fourier has quit [Ping timeout: 240 seconds]
<beach> phoe: (= (length "'foo") (length "(quote foo)"))
<beach> ... would be an example of a context when they are not the same.
<phoe> beach: oh, you mean *before* read-time - yes, they aren't the same as strings
<beach> That is why the context is important.
<sth_> thanks boeg i'll check it out. i'm kinda limited on time so i think i wanna mainly start getting the hang of lisp but emacs is definitely the next thing on my list of things to get better with
<beach> That is why "the same as" "equivalent" are bad choices of words.
<SAL9000> on the other hand, for a newbie lisper subtle quote vs quasiquote vs (quote) isn't that big of a deal
<SAL9000> I'm assuming they aren't going to be writing code walkers or macroexpand any time soon
<doomlist3> I will be in 2months when i finish gigamonkeys
<boeg> sth_: I understand! There is no better place to get to know either. Emacs is a lisp environment, so you cannot go wrong, and although emacs is elisp, you still learn a lot of things in emacs and common lisp that you can use in eithr place
<SAL9000> (require 'cl) ;; get some bits of cl in elisp :-)
<SAL9000> (cl-loop for dialect in lisp do (message "go wild!"))
<no-defun-allowed> Emacs behaves subtly differently to Common Lisp (such as, say, how the printer handles new lines), and it's not fun to be reading Common Lisp references while debugging Elisp problems.
milanj has joined #lisp
<doomlist3> no-defun-allowed: why don't you allow defun? is there a better alteernative in your opinion?
<Grue`> flet/labels is obviously superior because no global state :)
<no-defun-allowed> doomlist3: (setf (fdefinition '...) ...) ;; No, I just thought it was a funny name.
<beach> doomlist3: It's just a name, but DEFGENERIC is often better. :)
<no-defun-allowed> I can't disagree with beach's interpretation.
<doomlist3> I didn't knew setf can be used to define functions, can you give an example
<phoe> (setf (fdefinition 'foo) (lambda () 42))
luckless has quit [Read error: Connection reset by peer]
<no-defun-allowed> (setf (fdefinition 'the-more-you-know) (lambda () (write-line "The more you know")))
<phoe> no-defun-allowed: ... isn't a valid function name unless escaped
luckless has joined #lisp
<no-defun-allowed> It's a lousy indication you put something there.
<no-defun-allowed> (So far, I haven't been able to make the Lisp printer draw the text in 3d with a rainbow and star underneath, but that should suffice as an example.)
<SAL9000> no-defun-allowed: http://www.martin-loetzsch.de/gtfl/
dale has quit [Quit: My computer has gone to sleep]
datajerk has joined #lisp
<no-defun-allowed> "A Graphical Terminal For Lisp" Cool, but I think clim-listener beat the author to it.
<beach> doomlist3: That's what happens when you do (DEFUN ...).
heisig has joined #lisp
karswell has quit [Remote host closed the connection]
karswell_ has joined #lisp
pjb has joined #lisp
<no-defun-allowed> Nice.
lnostdal has joined #lisp
karswell_ has quit [Read error: No route to host]
McParen has joined #lisp
Grue` has quit [Quit: ZNC 1.7.2 - https://znc.in]
SGASAU has quit [Remote host closed the connection]
dxtr has joined #lisp
SGASAU has joined #lisp
Grue` has joined #lisp
Grue`` has joined #lisp
keep_learning has quit [Quit: Leaving]
shifty has quit [Ping timeout: 265 seconds]
doomlist3 has quit [Ping timeout: 258 seconds]
doomlist3 has joined #lisp
easye` has joined #lisp
easye has quit [Read error: Connection reset by peer]
random-nick has joined #lisp
ffwacom has joined #lisp
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
ym555 has joined #lisp
<doomlist3> hey how to iterate using dolist over plist and list
ArthurStrong has joined #lisp
<beach> Don't use DOLIST
<beach> (loop for element in list ...) for ordinary lists.
<doomlist3> https://bpaste.net/WPCQ i read gigamonkeys chapter 3 database building
<doomlist3> beach: i get u but just understanding my error
<beach> What is your TAGBODY doing there?
<beach> I need to see the source code.
<phoe> beach: DOLIST expands into a TAGBODY.
<beach> Right.
<phoe> The FORMAT call doesn't have parentheses.
<beach> Ah, I see it.
<beach> You are right.
<phoe> Therefore all four objects there are attempted to be interpreted as TAGBODY tags.
<beach> Indeed.
<doomlist3> print p-list
<phoe> doomlist3: (dolist (n *db*) (format t "~a element~%" n))
<doomlist3> phoe: that is what i did
<beach> No.
<beach> You forgot the parentheses around the FORMAT form.
<phoe> no
<phoe> you did
<phoe> doomlist3: (dolist (n *db*) format t "~a element~%" n)
<phoe> count the parentheses in both cases
<beach> doomlist3: To invoke a function, like FORMAT, you need to stick the function name and its argument forms in a list.
<doomlist3> ok
Ven`` has joined #lisp
<doomlist3> (loop for i in *db* (format t "~a element~%" i)) too shows error
<phoe> (loop for i in *db* do (format ...))
<beach> doomlist3: (loop for i in *db* DO (format t "~a element~%" i))
Grue`` has quit [Ping timeout: 256 seconds]
<beach> phoe: Looks good to me.
ym555_ has joined #lisp
ym555 has quit [Ping timeout: 260 seconds]
<phoe> OK. I wonder how much code relies on ROTATE and SHUFFLE for side effects only - I can imagine it being the case for vectors. That code will need to be updated.
<phoe> Xach: do you have any tools for checking such? I remember pfdietz used to scan all of Quicklisp in some way; I'll ask him when he comes online.
marcoxa has joined #lisp
<doomlist3> how to iterate over plist using format t
<phoe> doomlist3: (loop for (key value) on '(:a 1 :b 2 :c 3) by #'cddr do (format t "~A: ~A~%" key value))
<phoe> note that we bind two variables now, KEY and VALUE; note that we use ON instead of IN; and note that we use BY #'CDDR now to skip two elements on each iteration instead of just one
<doomlist3> by #'cddr --> this syntax is really bad
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phoe> why? BY is a standard LOOP keyword, and #'CDDR is standard syntax for named function objects
<doomlist3> I am from python background
<phoe> so it's not bad, it's new
<beach> doomlist3: yes, we need a new Common Lisp standard to change that.
<beach> *sigh*
<adlai> another standard? but then you'd have four problems
<marcoxa> doomlist3 will the following do
<no-defun-allowed> I'm looking at making Postmodern work with byte arrays (bytea); why should (let ((array (make-array 10 :element-type '(unsigned-byte 8) :initial-element 10))) (postmodern:query (:select array))) produce a string?
<marcoxa> [(key value) :on (list :a 1 :b 2) :by 'skip2] work for you?
<marcoxa> We can make CL do that for you :)
<beach> marcoxa: I don't think that is helpful to a newbie.
<phoe> marcoxa: I worry that if you introduce custom syntax for people who are just learning lisp then you have more than two problems
<beach> What phoe said.
<marcoxa> I know. I am just being an ass :) :) :)
<no-defun-allowed> Bummer.
<phoe> don't
<marcoxa> Sorry :)
<beach> Being an ass is also unhelpful to newbies.
<phoe> ^
<phoe> no-defun-allowed: basically, postmodern coerces everything to a string internally because of how it uses the postgres wire protocol; the issue is triaged and diagnosed as you can see in the issue comments, it needs to be implemented
<no-defun-allowed> I see, for now I could kludge that and do (:SELECT (:TYPE <array> BYTEA)).
<phoe> sabrac might use some help with that
nika has joined #lisp
<marcoxa> Well. By mean of some reader-macro magic you CAN make the above work. It should tickle the newbie curiosity :)
<phoe> yes, that's a workaround
<no-defun-allowed> When I get a break, I might take a look then.
ym555_ has quit [Ping timeout: 260 seconds]
<sabrac> no-defun-allowed: The first issue is that cl is dynamically typed and a database is statically typed. If you are selecting not from a table, you can specify the type with ::
<sabrac> If you are selecting from a table, you need to know what how column is typed. int2 does not equal int4. Etc.
<sabrac> But yes, I could use help thinking through how to deal with binaries.
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
Bike has joined #lisp
<no-defun-allowed> Sure, fair enough.
<no-defun-allowed> I noticed a comment suggesting that the wire protocol for bytea was inefficient; do you have an opinion on that?
gargaml has joined #lisp
karlosz has quit [Quit: karlosz]
<no-defun-allowed> I'm still on the fence on if I should store my binary data elsewhere. (I suppose I probably should, but I recall Heroku only has Postgres for free persistent storage.)
doomlist3 has quit [Ping timeout: 246 seconds]
<sabrac> no-defun-allowed: you planning on using the postgresql bytea hex format or escape format as the datatype inside the database?
<no-defun-allowed> I don't know honestly.
Grue` has quit [Ping timeout: 265 seconds]
<sabrac> no-defun-allowed: generally recommended to use the hex format. See https://www.postgresql.org/docs/current/datatype-binary.html#id-1.5.7.12.9
<no-defun-allowed> Okay. I've been poking at it from S-SQL which I think uses the escape format.
<sabrac> Another thing to add to the list
Lord_of_Life_ has joined #lisp
SGASAU has quit [Remote host closed the connection]
Lycurgus has joined #lisp
theosvoitha has quit [Quit: Connection closed for inactivity]
Lord_of_Life has quit [Ping timeout: 265 seconds]
Lord_of_Life_ is now known as Lord_of_Life
SGASAU has joined #lisp
<boeg> I'm trying to find out how to organize my, specifically; I have a package where things are written and read from a database, and things that need that, do it via that package. So I have a function to update a post, and it then validates the data provided, and persists the change if its valid, and if errors happens - either invalid data or persistence failed - it collects these errors, and returns two values, a boolean stating
<boeg> success or
<boeg> failure, and a list which in the case of failure will contains a list of errors like so: https://pastebin.com/zafsB9HR - is this a "good way" to architecture such a thing in common lisp, is there a better way/pattern to use?
<boeg> organize my code*
<boeg> i'm not sure that code actually works, I just freewheeled it in pastebin, but it carries the idea i'm playing with
scymtym_ has joined #lisp
scymtym has quit [Ping timeout: 256 seconds]
Ven`` has joined #lisp
<beach> boeg: You should use the condition system to signal errors.
<beach> boeg: LET has an implicit PROGN, so no PROGN needed there.
<beach> Why do you return a list of errors?
<boeg> beach: yes, I had thought about the condition system, but I haven't gotten into the weeds of it yet, and didn't know if I could return multiple errors with it like I need. I didn't know about the implicit progn in let, thank you! I need to return a list of errors because the errors, one or more, have to be shown to the user with the form fields that has errors, like if a required field is empty, or contains invalid content in
<boeg> another
<boeg> way
<boeg> so there can be many errors in the content and they need all be signaled to the caller so the caller can render them to the client
<boeg> in the provided content/data*
<phoe> boeg: in the end you can signal a single error object that contains, as a slot, a list of all things that are wrong with the post
<phoe> I'd separate the validation logic from the control flow
<boeg> phoe: do you by chance have something about this specifically in your book? :P
<boeg> well, something you would think i could use for this to understand how to properly model it?
<boeg> because that would be a good reason to read your book now instead of later, or at least parts of it :P
<phoe> boeg: lemme write an example
<phoe> boeg: this issue is orthogonal to my book, so I don't have much about it
<boeg> alright, could be, thought i'd ask :D
<boeg> thanks
<phoe> I'd suggest such structure
<phoe> it separates validation from control flow
<phoe> and also uses the condition system, signaling a validation error if the data doesn't pass validation
<phoe> and doesn't handle the mito error, allowing it to bubble up and be handled by the logic that calls UPDATE-POST
<phoe> a handler-case that handles *ALL* conditions, like you had it, is a big anti-pattern in general
<phoe> mito is allowed to signal a non-error condition as a part of its normal functioning, and your original code is going to treat it as if it was an error
<boeg> alright, that makes a lot of sense, although I think i'd want the mito error to not bubble up to the caller - I want it to be abstracted away, so I can easily change the persistence-layer if needed. But I could handle the mito error in update-post and then signal another that tells the same story, but isn't specifically a mito error. What do you think?
<boeg> another custem error*
rozenglass has joined #lisp
<phoe> boeg: you could encapsulate the error into your own error condition, sure
Inline has joined #lisp
theosvoitha has joined #lisp
<phoe> though, for modularity, I'd add one more layer above UPDATE-POST that actually performs error handling
<phoe> that's for fulfilling the single responsibility principle
bitmapper has joined #lisp
<boeg> when you say performs error handling, what do you mean? Because I'm just thinking that the layer above that function is the place that calls update-post and if error(s) occurs, it presents it to the user, no?
Grue` has joined #lisp
<boeg> I guess in the case of a mito-error, there could be a layer above that could try persisting the data again if it fails before signaling to the user that something is wrong
<boeg> but for the validation errors, they just need to be signaled to the caller say they can be rendered to the user so the user can fix them
<boeg> so they can be*
<boeg> before signaling to the caller to rendering the persistence-error/mito-error to the user
<boeg> **
<boeg> render*
<pjb> sabrac: sqlite is not statically typed.
SGASAU` has joined #lisp
__lm__ has joined #lisp
__lm__ has quit [Remote host closed the connection]
SGASAU has quit [Ping timeout: 258 seconds]
<boeg> brb
<phoe> sabrac: we're talking postgres here
bitmapper has quit [Ping timeout: 256 seconds]
SGASAU` has quit [Remote host closed the connection]
gxt has quit [Remote host closed the connection]
SGASAU` has joined #lisp
gxt has joined #lisp
<boeg> phoe: ah, so you meant to not mix the operation of validation and persisting, right? Makes sense, thank you!
<boeg> well, obviously thats what you meant, it was just I who didn't understand :)
<phoe> boeg: yes, these two are supposed to be separate; in general, it is worthwhile to separate parts of code that are pure and that have side effects, and that is just one practical example of that
<boeg> indeed, thanks!
<phoe> also now it is `update-posts` that controls the flow of this part of the code and decides whether it is okay to invoke `perform-update-posts` and therefore perform side effects
<boeg> yes, i see that its a good way to organize it!
<phoe> so we have three functions in effect: one for validation, one for side effects, and one that controls the program flow
<phoe> and you will likely see similar structuring outside Lisp, too; it's a general programming pattern
<boeg> Indeed! I wanted to ask - is it correct to the -p (for predicate) for stuff like a function that returns a bool for example in the above case of post-path-p that decides whether the path is valid?
<boeg> as I understand it, thats the naming-scheme to use right? -p if multiple words (post-path), just "p" if it was "path" so "pathp", yes?
<phoe> boeg: the naming scheme is correct
<boeg> good!
<phoe> in general, predicates answer "yes or no" questions
<boeg> yes
<phoe> so I wouldn't use that for `validate-post` because this function answers *what* is wrong with a post
<boeg> thanks
<phoe> since you need detailed information.
<boeg> yes, good point!
<Shinmera> Could also use check-post-valid, which signals different conditions depending on the problem.
<phoe> Shinmera: the issue is that he needs not alter control flow of validate-post, he needs to go through all fields and collect the errors.
<Shinmera> then just use cerror
SGASAU` has quit [Quit: ERC (IRC client for Emacs 26.3)]
<phoe> Shinmera: that seems kinda backwards; cerror is going to either alter control flow or enter the debugger
SGASAU has joined #lisp
<phoe> or require a handler-bind with #'continue
<Shinmera> ? obviously you gather the conditions in a handler
<Shinmera> if that's what you want.
<phoe> I understand that what is wanted here is a list of all things that are wrong with a post, e.g. ("post title is invalid" "post path is invalid" "attachments not recognized" ...) etc..
<phoe> because that is then needed to be sent over the network and presented to the user in a frontend
<Shinmera> Yeah, I do too.
<boeg> indeed, thats the need
<phoe> I think that pushing to a list in validate-post is going to be the most effective here; I don't know how to include the condition system and handlers here without bloating that code
<Shinmera> You could also use a library like ratify to do things like this.
* phoe learns about the existence of RATIFY
<Shinmera> Typically validation is repeated in very similar ways all over. Using the condition system you can factor a validation out into a single function per 'validation type'. then just group a bunch of these checks into a validation function for an object
<Shinmera> then, if you need to gather all of the errors, use a handler.
<Shinmera> this allows you to reuse the checks in interactive sessions as well where the intent is not to redirect to a web frontend.
<phoe> I am more and more convinced of the truth of the statement "there's Shinmeraware for that"
<phoe> damn, that's a big library
<Shinmera> and it won't lose you the stack trace.
<Shinmera> I should rewrite it, I don't like its current design.
<Shinmera> It's one of my very early libraries.
<boeg> that's an interesting library
red-dot has joined #lisp
<boeg> although I think I should do it without that library for now until I've done this same thing in common lisp (as opposed to python where I do indeed use such a library because its a task repeated often, as you say, Shinmera) so many times that I myself discover the need of the library in the context of common lisp, so I actually get used to how to do it in common lisp without a library for now
nmg`` has quit [Remote host closed the connection]
SGASAU has quit [Remote host closed the connection]
SGASAU` has joined #lisp
<dlowe> for any problem, there exists solutions in pjbware, Shinmeraware, and hu.dwim
<boeg> lol
<phoe> and, possibly, fukamachiware
SGASAU` has quit [Remote host closed the connection]
<jackdaniel> hu.pjb.fukashrine
SGASAU` has joined #lisp
* phoe takes a brief break from #lisp
SGASAU` has quit [Remote host closed the connection]
Lycurgus has quit [Remote host closed the connection]
SGASAU` has joined #lisp
karayan has quit [Ping timeout: 240 seconds]
karayan has joined #lisp
ineiros has joined #lisp
ineiros has quit [Client Quit]
ineiros has joined #lisp
ineiros has quit [Client Quit]
ineiros has joined #lisp
gabiruh has joined #lisp
<phoe> oh bother
<phoe> (restart-case ... (abort () :report)) is allowed
<phoe> I am more and more tempted to say that keyword options to restart cases should have been provided in a distinct pair of parens
<phoe> like, a restart case could be destructured against (name (&rest arguments) (&key report interactive test) &body body)
<phoe> that would avoid the terribly awkward keyword parsing
<Bike> how is that allowed?
<Bike> oh, like, :report is the body?
<Bike> that's perverse.
<phoe> yes
<phoe> perverse, but standard
<Bike> mmh.
<phoe> is this the only place in standard CL that violates the no-&REST-after-&KEY rule?
<shka_> phoe: well, i suspect that you know better ;-)
<phoe> shka_: I'm only somewhat sure about the macros in the condition system, not about the other ones
EvW has joined #lisp
<White_Flame> what's the proper grammatical term for a verb that is involved in a closure? "The variable is closed over"? "The variable is closured in"? etc
<White_Flame> in an active etnse
<White_Flame> tense
<p_l> White_Flame: closed over
<shka_> uhm
Inline has quit [Ping timeout: 240 seconds]
<p_l> or possibly enclosed
<shka_> is it the correct direction though?
<Bike> well, active voice would be "the function closes over the variable"
<shka_> i thought that it is the function is closed over
<shka_> and not variable is closed over
<dlowe> the binding is closed over
<shka_> riight
<dlowe> so functions and variables
<White_Flame> Ok, when talking about deciding whether the variable is local/private or does closurey things, as the subject of the sentence?
TCZ has joined #lisp
<White_Flame> and yeah, none of these seemed rigt
TCZ has left #lisp ["Leaving"]
<White_Flame> erm, none that I posted seemed right, as you're pointing out
<shka_> White_Flame: variable may be included into closure lexical environment
<shka_> which i suspect is at least more correct term
orivej has joined #lisp
<White_Flame> I think "is enclosed" is probably correct enough and concise. I do like it
<phoe> oh bother
<phoe> clhs restart-bind
<shka_> this sounds good
<phoe> are declarations allowed in there?
<phoe> like, in forms?
<White_Flame> thx
<Bike> doesn't look like it. it says "implicit progn".
<Bike> and there's no opportunity for any bound declarations.
<phoe> right - SBCL accepts them there, but CCL doesn't
<phoe> heh, the spec could really use an "implicit locally" glossary term sometimes
* phoe puts it in the ideas-for-cltl4 jar
<Bike> well, sbcl is wrong
<Bike> looks like it's just part of a let. easy to fix, just replace ,@forms with (progn ,@forms)
<phoe> yes
<phoe> do I care enough to put a bugticket for that though...
<phoe> sigh
Inline has joined #lisp
<phoe> one second though
<phoe> a spurious DECLARE invokes undefined behaviour
<jmercouris> I believe in you phoe
<jmercouris> you can do it
<phoe> so SBCL is allowed to do what it does
<phoe> so no bugticket time
<phoe> clhs declare
<phoe> oh well
jrx has joined #lisp
rozenglass has quit [Quit: WeeChat 2.3]
rozenglass has joined #lisp
fourier has joined #lisp
rozenglass has quit [Client Quit]
<pve> Hello everyone
<pve> I'm working on a smalltalk-like "mini language" (in lisp) that I would like to put up on github, and now I'm wondering what I should call it.
<pve> Since its syntax basically consists of lisp symbols and forms I was thinking "symbolic smalltalk", but would that be inappropriate?
<Shinmera> smallertalk
<pve> (it's not a real smalltalk system by any means)
<pve> Shinmera: great suggestion
<fourier> tinytalk
<_death> thmalltalk
<pve> hehe
<dlowe> chitchat
<pve> dlowe: that one crossed my mind already
<jrx> lisp flavored smalltalk
<dlowe> yakity
<jrx> like this one : http://lfe.io/
<jrx> "flavoured"
<jrx> I see "Latest commit on 12 May 2019" on github page https://github.com/rvirding/lfe
jrx has quit [Quit: ERC (IRC client for Emacs 26.3)]
<pve> i like "smaller" and "tiny" because they reflect the fact that it's something you embed in normal lisp code
<shka_> commontalk ;-)
<pve> really good suggestion too
<Bike> lingua franca?
<shka_> is (check-type something-p boolean) considered to be a pedantic or not?
<phoe> yes
<phoe> all Lisp data are booleans
<phoe> generalized, but booleans
<pve> Bike: perhaps a bit too dramatic :)
<phoe> so limiting options to just (member t nil) may break existing code that passes e.g. 2 as a true value
<shka_> eh, ok
<jmercouris> can coerce to boolean?
<phoe> (coerce x 'boolean) would be nice to have, but is undefined
<jmercouris> shame
<phoe> (define notnot (x) (not (not x))) is also commonly seen somewhere
<dlowe> (if x t)?
<jmercouris> that works
<jmercouris> i know that one
<shka_> i just want to say that i don't like this one bit
IRC-Source_21 has joined #lisp
<jmercouris> what about the other bit?
<dlowe> shka_: ha ha
<shka_> sbcl already accepts everything as boolean everywhere
<shka_> so i will follow
<phoe> as it should
<phoe> nil is the only valse value in Lisp
<jmercouris> false*
<phoe> false, yes
<shka_> eh, we have to accept difference of opinions on this subject
<jmercouris> just in case someone in 2050 is reading this log and get's confused by the usage of the word valse
<jmercouris> maybe valse means something in 2050
<shka_> but as far as practical implications go, i agree
<jmercouris> i don't mind the generalized boolean approach
dyelar has quit [Quit: Leaving.]
<jmercouris> it is very much inherited and implicit behavior from C I think
<shka_> lisp didn't inherit anything from C
<shka_> python did
<jmercouris> lisp inherited things from C
<shka_> so 0 casts to false
<shka_> even though there are proper booleans
<shka_> oh, and False casts to 0
<shka_> this is as stupid as it gets
<jmercouris> or maybe C inherited from lisp
<shka_> ok, enough of ranting, back to programing
xkapastel has joined #lisp
theosvoitha has quit [Quit: Connection closed for inactivity]
<Bike> checked the maclisp manual and the description of cond is in terms of generalized booleans (though it doesn't use the term), and it says this is "like the traditional LISP 1.5 cond"
<phoe> generalized booleans saved us a ton of (not (eq ... nil))
<phoe> or, alternatively, (eq ... t)
<Grue`> nil as false is more pragmatic than Scheme's #f, but sometimes 0/empty string/empty array not being false or all objects being always true leads to ugly code
<Bike> i guess i can just check the 1.5 manual
<shka_> well, beach writes (when (not stuff) …) and is pretty explicit about this in his style guide
<beach> I write (when (null stuff) ...) but I don't think I write (when (not stuff)...)
<shka_> ok, ok
<shka_> null stuff
<shka_> even better
<beach> That's VERY different.
<shka_> yes
<shka_> you are right
<Bike> "Semantically, any S-expression that is not NIL will be regarded as truth [...]" yeah ok.
<Bike> though it's stricter about some things, like it says EQ returns *T* or NIL, not just a generalized boolean
<beach> shka_: Since NOT should take a Boolean value, (WHEN (NOT <stuff>) ...) would be entirely equivalent to (UNLESS <stuff> ...)
<shka_> beach: i understand, pardon my mistake
arbv has quit [Quit: ZNC - https://znc.in]
<beach> No problem.
arbv has joined #lisp
<jmercouris> why isn't it nullp?
<beach> For hysterical raisins.
<phoe> same why atom isn't atomp
<jmercouris> hysterical raisins?
<beach> *sigh*
<Bike> historical reasons
<shka_> :D
<phoe> translating from beachspeak: historical reasons
<jmercouris> man those grapes
<jmercouris> they are out of control
<shka_> grapes of the hysteria
<splittist> What else would a Professor from his town say?
<beach> "raisins hystériques" probably
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
<shka_> this sounds like a french punk rock band name
<jmercouris> this sounds like daft punk to me
sjl_ has joined #lisp
fourier has quit [Ping timeout: 240 seconds]
dyelar has joined #lisp
corpix has quit [Remote host closed the connection]
corpix has joined #lisp
dyelar has quit [Quit: Leaving.]
sabrac has quit [Quit: Konversation terminated!]
gargaml has quit [Ping timeout: 240 seconds]
gargaml has joined #lisp
MerlinTheWizard has joined #lisp
<pve> Bike: I take it back, it's not necessarily too dramatic :)
<pve> thank you all for your great suggestions
wsinatra has joined #lisp
Aurora_v_kosmose has quit [Remote host closed the connection]
red-dot has joined #lisp
Aurora_v_kosmose has joined #lisp
wsinatra has quit [Client Quit]
efm has joined #lisp
bitmapper has joined #lisp
<jackdaniel> histeryczne rodzynki?
<jackdaniel> mmm
beach` has joined #lisp
duncan_ has joined #lisp
Inline has quit [Ping timeout: 244 seconds]
beach has quit [Disconnected by services]
beach` is now known as beach
constptr has joined #lisp
vyorkin has joined #lisp
borei has quit [Ping timeout: 240 seconds]
v0|d has quit [Remote host closed the connection]
<gendl> Happy Mayday, everyone.
<beach> Thanks. You too.
<phoe> ^
Inline has joined #lisp
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
ahungry has joined #lisp
EvW has quit [Ping timeout: 240 seconds]
rozenglass has joined #lisp
marcoxa has quit [Ping timeout: 258 seconds]
red-dot has joined #lisp
asarch has joined #lisp
corpix has quit [Remote host closed the connection]
corpix has joined #lisp
duncan_ has quit [Ping timeout: 246 seconds]
corpix has quit [Remote host closed the connection]
corpix has joined #lisp
Lycurgus has joined #lisp
MerlinTheWizard has quit [Ping timeout: 240 seconds]
lxbarbosa has joined #lisp
corpix has quit [Remote host closed the connection]
corpix has joined #lisp
corpix has quit [Remote host closed the connection]
MerlinTheWizard has joined #lisp
corpix has joined #lisp
rogersm has joined #lisp
corpix has quit [Remote host closed the connection]
corpix has joined #lisp
<phoe> In DEFCLASS, "slot-spec" means "slot specification", "slot specifier", or something completely different?
corpix has quit [Remote host closed the connection]
scymtym__ has joined #lisp
rogersm has quit [Client Quit]
<Bike> what do you mean "In DEFCLASS"
corpix has joined #lisp
<Bike> on CLHS there is "slot-specifier" in the grammar
scymtym_ has quit [Ping timeout: 240 seconds]
<phoe> oh wait
<phoe> I meant in DEFINE-CONDITION
<phoe> thanks, DEFCLASS clarifies that one
<Bike> as we previously established, the define-condition grammar is weird and bad anyway
<phoe> yes
<phoe> I'm attempting to fix it a little bit now
<phoe> ...why is a single symbol even legal as a condition slot specifier
efm has quit [Read error: Connection reset by peer]
<phoe> you cannot even portably access that slot
<Bike> as we previously established, the define-condition grammar is weird and bad
<phoe> point taken
even4void has joined #lisp
even4void has quit [Client Quit]
efm has joined #lisp
luni has joined #lisp
souron_the_evil has quit [Quit: Leaving]
ljavorsk has joined #lisp
fourier has joined #lisp
Ven`` has quit [Quit: Textual IRC Client: www.textualapp.com]
gko has quit [Ping timeout: 240 seconds]
<bitmapper> can i use defmacro in defmacro, i forget
<Bike> you can expand to a defmacro, which is fine, or you can execute a defmacro which is technically legal but very weird to do.
<bitmapper> i'm expanding to one
<bitmapper> so, perfect
rgherdt has quit [Remote host closed the connection]
rgherdt has joined #lisp
<phoe> yes, expanding into a defmacro is not too weird to do
<fourier> 'programs generating programs generating programs'
<phoe> I mean, DEFINE-FOO-DEFINER isn't unseen in the wild - and such expand into DEFMACROs usually
<froggey> and it makes defmacro trivial to implement: (defmacro defmacro (name lambda-list &body body) `(defmacro ,name ,lambda-list ,@body))
<bitmapper> lol
<phoe> froggey: hold on for a moment
<Grue`> it needs to be a quine
<Grue`> expand into its own definition
<phoe> obviously
ljavorsk has quit [Ping timeout: 240 seconds]
rpg has joined #lisp
<bitmapper> aren't those function wrappers around primitives?
<bitmapper> or is some satanic magic happening
<phoe> they are open-coded into primitives, yes
<Grue`> i like how nobody knows what a certain comment means anymore, happens too often with old codebases
Inline has quit [Ping timeout: 240 seconds]
shukryzablah has joined #lisp
dddddd has quit [Remote host closed the connection]
karayan has quit [Ping timeout: 264 seconds]
karayan has joined #lisp
shifty has joined #lisp
karayan has quit [Ping timeout: 240 seconds]
karayan has joined #lisp
marcoxa has joined #lisp
zmt01 has joined #lisp
efm has quit [Remote host closed the connection]
rozenglass has quit [Ping timeout: 240 seconds]
zmt00 has quit [Ping timeout: 240 seconds]
efm has joined #lisp
lnostdal has quit [Read error: Connection reset by peer]
marcoxa has quit [Quit: ERC (IRC client for Emacs 25.3.1)]
marcoxa has joined #lisp
xlarsx has joined #lisp
xlarsx has quit [Ping timeout: 260 seconds]
xlarsx has joined #lisp
narimiran has quit [Remote host closed the connection]
xlarsx has quit [Remote host closed the connection]
narimiran has joined #lisp
rozenglass has joined #lisp
<jackdaniel> that's nothing, function names and comments in McCLIM's geometry module *were* written in german :)
<phoe> take a look at clisp source code if you want lots of german
rozenglass has quit [Quit: WeeChat 2.3]
jfrancis has joined #lisp
jfrancis_ has quit [Read error: Connection reset by peer]
xkapastel has quit [Quit: Connection closed for inactivity]
karlosz has joined #lisp
<asarch> If I have: ((pizza . 4) (beer . 5) (tacos . 8)), how would I get quickly the value of beers?
<Josh_2> assoc
stepnem has quit [Read error: Connection reset by peer]
z147 has joined #lisp
<asarch> Thank you!
<Josh_2> well (cdr (assoc 'beer <that list>))
karayan has quit [Ping timeout: 256 seconds]
karayan has joined #lisp
fourier has quit [Ping timeout: 240 seconds]
<phoe> alexandria:assoc-value
stepnem has joined #lisp
choegusung has joined #lisp
choegusung has quit [Client Quit]
IRC-Source_21 has quit [Quit: Connection closed]
<Grue`> cdadr is the quickest. but only if the entries are in this specific order
<asarch> Thank you very guys! :-)
EvW1 has joined #lisp
fourier has joined #lisp
<asarch> And what if: ((food (tacos . 8) (pizza . 3) (beer . 6))), how could I get the value of beers?
rozenglass has joined #lisp
<Bike> it's gonna be various combinations of car, cdr, and assoc.
<jackdaniel> Grue`: if the entries are in this specific order and have this specific values, then typing "5" in repl should do ,-)
<Bike> in this case probably assoc of cdr of first of first. but it depends on your data structure.
<Bike> which we can't tell you about.
<Bike> er, only one first
barthandelous has joined #lisp
shangul has joined #lisp
Lycurgus has quit [Remote host closed the connection]
<asarch> (assoc 'beer (cdr (car '((food (pizza . 4) (beer . 5) (tacos . 8))))))
z147 has quit [Quit: z147]
ted_wroclaw has joined #lisp
Inline has joined #lisp
efm has quit [Ping timeout: 256 seconds]
<ahungry> assuming the assoc key 'food' is more relevant than whatever item is first in your data set, to get the value would likely be more clearly written as: (cdr (assoc 'beer (assoc 'food your-list-of-things-here)))
Fare has joined #lisp
efm has joined #lisp
<ahungry> well, maybe a little off, I guess emacs cl-assoc doesn't quite map 1 to 1 with CL assoc, my bad
<ahungry> yea, so adjust it similar to this and its an easy accessor for association lists: (assoc-cdr 'beer (assoc-cdr 'food food-menu)), where assoc-cdr is just a small function similar to: (defun assoc-cdr (k l) (cdr (assoc k l)))
eta has quit [Ping timeout: 260 seconds]
fourier has quit [Ping timeout: 240 seconds]
<Fare> Somehow quicklisp won't find clx-truetype in ~/quicklisp/dists/quicklisp/software/clx-truetype-20160825-git -- how do I debug that?
efm has quit [Remote host closed the connection]
karswell_ has joined #lisp
<Fare> also, while downloading, I had to restart a lot of times because a package was downloaded with the wrong size
<phoe> or are you using an older dist that still contains that system?
stepnem has quit [Ping timeout: 264 seconds]
stepnem has joined #lisp
efm has joined #lisp
<Fare> phoe: aha. I had updated my dist, but the source directory still existed from a previous dist.
<Fare> when I did a (ql-dist::clean (ql-dist::dist "quicklisp")) it disappeared.
<asarch> Or just (flet ((quantity (value) ....) (quantity 'beer'))
<phoe> Fare: sounds like it "fixes" your problem, then
milanj has quit [Quit: This computer has gone to sleep]
<phoe> doesn't fix the fact that clx-truetype disappeared altogether, but should fix your dist structure
ChoHag has joined #lisp
<ChoHag> I know it begs the question "when would it even be called?" so does CLOS have the concept of automatic destructors?
lemoinem has quit [Ping timeout: 244 seconds]
<dlowe> they're called "finalizers"
eta has joined #lisp
lemoinem has joined #lisp
<dlowe> and the answer is "not portably"
<phoe> ChoHag: the first, incorrect answer is (ql:quickload :trivial-garbage)
<phoe> the second, correct answer is "really, don't use finalizers"
<dlowe> you really want to control when you release resources
<ChoHag> No. I don't *want* to.
<dlowe> then you will want to when you hit the error-prone nature of the idea
karswell_ has quit [Remote host closed the connection]
ted_wroclaw has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ChoHag> I do every time I try and use it.
<ChoHag> I want to like RAII.
Jesin has quit [Quit: Leaving]
<_death> huh, it seems hofstadter's copycat program is not too hard to port to modern common lisp, so far.. https://plaster.tymoon.eu/view/1794#1794
<phoe> ChoHag: this sounds like initializing some resources with dynamic extent
<phoe> which, in turn, sounds like a WITH-FOO macro
<Fare> the correct answer is "Use Rust" ?
<phoe> Fare: that's a weird answer to get on a Lisp channel
karswell_ has joined #lisp
<Inline> more rusty
<Inline> lol
<Fare> by which I mean "implement Rust in Lisp"?
<dlowe> RAII (which I remain unsold on) requires definite lifetimes
<dlowe> which you're not going to get via garbage collector
<phoe> and definite lifetimes means that you can use a WITH-FOO macro to control resource releasing
<dlowe> yes
<Fare> isn't Lisp supposed to be every language?
<Fare> I saw people implement parts of Rust in Racket.
<phoe> (defmacro with-foo ((var) &body body) `(let ((,foo (make-foo))) (unwind-protect (progn, @body) (free-foo ,foo))))
<dlowe> some things in the runtime are harder to mess with than others without creating a new runtime
<ChoHag> Fare: Other way around.
<phoe> adapt to your needs
vlatkoB has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<phoe> Fare: I don't know if Rust-style borrowers have ever been attempted in CL yet
<Fare> ChoHag, you want to implement CL in Rust?
<phoe> uh, s/foo/var/
<ChoHag> No thanks.
<Fare> Lisp can be every language, and every language can be Lisp!
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Jesin has joined #lisp
barthandelous has quit [Quit: barthandelous]
efm has quit [Read error: Connection reset by peer]
jonatack_ has quit [Read error: Connection reset by peer]
jonatack__ has joined #lisp
jonatack__ has quit [Client Quit]
efm has joined #lisp
jonatack has joined #lisp
<Fare> "Guy Steele has been quoted as vaunting the programmability of Lisp’s syntax by saying: If you give someone Fortran, he has Fortran. If you give someone Lisp, he has any language he pleases. Unhappily, if he were speaking about CL specifically, he would have had to add: but it can’t be the same as anyone else’s."
rpg has joined #lisp
fourier has joined #lisp
<_death> seems your quotation is putting words into Guy Steele's mouth
<Fare> _death, I need more nested quotes?
<Fare> "Guy Steele has been quoted as vaunting the programmability of Lisp’s syntax by saying: «If you give someone Fortran, he has Fortran. If you give someone Lisp, he has any language he pleases.» Unhappily, if he were speaking about CL specifically, he would have had to add: but it can’t be the same as anyone else’s." Better?
<_death> now the dishonesty is clearer, yes
<Fare> In the original, the Steele quote was in italic.
MerlinTheWizard has quit [Ping timeout: 240 seconds]
<Fare> How is that dishonest?
<_death> because you have no idea what Guy Steele would have to add or not.. you just use his aura of authority to advance your own arguments
<_death> or rather, claims
eta has quit [Ping timeout: 260 seconds]
<Fare> I'm shocked that my addendum is interpreted as being attributed to Steele or claiming his authority—--it undermines Steele as much as it reveres him.
<Fare> That said, I should ask Steele next time he's in town.
<dlowe> computer languages were a much simpler affair in the 80s
<dlowe> there was much less of an ecosystem aspect
<Fare> dlowe, indeed they were.
<Fare> or rather, there was the ecosystem aspect, but at a smaller scale.
<Fare> dlowe, I see that you maintain local-time.
<dlowe> Fare: to some degree
vivit has joined #lisp
vivit has quit [Changing host]
vivit has joined #lisp
<Fare> the naggum document mentions allocating a large table of data and then other optimizations, and concludes that "this optimization is not implemented yet" or something, but it's unclear what is or isn't. Does local-time do that?
karlosz has quit [Quit: karlosz]
<phoe> Fare: the document mentions a fixnum space, which makes me wonder if Naggum worked with 64-bit machine words
<dlowe> No. I realize that was most of the document, but I figured that computation was fast enough
<dlowe> and so far no one has cared enough to add the speed/space tradeoff
ted_wroclaw has joined #lisp
<phoe> blah, I have less and less energy for writing this book; I already want to be done with it
<phoe> glad that all that remains is writing the reference and stuffing the code on github
<Fare> phoe, what does the book say / do?
shangul has quit [Ping timeout: 256 seconds]
SGASAU` has quit [Remote host closed the connection]
<phoe> tl;dr a book on the condition system. The abstract is at the beginning.
SGASAU` has joined #lisp
shka_ has quit [Ping timeout: 246 seconds]
<aeth> Nested quotes? When you can just do this? '(GUY STEELE HAS BEEN QUOTED AS VAUNTING THE PROGRAMMABILITY OF |LISP'S| SYNTAX BY SAYING |:| (IF YOU ...))
<Fare> aeth, wow, back in the 1970s
<ChoHag> phoe: What does var do in that macro?
<ChoHag> It's not used anywhere.
<Fare> phoe, not sure your long discussion on dynamic variables should be the chapter 1 rather than an appendix
<ChoHag> Also FWIW I'm unused to lisp macros - I'm approaching lisp from scheme.
karlosz has joined #lisp
<phoe> Fare: what do you mean, appendix
<phoe> oh, I see
<Fare> phoe, I don't know who is your intended audience, but I would pick a few proofreaders and listen to their feedback on how to organize the book.
<phoe> I chose to put it there because people were getting confused about how dynavars work, especially people who aren't lispers.
<Fare> "Dynamic variables? Ah, you mean the reader monad!"
<phoe> Fare: sure.
<phoe> ChoHag: I screwed up, the valid macro is (defmacro with-foo ((var) &body body) `(let ((,var (make-foo))) (unwind-protect (progn, @body) (free-foo ,var))))
<ChoHag> Ah so var can be used within body?
<phoe> correct
akoana has joined #lisp
<phoe> Fare: the target is beginner and intermediate Lisp programmers and intermediate non-Lisp programmers
<phoe> the dynavar chapters are for the latter, since many languages simply don't provide dynavars and so even the concept is completely foreign for them.
<phoe> and dynavars are the foundation of the whole handler and restart subsystems, so I don't think stashing the concept away to an appendix will do the book much good.
shukryzablah has quit [Quit: ERC (IRC client for Emacs 26.3)]
<dlowe> phoe: (free-foo ,var) should probably be (ignore-error (free-foo ,var))
lxbarbosa has quit [Remote host closed the connection]
<ChoHag> phoe: Do dynamic variables differ substantially from perl's globals?
<ChoHag> Or whatever it calls what local does.
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
<dlowe> actually, never mind. I misremembered a thing.
<phoe> dlowe: wait a second, why
<phoe> if you get an error freeing some resource, then that error must be meaningful for the programmer
<dlowe> I had some vague recollection that having a non-local exit in a recovery was bad, but when I looked I saw no such thing.
<ChoHag> Well presumably the expression normally evaluates to the result of body?
<phoe> non-local exit? what do you mean?
MerlinTheWizard has joined #lisp
<dlowe> phoe: like another signal or a goto or a throw
<dlowe> or invoking a restart
<ChoHag> Also a good point - how *are* unexpected conditions in the unwinder 'supposed' to be handled?
<phoe> ChoHag: that's not really the issue of the unwinder; if your freeing function signals an error, then it signals an error, and at some point it should be handled
MightyJoe has joined #lisp
<phoe> dlowe: I remember no such thing, the protecting forms can do whatever they want
cyraxjoe has quit [Ping timeout: 256 seconds]
<ChoHag> Hmm I should probably find out how CL does exceptions.
<dlowe> phoe: how many times do I need to say I was mistaken.
<phoe> welp, sorry
<phoe> ChoHag: well that's what my book is about
<ChoHag> I thought it was about dynamic variables?
<phoe> its name is Common Lisp Condition System
<ChoHag> Oh wow that scroll bar's actually quite small...
rozenglass has quit [Quit: WeeChat 2.3]
<phoe> which, in turn, is mostly about dynamic variables
<phoe> and creative ways of using them
<ChoHag> TOC would be nice.
<pjb> dlowe: were you mistaken?
<phoe> ChoHag: it's a markdown document, ToCs will be done when the book is finished.
<phoe> and published.
<phoe> it's still a WIP.
<ChoHag> Just giving the gist of it?
<phoe> just publishing an early version in hope I get some more proofreaders on it
<ChoHag> Is there some concise description of what the condition system is/does before reading this for the details?
<ChoHag> You make it sound like it's a common feature.
MightyJoe has quit [Ping timeout: 240 seconds]
<ChoHag> I like the idea of 'exceptions, but winding the stack UP'.
fourier has quit [Ping timeout: 240 seconds]
<phoe> ChoHag: the "Introduction" should give a brief glimpse of what it is
<ChoHag> I'm just not a fan of "This book is supposed to be read in order" :(
cyraxjoe has joined #lisp
<phoe> I'm sorry; I have no idea how to make that book modular, since you need knowledge from the earlier chapters to understand later ones.
rwcom3 has joined #lisp
<Bike> even books that try to be modular still have internal dependencies
<Bike> i guess you could do your technical book like Pale Fire. sounds innovative
<ChoHag> Well I'll make a point to read it later. I've been thinking a lot about that side of things recently but taking a detour to actually learn lisp for real this time.
<ahungry> phoe: typo in "Tom tends to call various people often and for various puroposes. "
<phoe> ahungry: thanks, will fix.
* phoe googles Pale Fire
<Bike> well, the point is there's no particular order you have to read it in, though reading the individual sections linearly is probably a good idea
<Bike> "Types and Programming Languages" does give a dependency graph of the chapters early on. i think a few other mathy books do that as well, but that's the one i remember
<_death> you could make it hierarchical.. first the big picture, then more and more detailed reiterations
<Bike> of coruse, this still establishes a _partial_ order, so technically,
<ChoHag> Oh btw, as a general rule please try to give (a summarised version of) the expected result of any code samples.
<Fare> phoe, some people understand the reader monad, or dependency injection, etc. You can appeal to their familiarity of it and/or to the fact that dynamic binding trivializes these things that are non-trivial in other languages.
<ChoHag> It's one of the most frustrating things when reading documentation to see code and be expected to know what its output would be, given the API being documented.
MightyJoe has joined #lisp
<phoe> Fare: point taken, thank you. I'll do that.
<phoe> ChoHag: I do that when I test things in the REPL. Or do you mean something else?
<ChoHag> Mostly things that could be copy-pasted into a REPL, include in the book what the REPL would display.
<phoe> ChoHag: I do that
<ChoHag> Yes I've seen a few.
rumbler314 has joined #lisp
cyraxjoe has quit [Ping timeout: 256 seconds]
<ChoHag> Maybe it's ubiquitous already, I don't know; I haven't read it in depth yet just a quick eyeball.
dale_ has joined #lisp
dale_ is now known as dale
terpri has quit [Remote host closed the connection]
terpri has joined #lisp
<phoe> okiedokie
gargaml has quit [Quit: WeeChat 2.8]
shangul has joined #lisp
cyraxjoe has joined #lisp
MightyJoe has quit [Ping timeout: 240 seconds]
eta has joined #lisp
MightyJoe has joined #lisp
cyraxjoe has quit [Ping timeout: 260 seconds]
<ted_wroclaw> phoe: I think it's great that someone is writing a lisp book. We need more of them.
<phoe> ted_wroclaw: thanks, that's why I'm doing that
pve has quit [Quit: leaving]
<phoe> are you from Poland? your nickname sounds quite Polish
<ted_wroclaw> I'm American, but I live in Wroclaw
<phoe> oh! I see, amazing stuff
<ted_wroclaw> you are polish?
<phoe> yep, Kraków says hello
<phoe> you can meet some Polish lispers on #lisp-pl if you want
<ted_wroclaw> świetnie!
<ted_wroclaw> but my Polish is limited to ordering tartar at the 1 eur bars
<Josh_2> I have met polish lispers :O
SGASAU` has quit [Remote host closed the connection]
narimiran has quit [Quit: leaving]
SGASAU` has joined #lisp
vladomiro has joined #lisp
gravicappa has quit [Ping timeout: 264 seconds]
shangul has quit [Ping timeout: 246 seconds]
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
McParen has left #lisp [#lisp]
<Fare> phoe, next time you go to Wawel castle, please take pictures of the armor room
<phoe> Fare: I remember that one, you asked me previously about it
nika has quit []
cyraxjoe has joined #lisp
MightyJoe has quit [Ping timeout: 260 seconds]
jonatack_ has joined #lisp
jonatack has quit [Ping timeout: 260 seconds]
MightyJoe has joined #lisp
cyraxjoe has quit [Ping timeout: 260 seconds]
cyraxjoe has joined #lisp
quazimodo has quit [Ping timeout: 246 seconds]
quazimodo has joined #lisp
ted_wroclaw has quit [Quit: Textual IRC Client: www.textualapp.com]
MightyJoe has quit [Ping timeout: 260 seconds]
eta has quit [Ping timeout: 260 seconds]
Bourne has quit [Ping timeout: 260 seconds]
<ChoHag> How can I adapt the with-foo macro so that arguments can be passed to make-foo? I presume (defmacro with-foo ((a b c) &body d) ... (make-foo a b c) ... would work, but how do I just say 'pass any arguments as-is'?
<ChoHag> In scheme I'd have something like '(var . opt)' and '(apply make-foo opt)'.
MerlinTheWizard has quit [Remote host closed the connection]
eta has joined #lisp
MerlinTheWizard has joined #lisp
<ChoHag> Then '(with-foo var-name 42 43 44)'.
<ChoHag> Oh and a body and an extra level of () around the arguments but you get the idea.
<phoe> (defmacro with-foo ((var &rest args) &body body) `(let ((,var (make-foo ,@args))) (unwind-protect (progn, @body) (free-foo ,var))))
<ChoHag> Perfect thanks.
<ChoHag> Macros look weird.
<phoe> a macro is just a function that accepts Lisp data and spits out Lisp code
<phoe> wait a second, I screwed it up
<phoe> (defmacro with-foo ((var &rest args) &body body) `(let ((,var (make-foo ,@args))) (unwind-protect (progn ,@body) (free-foo ,var))))
<phoe> there
Bourne has joined #lisp
<ChoHag> Oh yeah you had that in the previous one.
<ChoHag> I can read macros, they just look weird.
<phoe> (defmacro with-foo ((var &rest args) &body body) (list 'let (list (list var (list* 'make-foo args))) (list 'unwind-protect (list* 'progn body) (list 'free-foo var))))
<phoe> there, have that instead
<ChoHag> Oh for ...
<ChoHag> Oh I see. God that's awful.
<aeth> things like that are usually better with `
ggole has quit [Quit: Leaving]
<phoe> yes
<ChoHag> Yeah... Why am I a programmer again?
jruiz has joined #lisp
quazimodo has quit [Ping timeout: 264 seconds]
quazimodo has joined #lisp
<aeth> Well, I mean, it's a simple pattern so you could always do (defmacro define-with (binding cleanup &body body) ...)
karayan has quit [Remote host closed the connection]
<aeth> well, something along those lines
<aeth> Always go one level more meta
karayan has joined #lisp
<phoe> ah yes, the definer definer
MerlinTheWizard has quit [Ping timeout: 240 seconds]
<aeth> define-modify-macro
<ChoHag> The wrap-line symbol on the right hand side of the screen is the sign to go up another metalevel.
<aeth> define-modify-macro is the sort of high level you should be going for
<aeth> (yes, it's not a definer definer, but it's a one liner sort of thing)
SGASAU` has quit [Remote host closed the connection]
vivit has quit [Ping timeout: 264 seconds]
Aurora_iz_kosmos has joined #lisp
heisig has quit [Quit: Leaving]
ahungry has quit [Remote host closed the connection]
Aurora_v_kosmose has quit [Quit: Пока, мир.]
rumbler314 has quit [Ping timeout: 245 seconds]
MerlinTheWizard has joined #lisp
asarch has quit [Quit: Leaving]
Aishawhite has joined #lisp
Aishawhite has quit [Client Quit]
<Inline> so a 'has-a' relationship in oop cl is realized by adding a mixin ?
shangul has joined #lisp
shifty has quit [Ping timeout: 260 seconds]
vivit has joined #lisp
vivit has joined #lisp
<_death> no, it is realized by defining a slot.. a mixin lets you reuse implementation
<jruiz> Inline: say you have an engine class and want to define a car class
<jruiz> a car 'has' an engine, so you could do
<jruiz> (defclass car () ((engine :initform (make-engine) :reader car-engine)))
<jruiz> assuming you have an engine constructor, make-engine
vyorkin` has joined #lisp
kark has joined #lisp
vyorkin has quit [Ping timeout: 260 seconds]
<Inline> allright
MerlinTheWizard has quit [Ping timeout: 240 seconds]
hsaziz has joined #lisp
_whitelogger has joined #lisp
drewc has quit [Ping timeout: 244 seconds]
Josh_2 has joined #lisp
<Inline> or a few slots which are not thought to be part of the normal instance
azrazalea has joined #lisp
terpri has joined #lisp
niceplace has joined #lisp
terpri has quit [Remote host closed the connection]
vyorkin` has joined #lisp
nchambers has joined #lisp
|3b| has joined #lisp
HiRE has joined #lisp
terpri has joined #lisp
<jruiz> mixins generally customize or enhance the behavior of other classes
<Inline> right so thru slot inheritance it can modify the slot too
<Inline> hmmm
eagleflo has joined #lisp
kark has joined #lisp
ft has joined #lisp
Necktwi has joined #lisp
ult has joined #lisp
drewc has joined #lisp
<aeth> in Common Lisp, cars are called automobiles :-)
<jruiz> aeth: oh yes, good point
<jruiz> (defclass automobile () ((engine :initform (make-engine) :reader automobile-engine)))
seok has joined #lisp
<seok> morning guys
MerlinTheWizard has joined #lisp
<seok> Is there some kind of data structure that uses datetime as index?
<seok> something like pandas in python
torbo has joined #lisp
sjl_ has quit [Ping timeout: 256 seconds]
vivit has quit [Ping timeout: 240 seconds]
hsaziz has joined #lisp
frgo has quit [Remote host closed the connection]
hsaziz has quit [Client Quit]
Necktwi has quit [Ping timeout: 256 seconds]
efm has quit [Ping timeout: 246 seconds]
hsaziz has joined #lisp
frgo has joined #lisp
hsaziz has quit [Client Quit]
torbo has quit [Remote host closed the connection]
torbo has joined #lisp
marcoxa has quit [Remote host closed the connection]
<markasoftware> so, uh, why is loop way fastert han dotimes in sbcl?
<markasoftware> (let ((total 0)) (dotimes (i 16000000) (incf total i)) vs (loop with total = 0 for i from 0 below 16000000 do (incf total i) finally (return i))
<markasoftware> *return total
Nilby has quit [Read error: Connection reset by peer]
<markasoftware> i guess i should just look at the macroexpand
<saturn2> they produce almost the same disassembly for me
<White_Flame> loop is a bit smaller than dolist for me as well (speed 3, safety 0 etc)
<Bike> those both take about the same time for me.
<Bike> also it varies by a not insubstantial fraction between runs.
<markasoftware> i may have done something wrong
<White_Flame> also, you should probably declare fixnum for such a test in case it's doing generic + calls
<markasoftware> ah ok, the problem was when i didn't use let
<ralt> so
<markasoftware> so, just (setq total 0) then (dotimes (i 16000000) (incf total i))
<ralt> I have a system with :build-operation :static-program-op
<markasoftware> but then the same thing happens with loop. So it is about global vs local variables, probably something type related
<Bike> markasoftware: in that case it will use dynamic variables, which probably will be much slower.
<markasoftware> my apologies
<Bike> markasoftware: sbcl should have warned you about this?
<markasoftware> yess
vivit has joined #lisp
vivit has quit [Changing host]
vivit has joined #lisp
<saturn2> dynamic variables are always going to be slower even with a declared type
<ralt> my sbcl 2.0.4 was compiled with sb-linkable-runtime, the system defsystem-depends-on on cffi-grovel, and I even have a static library (.a) built
<markasoftware> why is setting a dynamic variable slow?
<ralt> but the compilation is failing with (.text+0x24): undefined reference to `main'
<Bike> setting a dynamic variable means setting a global spot such as part of the environment or thread local storage
<Bike> whereas setting a lexical variable might be setting a register, or a stack location, or nothing
<ralt> looking on reddit/cl-mpi, it sounds like just having a correctly compiled sbcl should be enough, but mine definitely has that done, so I'm a bit at a loss
<White_Flame> there's generally a test to see if it's dynamically bound, and if not then the write goes to the global symbol-value slot
<White_Flame> and incf is doing both a read & a write, both which need to perform that test
<White_Flame> (likely, not verified)
<markasoftware> huh, cool stuff
<markasoftware> thanks!
<saturn2> most optimizations can't be done because the dynamic variable might be changed by other code and might be bound on the stack or globally
<White_Flame> if you didn't defvar the variable, then it even calls through a SET function
<White_Flame> since there's many other declarations that could define how it's stored, and it'd have to figure that out at runtime
igemnace has quit [Quit: WeeChat 2.8]
<White_Flame> markasoftware: in any case, DISASSEMBLE is your frient
<White_Flame> even if just to see the general gist & size of the generated code
<White_Flame> and how many embedded function calls occur vs inline work
<saturn2> sbcl lets you optimize that slightly by using defglobal, but it still can't optimize away any reads or writes since other code might depend on them
<White_Flame> a write to a defglobal is a plain MOV QWORD PTR [location], val
<White_Flame> (with optimizations cranked up)
<axion> CCL and LW also have globals.
<White_Flame> do any of them have thread-local-only declarations? sbcl doesn't
<White_Flame> that would help microoptimize a lot of my use
<axion> There's even a portability library, if you call 3 implementations "portable", and any others, falling back to a symbol macro.
torbo` has joined #lisp
<markasoftware> it's pretty fast if i do defvar instead of just setq
karayan has quit [Ping timeout: 240 seconds]
<White_Flame> yep, then it knows what you're talking about when you use the variable name
torbo has quit [Ping timeout: 260 seconds]
<White_Flame> instead of needing to be ultra generic with runtime tests
theseb has joined #lisp
jonatack_ has quit [Ping timeout: 246 seconds]
jonatack_ has joined #lisp
<theseb> Do macros simply lead to the reader making various text substitutions? I'm looking at simple macro examples and wondering..."Why can't those substitutions happen during the evaluation phase"?
<theseb> e.g. I'm looking at a macro definition of "let"......it is a lambda expression....Could we effectively get "let" my coding it to equal the correct lambda expression w/o macros?
<no-defun-allowed> Macroexpansion happens as a part of evaluation.
<saturn2> i don't understand the question
torbo` has quit [Remote host closed the connection]
torbo has joined #lisp
xkapastel has joined #lisp
<_death> you are looking at a macro definition of "let" and finding a lambda expression?
<_death> what lisp is this
vladomiro has quit [Quit: Leaving]
MerlinTheWizard has quit [Ping timeout: 240 seconds]
<aeth> in theory (let ((a 42) (b 53) (c 64)) (values a b c)) is the same thing as ((lambda (a b c) (values a b c)) 42 53 64) although an implementation might choose a more efficient representation (for its particular architecture)
<_death> (let ((&key 42)) &key)
<aeth> _death: that can be solved by gensym
<_death> (let ((&key 42)) (declare (special &key)) &key)
<aeth> so it's really `((lambda (,a ,b ,c) (values ,a ,b ,c)) 42 53 64)
SGASAU has joined #lisp
<aeth> _death: that fails in SBCL
<aeth> So my implementation could still work :-)
<aeth> "Lock on package COMMON-LISP violated when declaring &KEY special while in package COMMON-LISP-USER."
<_death> right
<aeth> And, anyway, you'd only have to gensym the &key, &rest, etc.
<_death> it cannot be solved by a gensym unless you walk the body
<White_Flame> theseb: the macroexpansion is not part of the reader. It's the early part of the evaluator
<aeth> _death: which an implementation is safe to do
<aeth> _death: tree walkers are only problematic from our perspective, trying to write one that's not fragile. Implementations can cheat
decent-username has quit [Ping timeout: 265 seconds]
<_death> aeth: yeah.. I can't think of a theoretical limitation at the moment.. but theseb claims to have a concrete case
<aeth> _death: (1) I'm not sure, since the line seems poorly phrased. (2) It could be a Scheme. Schemes love lambda.
<aeth> (And a Scheme wouldn't need these workarounds)
<_death> a scheme is offtopic
SGASAU has quit [Remote host closed the connection]
<_death> hence my question: what lisp is theseb talking about
SGASAU has joined #lisp
<aeth> it could be a pedagogical example, which probably wouldn't include handling complex edge cases like &key, and probably wouldn't care about performance, either
MerlinTheWizard has joined #lisp
<_death> in Common Lisp, LET is not a macro; it is a special operator (it's true that an implementation may provide a macro function for it as well)
<Inline> let let let let let......
karswell_ has quit [Read error: Connection reset by peer]
<_death> so the answer to his question appears to be "yes"
<aeth> and, anyway, even if the example let definition was Scheme, I don't see why it's off-topic because it also applies to CL and was asked in a CL context
ealfonso has joined #lisp
<aeth> but whether it was Scheme or just an example, you raise a valid complication for a naive implementation in CL.
<aeth> Implementations could cheat in various ways that you can't, though, like with gensym, or even by having a lambda without the advanced lambda-list features.
<aeth> (as e.g. %lambda)
<_death> that's just saying LET can be implemented in some way
<aeth> and, yeah, it can be implemented as a lambda expression, but doesn't have to be
<aeth> And I think that's where the point of confusion is.
SGASAU has quit [Ping timeout: 260 seconds]
<aeth> Just because two things are equivalent, and the lambda is in some sense simpler, and you can define LET in terms of LAMBDA, doesn't mean that implementations actually do this, and they probably don't.
<Inline> heh
<Inline> lol
<aeth> And unless the lambda is inline it's probably not the most efficient way to do it.
edgar-rft has quit [Quit: Leaving]
<aeth> So it really comes down to if the compiler is smart enough to inline such lambdas since they can't be declared inline.
<aeth> And it still doesn't give you flet, labels, macrolet, or symbol-macrolet
random-nick has quit [Ping timeout: 260 seconds]
<aeth> Or even multiple-value-bind, since m-v-b inserts implicit NILs while multiple-value-call fails if something is too short.
Oladon has joined #lisp
Lord_of_Life_ has joined #lisp
<aeth> (You could probably use &optional to get around that, but now you can't use a special %lambda that avoids the &rest, &optional, &key, etc., issue)
<aeth> (I guess you could make an %lambda* that is always &optional)
edgar-rft has joined #lisp
Lord_of_Life has quit [Ping timeout: 256 seconds]
Lord_of_Life_ is now known as Lord_of_Life
<theseb> _death, aeth: i wrote my own lisp + macro system....i guess it is scheme like....here is my let implementation ... https://pastebin.com/3a6CJ8f1
<theseb> _death, aeth: somehow i forgot why macros are necessary
<theseb> trying to retrain my brain
<Xach> nothing is necessary but many things are handy
<theseb> Xach: what is simplest macro that has funtionality that cannot be done w/o macro system? (for pedagogical reasons)
<_death> a definition for such a macro was given here today
<theseb> preferably one that uses , and ,@ for pedagogical reasons too
<no-defun-allowed> (defmacro delay (thing) `(lambda () ,thing)) maybe
<_death> [19:55] <froggey> and it makes defmacro trivial to implement: (defmacro defmacro (name lambda-list &body body) `(defmacro ,name ,lambda-list ,@body))
<theseb> i think i need to think on this more...i'm slow
<_death> you can think of macros as a way to extend your interpreter..
jason_m has quit [Ping timeout: 260 seconds]
<_death> you can always integrate operators into your interpreter, but the point of macros is to allow ad-hoc extension without modification
<aeth> most macros are just sugar, like having a LET defined in terms of LAMBDA instead of having to just use LAMBDA for everything
<aeth> they can also be optimizations, though, since the function (infix '(1 + 1)) is possible just like the macro (infix (1 + 1)) or (infix 1 + 1) but the macro will do things at macroexpansion time instead of at runtime
<aeth> with an interpreter it's not necessarily a performance win unless you do bytecode compilation, though
<aeth> With a naive intrepreter, the macro will probably be slower than the function because there's some extra steps involved.
<pjb> aeth: interpreters still have to do minimal compilation when you call compile.
<pjb> aeth: most interpreter will only macroexpand once the macros, caching the result.
<aeth> pjb: yes, but the context is writing a Lisp-like language in Common Lisp, not writing a Common Lisp
<pjb> (I know of no interpreter that doesn't just expand everything at defun time).
<aeth> (the context wasn't clear before)
<pjb> aeth: in that case, you do however you want.