freenode/#lisp - IRC Chatlog
Search
23:48:02
sea
Why does it do that in one case and not the other? What's the behavior of 'being the elements of' supposed to be, and 'across'?
23:50:34
pierpa
nobody can tell you why "being the elements" is slow since "being the elements" is not CL. It must be an extension of the implementation you are using.
23:51:20
pillton
sea: It is defined here http://www.doc.gold.ac.uk/~mas01cr/papers/ilc2007/sequences-20070301.pdf.
23:52:06
aeth
So it's the sequence-generic version, but unlike most sequence-generic things it doesn't un-generic when the type is known
23:53:24
jack_rabbit
Is there another free CL implementation out there that works well aside from SBCL?
23:56:34
aeth
CCL has a superior GC than SBCL and is fairly comparable to performance in SBCL. ECL apparently is better on some niche areas like bignum performance.
23:57:01
aeth
SBCL, though, in general is pretty nice. It's usually the fastest, the most helpful, and the most feature-rich.
23:57:31
aeth
You could definitely beat SBCL in performance, though, if you really tried. There's definitely lots of room for improvement all over the place.
23:59:10
aeth
SBCL is pretty fast, but its optimizations don't really compare to some of the ridiculous optimizations compilers with big budgets can do these days.
23:59:31
jack_rabbit
pierpa, ccl gave me an error compiling some quicklisp library. I assume that is the library's fault. clisp crashes trying to load swank, which I assume is clisp's fault.
0:00:08
aeth
Ime, libraries will usually work on CCL, often work on ECL, and give issues with just about any other implementation, especially 32-bit ones.
0:01:01
aeth
It's hard to not write for SBCL, though. There are so many ways to figure out what's going on in SBCL.
0:01:16
aeth
I'm pretty sure of how my code behaves in SBCL, at least at the defaut optimization levels.
0:02:28
jack_rabbit
The library is static-vectors, and the error is: "Foreign function not found: X86-LINUX64::|memset|"
0:02:48
aeth
Really? static-vectors works for me in CCL. It gives me issues in ECL, though, even though it's supposed to support it.
0:05:26
aeth
But that does seem to match my experience. Things that use CFFI are the most problematic.
0:10:27
aeth
It's unfortunate that unless CLX works for you there's no way to avoid at least some foreign code.
0:31:57
pillton
White_Flame: I'm not sure what problem static-vectors solves. Do some implementations invoke the GC during foreign function calls?
0:32:29
White_Flame
you can't pass a pointer to foreign code if it could be moved at any time in the future
0:35:11
White_Flame
and in a lot of I/O cases, including graphics, the call does not synchronously encapsulate all access to the buffer you give it
0:43:52
aeth
pillton: Without static-vectors, you're either going to be working with a foreign array through stuff like mem-aref (not a pleasant experience) or you're going to copy from a CL-native vector into a foreign array at some point (which can kill your performance).
0:44:49
aeth
With static vectors, there's no need to do either, as long as you're in control of the allocation and not the foreign library.
0:46:23
aeth
The downside is that you're going to either have to use with-static-vector/with-static-vectors or you'll have to explicitly call free-static-vector in your own unwind-protect at some point.
0:47:15
aeth
I'm guessing you also can't use (declare (dynamic-extent foo)) on a static-vector to stack allocate, so that's another restriction.
0:48:12
aeth
Another downsize is that it seems to fool SBCL's type inference, so I have to (declare (whatever-type foo)) after with-static-vector or a let initializing the static-vector in order to get efficient sequence code, which is unnecessary with a normal vector.
2:20:45
jack_rabbit
Can anyone with CCL execute (read-from-string "#_memset") and let me know what happens?
2:38:14
jack_rabbit
huh. I didn't even need to rebuild. Just used the download from the clozure.com site rather than my distro repo.
3:39:19
aeth
Everything on QL has to run on at least two implementations, so supporting #1 and #2 by popularity is pretty much the absolute minimum.
6:52:20
TMA
jack_rabbit: (read-from-string "#_memset") => (values 'WIN32::|memset| 8) or (values 'WIN64::|memset| 8)
7:20:51
rme
TMA: Support for running the 32-bit lisp on 64-bit Windows was added (by yours truly) in ccl 1.7.
7:48:32
TMA
rme: oh, I never knew. I have an old 1.6 sitting in a directory transferred from an old 32-bit XP system and I tried to run it.
8:10:30
TMA
schweers: I do not. I ran XP in 32 bit mode, I run everything in 64 bits since. I would return to 32-bit mode on low memory devices like low-end netbooks though.
8:11:56
schweers
okay, that explains. I was wondering how windows 10 would perform with a maximum memory of ... 3GB? I know that 4GB or close to that are possible, but if I remember correctly, windows has a weird limit on 32 bit systems.
8:12:43
schweers
It sure is, but then again, I was thinking about running windows 10, which -- I presume -- needs lots of memory just to boot.
8:13:54
flip214
TMA: but having more registers in 64bit-mode might mean less memory needs (eg. for temporary data) and faster computation as well
8:19:13
TMA
flip214: that's true for arithmetic-intensive workloads. I guess most of what I do is data traversing, not number crunching
8:32:35
aeth
The specifics of Lisp complicate 32v64 bit further. e.g. larger fixnums and unboxed single-floats
8:36:38
jack_rabbit
schweers, windows 32-bit (IIRC) reserved ~1GB of address space for kernel stuff, so only 3GB available to user programs.
8:37:26
schweers
I thought there was something else, but I may be wrong. Not my main platform anyway ;)
9:00:49
flip214
TMA: still, being able to hold much more data (eg. pointers!) in CPU registers might help, not only when doing arithmetic.
9:56:12
hlavaty
hi i have a fileSystems."/var/lib/foo" entry in configuration.nix. the disk failed and now on boot the machine goes into rescue mode. how do i disable the disk so that the machine starts normally again and i can ssh in an upload and activate new configuration?
10:15:09
TMA
flip214: I refuse to take position on that matter when I have no data. I am saying I can pack twice as many conses into the same amount of memory. I do not have performance data to tell, whether it will be faster. the execution speed is nowadays usually severely constrained by the memory access time (that's why beach's generic function dispatch scheme that removes one memory access is so awesome)
10:16:53
TMA
flip214: so I guess, it might be faster for some workloads. your guess of the registers helping might be better or worse than mine. without data there is nothing we can do to tell them appart
10:51:39
makomo
how can i define a function in a different package if i want to do it within a file which has a different package in (in-package ...) on the top?
10:52:04
makomo
i tried using (in-package) right before the defun (and then again to switch back). i've also tried rebinding *package*. none worked
10:53:30
Shinmera
If the symbol is already exported from the other package you can also do foo:bar, of course.
10:55:30
Bike
i don't know how slime decides a package to read code in, it might just look for the first in-package in the file
10:56:15
Shinmera
I'm gonna go ahead and guess it errors because of something that isn't related to the name of the function
10:57:54
Bike
as in, (in-package #:foo) (defun bar () 'foo) (in-package #:foo2) (defun bar () 'foo2), C-c C-c the last, get (foo2::bar) => foo2::foo2
11:01:02
Shinmera
The reader reads only complete forms. By the time it's evaluated, and the package switch would happen, it's already read.
11:01:09
makomo
i remember the same issue i had with quicklisp, loading a library in the same form and using it, but that made sense because reading happens before evaluation
11:03:15
Shinmera
(in-package foo) (progn (in-package bar) (defun baz ..)) is read as: (cl-user::in-package cl-user::foo) (foo::progn (foo::in-package foo::bar) (foo::defun foo::baz ..))
11:04:32
makomo
would there still be a way to create a macro which would temporarily switch packages, evaluate a body and then switch back?
11:05:01
Bike
no, because you read before evaluating/compiling, and macroexpansion happens during evaluation/compilation
11:05:22
Shinmera
A macro could do nasty things with trying to guess what the read form of a symbol was and translate it according to that
11:05:53
Bike
for the purpose of this question, i'm assuming that evil magic is prohibited by the ancient treaty
11:11:11
makomo
so the way DEFUN knows in which package to define the function is by the symbol that names the function? i.e. it doesn't use *package* directly (but this is used by the reader when interning symbols then?)?
11:12:42
Bike
(defun name lambda-list ...body...) expands into `(setf (fdefinition ',name) (lambda ,lambda-list ,@body))
11:16:51
makomo
an unrelated question. i made this spreadsheet-like thing where the cells in the sheet can contain arbitrary lisp code as their formulas. the code gets compiled at runtime and attached to the cell, and is run whenever the cells needs to update its value
11:18:23
makomo
so any (in-package) calls within COMPILE will have no effect (assuming for the moment that somehow i could provide multiple top-level forms within COMPILE)
11:19:25
Bike
anyway, it sounds like you're arranging the compilation yourself, so surely you can just see when you've written it to READ the code
11:22:16
makomo
so if i have a macro which takes lisp code and attaches it to a cell, there's no way to make this code live inside some "cell-user" package because by the time it even gets to COMPILE it has already been READ within the current package
11:23:37
Bike
If you had a, like, graphical spreadsheet application like Excel, the user would input code into a cell or whatever, and then you'd have to READ it yourself
11:23:57
smokeink
but can't one define a symbol in the "cell-user" package that calls that code (no matter from what package) ?
11:24:44
Bike
generally, if the user is writing lisp code themselves though, as normal source, ikt's their responsibility to put it in the right package, you know?
11:25:08
makomo
it's just a toy spreadsheet thingy that we were supposed to make, but i went and made it in lisp and realized i could use anything as the cell's formula
11:26:22
makomo
that wasn't my problem (if i understood what you're saying). i only wanted the code provided within the macro to live within another package
11:26:40
makomo
so i would have a "cell-user" or "cell-user-impl" thingy which would have built-in functions for these cell formulas
11:26:59
makomo
and then you can write a macro without prefixing these built-ins with "cell-user:" constantly
11:27:45
makomo
now of course, if this was a proper application, the user would input a string of lisp and i would READ it myself, etc.
11:28:20
makomo
or perhaps it would happen within a REPL too but just within the "cell-user" package
11:31:27
makomo
another question -- how would you implement something to not allow the user to access any functions that aren't within cell-user, i.e. stop them from using malicious code as formulas for cells?
11:32:16
makomo
what is the general way stuff like this is done? is it even done? a separate lisp image?
11:32:52
smokeink
the "Reader Security" section https://letoverlambda.com/index.cl/guest/chap4.html might be of use to you
11:33:16
theemacsshibe[m]
I'd probably either scan the forms before evaluating them, or have a separate interpreter.
11:33:44
theemacsshibe[m]
Using something like secure-reader helps if you don't want evil reader macros like #.(hose-my-computer)
11:35:14
scymtym
regarding reading untrusted input securely: https://github.com/robert-strandh/Eclector is a portable, customizable reader which is slowly becoming usable as of late
11:35:26
makomo
using a separate lisp image would however break the interaction with the spreadsheet application itself?
11:39:06
smokeink
no need for a separate image, just use a separate reader or scan the forms to check if there are any blacklisted symbols in it,etc
11:42:26
mfiano
#lispgames is hosting the annual Lisp Game Jam which begins in about 10 hours. As of now there are over 100 participants this year. If anyone here wanted to participate, you still have time to sign up: https://itch.io/jam/lisp-game-jam-2018