freenode/#lisp - IRC Chatlog
Search
18:51:56
ealfonso
I have a long-running service that continually adds elements to an array until it eventually runs out of memory and crashes. Is there a library that provides an abstraction to a data structure with a maximum in-memory capacity and the rest backed by disk?
19:00:40
rpg
clintm Bike: I think even if we had some structure like Java, we couldn't do much, because the set of standard conditions in the spec is minimal and weak.
19:01:39
rpg
Even if you knew what set of conditions might be raised by a set of mathematical operations in SBCL, I doubt that would be at all predictive about what CCL or Allegro would do, for example.
19:02:58
rpg
I could imagine that given a small piece of code, and access to the SBCL source code, a sufficiently clever theorem-prover could compute a conservative over-approximation of the set of conditions that could be raised.
19:05:38
ealfonso
dlowe I guess this seems something similar to memory paging or caching, so I wasn't sure if there was something already available
19:09:43
aeth
ealfonso: There are ways to serialize to disk, so it shouldn't be too hard to choose one of them.
19:12:47
ealfonso
I was thinking of implementing this using a virtual array displaced to a real array of fixed capacity, with the real array periodically flushing to disk, and adding a custom handler for negative indices into the real array. I wonder if it's possible and efficient to handle a condition like this in a custom way : (aref (make-array 5) -1) => #<SB-INT:INVALID-ARRAY-INDEX-ERROR expected-type: "(INTEGER 0 (5))"datum: -1>.
19:18:31
rpg
ealfonso: You can make your own condition, which is something like "item paged out of memory," and write a continue handler that would page it back in.
19:19:13
rpg
But it sounds like you need a notion of page or something, which sort of smells like you are reinventing virtual memory. Why doesn't OS VM solve this problem for you?
19:27:27
ealfonso
rpg well, in my case the amount of memory grows continuously, and eventually the process always runs out of memory (including any additional swap space). but you're right that I could increase the amount of swap space without having to change anything else.
19:30:06
rpg
ealfonso: Before trying this new data structure, unless you need it to be portable, I'd check with your lisp implementation to see if there's a way to make it smart about paging a data structure like this. Maybe there's some way to allocate it so that the implementation will handle it well. Or I wonder if you could just make a big array that's mapped on to some block-size of individual arrays, hoping that parts of the array that aren't being used will get paged out
19:34:45
ealfonso
in my particular case, I only care about the latest 'page' being in memory since it accounts for 99% of accesses, so for my use case I don't need to worry about paging, only about not crashing due to running out of memory by periodically flushing to disk or increasing virtual memory.
19:35:59
rpg
ealfonso: Right, but we need to make sure that the lisp implementation correctly discovers this pattern of memory access. So it would help to know if the implementation will, for example, page out parts of large in-memory data structures. If it *won't*, then it might help to do the trick I mentioned above.
19:38:45
ealfonso
rpg that's right. unless I implement it manually and manually flush to disk and only keep one page in memory (which would mean all other accesses outside of latest page would be a miss, which I think is OK in my case)
20:45:51
aeth
Apple deprecated OpenGL. https://www.reddit.com/r/programming/comments/8okg5y/apple_deprecating_opengl_and_opencl_in_macos/
20:46:20
aeth
Direct link but without the emphasis on the big (to us) announcement. https://developer.apple.com/macos/whats-new/
20:47:36
aeth
This is huge. Nearly everything uses cl-opengl and cl-vulkan, the only alternative, is incomplete. Applications that wish to continue supporting 3D on macOS would need to port to Vulkan, cl-vulkan (or some other bindings), and use the MoltenVK library.
21:14:50
aeth
A slight clarification: I'm not actually sure if deprecation means removal in macOS 10.15. It just means that it *could be* removed in macOS 10.15.
21:16:44
aeth
Bike: Well, you'd have to approach it the same way if you want to ensure continued macOS support.
21:18:10
rpg
ACTION remembers "The only thing worse than being talked about is *not* being talked about..."
21:19:12
aeth
rpg: I guess on the plus side, people will finally start abandoning OpenGL 3.3 or OpenGL 4.1 in favor of either Vulkan or newer versions of OpenGL. The macOS excuse will no longer exist and the older drivers/hardware for the other OSes are fading.
21:20:01
rpg
aeth: Seems weird, but I'm kind of a 2D guy, anyway! ;-) Have you checked in with #lispgames?
21:25:26
Bike
you can iterate over hash tables with a variety of mechanisms, such as maphash; the rest shouldn't be too hard depending on your desired semantics
21:26:29
dxtr
Question #2: Are hash tables passed as copies? What I'm basically wondering is that if I modify a hash table within a function will that affect the caller too?
21:27:37
dxtr
Oh, so if I modify *anything* within a function that affects the caller too? This is an area I haven't really thought about
21:28:03
dxtr
I always try to make everything immutable but this time I'm considering if non-mutability is simply easier
21:28:41
rpg
dxtr: most things *are* immutable, but there are things like list structures (if you use nconc or the like), arrays (if you modify their contents), etc.
21:29:37
rpg
e.g. if you change a variable from one string to another, it doesn't harm the original string. It's only if you modify the string's contents.
21:32:42
aeth
What's the best way to ensure sb-ext:*derive-function-types* when building an executable with SBCL but not during development?
21:36:18
aeth
sb-ext:*derive-function-types* is normally NIL, and should normally be NIL, but when compiling an executable for SBCL for applications using my framework, it should be T. It makes SBCL assume that functions won't be redefined to change the function types, which gives more power to the compiler. i.e. Optimizations, compile-time warnings/errors, etc.
21:37:24
rpg
aeth: One way to do it would be to bind that variable around the build process for the executable. You could do that relatively easily, I think, if you were using Fare's ASDF "bundle" stuff.
21:37:55
rpg
That said, I've never used that stuff myself, except to run tests, so I'm not at all familiar with its ins and outs.
21:39:16
aeth
Oh, there is a slight complication in that what I'm doing is an engine/framework thing, so the ultimate executable will be for a system other than the systems that I am writing.
23:54:39
Xach
the quicklisp build server has a failed hard drive. i'll get a new one in the next few days and hope to be back annoying people with build failures by the weekend.
0:21:55
akkad
ACTION hunts fruitlessly for the slime var to limit output in the repl from crippling emacs
1:11:42
DataLinkDroid
The Ada Number Words library has been moved to Bitbucket: https://bitbucket.org/EclecticSoftwareEngineer/ada-number-words.git
2:54:43
mfiano
If I make a custom "continue" restart, is there a way to register that with SLIME as the default for when 'c' is pressed?
4:43:22
asarch
I do: (defclass point () (....)) and then (defgeneric draw (point) ...) and later (defmethod draw ((point p1)) (...)) but I get "There is no class named COMMON-LISP-USER::P1".
4:45:06
asarch
As far I understand, defgeneric functions are like "templates" which I can "define" with defmethod
4:45:27
asarch
(From this: http://www.gigamonkeys.com/book/object-reorientation-generic-functions.html)
4:50:54
jackdaniel
usually error messages are quite informative, in this case it told you, that there is no class "p1" – skimming where did you put this symbol would indicate the problem
4:51:56
asarch
How would you do (from C++): class point {int x, y, z; ... }; class rect {point p1, p2; ...}; (the "point p1, p2;" part)?
4:56:03
jackdaniel
if you talk about having class instances as members of another class, you have it without any declarations
4:56:22
jackdaniel
you may add :type initarg to slot definition, but there is no guarantee it will be enforced
4:56:56
minion
asarch: please look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
4:57:48
jackdaniel
loke: it certainly did not on 1.4.1 version, because I needed defclass* for that (to increase the safety level locally)
4:58:42
jackdaniel
asarch: slot (like variable names) doesn't have a type, it just stores a reference to the variable (which is typed)
4:59:30
jackdaniel
so (defclass rect () ((p1 :initform (make-point 0 0)) (p2 :initform (make-point 1 1)))) is a class having by default two points
4:59:51
loke
asarch: As for your question, you'd create a rect class like so: (defclass rect () ((p1 ...) (p2 ...))
4:59:55
jackdaniel
but you can do (setf (slot-value rect 'p1) 'boom) and you won't have a point in one of the slots
5:00:31
jackdaniel
ACTION leaves asarch in more konwledgeble hands, needs to take a shower (just finished morning excercie)
5:07:05
loke
(defclass rect () ((p1 :initform (make-instance 'point)) (p2 :initform (make-instance 'point))))
5:07:36
loke
then you can add :READER arguments to each point, meaning that you can expose the reader function, but no accessor/writer.
5:13:02
asarch
If you can supply the reader and the accessor, what is the point of the defmethod functions?
5:13:49
loke
asarch: readers and accessors are just a quick way to generate the appropriate methods/gneric functions for you
5:15:00
loke
(defclass foo () ((x))) (defgeneric foo/x (obj)) (defmethod foo/x ((obj foo)) (slot-value obj 'x))
5:19:43
asarch
If I have ":accessor get_x", how could I access to it from: (defparameter *p1* (make-instance 'point :x 1 :y 2 :z 3))?
5:22:19
loke
(let ((a (make-instance 'foo))) #|set the value|# (setf (foo/x a) 'new-value) #|print the value|# (print (foo/x a)))
5:27:31
asarch
This girl was my inspiration to learn Lisp. Now she is sick: https://www.youtube.com/watch?v=gS1DbvHHVH0
5:46:02
asarch
If I have (defgeneric draw (point) ...) and then (defmethod draw (p1 point) ...) and (defmethod draw (p2 point) ...), how can I specify which one (p1 or p2) version of draw I want to use?
5:47:24
jackdaniel
if you want two distinct point classes which are drawn differently, you need to create them and specialize on them
5:48:03
jackdaniel
(defclass p1 (point) (…)) (defclass p2 (point) (…)) (defmethod draw ((p p1)) …) (defmethod draw ((p p2)) …)
6:02:07
asarch
I guess that, by default, all projects stored there now are property of Microsoft :-(
6:02:09
jackdaniel
I'm certain many people heard about that, but it seems a bit offtopic, hence it belongs to #lispcafe
6:08:39
jackdaniel
one way to do that is: (find-class 'foo), PPM on it in slime, select inspect, go to "SLOTS" slot of the class and inspect individual slot
6:09:50
jackdaniel
I'm sure my question got missed in a wall of text – did you read the page in the spec about "documentation" function?
6:10:38
didi
How do I copy the intelligent way structures are printed, using my own :print-object? i.e. I want to open a line whenever I print to a too high column.
6:14:05
asarch
No, I didn't. I just was wondering the Lisp way to access the documentation for the "point.x" slot
6:16:21
jackdaniel
why didn't you? this is a way you look up things by yourself (without depending on others)
6:17:26
jackdaniel
as a bonus point trying to look things up first saves you from creating (hopefully misleading) impression, that you value your time more than person's who you ask for help
6:17:29
asarch
I thought there was another easy way other than: https://stackoverflow.com/questions/21367083/how-do-i-access-the-documentation-string-of-a-slot-of-a-defclass-in-common-lisp
6:20:07
jackdaniel
sure. if you look for something, it is a good idea to type function name in l1sp.org and see what comes up