freenode/#lisp - IRC Chatlog
Search
21:56:00
eminhi
now this was noise. https://bpaste.net/show/dee55ad8acae . I only knew split-seq utility.
22:48:00
dim
tumdum: I'm trying to go CL only for now (until I'm bored), as an excuse to learn the standard better, https://github.com/dimitri/AdventOfCode/blob/master/2018/d03.lisp#L27
22:49:36
dim
_death: I used repeat instead of below in my loops so that I don't have to compute the end index ;-)
22:49:57
dim
(defun update-fabric-claims (fabric claim) (loop :for row :from (claim-top claim) :repeat (claim-height claim) :do (loop :for col :from (claim-left claim) :repeat (claim-width claim) :do (incf (gethash (cons row col) fabric 0)))))
22:51:57
no-defun-allowed
is there a case-lookalike that expands to a lookup table with O(1) access?
23:06:21
no-defun-allowed
my issue would be creating the table at compile time with the correct lexical scoping
23:39:37
aeth
e.g. (dotimes (i 4) (dotimes (j 5) (dotimes (k 6) (format t "~D~%" (+ i j k))))) vs. (loop :for i :from 0 :below 4 :do (loop :for j :from 0 :below 5 :do (loop :for k :from 0 :below 6 :do (format t "~D~%" (+ i j k)))))
23:41:38
aeth
And if you have a simple repeated iteration pattern in your code (probably 6 or so times for it to be worth it) that cannot be expressed concisely outside of loop but you can define either a do-foo macro or a higher order function using do/do*/dotimes/loop/map/mapcar/maphash/etc., you should do that imo rather than directly use loop in that case.
23:42:30
aeth
But if you're e.g. doing some numerical algorithm that involves stepping through 5+ different variables, using both :with and :for, with a lot of complex logic going on, then you probably should just use LOOP.
23:45:28
aeth
(You could also use DO or DO* for many of these complicated iterations, but then the first thing you'll hear from your peers is "I can't read this")
23:48:06
aeth
DO/DO* are great for macro targets, and they're basically just LET with a(n optional) step, a terminator, and a return value.
23:52:42
aeth
The three points of confusion are probably (1) the terminating condition is the opposite of what you might expect, (2) the terminating condition and the optional return value are in the same s-expression, and (3) a well-written DO often doesn't have a body at all.
23:54:45
aeth
With LOOP you can specify :until/:while, the return is pretty clearly marked, and the step (:for) vs. not-step (:while) forms are clearly distinguished instead of relying on an optional third element in a binding's list.
0:36:02
no-defun-allowed
depends on the context, i think DO would be better for looping, but it does expand to TAGBODY in the end
0:36:33
aeth
eminhi: In most implementations DO will macroexpand to block over let over tagbody and DO* will macroexpand to block over let* over tagbody, e.g. it's pretty straightforward in SBCL with this: (macroexpand-1 `(do ((x 42) (y 1 (1+ y))) ((> y x) (+ y x)) (format t "~D ~D~%" x y)))
0:37:12
aeth
(It actually has two TAGBODYs in SBCL's macroexpansion of DO because DO-FOO forms have an implicit TAGBODY so you can write your own labels/GOs in there for more complicated iterations.)
0:39:29
eminhi
I want to reason with something more abstract than TAGBODY. and I really dont want to target loop.
0:39:32
aeth
eminhi: If what you want is ultimately BLOCK over LET over TAGBODY over TAGBODY then DO (or DO* for LET*) can save a lot of lines in your macro
0:40:13
aeth
If you want something more complicated (e.g. MULTIPLE-VALUE-BIND) then you'd have to work with TAGBODY directly, or you'd have to work with someone else's more advanced macro.
0:56:44
PuercoPop
How would you phrase the relationship between the method and the specialized parameter? e.j. "The EMACS-INSPECT method that specializes in HASH-TABLE"?
0:58:28
PuercoPop
Also can someone with access to SLIME check if inspecting the resulting hash-table from the following expression breaks for them?
0:58:29
PuercoPop
(let ((ht (make-hash-table))) (setf (gethash #C(0 1) ht) t (gethash #C(0 2) ht) t) ht)
0:59:56
PuercoPop
Basically the problem is that it applies < to complex numbers, that only applies to reals
1:00:56
PuercoPop
I'm going to recommend to change the typep to real. However I'm wondering it would make sense to implement an ad-hoc order
1:03:12
aeth
PuercoPop: Distance from 0 (assuming it's on the real-imaginary plane) with the real part as a tie breaker could be another way to sort complex.
1:12:25
aeth
There's probably a way to combine ABS and PHASE so it gets the regular sorting order on reals as well, e.g. (phase 1) is 0.0 and (phase -1) is pi
1:12:25
PuercoPop
aeth: I've opened the issue on the SLIME issue tracker but the fix only for Sly, maybe you can send a PR that orders numbers that way?
1:15:22
drmeister
Given a quicklisp system - is there a way to get the dependency graph before quicklisp starts compiling stuff?
1:16:02
aeth
hmm... Backwards sort of PHASE's angle and then ABS would work for complex in a way that also works on reals. i.e. if PHASE is the same, tiebreak with abs (since it's float you wouldn't be able to use =, though).
1:18:24
aeth
(obviously it's faster to have a typecase and only do this for complex, but you could still encounter things like #C(1d0 0d0) and #C(-1d0 0d0))
1:23:44
aeth
PuercoPop: Maybe something like this but without = (since you can't really use = on floats)? Sorts by angle then magnitude in a way that behaves like < if the imagpart is 0. (defun complex-< (x y) (if (= (phase x) (phase y)) (< (abs x) (abs y)) (> (phase x) (phase y))))
1:24:09
aeth
There's probably a name for something like this because sorting complex is not a new problem.
1:26:03
Bike
it's pretty easy to prove there's no total order, and that's about where things usually end
1:29:39
aeth
Bike: This seems like a weaker issue, though: can we produce a function that works with #'sort?
1:37:51
Xach
drmeister: .asd files are loaded and can run arbitrary lisp code, including loading and building other things. also :defsystem-depends-on is a problem.
1:38:41
Xach
drmeister: then you can look at the relationships between systems without much trouble.
1:39:08
Xach
drmeister: also, quicklisp precompiles info about those relationships, so if every system is from quicklisp, you can query quicklisp's indexes instead of asdf's.
1:43:40
Xach
drmeister: with quicklisp, i compile and load everything, and record what actually gets loaded, and use that to find the de facto relationships.
1:45:53
drmeister
We have the clasp build down to about 30 min by forking every compile-file that we can.
1:46:11
drmeister
Then we build the Cando quicklisp systems and it drops back to serial mode and takes an hour - ugh.
1:47:05
drmeister
I'm thinking that I should load everything with quickload and then determine the system dependencies once everything is loaded and save the dependency graph to use the next time we build.
1:48:21
drmeister
POIU would be nice - but it's broken. A faster compiler would be nice - but... llvm.
1:50:18
aeth
drmeister: The problem with compiling systems in parallel is that some systems change globals as part of their compilation process, even though they probably shouldn't do that and should leave that to the user (except for pushing to *FEATURES* and a few other niche cases)
1:54:44
drmeister
If I quickload systems from the leaves in to the root in separate forks it will compile all of the source code once and then I can quickload the root and it will hopefully all work.
1:55:58
drmeister
I'm going to change compile-file so that it compile-files into a temporary file and then atomically renames it to the target.
1:56:00
pfdietz
The advantage of compiling things in parallel is you can fail when people do that (which is wrong, as what happens when you reload precompiled fasls into a new image?)
2:02:42
pfdietz
If you've already compiled a system, you can just load the fasls, right? So if the compile process caused some side effect that you're depending on, you won't get that just by loading the fasls.
2:17:41
pfdietz
In general, any global change that you depend on should go into an eval-when that causes it to be performed when the fasl is loaded as well.
2:18:41
drmeister
I'm looking at asdf-viz - it visualizes these things but I can't make hide nor hair of it.
2:30:06
no-defun-allowed
dot's a program for spitting out SVGs from edges of a graph, so half the program would probably just be flattening the tree of dependencies
5:22:57
rk[ghost]
it returns icky, in values.. i forget.. how to grab first part of a values return?
5:30:02
rk[ghost]
pillton: thanks much. that saved me grepping thru a bunch of files to see how i used it in a project (who knows which one, long enough ago) :P
6:03:31
elderK
I've switched clients - it may have been a long long time ago. I didn't check the timestmap :P
6:04:03
equwal
I can't remember. I have a vague memory, probably I was talking about how in emacs you can get a library to rotate the in-frame windows.
6:33:00
elderK
Like, do they just use destructuring-bind and let it do checking, or do they first verify the structure /then/ call destructuring-bind
6:43:30
equwal
So only error check something that you think should be legal but which requires special treatment.
6:44:02
elderK
Right, so in that case I'd specify "Slots are of the form (name type &key (count 1)).
6:47:42
equwal
The point of my suggestion is that you wouldn't check any of that since it is a waste of your effort and isn't meaningful anyway. The only reason you might check is if you want to make sure that your program fails in a specific way when that happens.
6:57:59
equwal
Though I was just going to modify my emacs init file, but now I am programming udev and systemd.
7:00:37
equwal
Hasn't worked with GNOME in my experience, since GNOME has it's own incomplete system for keybindings.
7:01:17
no-defun-allowed
cause just in emacs is 4 lines of elisp, and ctrl-caps swapping was 2 in xmodmap so i imagine it's not too hard
7:01:17
equwal
So you have to change the keybinds on hotplug of the keyboard, which requires watching Udev with a systemd script.
7:06:10
equwal
Spent a decent amount of time trying to find that. Lots of bogus answers on stackoverflow.
8:08:55
hajovonta
work issues, family issues... I currently don't have a desk at home and did no CL recently :(
8:10:31
hajovonta
I couldn't find a way to incorporate CL into my daily job in the past year. We hopefully get a new assignment for next year though, and I'm optimistic.
9:40:47
hajovonta
sindan: I think many system engineering type assignments give possibilities to develop something in CL
9:44:08
sindan
hajovonta: just curious, CL is wonderful but it's far too powerful and flexible for many managers' taste, and if they know anything about software development, they know that the developer market is not big, therefore they resent having critical systems dependant on just one person, but maybe you knew that already
9:48:06
ogamita
Yes, anytime you start writing #!/bin/bash quick, type ^W^W usr/local/bin/clisp -ansi -q -E utf-8 instead.
9:49:32
ogamita
equwal: what pain do you have in swapping [] with ()? (apart the need to adapt to the new layout?)