libera/#commonlisp - IRC Chatlog
Search
0:58:12
hayley
FWIW Bike's definition of parallel (w.r.t parallel assignment) is the undisputed definition of concurrent at least, that there are no happens-before relations that would order one before the other.
1:26:13
hayley
Can I do anything to make the SBCL compiler do less optimization somehow? It doesn't appear that the code I generate would benefit from much more type inference, for example.
1:56:22
hayley
Huh, optimizing for (speed 0) actually affected compile time (which went from 450ms to 250ms), and the drop in execution performance isn't that bad. Somehow I don't seem to write code where it usually does much.
5:37:35
lisp123
Usually its a trade-off between abbreviations vs. longer names, e.g. ((find (cadr function-definition) *cl-symbols* :test #'symbol-name-equalp)
5:38:28
lisp123
I put that into a COND as a test and now its hard to indent the body of the form since its already so long
5:42:35
lisp123
flip214: Yes, perhaps I should use anaphoric macros (seems a bit too much to define a wrapper around find)
5:45:35
lisp123
\n :test ) --> Since the test is optional, it flows better having that on a new line
5:45:50
beach
lisp123: Please don't use anaphoric macros. They tend to violate the rules of page 13 of the LUV slides.
5:47:41
beach
The best solution is to have lots of small functions, and occasional macros, so that the total code size is still limited.
5:48:46
lisp123
The trade off I am having with small functions is that one has to make an extra step to read what they do, whereas writing in terms of the standard function "inlines" it
5:50:46
lisp123
In this case, I think it might be a good idea, (defun IS-CL-SYMBOL (sym)), so I will do that -> But I used to have a lot of smaller functions and it felt like I was going through 5 functions to get to the final code
5:54:29
flip214
lisp123: right. but these additional small functions are a kind of documentation - one that (hopefully) better reflects what happens than comments that are outdated
5:58:21
lisp123
As in adding doc strings to these functions vs. writing comments? That sounds interesting
6:00:40
flip214
lisp123: yes. Small function tend to not change so much, so the docstrings stay current... they might not be used anymore, but that you can find out via xrefs and then delete them.
6:41:39
beach
lisp123: I agree with flip214. Small functions with relevant long names are self documenting, so they save effort to understand.
6:42:42
beach
Plus, if those small functions reflect useful abstractions, they can be reused in several places.
7:55:54
pjb
saturn2: as I said, if you want the performance of C (or python), then do what C (or python) does. Don't parse and convert octet sequences into strings. Process the octets directly.
8:16:09
lisp123
Thoughts of using newlines to break up code blocks? e.g. https://plaster.tymoon.eu/view/2643#2643
8:17:36
jackdaniel
if you have long blocks of code you want to "separate" you probably should think about defining a function (i.e in flet, or toplevel)
8:18:18
lisp123
jackdaniel: Thanks, the progn was a leftover from a previous code, so I will adjust that. Here I need to keep the parts together due to lexical scoping
8:20:43
lisp123
moon-child: Yeah, ignore the indenting :) Question was on line breaks (obviously indenting I can do ;)
8:22:46
pjb
lisp123: you can factorize locally; using flet/labels and macrolet, you can design a local mini-dsl that allows you to express your function code more concisely.
8:23:50
pjb
lisp123: (flet ((find-function-name (function-definition) (find (cadr function-definition) *cl-symbols* :test #'symbol-name-equalp))) … (cond ((find-function-name function-definition) …)) …)
8:24:04
pjb
lisp123: you can't deny that ((find-function-name function-definition) …) is clearer and shorter than (find (cadr function-definition) *cl-symbols* :test #'symbol-name-equalp)
8:26:50
pjb
(let ((v (velocity thrown-weapon)) (dt (game-time-step game)) (x (player-position player))) (+ x (* v dt))) instead of (+ (player-position player) (* (velocity thrown-weapon) (game-time-step game)))
8:27:46
pjb
write down the formula (+ x (* v dt)), then assign the value (describe what each variable is), the compute the result.
8:28:08
lotuseater
oh pjb, so when you play DOOM or such you fight the demons by throwing the weapons rather than shooting? ^^
8:28:11
pjb
Note that there are with-slots and with-accessors to deal with length accessor names too.
8:30:47
lotuseater
oh I remember some funny situations when classmates had expressions like log(10)/log(2) and they "canceled" it to 10/2 = 5 ...
8:32:11
pve
lisp123: instead of using blank lines, why don't you separate stuff with cute comments instead ;)
8:32:28
lotuseater
pjb: most times when i translated some algorithm from TAoCP and Knuth uses t i used c for that instead if it was free. also when parameters are in small and big form like n and N, so I used %N for the big one
8:33:55
lotuseater
pve: like "this is a really interesting comment"? lines that speak about themselves
8:34:50
pjb
the idea is to use a DSL that allows you to transcribe maths and physics formalae as-is to avoid errors, and let the DSL make the formula translation.
8:35:34
pjb
lotuseater: if there's n and N, I'd use a reader macro to activate a case sensitive mode and write down the formula as-is.
8:35:45
pve
lotuseater: Well, I was actually being half-serious. Like if you need to separate code blocks, at least explain why.
8:42:18
lotuseater
yes I thought now from reading the examples that a programmable reader comes in well for that
8:44:41
pjb
another related funny thing, is that in early computer vision, they used a parser to analyse 2D pictures of 3D scenes, and construct the 3D objects seen.
8:45:56
pjb
IIRC, there's an emacs equation editor that let you edit (or at least generate) an ASCII art representation of equations. We'd just need to be able to parse them back.
8:46:34
pjb
HAL/S is quite restricted, it just deals with exponents and subscripts (but with several levels, you can write x_k_i^a^b
8:48:22
lotuseater
i think it must be restrictive, for safety is highest priority and efficiency hopefully the second. and ok, the guidance computer also had few resources
10:05:21
mfiano
Is the only difference between #'symbol-function and #'fdefinition that the latter is more general in that it also works with '(setf name)? If so, is there any use for the former?
10:07:03
mfiano
ACTION has always used fdefinition. Not sure what symbol-function can do that it can't
10:13:15
mfiano
Ah I suppose symbol-function works for functions not bound in the global environment.
10:27:03
pjb
lotuseater: it would be dangerous to try to parse svg, if you expect a certain form of svg (eg. as generated by TeX), because other svg could be parsed giving one expression, but rendered showing another expression.
11:23:13
jackdaniel
mfiano: basically fdefinition was introduced /after/ cltl2 to allow accessing functions like (setf foo), symbol-function was left for backward-compatibility