freenode/#lisp - IRC Chatlog
Search
8:13:26
White_Flame
so for what it takes to set up & initialize, not sure it's better to move to that workflow from SLIME
8:16:07
White_Flame
and more of a usage testing environment than an actual software development environment
8:16:56
White_Flame
first lines: "To continue with installation, evaluate: (quicklisp-quickstart:install)"
8:17:45
no-defun-allowed
I think you would need to install the headers for zmq. The version has -debian- in the name, so I would guess it's in a libzmq-dev
8:23:55
doomlist3
mkdir: cannot create directory ‘.local/share/jupyter/kernels/common-lisp’: Permission denied
8:24:08
doomlist3
using sudo it works but it's user becomes root, but i don't intend dto run it as root
8:24:51
jdz
It seems you've have done something as a root user already, so you should fix what's broken before proceeding.
8:28:26
doomlist3
mkdir: cannot create directory ‘.local/share/jupyter/kernels/common-lisp’: Permission denied
8:33:12
doomlist3
https://bpaste.net/JRJQ let's just hope now it begins. i put a lot of effort into this
9:07:12
no-defun-allowed
To my knowledge, the consequences are undefined if you (declare (type ty p)) and P is not of type TY.
9:08:18
no-defun-allowed
If you want to assert that a variable is bound to a value of some type, use CHECK-TYPE.
9:12:45
phoe
momozor: depends on the compiler. SBCL tends to optimize it away and also warn if it detects a type mismatch at compile-time.
9:13:08
phoe
also, CHECK-TYPE actually prevents you against supplying an object of wrong type by means of signaling an error
9:14:32
beach
ACTION observes that phoe is either not interested in his talk, or phoe is a much better multi-processor. :)
9:22:09
phoe
I am currently listening the ELS talks, answering IRC, and handling people who are performing fixes in the flat I'm in
9:27:34
phoe
but that's when things collide, I wish I could focus on my computer and therefore on Lisp-related things
10:01:45
rtvdenys
However, the warnings do not mention the files and lines in the files where the problem is.
10:04:16
rtvdenys
For C-c C-k I need to know which file is producing those warnings but I do not know even that.
10:07:15
rtvdenys
(asdf:compile-system :cl-async :verbose t :force t) made it error and the error is quite unclear. I suspect it did not like those asdf options
10:08:56
rtvdenys
(UIOP/LISP-BUILD:CHECK-LISP-COMPILE-RESULTS NIL T T "~/asdf-action::format-action/" ((#<ASDF/LISP-ACTION:COMPILE-OP > . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "cl-async" "src" "tcp">)))
10:11:42
phoe
rtvdenys: basically, what happens, is: ASDF treats all* compile-time warnings as errors and signals an error
10:12:13
phoe
You also get the warning file name in the error message - so you know that cl-async/src/tcp.lisp is the faulting file
10:12:56
rtvdenys
Ah.. Makes sense. I see lots of warnings. I guess I will try to identify them one by one and get rid of them.
10:16:00
doomlist3
(defun hello-world () (list (3 45)) OUT: end of file on #<SB-IMPL::STRING-INPUT-STREAM {1004BCB213}>
10:17:06
rtvdenys
I have checked out cl-async from github to figure out how it works and tried to compile it.
10:17:24
no-defun-allowed
Well, it doesn't appear you are grabbing the quicklisp version. That would probably fare better,
10:18:56
phoe
rtvdenys: I have no idea why you get these warnings; cl-async is supposed to compile cleanly if it is on quicklisp
10:20:04
minion
doomlist3: please look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
10:20:59
Cymew
doomlist3: Learn to use an editor that helps you balance the parens, and it will be much easier.
10:21:46
phoe
rtvdenys: can't reproduce, it compiles cleanly on my machine. What's your repository version and which commit is your repository at?
10:21:48
beach
doomlist3: Then you will know that (<something> <something-else>) means that <something> is an operator that is applied to <something-else> as an argument.
10:23:31
phoe
rtvdenys: just to be sure, please give me (asdf:system-relative-pathname :cl-async "")
10:24:06
doomlist3
okay and i did (defun hello-world () (list 'bull' 3 "shit")) why is bull an atom and "shit" a string
10:24:22
rtvdenys
So I should try to get a fresh SBCL and see what happens. Maybe that will sort it out.
10:42:34
rtvdenys
I've built sbcl 2.0.4 from source and it compiles differently but it still fails. Perhaps I should remove all .fasl files as they were compiled by the previous version?
10:45:45
phoe
you should be able to `cd ~/quicklisp/local-projects && git clone cl-async` and then just (ql:quickload :cl-async)
10:46:27
phoe
I mean, your issues are foreign to me, but then also you have a setup that doesn't resemble mine
10:46:54
phoe
I clone only the projects I edit or whose changes are not yet upstreamed to Quicklisp; the rest, QL pulls for me, including all the dependencies
10:49:33
rtvdenys
(quicklisp:quickload :cl-async) works fine. But then it may be hiding some warnings, may it not?
10:50:56
phoe
I want to double-check this one because this still looks like two different versions of cl-async
10:53:11
rtvdenys
relative pathname of cl-async still points at the version I have checkout of from github
10:54:19
Xach
(ql:quickload :cl-async :verbose t) will show warnings as it builds - but if it's fasl cached already you won't see compilation warnings.
10:55:29
rtvdenys
When I do it from quicklisp then I see no warnings reported. If I try to do it with asdf:load-system then I see a bunch of warnings
10:58:48
rtvdenys
OK. Maybe they are unimportant. But still, how do I find out which file do they relate to?
10:59:35
phoe
they come from CFFI, https://github.com/cffi/cffi/blob/5db779dae91945f9edb68552a2fa04e1484b4ac3/src/types.lisp#L620
11:01:14
phoe
rtvdenys: I'd try to (handler-bind ((style-warning #'break)) (ql:quickload ...)) to capture these style warnings
11:02:00
_death
if you delete the cl-async fasls and load verbose, you'll be able to determine where the warnings come from
11:13:40
rtvdenys
For that I have removed all fasls and ran (quicklisp:quickload :cl-async :verbose t :force t), sending everything to a "less" program.
11:37:16
jdz
Maybe because that's how the HTML works if the content is not in any of the "pre-formatted" elements.
11:43:10
ck_
doomlist3: maybe take a look at the html source to see whether it's actually the browser that modfiies the output
11:47:13
ck_
also, try comparing the output of these: (format t "~a:~20,1,0@a" :format "test") and (format t "~a:~20,1,0'_@a" :format "test")
11:51:27
ck_
sorry, the latter is missing a comma before the ' -- it should be (format t "~a:~20,1,0,'_@a" :format "test")
15:40:30
theseb
So is it customary for an interpreter to only print the value of the LAST expression? (I'm writing my own little implementation)
15:40:54
theseb
is it ever normal/conventional to print ALL values of ALL the evaluated expressions?
15:47:41
phoe
if you have several DEFUNs in there, for instance, I can't really find a use case for printing all the function names to the REPL
16:03:27
beach
theseb: In the case of Common Lisp LOAD, a single generalized Boolean value is returned, so that is the one that is printed.
16:04:28
beach
theseb: EVAL is just a function that takes a form and returns a value. No printing there either.
16:20:42
axion
exif-alist works, but ifd-alist is giving a no applicable method error (zpb-exif::entries when called with an exif instance argument)
16:21:19
axion
Well it's not jpeg. I'm using 3b's fork that allows parsing an octet vector rather than a file
16:26:05
Xach
that is definitely a doc bug. it's meant to take one of the ifds in the exif, not the exif.
16:32:24
axion
Xach: I get the same alist with (exif-alist exif :parsedp t) that i do with (ifd-alist (image-ifd exif) :parsedp t). Is that correct? I'm not very familiar with this format
16:33:06
Xach
I *think* it might help to know the exif standard well before using zpb-exif, but I'm not sure.
16:33:40
Xach
I honestly can't remember why I wrote it. possibly for some graphics website or something.
16:34:45
axion
Well regardless, it works and it's better than the only other parser, so thanks! pngload will soon have exif support
16:39:37
axion
I think 3b is going to send you a PR for reading from an octet vector (simple change, additional non-breaking API function)
16:57:57
|3b|
i think exif-alist includes image-ifd and a few other common IFDs, but not all of them, so you need ifd-alist for the rest
17:23:08
MerlinTheWizard
In PCL Chapter 20 - The Special Operators, under "Unwinding the Stack", Peter Seibel talks about 'closures' and uses the phrase 'closed over' to mean something that to me doesn't sound any different from 'referenced':
17:23:49
MerlinTheWizard
What is the difference in that context between a 'closure' and a 'reference'? Can anyone tell me?
17:24:19
|3b|
if you have a variable binding (let ((x 1)) ...) the binding normally no longer exists after that LET form exits
17:25:17
|3b|
if it is (let ((x 1)) (lambda () x)), the function returned from the let continues to use that binding, so it continues to exist, and that is called a closure, and x is "closed over"
17:25:24
Xach
a closure is a function object. the references to enclosing lexical bindings distinguish a mundane function object from a closure.
17:25:49
Bike
it's a bit more complicated since in this context, rather than closing over a binding, it's closing over an exit point, which does actually cease being valid once the block exits
17:26:09
|3b|
in particular, if you have (let ((x 1)) (lambda () x) (lambda () (incf x))), both function continue to access the /same/ binding of X, so calling the 2nd will change the value returned by the first
17:26:55
MerlinTheWizard
|3b|, I very roughly understand that explanation of closure, but it doesn't seem to apply here in this context.
17:27:01
|3b|
ah, same thing applies to block names and tags, though you can't access those after it exits
17:28:44
|3b|
hmm, to some extent there might not be much difference in that case, since it is limited to the scope of the outer form
17:28:44
MerlinTheWizard
I mean in this context, BLOCK a just exists for its normal lexical scope. There's no modification of the scope of a reference. So how is it a closure?
17:29:52
|3b|
though it still has to maintain a reference to the containing environment in the function object
17:30:16
Bike
because it refers to the same block even if called in a context in which there's another block with the same name
17:30:52
|3b|
(lambda (x) x) contains its own environment, and doesn't reference anything outside that function
17:31:17
Bike
if you have (block nil (let ((f (lambda () (return-from nil)))) (block nil (funcall f)) (print "H")))), no H is printed
17:31:34
Bike
since the function knows where it's supposed to return to - it's "closed over" that information
17:33:03
Bike
if you do this with catch/throw (the operators explained a bit farther on in the text), nothing is closed over and H is printed
17:33:06
MerlinTheWizard
Bike, I need someone to draw me a picture or something. This concept is hard enough to grasp on it's own, but when the term 'closure' is used when 'reference' would do, it makes understanding this idea even harder.
17:33:54
MerlinTheWizard
Bike, Catch and throw, don't these usually kind of break the lexical environment?
17:34:27
phoe
they are like BLOCK and RETURN-FROM except they work dynamically and can therefore be e.g. in separate functions
17:36:02
MerlinTheWizard
phoe, 'reference' is quite a broad term, a very fundamental term within semantics, and therefore hard to define.
17:36:20
Bike
and closure and reference mean different things. casually, i might say that a "closure" "closes over" a variable so that the correct one can be "referenced" when the function is called
17:36:57
Bike
lisp has lots of side effects, so referential transparency like that isn't quite enough
17:38:15
MerlinTheWizard
Bike, in this case the semantics of the supposed 'closure' seems to refer to something that happens in any ordinary function return.
17:38:30
Grue`
what is the context where the word 'closure' can be replaced by 'reference'? seems like refer to completely different things
17:38:57
MerlinTheWizard
In PCL Chapter 20 - The Special Operators, under "Unwinding the Stack", Peter Seibel talks about 'closures' and uses the phrase 'closed over' to mean something that to me doesn't sound any different from 'referenced':
17:38:57
MerlinTheWizard
<MerlinTheWizard> http://www.gigamonkeys.com/book/the-special-operators.html
17:39:42
MerlinTheWizard
This could be replaced by a pure function with no side effects couldn't it?
17:40:01
TMA
MerlinTheWizard: do you understand the difference between a dynamic binding and a lexical binding?
17:40:34
Bike
the point is that when bar is called, it calls that lambda, which immediately returns from (block a...), so the "Leaving BLOCK" is never executed.
17:41:16
Bike
you could like, rewrite this in continuation passing style or something and then it could be all pure functions. maybe that's what you mean?
17:41:20
TMA
MerlinTheWizard: if so then 'close over x' means 'keep reference to the lexical binding currently in effect' and closure is the result of that process
17:41:45
MerlinTheWizard
Bike, that's what happens with typical early 'return', which can happen in a pure function.
17:42:07
TMA
MerlinTheWizard: so closure is not something that is a reference, but something that keeps the reference inside itself intact
17:42:14
Bike
MerlinTheWizard: let's back up a moment. you say "typical". what is your reference frame for "typical"? are you thinking of some other programming language or what?
17:42:24
Grue`
A is "closed over" B is more like B is "referenced" by A. So it's kind of the opposite?
17:43:43
Bike
You can pass function pointers around, but when a "return" statement is executed, it returns only from the function the statement is in.
17:45:39
Bike
Again, I'm talking about the first example in the section you linked. Consider (bar #'(lambda () (return-from a))). How would you write that in C?
17:46:00
Bike
BAR is just a function. (bar #'(lambda () (return-from a))) is a function call with one argument.
17:47:08
Bike
this function's body is (return-from a). It returns from the (block a...), which is outside the function itself.
17:48:51
MerlinTheWizard
So, in a closure, a referenced symbol is always made available outside of it's normal scope?
17:51:57
phoe
because it refers to a block named by symbol A, even though that block is outside the body of that function
17:52:02
Bike
I gave an example a while ago. The closure has to "know" where it's returning from. For example, if the body of the BAR function had another (block a ...), that would have no relevance on where the closure would return from.
17:53:09
MerlinTheWizard
So bar's own lexical binding of 'block a' is shadowed, and that makes it a closure?
17:53:57
Bike
What makes (lambda () (return-from a)) a closure is that it refers to a kind of lexical binding outside the function body, so it has to carry information about that binding around.
17:54:59
MerlinTheWizard
Bike, he might have briefly mentioned closures earlier, but I guess I didn't get it.
17:55:58
MerlinTheWizard
Bike, I've read explanations of closures before. They were always confusing to me.
17:56:41
MerlinTheWizard
If they always referred to capture of a symbol outside of it's lexical scope, I guess it would make sense to me.
17:57:24
MerlinTheWizard
But in this case, the lexical scope is preserved from the perspective of the instance (although not from the definition of bar)
17:58:21
Cymew
MerlinTheWizard: This is a really good explanation of closures, if you don't mind the rust code: https://doc.rust-lang.org/book/ch13-01-closures.html
17:58:45
Bike
There's the example of (let ((count 0)) #'(lambda () (setf count (1+ count)))) in the Variables chapter. The point is that the function "closes over" the binding of COUNT, so if you call the function repeatedly it updates that same binding.
17:59:18
Bike
as it says, you can do (defparameter *fn* (let ((count 0)) #'(lambda () (setf count (1+ count))))), and then (funcall *fn*) => 1, (funcall *fn*) => 2, ...
17:59:44
Bike
i would try to understand it with variables before going on to block/return-from, personally
18:03:01
Xach
i like to think of a closure as a function that carries around (some of) its defining lexical environment
18:03:09
phoe
MerlinTheWizard: an object in the traditional OOP sense; something with slots that you can get and set
18:05:56
MerlinTheWizard
phoe, yes, that makes sense, it just doesn't really apply to the current example, except that a reference is being carried by a function.
18:06:08
fourier
I would think the problem could be with any 32bit CL on Linux: Error: Unable to load any of the alternatives: ("librt.so.1" "librt.so")
18:06:29
MerlinTheWizard
Anyway, I'm probably getting it a little better now, so thanks everyone for your help.
18:06:42
phoe
MerlinTheWizard: that's the whole point - a reference to this place is carried around by these lambdas
18:15:47
_death
phoe: cool @ https://i.redd.it/0wgtrq978fv41.jpg .. methinks heisig could put it in the sealable-metaobject repo :d
18:19:09
beach
MerlinTheWizard: Not everything in Common Lisp is an object. A comment is not an object for instance. Neither is a place.
18:47:38
gendl
Hi, i just installed mysql on my mac with brew, set the root password, and quickloaded clsql in CCL. Can anyone give a quick pointer about how to connect to mysql from CL? And is clsql even what I should be using at this juncture?
18:48:43
gendl
The manual seems to be missing from here: http://clsql.kpe.io/documentation.html and although Kevin Rosenberg has done some great stuff it seems he's not active these days...
18:58:46
specbot
The for-as-across subclause: http://www.lispworks.com/reference/HyperSpec/Body/06_abae.htm
18:59:11
phoe
I guess that it does because it makes no sense otherwise, but the LOOP reference is not clear about it...
19:03:44
phoe
didi: https://gitlab.common-lisp.net/ansi-test/ansi-test/-/blob/master/iteration/loop5.lsp#L146-150
19:06:04
didi
At least in practice, I can't change the fill-pointer. SBCL reads the array length only once.
19:06:36
Bike
oh, if you're trying to _alter_ the fill pointer in the middle of a traversal, that's definitely not allowed.
19:06:39
specbot
Traversal Rules and Side Effects: http://www.lispworks.com/reference/HyperSpec/Body/03_f.htm
19:48:34
_death
jackdaniel: I decided to put my ecl+imgui project on github: https://github.com/death/imcl
20:12:03
fourier
_death: thats cool, I was thinking about connecting imgui to CL in some way but looks like you did it!