freenode/#lisp - IRC Chatlog
Search
6:22:18
edgar-rft
The question mark was used in the 1980s as the suffix for "unknown" variables in logical pattern matchers, while the p suffix was used for logical predicate functions. That was long before Scheme used ? for predicates.
6:25:33
aeth
I use the ? and ! conventions from Scheme from time to time. Interestingly enough, I don't use it in implementing my Scheme. If CL doesn't have a foop function and Scheme has a foo? procedure it seems clearest just to define a foop function and then use that as the implementation of Scheme's foo? procedure, especially when barp does exist in CL.
6:25:55
aeth
I'm fuly aware that if I use foo? somewhere, 90% of the readers will despise it, though :-p
6:26:39
aeth
foo! is trickier because there's no direct equivalent so it might be the best choice if you need to communicate mutation. The f in setf or incf doesn't mean the same thing.
6:29:39
edgar-rft
What I wanted to point out is that using ? for Common Lisp predicate functions is historically wrong.
6:31:36
aeth
The only wrong answer is some convention from another more distant language like is-foo (or get-foo)
6:32:58
edgar-rft
there had been so many obscure conventions in the past that "wrong" becomes rather blurry in this context
6:34:09
aeth
It's funny that get-foo is, in my opinion, incorrect CL style that I wouldn't accept in any of my projects (just call it foo), but cl:get-TAB produces 9 results.
6:35:55
aeth
Similarly, define-condition is there as a define-foo, even though the style many use is deffoo or defoo vs. define-foo-bar
6:38:16
aeth
The standard doesn't have +foo+ for its constants, just foo. That one's annoying. e.g. this won't work in SBCL: (let ((most-positive-fixnum 42)) (1+ most-positive-fixnum))
6:51:26
aeth
Instead of using +foo+ you can just take the convention from C and write it as FOO. e.g. (defconstant FOO 42)
6:54:38
jackdaniel
aeth: that C convention is broken for lisp, because default reader converts to upcase anyway
6:56:14
aeth
jackdaniel: +foo+ is superior anyway even if you could write FOO because not every Unicode character that's valid for a symbol name has an upper case form (although some symbols have upper case forms if you trust IRC)
9:13:36
schjetne
beach: I stayed at home (meant to get my PPL current again, but weather got in the way), but more importantly I want to discuss some consulting opportunities at my company. What do you prefer, email?
9:21:52
dim
when playing with unicode variable names, don't forget about the ++ (using zero-width space) (you could use more than one)
9:53:30
dim
I'm using rcirc in Emacs, so I can place my cursor and then use C-x = runs the command what-cursor-position to have information about the chars
10:00:00
dim
useful? I don't know about useful, I know about the dangers of using unicode symbols in variable names when programming…
10:43:26
makomo
Shinmera: https://github.com/Shinmera/dissect/blob/master/toolkit.lisp#L31 not sure if this was intentional, but this breaks on strings that contain parentheses
10:43:52
makomo
(with-input-from-string (str "(hello \"th)ere\")") (dissect::read-toplevel-form str)) ;; => "(hello \"th)"
10:57:48
Shinmera
Could probably get a good bit farther by handling escapes and strings, but I don't have time at the moment.
11:01:33
makomo
Shinmera: yeah, i thought that might be the reason. wanted to let you know just in case.
11:02:33
Shinmera
You can, but I'd rather read primitively than to cause potentially undesired read effects
16:09:35
antoszka
you can write your frontends in whatever you like and just define protocols speaking to your backend
16:18:12
Demosthenex
newbie question. which is better practice, (cdr (assoc ...)) or (alexandria:assoc-value ...)
16:21:09
Demosthenex
given they are about the same lenght, i'd stick to (cdr (assoc)) just because there's an argument for staying at the low level when a lib isn't needed
16:21:43
Shinmera
Sure. On the other hand, a lot of people use alexandria anyway and if you depend on other libraries it's likely you'll have it in your tree already.
16:22:34
Jachy
If you're using the same key over and over, perhaps a tactful function you define is in order too.
16:25:52
Shinmera
If you want to use just CommonQt, you should also be able to load qt+libs instead of commonqt
16:33:16
AeroNotix
I quickloaded qt+libs but the conv.lisp example claims the qt package is not available. Should the conv example work immediately after qt+libs?
16:34:25
AeroNotix
quickloading qt stumbles on compiling the so file. Running the commands in the commonqt directory tells me that smoke.h is unavailable but I'm unable to see which package on Arch brings that in. Hence my original question
16:37:39
AeroNotix
removing all the install Qt related librarys, running (ql:quickload :qt+libs) and running the conv.lisp example with `sbcl --load conv.lisp` tells me that QT is not a designated package
16:38:38
Shinmera
uh, if you just load a lisp file from the command line it won't magically load systems in for you
16:42:27
AeroNotix
oh I get you. I thought you meant load qt+libs separately to pull in dependencies and then use the commonqt package going forward
17:25:43
emaczen
How do I open a jpeg file and read the bytes? When I open the file in emacs I see a bunch of bytes of the form \324\365 etc... and some occasional letters in between
17:28:14
emaczen
Shinmera: Thanks! I just glossed right over that keyword since I saw external-format..
17:33:43
emaczen
would cffi:foreign-array-to-lisp be any faster than initializing an array, looping to evaluate (setf (aref ...) ...)?
17:40:07
phoe
if the overhead of repeating mem-aref wouldn't be smaller than the overhead of array copying
17:42:10
phoe
Theoretically, if you have a foreign pointer and a length, that's theoretically enough for you to create an Lisp array object
17:42:16
Shinmera
uh, how would the lisp implementation form the vector structure around the pointer? It doesn't know what's before or after that piece of memory
17:42:40
phoe
Shinmera: it would need to be something like a displaced array that just "points" to the storage there
17:42:46
pjb
emaczen: (subseq (com.informatimago.common-lisp.cesarum.file:binary-file-contents #P"/Users/pjb/Pictures/20180321--pascal-bourguignon--cropped.jpg") 0 10) #| --> #(255 216 255 224 0 16 74 70 73 70) |#
17:43:30
Shinmera
mostly because it's a headache and would require an entirely separate kind of structure of array.
17:46:23
Shinmera
Plus C functions that return a chunk of memory (that isn't just static) are Bad and Not Good anyway. :)
17:47:18
phoe
Though the best thing that could happen, I think, is an implementation compiling a LOOP over MEM-AREF to simple pointer dereference.
17:48:10
phoe
We're using raw memory so all safety checks are off anyway. Segfaults can be caught and handled in the Lisp condition world.
17:48:44
Shinmera
segfaults can only be handled in the "pray not everything will burn in the next processor cycle"
17:52:27
phoe
Shinmera: I don't know what you're talking abCORRUPTION WARNING in SBCL pid 22144(tid 0x7ffff5527700): Memory fault at (nil) (pc=0x228c3f60, sp=0x7ffff5525d18)
17:52:59
Shinmera
Well I'm talking about not that happening, and instead things just going full schrödinger