freenode/#lisp - IRC Chatlog
Search
23:12:02
aeth
I have two styles: inside game loop and outside game loop. Only the former cares about avoiding consing.
23:12:26
aeth
I should probably update my CONTRIBUTING.md to explain this, although it's not like anyone contributes.
23:13:47
Shinmera
rumbler31: if I remember correctly doesn't work at all on OS X, has a broken, unmovable, borderless, fixed-size window on Windows.
23:14:43
Shinmera
jasom: if I remember correctly the GC shouldn't trigger unless there's pressure anyway, right?
23:39:10
aeth
I added an explanation of my no-consing style to my CONTRIBUTING.md: https://gitlab.com/zombie-raptor/zombie-raptor/blob/5e0f01a21cd1b3359925f726eddff9237f02d3ff/CONTRIBUTING.md#consing-heap-allocations
23:59:44
gendl
Hi, is there something which works similar to mapcan, but collects the results into a string instead of a list? (where the lambda function would return a string).
0:07:52
phoe
if you want longer lists, then go for a custom concatenator whom you feed a list of strings, which makes a fresh string of length (reduce #'+ strings :key #'length) and then copy-seqs each string into its respective place inside the result string.
0:18:38
borei
i'm implementing basic linear algebra library, was working on the matricies arithmetic operations - like '+', '-', multiplication by number, but COMMON-LISP package already has that operation defined as ordinary functions, does it mean that i can't use above operation normally like for example in C++ ? without package prefix like cl:+ ?
0:32:11
borei
seems like best approach would be introduction of alphanumerical functions names like - add, subtract, mult, divide etc
0:44:11
Xach
borei: "shadow" in the lisp sense means what happens when you use a package but don't want to use it all
1:02:02
jasom
Shinmera: all I know is that whatever heuristic sbcl uses for invoking the GC doesn't usually do what I want. I typically invoke the GC manually
1:18:57
aeth
borei: If you're writing a linear algebra library and you want generic arithemtic operators, you probably want to use specialization-store by pillton instead of writing your own macros. https://github.com/markcox80/specialization-store/
1:20:03
aeth
You *might* be able to use it to still call cl:+ for types that cl:+ supports, with most of the work done for you.
1:21:12
aeth
specialization-store basically lets you define functions that work in (roughly) the same way as the built-in CL functions that are generic over sequences or numbers. Runtime dispatch on unknown types, but more efficient code if the types are known.
1:24:14
aeth
(This only happens when inline, but if you want a middle ground for more complex functions that probably shouldn't be inline, you could define functions that are called by inline specializations.)
1:26:32
aeth
(And you'd probably want to wrap that function call in (the foo-type ...) if the return type is known)
1:28:54
aeth
(Actually, it'd be great if specialization-store had something like :inline-function-call that did this automatically.)
1:29:11
ebrasca
No applicable methods to generic function #<Standard-Generic-Function PARSE-NAMESTRING-USING-HOST 400000002539> (PARSE-NAMESTRING-USING-HOST) when called with (#<Mezzano.Fat32-File-System::Fat32-Host 400001E51469> ">Fonts>LICENSE" NIL).
1:31:43
Bike
parse-namestring-using-host is a generic function, and it doesn't have any methods that would fit the classes of those objects.
1:35:23
aeth
Bike: Is it possible to write hygienic macros in CL without any libraries? If not, is it possible to write hygienic macros in CL with introspect-environment? Or is there some vital information missing? https://github.com/Bike/introspect-environment
1:35:43
aeth
The main thing I know about hygienic macros is that they require knowledge of the environment.
1:36:21
Bike
not something i care about, but maybe see https://pdfs.semanticscholar.org/8b69/c81fff9a5ecebdd0a5839536eb7d716d8b5b.pdf
1:47:21
aeth
Here's why: I think I could actually produce faster CL code by generating CL code from CL code since cl-cl would be able to analyze the whole program and essentially automatically apply little optimization tricks.
1:58:09
asarch
"Today, I want to use CLISP instead of SBCL" <- Is there any way to start SLIME with a different Lisp?
2:03:46
sigjuice
asarch: the Run Lisp: prompt in the minibuffer should also have history, accessible by <up>/<down>
2:10:20
sigjuice
This is also super convenient for trying out a different version of an SBCL binary release. There is no need to "install" anything. C-u M-x slime ~/sbcl-1.4.3-x86-linux/run-sbcl.sh RET
2:41:44
sigjuice
Also leaves behind a *slime-events* buffer. C-h f slime-quit-lisp RET says "Quit lisp, kill the inferior process and associated buffers.".
3:43:52
ebrasca
jmercouris: Probably not used as primary os , but I can start mezzano in my PC bare metal.
4:55:16
aeth
Is it possible to use static-vectors (which appears to be terribly documented) to allocate a big chunk of memory and use a subset of it? This appears to be very possible in C: static-vector-pointer has an offset parameter, which is either in bits or bytes (again, terrible documentation... I'm guessing bytes?) so the byte size given in cffi:foreign-type-size definitely can work there.
4:57:53
aeth
(Although it looks like making an offset pointer appears to be a complicated, consing process)
5:02:38
aeth
So one possibility would be to patch it to make it work in general, but another possibility is to just work with offsets.
5:03:32
aeth
I think an issue with working with a range, though, is that the function could bounds check each aref, which could become expensive for a large range (e.g. 16)
5:08:15
aeth
At least in the SBCL I am on, not only does it have an INVALID-ARRAY-INDEX-ERROR for each index, it also doesn't appear to be smart enough to remove those checks automatically if I first do a manual length check
5:15:36
aeth
The function is 1253 bytes when it knows the length, so inlining is out of the question
5:22:49
aeth
that keeps the other elements of the safety, which declaring the whole function unsafe would not do
5:24:13
pillton
There are references in the book "Types and Programming Languages" by Pierce which discuss the subject of automatically removing array bound checks.
5:26:15
aeth
I guess if it's always a fixed size range only give the starting point of the range, and check that the (> (length foo) (+ start range-length))
5:39:24
aeth
because otherwise it would perform worse with global safety 0 because it forces some limited bounds checks that otherwise wouldn't be there
5:48:46
aeth
Otherwise, if the program is compiled with (safety 0) I will have accidentally introduced some safety to it
8:02:46
phoe
pillton: correct, it has a mechanism for that, you can use its functions inside macros.
8:31:19
beach
jdz: Sadly, many of the discussions here involve using Common Lisp to do unsafe things such as accessing memory directly.
8:40:52
beach
Well, since most people think Common Lisp is irrelevant as well, then one might as well use a language that is unsafe by design, rather than trying to twist an otherwise safe language into doing unsafe things.
8:51:09
p_l
beach: I'd argue that since our computational substrate doesn't provide some higher abstraction by itself, we should strive to give all the power we can while simultaneously making the easy problems trivial, hard problems easy, and insane problems doable, for the end user of the tool
8:56:14
jackdaniel
while direct memory access may be considered unsafe it is only a minor bug which may be avoided (that is a case for using language which manage memory for the programmer, I'm all for that and we have a lot of mainstream languages doing that too) - avoiding this class of problems doesn't make a language safe though
8:57:14
beach
So you are saying, Common Lisp is unsafe anyway, so we might as well go the extra mile to make it totally useless?
8:58:38
jackdaniel
what I'm saying is that trading "unsafe" language to Common Lisp is trading one "unsafe" language to another "unsafe" language, so it is not a very good argument to switch
9:00:20
jackdaniel
(for instance Java doesn't have direct memory access but many people seem to dislike it and software written in it still has bugs which lead to unsafe behavior, yet some of bloat could be mitigated with macro abstraction which it lacks)
9:01:48
p_l
beach: CL is "safer" in the default state. Essentially giving "sane defaults" while at the same time providing ways to expand *when needed*
9:02:01
otwieracz
Do you have any ideas for examples how to handle file upload properly with clack/ningle?
9:02:17
p_l
beach: someone nicely described "low-level language" as one where issues irrelevant to problem being solved are important :)
9:05:10
aeth
And I'd love not to have to use CFFI at all. If we add window, input, sound, and 3D graphics to the next version of the standard, I guess that'll get rid of a lot of reasons to use it.
9:08:42
jackdaniel
/another kind of safety improvement would be static typing which some could argue (me included) would be an overkill for CL/
9:09:45
aeth
Because CL has sequence-generic and number-generic things, declaring types for sequences/arrays and numbers makes a big difference.
9:10:10
aeth
I think the compiler can normally tell what type is expected by what functions are being used on it, although I could be wrong.
9:10:46
aeth
I do wish it was standard that type declarations checked and aren't assumed when safety != 0, though
9:11:05
jackdaniel
aeth: by static typing I don't mean declarations but rather some enforcement from the compiler to make various informations certain and available at compilation time
9:11:51
aeth
jackdaniel: It could be done, there would just need to be a way to handle functions differently.
9:12:49
aeth
fiddlerwoaroof_: pretty much, you'd just wrap a function foo with (the return-type (foo ...)) or (the (values return-type-0 return-type-1) (foo ...))
9:12:57
beach
jackdaniel: So what they do with languages that enforce static typing is to make the type system so restrictive that it severely hinders programmer productivity.
9:14:29
fiddlerwoaroof_
minion: memo for Xach: I added a new Makefile to the repository that should work without any external dependencies. Just Make -f Makefile.minimal mkapp
9:20:20
aeth
jackdaniel: I think the future is a mix between static and dynamic typing within one language
9:20:53
aeth
Languages are slowly inching their way in that direction in different ways (of course, Lisp has always had type declarations)
9:21:09
pillton
beach: The discussion I had with aeth regarding unsafe array access was to eliminate redundant index checks.
9:21:52
Shinmera
beach: I don't /want/ to do unsafe stuff, but I do want to get things done. Sometimes getting things done requires doing unsafe stuff. The benefit is that others won't have to anymore once someone has made a library that does it for them.
9:21:57
aeth
Ideally I can do one check before tons of arefs instead of one check on every aref. Very niche situation to need so many arefs, pretty much just matrix*
9:23:24
Shinmera
jackdaniel: In actuality tech is moving more like a dry cleaner. The same stuff being done over and over.
9:24:05
beach
Shinmera: I totally agree. Stuff like that should be isolated behind some Common Lisp abstraction layer. The reason I uttered something in the first place, is that the discussions here are disproportionately about unsafe stuff, suggesting that not only do we hide stuff behind abstractions, but many applications programmers do it as a normal part of the application.
9:24:13
p_l
language standards take time, and just for graphics in one API family there were significant changes since 2000. Let's see, around 5 big changes?
9:24:16
jackdaniel
Shinmera: if it were just that. as an example: websockets are build on top of ton of abstractions, which when peeked at the bottom is build on top of sockets
9:24:59
pillton
beach: Ok. I don't really classify this problem as wanting to make CL programs unsafe.
9:25:01
aeth
beach: It might just be because the FFI stuff is harder and less obvious than native Lisp stuff
9:25:20
beach
I am also very surprised that we still continue to claim that some features must be IN THE STANDARD in order to be useful, even though many people use languages without any standard whatsoever, and many others use libraries that are not part of the standard of the programming language they have chosen to use.
9:26:08
p_l
beach: true. Personally, I'd rather see more cooperation on the CDR front, as essentially "enshrining" common library code
9:27:01
aeth
p_l: If SBCL, CCL, and ECL developers can agree on some language extension (CDR or otherwise), it will reach most users, at least in #lisp
9:27:13
aeth
But if SBCL, CCL, and ECL developers ignore it, then it probably won't reach too many people
9:27:42
aeth
SBCL, CCl, ECL, ABCL, CLISP, CMUCL, MKCL, Clasp, and Mezzano are the only living FOSS implementations I could find.
9:28:06
p_l
aeth: I think a bunch of people would have to band to work on implementation of such extensions, because frankly speaking I think current set of developers already has enough on their plate
9:29:34
aeth
MKCL is the only one I can't access through Roswell to run tests on. Well, I can't access Clasp, either, because it has a compilation error, but I can't see that compilation error from Roswell, I just see a Lisp stack trace saying the subprocess make failed
9:30:56
jackdaniel
and roswell has more issues with its abstraction, it was impossible for me to add hand-compiled implementation to it (even if it was sbcl)
9:31:01
aeth
I don't use Roswell to get access of CL in general, I use it to get access of CLs that would be hard to get access to manually.
9:31:53
aeth
p_l: that would help... what really is needed in general is some way to run tests on SBCL, CCL, ECL, ABCL, CLISP, CMUCL, and Clasp.
9:34:35
aeth
There might be an alternative that does SLIME + testing, I'd love to know, I'd consider using it instead if it's more stable
9:35:36
Cymew
A community vote system really would be a nice thing to have, integrated in ql and in github.
9:37:35
aeth
p_l: and, yeah, it would have to take a lot of coordination (and perhaps one person who knows the internals of several implementations) to get some extensions
9:38:31
Cymew
aeth: "This system is good and alive -> 5 stars" or "This system is not maintained -> 1 star".
9:39:34
Cymew
I actually started to read the quicklisp code to figure out how to add features to it, then a paying job came around...
9:39:53
aeth
I would say with the majority of libraries I have to read the code because there's essentially 0 documentation
9:40:11
Cymew
aeth: I think the exact details could be discussed, but yes I agree that is very important.
9:41:02
aeth
Rating based on documentation would be tricky, though, because do you reset it if it adds documentation?
9:41:08
jackdaniel
that sounds like a way for people who don't do to say people who do what to do ;-)
9:41:10
beach
Cymew: I think a voting system is an excellent idea. That's the main problem with finding something appropriate, namely knowing the opinions of others.
9:42:09
aeth
jackdaniel: but if there's a 5-star library with 1-star documentation, that gives someone looking for something to do a good suggestion of what they can do
9:42:27
aeth
I don't think people are going to reject documentation patches unless they're incorrect
9:45:37
aeth
On the subject of documentation, how many public classes have :documentation filled out?
9:47:34
Shinmera
ACTION can't wait for the inevitable drama of people getting upset over their libraries getting low ratings
9:48:55
Shinmera
So you won't find (:documentation "foo") in my code, but that doesn't mean it isn't documented
10:54:40
shaftoe
there's a voting system already... the library downloads per month or how many other libraries depend on it
10:55:16
shaftoe
you might give split-sequence 1 star, but it's one of the more heavily depended on and downloaded libs
10:58:00
shaftoe
one example where a popularity/rating system would be handy, was with graph libraries... there's at least 3 on quicklisp with various licenses and featuresets
11:04:46
shaftoe
likewise, updated for 2018 comparison articles would be good material for any aspiring lisp blogger
11:06:11
Shinmera
Benchmarking is the same problem in any language. The tricky bit is finding representative samples.
11:06:51
ebzzry
In SLIME, is there a way to muffle the warnings caused by `sb-ext:*on-package-variance*`