freenode/#lisp - IRC Chatlog
Search
14:59:34
pfdietz
aeth: oni-on-ion: Waters' old COVER package will be going into quicklisp soonish. I tidied it up a bit and wrote an asd file. https://github.com/pfdietz/cover
15:56:36
jasom
pfdietz: interesting; I wonder if that could be used to write something like AFL (a tool for generating inputs to take each possible branch).
15:58:33
jasom
pfdietz: thanks! it's people like you that allow me to sit on the couch eating bon-bons all day :)
15:59:51
pfdietz
The plan is to generalize the "point" data structure there to allow subclassing and custom behaviors. For that use case, it needs checkpointing and rollback, so tests can be tracked if they increase coverage, and then the test minimized to the smallest input(s) that still increase coverage.
16:00:26
pfdietz
Current issue I have with COVER is that it doesn't play well with certain macro packages, particularly ITERATE.
16:01:57
pfdietz
The only place you need to beware of EQ is with numbers and characters. Use EQL for those. Or, in general, use EQL instead of EQ unless you want to microoptimize.
16:22:26
slightlycyborg
Hi. I am interested in the concept of dyanmically loaded lisp packages. I want to run a top level form that loads some code, uses that code, and then unloads that code so it doesn't consume ram. What is the best way to do this?
16:23:06
Bike
loading code can have arbitrary side effects, so there's no nonspecific way to undo a load.
16:24:35
slightlycyborg
Ok. I am just imagining having more code on my machines HD than I have space for in RAM. If I want to use all that code at different points in time while still keeping the same lisp process up and running, then I will have to load and unload.
17:01:05
jasom
slightlycyborg: it's unlikely to be a real issue if you're only running a single lisp process because code has gotten larger much slower than RAM has gotten cheaper. If you do run into a problem you can enforce that a loadable "unit" of code use a single package and then delete the package, which may render most of the functions and global variables loaded unreachable
17:02:53
slightlycyborg
jasom. I was contemplating a lisp machine on top of linux where there is a single lisp process and all subsequent processes are sbcl threads.
17:03:40
slightlycyborg
Ok so if fn's are unreachable then they get gc'd I guess. I didn't know how fns work. I assumed data would get gc'd since that complies with my model of a java gc
17:04:34
Shinmera
The standard does not mandate GC of any kind. In practice every implementation so far has GC of some kind, though not all GC functions.
17:52:10
jasom
slightlycyborg: of course if you have any references to the names of the functions lying around (most obvious would be actual calls to the function, but any variables with the same name would do it as well), then the functions likely wont be GC'd, and it is very implementation dependent.
17:53:45
jasom
beach: I suppose a reference counted GC wouldn't need to walk the tree, but most other GCs tend to at least occasionally walk the entire heap (even if just incrementally).
17:54:34
beach
jasom: True. I was (jokingly) referring to the fact that most GCs will in fact traverse the entire heap because they copy it.
17:55:31
jasom
beach: most lisp GCs will; mostly-copying GCs tend to be less popular in other runtimes, in favor of either compacting or even non-moving GCs.
17:56:22
White_Flame
and if course, if you go oldschool like picolisp, then every object on the heap is 2 words and fragmentation isn't an issue at all
17:57:19
beach
jasom: I was also (jokingly) making an allusion to the planned SICL GC which I think would have less of a paging problem since the global collector does not move objects around.
17:57:42
jasom
I haven't measured it, but I imagine that non-moving GCs would be more VM friendly since they wouldn't dirty pages with only old objects.
17:59:08
jasom
does sbcl at least not move very large objects? When I was playing around with a toy incremental copying GC, that was a fairly large win.
17:59:56
beach
White_Flame: Interestingly, I made an early decision with SICL that every heap allocated object is either a 2-word CONS cell, or it has a 2-word "header" which has one pointer to the class and another pointer to the "rack" (which contains all data), so I can have the advantages of a mark-and-sweep collector for the CONS cells and headers, and I use a malloc/free style allocator for the racks (Doug Lea's technique).
18:01:53
jasom
though I only read it once, and 3 is a minimum for me actually understanding technical papers
18:02:04
jcowan
Java has pluggable GC, and has just introduced a GC that does not collect garbage. It can be used to induce memory pressure.
18:04:29
jasom
hmm if you ran in x32 mode they could be immediates (totally the opposite direction you are going, but gives me a fairly useless idea).
18:04:40
beach
jasom: A rack contains at the very least a stamp and a list of slots. So an object with 1 word information would have 3 words in it.
18:09:17
beach
I am off to spend time with my (admittedly small) family. I'll be back tomorrow morning (UTC+2).
18:11:44
jcowan
Bottom Scheme, a back-burner project of mine, uses all 8 pointer tags to encode fixnums, other immediates, and pointers to compnums, vectors, pairs, bytevectors, strings, and all other (procedure, symbol, or struct). Double floats are punboxed.
19:56:15
jcowan
I've been thinking about these conversions from bitvectors to integers. It seems in order to make them work, #*111000 has to be treated as the integer 7; that is, bitvector bits are numbered big-endianly (as in array displacements), integer bits are numbered little-endianly (as in byte specs). Does that seem wrong to anyone?
20:13:59
jcowan
Yes. But the LOGBITP and BYTE functions treat integers in a little-endian way, even if the internal representation is big-endian. That is, bit 0 is 2^0, bit 1 is 2^1, etc.
20:15:01
Bike
i guess i would just think of it as bit vectors being written left to right while numbers are written write to left
20:16:07
jcowan
Just so. (In actual Arabic writing (but not Persian, which uses the Arabic script), people actually do write numbers from right to left. In Persian and Hebrew, you jump forward (rightward) for the appropriate number of digits and then write them left to right, and then jump forward again.
20:18:32
ecraven
jcowan: you mean arabic writes literal "61" for 16? that is incorrect, I think, 1 is left and 6 is right, in arabic writing
20:22:32
aeth
ecraven: I think so, too. There are also two Arabic numerals. The first are the ones in the west (west of Egypt?) that Europe eventually got. The second are distinct
20:22:48
ecraven
I actually can't think of any number system that writes least-significant-digit-leftmost (unless you count things like ancient greek boustrophedon, which is not a positional numeral system anyway)
20:23:44
anamorphic
Is there any kind of guide on what's good practice when designing an API for a CFFI'd library?
20:24:57
anamorphic
e.g. should I make it really lispy, or make it very C-ish so that it is more easilly documented by the library's own C documentation
20:25:23
ecraven
anamorphic: I usually split it, one thin layer above C, and then a better abstraction on top of it
20:25:40
ecraven
so if anyone wants to, they can import the lower-level API, but for most use cases the higher-level API is better
20:26:48
sjl
that's the approach cl-charms takes. there's a charms/low-level package with the CFFI wrappers and charms/high-level with the Lispy abstractions. I've used that approach for some other things and it works pretty well.
20:27:28
anamorphic
would it matter if the low-level thing is defined at a asdf system level or is it enought as a system with low and high level packages?
20:27:34
sjl
You can even generate the low-level package with something like SWIG if that appeals to you (I know some people don't like it though).
20:27:49
Shinmera
Generally I make a *-cffi package for direct bindings, and a * package for a "no headaches" wrapper
20:28:13
sjl
I suppose you could make them separate systems if you really wanted to. I generally don't bother and just make them two packages in one system.
20:28:41
anamorphic
ok cool. I went the way of creating a foo-cffi pacakge and a foo pacakge with some niceties
20:32:27
Shinmera
Ok to be clear: I don't think splitting systems is a good idea. I do think splitting packages is a good idea.
20:33:34
|3b|
ACTION usually intends the low-level to be used in addition to the high-level for specific bits that need higher performance or something, so both would generally be used together
20:34:09
|3b|
i probably wouldn't reject a pull request from someone that wanted to be able to load the low-level by itself, but wouldn't set it up that way to start with
20:35:20
|3b|
like in the opengl case, i could see wanting to write a separate high-level layer for gles, which would usually run on resource constrained systems so skipping normal GL wrappers would be good
20:36:49
|3b|
in general for the part about pull requests and intent, cl-opengl specifically for gles example
20:37:54
|3b|
ACTION probably wouldn't accept a pull request for gles specific systems of my non-gl libraries :)
20:49:30
pjb
jcowan: (let ((i (random 1024)) (bv (make-array 10 :element-type 'bit))) (loop for bit below (integer-length i) do (setf (aref bv bit) (if (logbitp bit i) 1 0))) (values (format nil "~B" i) bv)) #| --> "1110100101" ; #*1010010111 |#
20:50:05
pjb
jcowan: it's just a matter of convention in the binary representation of integers, and the lisp printed representation of bit-vectors.
20:50:33
pjb
jcowan: if the bit weren't in the same order, we'd have to write (setf (aref bv (- (integer-length i) bit)) …)
20:59:54
jcowan
ecraven: no, I mean that when writing "16" in Arabic text, the 6 is written before the 1, whereas in Persian/Hebrew/Latin writing, the 1 is written before the 6.
21:01:23
aeth
jcowan: Saudi currency seems to disagree with you. https://en.wikipedia.org/wiki/Saudi_riyal#/media/File:Saudi_Riyal_5th_Domination.jpg
21:02:30
aeth
also e.g. Qatari riyal (only 50 has a picture). https://en.wikipedia.org/wiki/Qatari_riyal#/media/File:50_qatari_riyal.jpg
21:45:34
jcowan
"before" is ambiguous, I meant it in the temporal rather than the spatial sense. First you write the 6, then you write the 1 to its right.
22:25:25
|3b|
if you are passing to OS, native is better. CL one might escape things oddly to maintain CL semantics
22:36:11
jmercouris
then again, there is so much to learn, I feel like I could spend at least a decade before really mastering CL
22:39:40
pjb
A decade if you put in a dedicated effort learning it. I've been doing CL for 22 years, and I'm still very light on parts, such as the MOP.
23:01:10
Petit_Dejeuner
...how many years until you become such expert who regularly uses eval and read.
23:18:11
Petit_Dejeuner
Since we're on the topic, is there anyway to control what dynamic environment #'eval sees to limit what functions it can call?
23:20:00
White_Flame
it can always use package::private in order to hit whatever dynamic variable it wants
23:21:10
White_Flame
after read and before eval, maybe you could sweep through all the symbols to try to ensure they're always white-listed. Then you also have to eliminate interning, and it might be a difficult cat-and-mouse game
23:31:07
jasom
Petit_Dejeuner: there is no way to control the environment of eval in general; if you want to have a sandbox, it's probably better to write a CL-like DSL
23:32:33
Petit_Dejeuner
This ALMOST seems right, but I need to make sure stuff like #. isn't creating leaks. https://pastebin.com/raw/gQYwVRkF
23:36:49
Petit_Dejeuner
Maybe I can change the reader so qualified (or whatever they're called) symbols don't work?
23:52:11
jasom
Petit_Dejeuner: if you change the reader so it can't get at other packages and you don't import any symbols that could allow them to intern strings, then you might be almost right.
0:17:50
jcowan
given the limited objectives of safe-read, I would think writing it from scratch (by which I mean read-char) would be not only safer but easier
0:20:27
jcowan
come to think of it, though, there is no string->number, is there? If not, you'd have to sanitize numbers and call read on them.
1:03:11
didi
What should I use for the parameter `default' of function `getf' if I want to know, for certain, that an indicator is absent?
1:06:16
drewc
didi: I use a GENSYM for that if I really care, for often, :asbent, or a similar keyword that states my intention if it is vancant.
1:08:02
didi
I am thinking of using something like (list :absent) as default, so I can test it using `eq'.
1:09:53
jcowan
The advantage of that over a pair is that it doesn't interfere with the way things are printed
1:12:05
didi
The manual mentions function `get-properties' but seems a bit overkill. Maybe it isn't.
1:48:09
asarch_
I was watching a video about how to construct a menu using CSS and the programmer wrote: ul>li*5>a[href="#"]{Item $}