libera/commonlisp - IRC Chatlog
Search
10:08:57
lisp123
off topic but lots of good material on parsing algorithms here https://news.ycombinator.com/item?id=33662534&ref=upstract.com
10:15:04
lisp123
beach, that's honestly the worst indenting I have seen and I don't mind non-standard indentation
10:32:51
emacs-dwim
For some reason in emacs: (setf (default-value 'tab-width) 2 (default-value 'indent-tabs-mode) t).
10:37:28
emacs-dwim
I think it came from a bad merge of a win32 .emacs with my standard .emacs. Blubs often have tab indentable nesting.
11:14:48
Lucretia
I'm following dbotton's tutorial, have slime installed, but the M-C-x key combination isn't working. I'm on kde plasma. M-x works. I've just set "Alt and Meta are on Alt" option in the kb options
11:20:22
McParen
I'm looking for a name of a "list with an index", where i can select the next item, the previous item, get the current item, and so on. is there a known name for such a structure?
11:22:21
phoe
it's hard to say without the information of what operations you want to optimize for: can you insert new data into that structure? if yes, at the beginning, at the end, close to the Nth element for some N? how about deletion? do you need constant-time access to every element?
11:22:27
McParen
beach, that is what i'm looking for, or more precisely, i'm looking for the appropriate name for such a construct
11:24:30
beach
McParen: I know of no well established name for such a thing. But I know a few libraries that can implement such a thing.
11:24:36
phoe
if you implement your doubly-linked list as a list of doubly-linked conses, then you get cursors kinda for free
11:24:38
McParen
phoe: it should be able to insert, delete and replace every item in the list, but most importantly i just want a pointer to a "current element" which i can move.
11:25:43
phoe
where CAR is the "value" place, CDR is the next element, and CIR is the previous element
11:26:55
phoe
with singly linked lists where is no consistency to keep, but doubly linked lists have backreferences and these need special care
11:27:26
McParen
That sounds interesting, at the moment i just have a list wrapped in a class and a counter, which i then increment, decrement, etc. I'm not sure if that is the sensible way to do this.
11:27:49
beach
McParen: If you want a highly optimized implementation, then have a look at flexichain.
11:28:25
beach
But Flexichain can do much more. It can insert and delete elements at arbitrary positions, and much more.
11:28:53
McParen
beach: I guess at the moment I am just looking for how to correctly name such a construct of an "indexed sequence".
11:30:33
Nilby
McParen: Perhaps you're thinking of associative arrays https://wikipedia.org/wiki/Associative_array of which there are many many different ways to implement depending on what you want it optimized for. Doubly linked lists have a number of bad features.
11:31:00
McParen
I've searched around and on several places the concept of a list with and index is named an "iterator", but I'm not sure that this is correct.
11:32:14
emacs-dwim
If you know which direction you came from, you can xor the next & previous pointers.
11:33:02
beach
McParen: It seems everyone is suggesting an implementation strategy, even though all you want is a name.
11:34:23
McParen
beach: indexed sequence is obvious, but it also can be confused with a vector, which also is an indexed sequence.
11:34:26
beach
phoe: Also better than a doubly linked list would be two lists, one containing the prefix, and the other the reverse of the suffix.
11:35:37
emacs-dwim
(defmethod print-object ((object (eql 'some-symbol)) stream)) ;; breaks sbcl's compute-effective-method & sly backtracing overflows the stack
11:36:10
specbot
Constraints on the COMMON-LISP Package for Conforming Programs: http://www.lispworks.com/reference/HyperSpec/Body/11_abab.htm
11:36:22
McParen
beach: implemntation suggestions are good, i dont think my current implementation (list + counter) is very robust.
11:38:52
beach
phoe: But we haven't been given a complete list of operations yet, so we don't know whether traversal is one such operation.
11:39:22
beach
phoe: If moving the cursor arbitrarily is an operation, then a list (simply our doubly lniked) should not be used at all.
11:40:10
beach
I invented Flexichain to handle a very large subset of operations fairly well, given that there is some concept of spacial and temporal locality of operations.
11:42:21
McParen
beach: what i have is a list of widget objects in a list (or tree), an Im looking for how to keep track of which widget is slected, to be able to select the next, previous, etc.
11:43:19
contrapunctus
phoe: urgh, struggling to understand both the linked code and point #19... «19. Defining a method for a standardized generic function which is applicable when all of the arguments are direct instances of standardized classes.» ...why is it a problem?
11:44:03
phoe
and/or the implementation may ignore the method dispatch in that case and do something else
11:47:26
phoe
if you do (defmethod print-object ((object cons) stream) (format stream "(~S . ~S)" (car object) (cdr object))) then only CCL seems to do the funny thing in practice
11:48:29
phoe
EQL specializers are a bit more funky, but still, an implementation can depend on the fact that you will not violate point 11.1.2.1.2.19
11:48:54
phoe
and IIUC that is what SBCL does up there until it crashes and burns because its method dispatch for symbols broke
11:50:36
beach
McParen: If all you want is previous/next, then the best implementation is probably two lists, one with the reversed prefix and one with the suffix. Then you can move one CONS cell from one list to the other to implement previous/next.
11:51:23
beach
McParen: The "cursor" would then be located between the last element of the prefix (the first element of the reversed prefix) and the first element of the suffix.
11:52:05
beach
McParen: Inserting or deleting an element at the cursor is also easy. Just push or pop an element from one of the lists.
11:53:52
beach
McParen: So if you sequence is (a b c d e f g) and the cursor is between c and d, then the two lists would be (c b a) and (d e f g). Moving the cursor backward would be moving the first element of the first list to the beginning of the second list, giving (b a) and (c d e f g).
11:54:15
McParen
beach: thanks, I'll look into that. do you have a suggestion how such a construct could be properly named (other than "iterator" or "cursor sequence")?
12:29:05
McParen
beach: I think your suggestion to name the structure "cursor-list" could be right: https://hackage.haskell.org/package/cursor-0.3.2.0/docs/Cursor-List.html
12:29:48
Shinmera
I'd probably call it a "head" and the structure a "tape". You know, like the original turing machine.
12:33:35
ski
McParen : the name for a structure, with a focus, and cheap (usually `O(1)') movement around the focus, is "zipper"
12:37:10
ski
the original paper is "The Zipper" (Functional Pearl) by Gérard Huet in 1997 at <https://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/huet-zipper.pdf>
12:43:16
ski
this is also related to taking derivatives of data structures ("The Derivative of a Regular Type is its Type of One-Hole Contexts" by Conor McBride in 2007-10-11 at <http://strictlypositive.org/diff.pdf>) (and to the theory of "combinatorial species" (lists, cycles, trees, graphs, partitions, ..) in general, pioneered by André Joyal)
12:50:22
ski
(if `List(X)' (`= 1 + X + X^2 + X^3 + ... = 1 / (1 - X)', figuratively speaking) is the set of (finite) lists with elements in the set `X', then `d List(X) / d X' (the set of one-hole contexts in lists) (= `1 / (1 - X)^2') is `List(X)^2', iow you keep a pair of two lists around)
13:58:43
lisp123
I do something that is space-inefficient - i store a list together with an array of its elements
14:01:12
lisp123
but that's because my lists are usually created from arrays, so the processing cost of making the array is zero
14:33:38
Nilby
Shinmera: That's quite an extravagant bit of metaprogramming. Looks quite nice. That template style and the type dispatching seems like it could work for other things too.
15:07:31
Nilby
cool, i'm on a dogfood diet, but your dogs seem to eat pretty well, they get a whole game engine to chow on
15:17:05
Shinmera
.... and then 3d-transforms. Though I hope the latter two at least won't prove very challenging
15:23:10
Nilby
meta-meta-programming: (mapcar #'have-shinmera-update-with-fast-terse-macros (nice-3d-math-libs))
15:43:47
emacs-dwim
Shinmera: Might as well get the whole projective Geometric Algebra working. Sedenions aren't associative under plain multiplication; but the "sandwich product" *is* associative. Then the library would work for multivectors in 4d or the even grades of 5d projective GA. This projective basis works nicely for 4d objects because translations and rotations are the same operations (translations are rotations about an ideal at infinity).
15:46:26
emacs-dwim
Then 4d-projective GA. That simplifies 3d operations, and gives nice symmetry between objects and operations.
15:47:38
Shinmera
Feel free to implement it. I have other stuff to do in the meantime, most of which involves avoiding thinking about maths
15:48:28
emacs-dwim
beach: I found that my tabs come from: org-mode converts the spaces into tabs when closing src blocks.
15:50:20
Nilby
shinmera's gotta work on work on cloning themself, not hanging around in the sadly empty higher dimensions, and watching out for gimbal lock
15:51:14
yottabyte
how do people typically do language interop? I want to call a lisp program from java, do people usually return json, for example?
16:03:47
Nilby
yottabyte: It depends on requirements. You could use ABCL to reduce object conversion overhead. You could link ecl or sbcl with a jvm and use native calls. You could use one of the many RPC things like gRPC or XML-RPC or json rpc.
16:13:23
yottabyte
I've tried java ABCL interop before, I think it has other overhead which seemed to make it infeasible honestly. it was cool though
16:21:15
Nilby
yes, unfortunately ABCL is a bit slower than the others. maybe better for driving java then the other way. probably the easiest as far as getting it working is one of the rpcs, but the native calls are of course likely faster. i know the grpc is activly used.
16:25:44
denis`
so i am using asdf + emacs to run unit tests for my project. In test file, i have renamed a test (so the old name doesnt exist anymore); but asdf:test-system *still* has it loaded, and tries to run it. How do I remove stale functions?
16:31:29
phoe
anything else would probably depend on your test framework, since every one has a different way of storing runtime information about tests
16:31:50
emacs-dwim
ski: Makes me wonder if fractional-order derivatives would also apply to data-structure. On the problem of various definitions that all work in their own ways - for fractional-derivatives - but same for fractional-iteration in general: Since there can be (infinitely) many functions that, when applied n times, reach the destination - would it be useful to define some "action" in order to apply a stationary-action principle, similar t
16:43:35
ski
emacs-dwim : not clear to me what it would mean to remove "half an element" (e.g.) from a data structure
16:45:50
ski
.. not having looked into fractional derivatives much, i wonder whether considering (left vs. right) adjunctions / galois connections (being basically a kind of lower resp. upper approximations to inverses) would be useful in this regard (regaining uniqueness for each of the two kinds, as opposed to a single unique solution)
19:12:10
Lucretia
Hi, following dbotton's tutorial and I've hit a blocker with part 3, hello-package asdf stuff, https://pastebin.com/kGQdpX7g - I've no clue what's wrong. https://pastebin.com/nKFdK0kc (source)
19:14:56
phoe
as long as the ASD file contains just the DEFSYSTEM form and the lisp file contains DEFPACKAGE, IN-PACKAGE, and other stuff
19:50:39
NotThatRPG
I have a table that is growing over time and i would like to gather info about it.
19:52:49
Shinmera
You could try cloning it and checking ROOM, but that's going to be very inaccurate.
19:58:44
Nilby
For sbcl there's sb-ext:primitive-object-size. There are internalish things for other implementations
20:37:42
pjb
Lucretia: you could use: shar hello.lisp hello.asd to get an shell archive containing both files that you could paste. This is no more complicated than: (cd /tmp ; shar hello.lisp hello.asd )|tb --> https://termbin.com/wavv
20:39:04
pjb
alternatively: for f in hello.lisp hello.asd ;do printf '----8<----8<----8<-----(%s)----8<----8<----8<----\n' "$f" ; cat "$f" ; end | nc termbin.com 9999 | tr -d '\000' # the last part from nc is in my tb script.