freenode/#lisp - IRC Chatlog
Search
6:45:25
Shinmera
p_l: I used &aux in a custom macro to denote special bindings that should be emitted. https://shinmera.github.io/for/#bindings
6:46:12
beach
p_l: Yes, maybe so. I would certainly not want to see it disappear in this famous updated standard that so many people seem to want.
6:53:10
beach
I don't think there is a difference. But in my paper on method combinations, I analyze the lambda list. It would be much harder to analyze the body of the function.
6:54:08
heisig
phoe: Since &aux fits into the lambda list, it can sometimes shorten your code by one line. And it means that you have a central place to put your declarations (after the lambda list).
6:54:19
Shinmera
The &aux are used to emit bindings that surround the entire loop block, whereas the body is emitted within the iteration loop.
6:54:42
kpoeck
3.4.1.5 Specifiers for aux variables .... &aux variable processing is analogous to let* processing.
6:54:42
Colleen
kpoeck: karlosz said 9 hours, 44 minutes ago: https://github.com/robert-strandh/SICL/pull/153 fixes the maxima issue, it compile instantly now
6:54:42
Colleen
kpoeck: karlosz said 9 hours, 9 minutes ago: that means you don't need to comment do-inlining out. if you do, everything will be kinda slow.
6:54:53
heisig
And of course &aux is important in cases where you have no body - like struct constructors.
9:01:05
phadthai
2 should be the result, maybe something mistyped... there's an extra opening paren before your defvar
9:01:56
phadthai
and yes it's important to understand the distinction between defvar and defparameter
9:15:46
no-defun-allowed
doomlist3: Check your parens (and the structure suggested by your indentation).
9:26:04
jackdaniel
beach: I can imagine an expansion, where cd is separately bound in the end clause
9:26:49
beach
I can imagine such an expansion as well, but then it is not helpful to give that kind of style warning.
9:28:05
jackdaniel
doomlist3: to answer your explicit problem: you want (dolist (cd '(1 2 3)) (format t "hu ~a~%" cd))
9:28:30
jackdaniel
dolist has two arguments: one is the binding and return-result clause, and the second is its body
9:30:00
beach
doomlist3: If your code had been correct, with the FORMAT form in the body of the DOLIST, it would have been indented two positions compared to the (DOLIST, not 12.
11:34:11
Bike
Atomic theory says all matter is made up of tiny little balls science calls "atoms". When you ride a bike, your and the bike's atoms get jostled around, so when you do it long enough you swap atoms.
11:34:23
Bike
This is why people who ride bikes a lot eventually become more like bicycles with bell like voices
12:05:46
jmercouris
as you can see it is loading shared libraries from /opt/local/lib which IS NOT in the library load paths
12:22:27
jmercouris
on this page: https://common-lisp.net/project/cffi/manual/html_node/_002aforeign_002dlibrary_002ddirectories_002a.html
12:22:36
jmercouris
I found a foot note at the bottom: https://common-lisp.net/project/cffi/manual/html_node/_002adarwin_002dframework_002ddirectories_002a.html#g_t_002adarwin_002dframework_002ddirectories_002a
12:32:22
MichaelRaskin
Yes, as a terminal command — check if there is an environment variable with such contents
12:33:10
jmercouris
echo $PATH -> /Users/jmercouris/User:/opt/local/sbin:/opt/local/bin:/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS
12:33:12
MetaYan
jmercouris: That paste doesn't show cffi:*foreign-library-directories* . You see, on my macOS I have (CFFI::DARWIN-FALLBACK-LIBRARY-PATH), which adds /opt/local/lib
12:33:52
jmercouris
MetaYan: yes it does, CFFI: Foreign Library directories (/Users/jmercouris/Source/Lisp/xyz/bin/xyz.app/Contents/MacOS/../Resources/
12:35:37
jmercouris
it should not be touching that though unless *foreign-library-directories* is not set, which it is
12:38:24
jackdaniel
since we discuss cffi pats not really related to common lisp, any idea why after enabling terminal raw mode, if the very first input is i.e C-c it is delivered as a signal?
12:41:55
MetaYan
And the output of (print cffi:*foreign-library-directories*) doesn't give something like https://termbin.com/3g28 ?
12:43:50
jmercouris
yeah, it is expanded: (#P"/Users/jmercouris/Source/Lisp/xyz/bin/xyz.app/Contents/MacOS/../Resources/" #P"/Users/jmercouris/Source/Lisp/xyz/bin/xyz.app/Contents/MacOS/")
13:21:38
beach
ACTION hesitates to tell jmercouris about the very simple technique for avoiding all those FFI problems.
13:27:02
phoe
ACTION hesitates to tell beach about the very simple technique of failing to create a web browser following today's HTML5/CSS/JC standards
13:27:54
beach
ACTION hesitates to tell phoe that there are other projects than web browsers that need to be worked on.
13:27:55
jackdaniel
I'm not hestitating to say, that tracking OSX linking problems (even with cffi) is not very ontopic on this channel
13:29:44
jackdaniel
I've tried to signal it with a joke about terminal in raw mode and interrupts, but I think I've failed communication-wise
13:57:53
beach
doomlist3: (push <value> <place>) is roughly the same as (setf <place> (cons <value> <place>))
13:59:24
pjb
doomlist3: and beware with (let ((x '(1))) (push 4.4 x) x) #| --> (4.4 1) |# because only the first cons is mutable! The last cons is (1) which must be considered immutable since you quoted it!
14:00:27
pjb
so it would be better to use (list 4.4 1) #| --> (4.4 1) |# to get a fully mutbale list!
14:06:45
beach
doomlist3: Your problems are so basic that you should probably move your questions to #clschool.
14:25:31
beach
doomlist3: Also, it would be good if you would at least acknowledge that you saw the advice that was given to you, and even better if you would tell us whether you understood it or not.
14:41:29
Bike
https://gitlab.common-lisp.net/asdf/asdf/-/blob/master/uiop/common-lisp.lisp#L10 nice typo
14:43:18
jmercouris
I bet a good tool to detect typos could be used when you cant do real code analysis
14:43:22
jackdaniel
I'm sure that the macro uiop/package:define-package code-walks its arguments and fixes all uoip typos
14:51:57
luis
Speaking of CFFI, mid-30s-luis is quite disappointed at some of early-20s-luis's design decisions and particularly angry at late-20s-luis's integration of foreign-structs-by-value...
14:52:54
jmercouris
I've written: (cffi:load-foreign-library (library-name library) :search-path "/Users/jmercouris/Source/Lisp/xyz/bin/xyz.app/Contents/MacOS/../Resources/")
14:52:59
jmercouris
dyld: loaded: <9C53D76D-70B1-346A-992A-E5E4D60225EA> /opt/local/lib/libssl.dylib
14:54:09
jmercouris
can you perhaps look into your crystal ball into the path and explain to me why that is happening?
14:54:29
luis
jmercouris: ISTR search-path is only used as a fallback if dlopen() fails to find your library the first time around
14:56:25
luis
jmercouris: but younger-fe[nl]ix is the one to blame for adding that feature and not documenting it in the manual!
14:56:59
jackdaniel
luis: pay attention, it's not fe[nl]ix but younger-fe[nl]ix who should be put at shame! ;-)
14:58:28
jackdaniel
speaking of: fe[nl]ix is there any chance for marging mailbox support to bordeaux-threads?
15:41:53
jmercouris
luis: I'm just wondering why it doesn't look in the foreign library directories and instead tries these random paths
15:42:02
jmercouris
well, they aren't random, but they are not in the cffi foreign library directories
15:42:55
jmercouris
I wish there was at least an option to only look in the foreign-library search paths because the reason I have had this strugge is because libssl HAPPENS to be supplid on Darwin, but my Lisp is using a different version
15:43:37
xristos
jmercouris: looking at the code usually provides definitive answers to these sort of questions
16:03:20
pjb
jackdaniel: the trick is that those 427 volunteers do indeed look at the code to get the definitive answers!
16:05:18
jackdaniel
ACTION makes a shocked face and leaves to make some tea (in a shocked manner of walking)
16:06:14
fe[nl]ix
jmercouris: luis was right. the point of the search path is to have a list of often used directories, as a fallback
16:06:30
fe[nl]ix
if you already know the exact location of the library, just construct an absolute pathname and load that
16:11:06
jmercouris
and if you didn't have a habit of trying to make people look stupid and making snarky comments, you would see that
16:14:50
phoe
jmercouris: I assume that this would be to solve a problem that is the inverse of yours: CFFI being unable to find libraries on Darwin even if they were located in directories available by default
16:14:50
jackdaniel
I don't remember when I have last used moderator privigiles, but it is a fact that I'm sometimes tempted to kick and ban you, and some of the reasons are even valid :) that said I'm not overly attached to the '@' sign.
16:15:40
phoe
while you want to avoid loading libraries from /opt/ as a software deployer, some other people might want to load libraries from /opt/ as software developers
16:16:24
phoe
"if you can't find it in the list of CFFI dirs, fall back to the default list; if you can find it there, good, and if you can't find it there, signal an error"
16:16:27
fe[nl]ix
jmercouris: because especially on OSX, there are package managers like MacPorts, Brew, etc... which can install libraries in locations that are not in the default search path of libc
16:16:29
jmercouris
phoe: well, they are located in that directory by default, but of course the system supplied libraries are frequently out of date
16:17:07
jmercouris
fe[nl]ix: I am asking why we can't prioritize the paths in foreign-library-directories and THEN try others
16:17:21
jmercouris
why that choice? why offer the user the ability to set it when it will ignore it?
16:18:21
fe[nl]ix
and if you already know the exact location, building an absolute path is one make-pathname away
16:18:56
theseb
OMG i took a peak at Let Over Lambda....that seems like it is going to be an amazing read...I love the author's passion.....Don't be ashamed of macros...rather, turn them up to an 11 and let you "freak flag" fly!
16:19:23
jmercouris
I understand now the idea behind specify absolute path, but it is a little bit problematic in the case of an app bundle
16:19:56
phoe
theseb: Let Over Lambda is a wonderful exercise in mind-bending macros that you will likely never use in actual application code
16:20:05
xristos
jmercouris: nobody is obligated to spend his personal time and educate you for free, but your manners imply otherwise
16:20:41
jmercouris
xristos: I'll reply RTFM next time someone asks me a question on my channel too, I'm sure that will win me many friends
16:21:27
jmercouris
fe[nl]ix: for example, I've set foreign library directories to be a relative dir within my app bundle, it will behave as expected for libs not found on a typical system, however when I get to a lib that IS on a typical system it will try to use that one, which may be differenet
16:21:30
phoe
I enjoyed the read, but I never really came back to the book afterwards; it was certainly a good read to see what the Lisp macro system is capable of, but it has little "replayability value" to me since the author's style does not really align with the contemporary Lisp style that I know
16:22:20
jmercouris
fe[nl]ix: so the result is I cannot rely on foreign library directories and must always calculate an absolute path to every shared library within my app bundle to avoid potentially using the wrong system library
16:22:29
phoe
jmercouris: you seem to be trying to solve the problem of deploying applications and ensuring that the libraries that you bundle are going to be loaded
16:22:48
phoe
I remember Shinmera cursing multiple times when he was working on Portacle due to a similar problem
16:23:06
phoe
it wasn't CFFI but emacs loading up stuff that it wasn't bundled with, but the idea is the same
16:23:37
jmercouris
and the last thing I want to hear is a comment about "read the source code" as if I haven't been
16:28:18
fe[nl]ix
you write a wrapper shell script that sets up the environment and calls your binary
16:28:38
samlamamma
jmercouris:You probably already know this, but can't you just bundle your shared libraries as a pre-determined relative path to your application?
16:29:51
phoe
and the issue is that the /opt/ ones are prioritized anyway, and these are the ones that get loaded
16:33:10
phoe
I bet that if macOS bundling worked in this exact way, we wouldn't see any of that frustration or sparks that start flying off the channel
16:34:03
phoe
there's going to be people deploying Lisp apps for macOS with foreign dependencies in the future; they might stumble upon a similar issue
16:41:08
luis
fe[nl]ix: what do you think about augmenting CFFI's :string type to accept a special variable name that can be looked up at runtime so that each library can control their own encoding? E.g., (defcfun foo (:string :encoding mylibrary:*foreign-encoding*) ...)
16:45:04
fe[nl]ix
this is potentially slow because it defeats all compiler-macro optimizations in babel
16:45:54
luis
My motivation is some FFI for accessing a database that sometimes wants one encoding sometimes others, depending on the environment.
16:47:39
luis
You have to look up the encoder/decoder by name. Note that by default, :string will go through *default-foreign-encoding*
16:52:20
luis
This is probably not Oracle's fault. You can write whatever bytes you want in the database. Some clients use one encoding, other clients use a different one... Clients have control over these settings like it's the 1990s ¯\_(ツ)_/¯
16:53:39
phoe
blessings of the elder gods upon you who needs to interface with that bullsh#<error printing vowel>t
17:37:25
Bike
can anyone think of a situation in which the transform (if (not [test]) [then] [else]) => (if [test] [else] [then]) is not valid?
17:38:32
phoe
hmmmm. if [test] returns no values then the missing value is coerced into NIL, which still works correctly after that transformation
17:38:59
phoe
if control is transferred out of the test, neither option is evaluated, same thing after the transformation
17:51:36
Bike
well, i'm seeing it not be equivalent, basically. and no obvious example of a [test] it's not working for, of course.
17:53:10
Bike
i mean there is such an example (or something else is going wrong), i just don't know what it is because the error isn't anything obvious.
18:02:00
jackdaniel
Bike: maybe (if [test] foo) is transformed to (if (not [test]) foo) due to i.e calling reverse on "rest" args?
18:02:44
Bike
no, that should be handled. not a bad idea though, it's probably something dumb on my part like that
18:07:39
yottabyte
if I want to use Drakma to make a request and work with a json response, what's the best way to do that? for example, if I make the request (drakma:http-request "http://ip.jsontest.com/") which returns a simple json response, it's received as an octet stream. is the best way to use some library to turn this into a map? how would I do that? I tried using yason like the Drakma guide did, but I got an SSL exception
18:09:22
yottabyte
An I/O error occurred: undocumented reason (return code: 5). SSL error queue is empty. [Condition of type CL+SSL::SSL-ERROR-SYSCALL]
18:14:01
pve
Is it allowed to subclass standard-method and add an instance of the subclass to an instance of standard-generic-function? When I try it, the method goes in, but upon inspection of the generic function, it shows the method to be of type standard-method instead of the subclass.
18:15:45
yottabyte
so phoe: that returns a list, but it doesn't appear to be a plist, how do I work with it? should I really look to make a map out of it instead of a plist?
18:28:04
_death
yottabyte: actually yason has the same defect as cl-json.. sigh, just use something with a sane default such as com.gigamonkeys.json