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?
<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...
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
<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.)
<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?
<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>
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
<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 [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
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> ...)
<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?
<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
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
<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.
<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)
<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
<_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.