freenode/#lisp - IRC Chatlog
Search
5:10:20
earl-ducaine
Use of the question mark (rather than -p) seems barbaric: https://gist.github.com/earl-ducaine/dd90263f81d44ab1de90c868bff86c1f
5:18:39
sabrac
earl-ducaine: https://www.cliki.net/naming%20conventions indicates that scheme uses the question mark.
5:35:47
sabrac
https://google.github.io/styleguide/lispguide.xml#Predicate_names notes some existing CL packages use ? but recommends against it
5:40:10
earl-ducaine
The code in question was written by Mlynarik (mly), who was working at Xerox at the time. So, it might have been a Interlisp convention.
6:01:39
aeth
The two main styles are either p for single words and -p for multiple words or -p for everything. -p for everything does have its users
6:07:06
aeth
The original style is foop and foo-bar-p. foo-p came later, either to make it unambiguous or because someone misunderstood the rules (probably both, depending on the person)
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