libera/#commonlisp - IRC Chatlog
Search
11:20:30
prokhor_
is there a library to run edinburgh syntax prolog in a lisp program besides knowledgeworks?
11:29:03
contrapunctus
prokhor_: does cl-prolog2 do that? https://github.com/cl-model-languages/cl-prolog2
11:42:07
contrapunctus
Hm...docstrings in a `defmethod` with a `declare` expression, regardless of whether I place them before or after the `declare`, are being syntax highlighted by `lisp-mode` as regular strings. 🤔️
11:49:33
Nilby
contrapunctus: your lisp-mode probably isn't working then, since mine does it, but only when the docstring is before the declare.
11:52:52
contrapunctus
Nilby: hm, I just noticed the same thing. I think it's happening only for methods with a qualifier.
11:53:31
mfiano
That is correct. It's a limitation of how lisp-mode parses the arguments to defmethod.
11:54:41
mfiano
I would recommend attaching documentation strings away from the implementation. Documentation is for client code anyway, not developers.
11:59:38
mfiano
Well then, do as you please. I and some others feel that it is too noisy to be inlined into the implementation. It could, and usually should consist of several paragraphs, and vertical space is a resource related to reading code efficiently.
11:59:59
contrapunctus
mfiano: I don't usually put docstrings in methods, but in this case I was kind of losing track of which one was for what. Could be a sign of bad design ^^'
12:00:36
flip214
mfiano: well, my old-fashioned vim has something called folds... I can visually reduce several lines to a single one, I'd be very surprised if emacs didn't do that as well
12:05:19
lisp123
mfiano: That's sort of the point. I don't have a particular desire to jump across multiple files to understand a function
12:06:04
jackdaniel
contrapunctus: without taking sides - you can always put a comment before the method definition if you decide to avoid the docstring
12:07:16
mfiano
lisp123: Nobody said anything about files, and still, a keybinding to show the documentation string inline is quite easy with Emacs' virtual text facilities.
12:07:30
Nilby
When your repl or editor can display docstrings with a keystroke, as well as appropriate completions, it makes code very explorable.
12:09:08
lisp123
(although to play devil's advocate, placing docstrings elsewhere will not be precluded from this)
12:10:47
lisp123
If the text is in the same file, I have no problems. But otherwise, as many people do browse CL in plain text mode (e.g. on GitHub), it would be annoying to have to jump across multiple files to read a docstring
12:10:53
_death
in my opinion docstrings should be inline, short and sweet.. if you need more, well, often programmers tell others to "rtfm", but sometimes "wtfm" is appropriate
12:17:19
_death
it's also true that as jackdaniel hinted, method docstrings are (should be) rare.. it's conceivable that some newbies write docstrings for methods where they should be moving it to the generic function
12:18:12
lisp123
that's a mistake I used to make...although the format for defgeneric docstrings is a bit clunky
12:21:05
mfiano
Docstrings for methods are useful, for instance if you're writing a linear algebra library where all arithmetic generic functions have the same interface, but differ greatly in semantics (scalar multiplication is commutative for example)
12:23:53
_death
I think it's better to have different names for operators that are commutative and non-commutative
12:25:59
_death
math notation is actually a hodgepodge of notations full of hysterical raisins, basically terrible
12:28:22
_death
a generic function should specify semantics, and these should be adhered to by all methods.. if your multiplication GF does not mandate commutativity, that's fine.. but may lead to user errors
12:37:57
specbot
Examples of Associativity and Commutativity in Numeric Operations: http://www.lispworks.com/reference/HyperSpec/Body/12_aaaa.htm
12:57:02
utis
portaudio tells me ``warning: array is copied and/or coerced, lisp type is T, requested cffi type is float.'' does this sound like it could be fixed by the passing of a certain :element-type to #'make-array? i tried 'double-float without success
13:03:54
jackdaniel
perhaps try single-float, afaik double-float corresponds to cffi type double-float
13:14:07
utis
jackdaniel: maybe, i got the impression that portaudio wanted double, but i may have been confused; anyway, using single-float gives the same warning
13:14:47
Guest74
I write my documentation in separate files, but I believe they should be viewable when reading the code. I consider this more a convention to deal with a bad editor/or inability to use the editor properly.
13:33:18
_death
I was a bit flippant earlier.. math notations, like natural languages or programming languages, are terrible but also useful.. we're all being pragmatic.. the "because math does it" argument is a pet peeve, because these notations are often optimized for constraints (e.g., writing on paper, sometimes ad hoc use, communication with nonmachines, external requirements like established cultural/organizational pressure, etc.).. it's not a
13:33:19
_death
holy grail.. also, I like CL's generic operators, but then I've not written code that needs to be especially numerically accurate
13:45:33
_death
and then there's the fact that I may read 10 different papers on the same subject and have to figure out 11 different notations..
13:48:32
_death
in a particular subject I've noticed that papers from around 2000 onwards have noticeably different notations (that are more difficult to follow, currently) ... this may be an artifact of specialization, or explosion of students, or different software used to produce them, I don't know
13:50:58
_death
excellent.. combined with the attitude that if it's in parentheses it can be ignored :)
14:07:31
Guest74
I've often wondered how the layouting of math formulas should be implemented in lisp.