libera/#commonlisp - IRC Chatlog
Search
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
12:26:59
jackdaniel
indeed, it is already present in cltl2 (being nitpicky as I am - what I've _meant_ was CLtL2 because I've remembered wrong) ; thanks for correction
13:04:22
pve
I'm having great fun writing cute reader hacks with eclector, but are there any reader hacks that would be genuinely useful?
13:58:57
Josh_2
I was originally using condition and then pjb mentioned something about how I should use error or serious-condition etc and so I swapped to error
13:59:38
jackdaniel
serious-condition along with errors should catch as well timeouts and storage exhaustion conditions
13:59:45
beach
pve: And it is also used to avoid interning symbols arbitrarily, and to avoid errors due to package prefixes of packages that don't exist.
14:00:38
Josh_2
well currently I keep getting an problem where I'm running out of fd's because I have a background thread that is supposed to catch all errors
14:02:15
Josh_2
that is probably what is causing this, I'll just swap to serious-condition rather than error, that'll probably fix it
14:05:59
Josh_2
Bike: What I assume is happening is a condition is sneaking passed my handler-case and causing and its being handled by a restart much higher up, this restart tries to get it to reconnect to the server, this is then done thousands of times and bang broke
14:06:21
Josh_2
or the restart isn't happening and its just trying to make thousands of connections which achieves the same thing
14:12:31
beach
pve: Absolutely. I designed the embryonic version (as the SICL reader) in order to use it to parse Common Lisp code in Second Climacs buffers, but then scymtym took over and made it as great as it is today.
14:28:23
Josh_2
Yes the method locative, I just find it to be exceptionally finicky, although I should probably put that down to inexperience more than anything
14:28:43
Josh_2
I would copy the examples for say a method like (on-save (method () t)) and I would get an error saying that this method cannot be found
14:38:34
etimmons
Xach: I'd love to have a gray stream extension to salza2 that mirrors chipz's make-decompressing-stream. Is that something you'd like to see added to salza2 or should I make a new project to wrap it?
14:40:55
Xach
etimmons: hmm, i think that would be fine in salza2 - using trivial-gray-streams or similar?
19:34:01
etimmons
salt rock lamp: I promised you a link to my work in progress on libgit2. Sorry it took so long: <https://gitlab.common-lisp.net/etimmons/cl-libgit2>
19:34:41
etimmons
salt rock lamp: The lispified wrappers are very much in the experimentation phase, so I can't really recommend using it.
19:35:50
jcowan
The modern view seems to mean that "parallel" does mean" "at the same time", in which case let-bindings are better described as concurrent. This view goes back to at least 1968.