freenode/#lisp - IRC Chatlog
Search
23:18:54
didi
And a nitpick: LOOP's keywords for hash-tables are confusing. Using [each, the, in, of] makes no difference, but I was trained that using [in, on] with list does.
23:36:58
White_Flame
ugh, yet another (vector (unsigned-byte 8)) vs (simple-array (unsigned-byte 8)) mismatch, this time with cl-sqlite
23:48:37
aeth
destructuring-bind takes a while to get used to, but it has replaced almost all of my old ways of parsing lists because usually there's *some* structure
23:49:45
aeth
And for iterating, I usually use do-destructuring-bind (dolist with destructuring-bind) or a higher order function with destructuring-lambda (lambda with one argument, on which a destructuring bind is applied)
23:50:03
aeth
destructuring-bind gets annoying with iteration unless you build trivial abstractions like that to flatten it
23:50:32
aeth
Alternatively, there are general macros to flatten stuff, but it's probably more intended for with-foo, let, multiple-value-bind, destructuring-bind, etc., stacking together, rather than being used in an iteration
23:56:40
aeth
definitely an option but it's very heavyweight compared to a handful of trivial macros on top of built-in forms
0:18:35
didi
By using `destructuring-bing', I feel I won't be able to freely change a data structure implementation. So, If I say (destructuring-bind (a . b) foo ...), `foo' is set to be a cons, with `a' as the `car' and `b' as the `cdr'.
0:19:27
aeth
If you use destructuring-bind, you can usually tell if something doesn't match what you expect pretty quickly. If you use cadr or whatever, you might never refactor it properly
0:19:48
mfiano
If it's built out of conses, it is trivial to parse with destructuring-bind. You argument holds better for arrays or hash tables.
0:21:11
aeth
If you're calling (cadr foo) and (caddr foo) through inline accessor functions you're probably going through the list twice (and certainly if they're not inline), and you could have nonsense at the end unless you do another check.
0:27:10
aeth
Sometimes you have no choice, though, like in macros (okay, you can probably use a reader macro to create structs at compile-time and use make-load-form-saving-slots to save the compile-time object so it's handled as a constant at runtime... but why?)
0:32:56
aeth
I find that either accessor functions or destructuring-bind (assuming it's not in a macro) is usually the first step to replacing it with a data structure, though
0:34:50
pjb
and if at any time you're worried about evolutivity of an implementation choice, you can always wrap it in a macro. Don't use destructuring-bind, use your own macro, that could expand to either that, or a with-accessors or a with-slots or something else.
0:38:41
aeth
pjb: I usually hide complicated things behind symbol-macrolet or with-accessors or something similar
0:40:34
pjb
didi: that is, it's better if you have to use it several times, or if it has to have an implementation that should be consistent with some other such macro or operator.
0:40:58
pjb
it is easier to ensure consistency in a mechanism, when it is implemented independently and separately from the rest of the code.
0:41:31
pjb
Also having such abstractions helps when you need to debug, since you can easily instrument those abstractions (add checks).
0:43:02
pjb
Yes. There are quick and easy checks that you can add when debugging and leave in production, but you can also add heavy checks (things that walk whole data structures, or perform complex computations to validate).
0:44:00
pjb
Note that I speak generally, here, not specifically for CL. I'm currently working on FreeRDP written in C, and it's horrible.
0:44:09
aeth
I created a typed cons cell out of structs that's about 30% slower than the built-in cons, but it saves having to walk the data structure to verify things (just check the type in O(1))
0:45:42
pjb
note that clisp can be compiled with a clisp compilation time option to add a slot to cons cells for your own usage.
0:47:10
aeth
Using structs is mostly portable because :type on a slot is usually at least somewhat respected. Full portability would require testing implementation behavior and wrapping the or check-type in places where it isn't respected on various implementations.
0:48:20
pjb
check-type must not be used indiscriminately. Sometimes you must rely on the intrinsic type checking.
2:00:54
nowhere_man
I'm starting to understand the concept of delimited continuations in the basic theory, but now I wonder: what are their typical uses?
2:10:09
White_Flame
delimited continuations are basically registering an lambda event handler from within a closure, for example
3:15:48
didi
krwq: I dislike doc generators, so I have no recommendation. But, I like this article: http://stevelosh.com/blog/2013/09/teach-dont-tell/
3:40:16
jasom
krwq: somewhat out-of-date, but: https://sites.google.com/site/sabraonthehill/lisp-document-generation-apps
5:12:16
drmeister
Does anyone have insight into how to implement the optimization where functions that call each other within a compilation unit call each other directly?
5:43:18
mfiano
pillton: I got your message. I actually get a warning when quickloading specialization-store now
5:50:20
beach
drmeister: Instead of going through the function name, you do a relative jump since the two functions are in the same code body.
5:51:19
beach
But, if you do that, you can no longer redefine the callee by hitting C-c C-c in SLIME.
5:55:33
beach
Also, functions can have more than one entry point. You don't need to check the number of arguments for such a call.
6:05:19
drmeister
We are stuck on a couple of fronts. Inlining is still broken and so we can't bring the new cst compiler online. That is very frustrating.
9:42:39
ebzzry
littlelisper: the canonical answer is http://www.gigamonkeys.com/book/files-and-file-io.html
10:15:55
beach
It is tricky stuff. I am pretty sure you don't have the right to recompile callers from source code. The environment may have changed since last compilation.
10:17:05
littlelisper
compiling my defpackage gives me "bogus DEFPACKAGE option: (:USE-IMPORT-FROM :CL-PPCRE :SCAN-TO-STRINGS)"
10:17:49
beach
p_l: At the very least, the direct call contains a relative callee address and after update, it must have an indirection through the symbol or the environment.
10:18:27
p_l
beach: I was thinking of using absolute addresses instead, and essentially handling it the same way one would handle GC-movable code
10:20:49
p_l
also, one could patch the callee location with a jump to new code, and have GC hooks that fixup it later
10:21:09
p_l
though the latter requires that all code moves only in the area supported by relative call
10:23:53
p_l
AMD64 for example only gives 32bit relative addressing, which is something I once considered for a rather "larger" compilation unit
10:26:16
p_l
beach: doing it like that would also fit with my ideas of marrying your single-level-storage for OS with some robust real hw :)
10:28:36
beach
Perhaps the easiest thing to do is to require the programmer to us NOTINLINE for a function that can be redefined separately. Then there is no obligation to make it work otherwise, because the callee could very well have been inlined, so that redefining it won't have any effect anyway. Then for NOTINLINE, generate a full call so that redefinition works as expected.
10:28:43
p_l
then compilation unit becomes essentially a "segment" which has a external reference table, a table of its own contents, and can be as big or as small as it needs to be (because we could do transparent segment nesting)
10:30:54
p_l
and inside a segment, the IP-relative offsets could be market by debug data and updated when necessary (done right, one could also "fork" segments)
10:45:16
budRich
hello lisp people. Im currently in the transition phase of going from i3 to stumpwm and sublime to emacs (don't ask why). And it feels like i need to get a good understanding of and learn some lisp. It's all a bit overwhelming right now, with all the different dialects and stuff, just thought i would ask here how YOU got started: book, cource, emacs, dialect, whatever.
10:47:40
pjb
budRich: have a look at http://cliki.net/Getting+Started and http://cliki.net/Online+Tutorial
10:47:49
budRich
great, this is what i thought and planned, i try to conf stump and get used to that first, before starting with emacs, it feels like it can get confusing. And wm hacking is my cup of tea.