freenode/#lisp - IRC Chatlog
Search
0:54:04
aeth
I have an incredibly complicated loop (yes, more than the one from yesterday) because it collects twice, appends twice, and also generates an integer value that's used. https://gitlab.com/zombie-raptor/zombie-raptor/blob/master/entity/entity.lisp#L164-225
0:55:56
pjb
(loop for i in (loop repeat 4 collect 42) for j from 0 collect (loop for k below j collect (list i k))) #| --> (nil ((42 0)) ((42 0) (42 1)) ((42 0) (42 1) (42 2))) |#
0:56:48
pjb
aeth: a function must do a single thing. Unless you're looping over a multidimensional array, there should be as single loop per function.
0:57:20
aeth
Oh I did find a way to fix my emacs's indentation and clean up yesterday's loop a bit. https://gitlab.com/zombie-raptor/zombie-raptor/blob/b10b0ce00d4c27ec20860991907baae11e188040/util/array.lisp#L113-151
0:59:34
aeth
pjb: yes, but the five different loops (only two were actually LOOPs) were harder to follow because there were a bunch of things I combined when I combined them
1:00:23
aeth
e.g. now I collect a gensym that's generated each iteration into a list of gensyms, instead of generating that list of gensyms and using it both in the loops and in the macro, which then requires MAPCARing over two lists, which is more complicated than over one
1:01:02
aeth
And, yes, I use ? here instead of -p because it's a query mini-language (as the name suggests)
1:01:17
aeth
it queries a big, complicated data structure and symbol-macrolets away the implementation details to the variables you provide
1:02:03
aeth
pjb: I had it in 5 separate loops (well two were LOOPs and two were MAPCAR and one was REDUCE) and I couldn't read it
1:02:52
aeth
I could possibly spin out the boolean-set number generation into its own function because it isn't heavily tied to the rest.
1:06:05
aeth
Any mutation that changes the visuals of the engine must make changed? T and if you need to access the value of changed (but not set it!) you use LET-CHANGED? to get the result of `(= 1 ,%changed?)
1:09:10
aeth
pjb: okay, I fixed the accessor name and simplified the destructuring. https://gitlab.com/zombie-raptor/zombie-raptor/blob/a6b92a4ed50ad49cf709604bd15def274a3b97f5/entity/entity.lisp#L166-224
1:18:04
aeth
I think the big loop is more readable if I can replace the append, with the possible exception of the boolean-set part, which I could just spin off into a function and put at the top of the loop in another :with
1:18:39
pjb
But it may (reload it I missed the bindings function) be easier to read, since the naming of the important data is clearer in the let* form, and we can abstract away parts such as the bindings function (we could do the same for array-bindings and boolean-set); those functions could be reusable, etc.
1:19:31
aeth
pjb: Well, in one intermediate step I had the loop return multiple values into a multiple-value-bind. It seemed kind of pointless, *but* if I moved the loop into a separate function, it could be cleaner
1:19:45
pjb
The thing is that by writing separate loops, you can extract the computing of each list in a separate function.
1:25:44
pjb
Actually, I've got a backup of lisppaste with almost all of them. And scanning the irc logs, I could recover almost all the other urls…
1:26:20
aeth
pjb: How about this for now? https://gitlab.com/zombie-raptor/zombie-raptor/blob/69615bd70dae5627096702ee0a7e2a3564fd07de/entity/entity.lisp#L164-228
1:28:03
aeth
array-bindings is the non-trivial part I have to figure out how to deal with (whether in its own loop or not).
1:48:43
aeth
With the reduce in its own function. https://gitlab.com/zombie-raptor/zombie-raptor/blob/4d0f226962d3c699ebc3fe3f208b5fd7b5e09bfa/entity/entity.lisp#L166-235
4:15:12
drmeister
Say I have a vector of some number type and I want to convert it to a vector of single-floats - I have to convert the elements one by one - right?
5:32:43
beach
SaganMan: I am fine, thank you. I have been making excellent progress on bootstrapping the past few days. What about you?
5:34:38
SaganMan
beach: I'm in my family business. It's real estate and construction. We take land for development and construct apartments.
5:37:38
SaganMan
beach: We don't usually do projects on that grand scale. That is the biggest investment in mine and my father's life. It looks impressive but it's great risk and stress.
6:20:48
no-defun-allowed
well my ffmpeg interface is still shitslow at 4fps but the videos aren't broken now
11:26:09
makomo
pjb: i managed to find one occurence of the (4) (3) ordering, https://www.hexstreamsoft.com/libraries/place-utils/#funcallf-applyf
11:26:38
makomo
granted, funcallf is just _f in disguise, but the evaluation order has been explictily documented (and therefore thought through)
12:14:41
adlai
"risk and stress" ... yep, that sounds like components of the construction Hamiltonian. story checks out!
12:48:12
phoe
I'm running code that's fifteen years old and the only thing that was really required is fixing it to use ASDF.
12:52:05
_death
phoe: check copyright date range @ https://bitbucket.org/dfmorrison/roan/src/e43b5ae8af0aba6930f0183a4afbc7e3e004da1e/roan.lisp?at=master&fileviewer=file-view-default