freenode/lisp - IRC Chatlog
Search
2:15:42
White_Flame
but still, unless there's some weird superoptimizer style trick to bit order reversal, you'll probably still have to loop
2:16:34
no-defun-allowed
ebrasca: Any real implementation of CRC for a filesystem would use a byte-wise loop, not bitwise, and there is no reversal there.
2:17:08
White_Flame
ah, here's a reasonable method in log2 time: https://stackoverflow.com/questions/2602823/in-c-c-whats-the-simplest-way-to-reverse-the-order-of-bits-in-a-byte/2602885#2602885
2:17:10
dieggsy
way back in the day (lol just a few years ago) i had found some way to have a running SBCL process and write scripts that would like connect to it, does anyone know what i'm referring to ?
2:17:34
dieggsy
i don't think i was manually connecting to a swank server, though that may have been what the tool was doing
2:18:42
pjb
ebrasca: https://www.oreilly.com/library/view/hackers-delight/0201914654/0201914654_ch07lev1sec1.html
2:22:24
White_Flame
hmm, with 4 bytes to look up and re-merge, that pairwise reversal's 5 steps for reversing a 32-bit word might be shorter/faster
2:23:10
White_Flame
but yeah, feel free to try the various options in pjb's links for the really weird and potentailly shorter solutions
2:29:38
moon-child
http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious has a few methods
2:29:59
pjb
Now, when you have specific operations that can be thus optimized (don't forget the logand etc to ensure 32-bit operations are performed on the intermediaries), such algorithms are ok. But if you had some generic bit manipulations to perform, of various kinds, one way to do it in lisp would be to convert the integer into a bit-vector.
2:30:26
pjb
Then you can manipulate the bit-vector with any array or sequence operator. replace, reverse, aref, find, etc.
2:31:22
pjb
Of course, it would be nice if there was an implementation operation to do that perhaps in a more efficient way than looping on logbitp…
4:03:36
beach
Not a "vs" opinion, but I think both are sub-optimal and we should work to get something better.
4:15:06
moon-child
is there a general solution to that (that doesn't require special knowledge of the 'let' form)? You would have to macroexpand 'let' with a partial body (or, more charitably, a body with a hole in it) in order to infer that 'multiple-value-bla' were bound at the point of the cursor. All that without knowing the end of the body
4:15:54
beach
So, we should analyze the buffer that way. Why should we settle for a lousy approximation?
4:16:58
moon-child
I'm not saying we should settle, I'm genuinely curious how you would solve that problem
4:18:51
moon-child
(I suppose one solution would be to have the editor automatically insert closing parentheses, but I find such 'features' jarring)
4:19:25
beach
moon-child: Eclector would fill in the rest of the buffer so that we get (let ((multiple-value-bla)) (f multiple-value-b<cursor>)), then we would take the CST and convert it to an AST to get the role of each identifier.
4:19:34
moon-child
(I think structural editors would be a good solution, but those would require a somewhat radical rearchitecturing of editing and dynamic analysis infrastructure)
4:20:11
moon-child
beach: how do you infer the )) at the end? It seems very easy, in more complex scenarious, to get that wrong
4:20:45
beach
moon-child: It can't always get it right, but the simple solution is often correct. Eclector has a bunch of restarts for that kind of stuff.
4:21:25
dieggsy
beach: i'm not entirely sure how this is working yet. at first when i tried it, it suggested multiple-value-bla *only*, as in, in a completion popup. when i went back and tried it however, it suggested multiple-value-bind, multiple-value-call, everything *but* multiple-value-bla lol
4:23:25
dieggsy
..you can get multiple-value-bind completed from mvbind too. it's using some kind of fuzzy completion.
4:23:41
beach
dieggsy: Here is another thing you can try to compare between the two. Type (let ((hello<newline> and observe where the cursor is located. It is under the `e' in hello in SLIME. Now try (let ((prog1<newline> and observe the cursor positionh.
4:24:24
beach
dieggsy: My point is that multiple-value-bind should not be a suggestion since there is no such variable in scope.
4:26:18
beach
In fact, SLIME (or Emacs) nicely highlights the PROG1 for me as well, as if I should want that.
4:29:22
beach
But I have just had enough with substandard software, so I am not up to comparing badness.
4:30:04
beach
I am using Emacs + SLIME because that's the best I know, though perhaps SLY is better. But I am also working on creating something much better.
4:31:27
beach
Every day, I also use a crappy operating system that is the best one available (as far as I know).
4:32:42
dieggsy
this is all fine, but just like a let binds variables in a particular scope, we can ask questions within a particular practical scope
4:33:12
dieggsy
so you can have practical opinions and recommendations on existing software despite none of it being optimal
4:34:16
beach
I think we can do much better than what we have, and I think my time is better spent trying to accomplish something better, than comparing several sub-optimal solutions.
4:35:00
beach
We can at least analyze the buffer contents as well as a compiler does. I don't see any reason to do worse than that.
4:35:05
dieggsy
that works when you have that time, but when you need to get something done now (or in the interim), you still need to compare the sub-optimal solutions
4:35:53
dieggsy
in fact, as you've stated, you're using those sub-optimal solutions to accomplish the better thing. so the question "which sub-optimal solution should i use" isn't a useless one
4:37:31
beach
Sure, however, if I estimate that the differences are small, then I would spend more time comparing than what they deserve, and that would take up time. So I would need some indication that the difference is significant before I take time to compare.
4:39:28
dieggsy
beach: and tbh, i do appreciate that, i learned some things along the way and gained useful insights about these tools, so cheers
4:39:58
beach
My point is also that, if everyone needs to get things "done now", then we are collectively going to waste a lot of time on sub-optimal tools. So it would be better if each one took a little time to improve the tools so that everyone could become more productive.
4:41:59
ChoHag
Just saying, in all this time, you could have typed in 'bla' and moved on to figuring out how to make the computer guess what you're thinking of for the next expression.
4:45:05
Nilby
beach: I very much agree we can do better, and it's werid, because I'm usually very dissatisfied with it, but the completion I usually use in emacs (based on dabbrev-expand) expands to "multiple-value-bla" in that case. But I know it's cheating and I want it to be real syntax aware too.
4:47:21
Nilby
I've worked on parser based completion, but it too has a number of problems, and seems to be aided by statistical completion.
4:48:02
beach
Again, I don't see why the editor couldn't do what the compiler does in order to determine what is in scope.
4:49:41
Nilby
It should be able to, it's just not always what you want. But maybe it should be a first guess.
4:52:59
Nilby
Also multiply the time saved by all the other people that can use your better completion.
4:53:05
ChoHag
I'm working on this, fwiw, by removing as far as possible the distinction between editor and compiler.
4:58:56
Nilby
ChoHag: Same. The weight of yaks sitting on your average developer, or even lispers, is nearly crushing.
4:58:57
ChoHag
Also fwiw, the point of my snide comment was not "type bla and move on" but of the larger question of trying to make the computer guess what you want with(out) giving it context.
5:02:17
ChoHag
Nilby: One particularly frustrating problem, and ironic since I'm doing exactly that, is the way perfectly good code remains unused while a new implementation gets written.
5:04:04
Nilby
Agree. There's also a large weight of good but forgotten code, that's too overwhelming for me to think about.
5:10:34
fiddlerwoaroof
At one point I realized that many people don't use: https://github.com/anwyn/slime-company
5:11:32
fiddlerwoaroof
It doesn't distinguish between operator and arugment positions and it's annoying in a couple ways, but its main advantage is that it works by querying your lisp system to determine what symbols are available
5:12:33
fiddlerwoaroof
cool, I shared it somewhere at one point and was surprised by the people who didn't know about it
5:13:45
fiddlerwoaroof
I'd really like a better completion system, but it seems to me that any particular strategy for completions is going to have annoying edge cases
5:14:34
ChoHag
It should be unthinkable that the system doesn't somehow make slime users aware that slime-company is available, at least.
5:15:13
fiddlerwoaroof
I have all sorts of handy utilities on my laptop that no one can use because I haven't advertised them :)
5:18:23
fiddlerwoaroof
The other difficulty with completion is that sometimes text-based completion is better
5:18:59
fiddlerwoaroof
If I have three symbols with somewhat conventional names, after I type foo-a, foo-<TAB> completing foo-a makes it easier to input foo-b
5:19:54
fiddlerwoaroof
even though the completion is actually wrong, it's more useful than showing me either nothing (because I'm in a let and foo-a is a parallel binding) or some random symbol.
5:22:20
fiddlerwoaroof
One thing I'd like is the ability to write code into the buffer with #1# and #1= and then tell emacs to "expand" the reader macros
5:23:02
fiddlerwoaroof
It wouldn't be safe because it'd break identity, but it'd be pretty useful in some situations.
5:23:30
moon-child
I'm inclined to say that if you need to duplicate enough code that that would be useful, you're probably doing something wrong anyway
5:24:52
fiddlerwoaroof
Also, there's a bunch of places where that sort of editing shortcut would just be nice
6:14:07
jlarocco
In the Slime REPL, when I run (ql:quickload :my-package) where my-package has a syntax error, or some other failure, is there a shortcut or function to jump to the source code location causing the problem?
6:20:54
jlarocco
If I compile the file with C-c C-k, I can use next-error and previous-error to jump to the location that caused the problem, but that doesn't seem to work using (ql:quickload) from Slime
6:55:13
no-defun-allowed
Re-reading the Early History of Smalltalk, this statement could be read as in favour of generic functions and/or method combination: "And we soon discovered that "prototypes" were more hospitable than classes, and that multiple inheritance would be well served if there were classes for methods that knew generally what they were supposed to be about (inspired by Pat Winston's 2nd order models)."
7:17:31
pillton
I don't understand how "functions" coupled with state got so far. I am referring to the syntax for application and their declaration/definition.
7:21:12
Lycurgus
pillton that reminds me of when I once asked my mother if they had electricity when she was a child
7:24:45
Lycurgus
in fact before haskell, and erlang (outside switches), when strict FP meant ML, it (strict FP) was considered a useless academic toy
7:29:32
Lycurgus
it also makes it sound like langs with full referential transparency were now the norm which is hardly the case
7:52:06
phoe
jlarocco: compile with debug 3, then the backtrace will have a green-colored frame that shows the form beind compiled
9:47:04
pjb
moon-child: structural editors feel like straight jacket. I like the flexibility of emacs, allowing you to work at the character level as well as structurally thru things like paredit. It's a nice compromise IMO.
9:53:30
beach
But yes, now that we can parse the buffer contents incrementally, using the Common Lisp reader, I don't think there is any need for such restrictions.
10:33:38
pjb
if you have automatic editing to do, why not. But otherwise, consider something like sedit.
10:35:25
pjb
paredit approaches it, while leaving the character basis. We could implement a sedit in emacs, purely structural.
12:51:08
nij
Hello! I found that a script "dictionary" I wrote hasn't been working for a while.. but failed to see why's that the case: https://bpa.st/UILA
12:55:18
beach
You don't exactly give the output that would tell us why. But one hint is that ASDF by default converts warnings to errors that will prevent the compilation from finishing properly. You may want to change that default.
12:57:14
nij
Err. whatelse output should I provide? This is the debugging message after I run (ql:quickload :dictionary)
12:58:30
beach
Try putting this in your .sbclrc: (setf asdf:*compile-file-failure-behaviour* :ignore)
13:50:04
beach
phoe: Are you the one in charge of the streaming for ELS? If so, what is the deadline for uploading the talk?
14:01:36
Josh_2
Was wondering if someone could show me an example in real code where they have used it to get a performance increase
14:02:17
lotuseater
Josh_2: this is something which I still don't get ^^ got to know this after reading the Google Common Lisp style guide
14:04:40
Bike
i mean, honestly, there's not much to it. if you make an object and you know it won't escape you can declare it dynamic-extent to hint to the compiler to stack allocate
14:05:01
pjb
the use of the guard cons cell lets you avoid a special case when you have to insert at the before the first element of the list. However, this cons cell is a temporary cons cell that won't be needed once the function returns.
14:05:12
lotuseater
had the thought it could be useful if you loop many times and create each time new data in a DO clause
14:05:24
pjb
Josh_2: therefore it can be declared dynamic-extend and the implementation could allocate it on the stack instead of the heap.
14:06:26
pjb
It's dangerous to write dynamic-extend declarations, because in maintenance, the status of the object could change! It's better to let the compiler determine it itself, without error.
14:08:23
Nilby
I would only use a dynamic-extent declaration where it was demonstrated to make speed critical code faster.