freenode/#lisp - IRC Chatlog
Search
4:48:54
markasoftware
I want to pass the value of a variable as an argument to a function, if that variable is non-nil
4:49:07
markasoftware
otherwise i want to omit the argument so that the function can use its default value for it. (it is &optional).
4:49:51
markasoftware
Do I just make my own macro to handle this? Or is there some convenient way I am overlooking?
5:12:46
akoana
markasoftware: maybe use something like this: (defun f (&optional (p 'default supplied-p)) (if (and supplied-p (null p)) 'default p))
5:18:16
beach
I guess &aux is on my mind because I used it in my paper on representing method combinations.
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?