freenode/#lisp - IRC Chatlog
Search
17:40:27
flip214
https://github.com/pcostanza/closer-mop says "This page is taking way too long to load."
20:23:00
HighMemoryDaemon
Can Lisp be compiled to machine code that can be ran on computers without [insert common lisp implementation] installed?
20:24:36
random-nick
HighMemoryDaemon: does that disqualify implementations that bundle themselves with your executable?
20:25:32
random-nick
even if you somehow don't use any standard functions and macros you still have the garbage collector
20:26:02
trittweiler
HighMemoryDaemon, ECL can get you binaries that simply depend on a libecl.so dynlib.
20:27:11
sjl_
depends on what you mean by "installed". If you s-l-a-d on sbcl, it can produce a single binary that doesn't need anything else on the target machine to run.
20:27:25
random-nick
HighMemoryDaemon: SBCL can save a full image of the running system as an executable
20:27:46
sjl_
That binary will happen to include SBCL itself, so whether you consider that to be "installing" SBCL on the target machine depends on your definition of installing, I guess.
20:27:55
aeth
As far as standalone binaries, SBCL wil be the fastest, but the largest, so it depends on what you want. Probably unsuitable for a tiny script, but probably most suitable for a game or large application.
20:30:58
earl-ducaine
HighMemoryDaemon: For the sake of completeness: the degree of local support needed for compiled code is unspecified, i.e. implementation dependant and can be , and for modern common ilsp often is, zero
20:31:47
HighMemoryDaemon
Just compiled a console hello world program in SBCL. 42 megabytes in total.
20:33:31
aeth
On the other hand, even graphical applications are much larger than 42 MB these days. Bloat.
20:33:51
pjb
HighMemoryDaemon: with ecl, you can also generate a static library libecl.a, and link your program statically, so the executable doesn't rely on a shared library to be pre-installed.
20:34:35
sjl_
HighMemoryDaemon: Right, that includes SBCL itself. e.g. if your hello world app crashes you'll get the full debugger and Lisp environment.
20:36:20
marvin4
is there a way to avoid packing sbcl together with every executable? or do language spec require full enivornment available at runtime
20:37:49
pjb
marvin4: yes, instead of using sbcl, use another CL implementation. Then sbcl won't include itself with the executable.
20:38:36
HighMemoryDaemon
What are the most common uses of Lisp in the modern day? GUI applications, web servers, AI, ..? I have a feeling that with a lot of uses you don't need to worry about compiling to native machine code.
20:39:27
Bike
compiling to native code is usually useful. compiling gives you static error checks, and machine code is generally faster than interpretation.
20:39:52
Bike
it is a general purpose programming language. do people ask what java is "for"? it's such a weird question to me
20:40:02
aeth
HighMemoryDaemon: Two uses are common enough for their own channels: #lispgames and #lispweb
20:40:34
aeth
Lisp was also traditionally very large in AI, but it was mainly used for old school AI, not machine learning, so relatively speaking it's probably much smaller there than it was.
20:42:04
earl-ducaine
HighMemoryDaemon: If you're concerned about the size there are various compression schemes you could lookat.
20:42:23
Bike
i think sbcl already incorporates several, so it might be hard to squeeze it much more
20:42:46
earl-ducaine
HighMemoryDaemon: A quick export shows that gzip will compress it into a 12M file.
20:43:59
earl-ducaine
HighMemoryDaemon: (sbcl) Presumably the executable has various sparse memorry areas that are simply read into their location when the executable is loaded.
20:48:41
HighMemoryDaemon
earl-ducaine: That's cool. With Gzip are you just talking about reducing the download size for the end user or is their a way to actually zip an executable that unzips on launch?
20:49:19
aeth
HighMemoryDaemon: here's a bunch of them: https://dto.itch.io/ https://itch.io/jam/lisp-game-jam-2018/results
20:58:14
earl-ducaine
HighMemoryDaemon: Launch plain SBCL from bash shell and past this lisp code https://gist.github.com/earl-ducaine/c1a59ab3d9384d318fbe715abbff0eb6 into the terminal
21:15:16
HighMemoryDaemon
earl-ducaine: One thing I'm confused about though is the ":save-lisp-and-die" that is attached to the function name. I'm not so confused as to what it does but what is that syntax feature of Lisp called? I haven't seen that before.
21:15:52
sjl_
HighMemoryDaemon: save-lisp-and-die is the name of the function. sb-ext is the package
21:17:35
sjl_
you could also (use-package :sb-ext) first, and then just use (save-lisp-and-die ...) but that would import a ton of other stuff you don't need, so usually people just use the package-qualified name for stuff like that.
21:23:08
HighMemoryDaemon
Using the "time" command on Linux, I can see that a compiled+gzipped "hello lisp" app takes 0.15s to execute. The compiled+not-compressed "hello lisp" app takes 0.02s to execute.
21:25:09
sjl_
right, it takes time to decompress it first. it's a tradeoff between disk space and startup time
21:32:35
scymtym
there is also the minor difference that multiple SBCL processes cannot share as many memory pages when compression is used
21:48:59
drduck
Howdy. What's an actively maintained library for common-lisp that's similar to hibernate for java, in that it's an ORM mapping tool?
21:52:38
_death
personally I don't use ORMs, but I think an actively maintained one is https://github.com/fukamachi/mito
23:15:31
aeth
Any list that lists GCL among its recommendations is so incredibly uncurated that I wouldn't trust anything on it.
23:16:34
akkad
and it's list gets out of date often, to show you inperfections that it is done by hand.
23:17:05
aeth
For that list to have gotten out of date and have GCL on it, it would have had to be written in 2005 or so.
23:46:40
jasom
We should have a "If you say you are using X on #lisp, we won't laugh you out of the channel" curated list.
23:50:14
aeth
If you're going to recommend a bunch of things in the same category, you should be opinionated and not just list them alphabetically. e.g. I'd recommend trying SBCL, CCL, and ECL in that order. awesome-cl puts SBCL last because it's alphabetical and ultra-niche ABCL first!
23:58:17
akkad
but cl has an image issue, and this goes a long ways to teach potential developers how cool it is
0:01:51
p_l
akkad: when GCL was making doornails look lively, XEmacs was still something I would suggest over Emacs :)
0:02:05
aeth
akkad: It's not good for the image of CL (a dead implementation that's barely supported by the ecosystem does not make a good first impression) or for the security of CL programmers (SBCL or CCL would patch a security issue next month... GCL would patch it in 5 years maybe?) to recommend inactive implementations.
0:04:11
aeth
It's a lot harder to determine things about commercial implementations. It's likely they're not in the ASDF+Quicklisp ecosystem with the rest of us and if there's some issue it *could* still be patched quickly through a commercial support contract even if there's one user.
0:08:20
aeth
aeth-lisp is also alive if someone is willing to pay $500,000 a year or whatever. Even if it has basically 0 presence anywhere else.
0:11:20
aeth
Josh_2: It's a lot harder than it looks. I can't just "git clone https://github.com/sbcl/sbcl.git" because I also have to find-and-replace all instances of the strings "SBCL", "sbcl", "Steel Bank Common Lisp", etc., except on the relevant copyright/contributor pages, etc.
0:43:13
p_l
aeth: SCL is kinda dead, moxcl is probably alive but isn't a full implementation, Liquid, Franz and Genera are in similar state of undead (you can still get support), I actually don't know about Interlisp because it feels at times that the owners forgot there was a language implementation under the program they were selling
0:45:15
p_l
(I'm ignoring implementations that died back on DOS or were so obscure good luck finding mentions, let alone software or parts)
1:42:12
aeth
Is there a way to define a function with a defclass given some custom metaclass? It's very trivial with a defclass* macro, but I'm not sure how it can be done in the MOP. (setf (fdefinition foo) (lambda (...) ...)) in ensure-class-using-class :before?
2:24:46
Bike
:before method sounds right to me. you don't get to control the macroexpansion to put a defun in there, if that's what you're hoping for.
2:26:36
equwal
I'm not sure I understand what aeth means either. Are you talking about polymorphism?
2:31:21
Bike
i think aeth just wants a defclass of their custom metaclass to define more functions than just accessors.
2:33:03
aeth
I have it, but it's not particularly pretty. I can't just (setf (fdefinition foo) (lambda (...) ...)) because I have macroish things I want to do so I have to (setf (fdefinition foo) (eval `(lambda (...) ...)))
2:33:21
aeth
And I also have to wrap it in an eval-when in CCL because of course CCL is picky about things and wants extra eval-whens
2:34:15
aeth
Bike: https://gitlab.com/zombie-raptor/zombie-raptor/commit/036af6464f6517c13bed17416c7317391d733db4
2:35:24
aeth
I now have the source of the shader class definition itself down to just: https://gitlab.com/zombie-raptor/zombie-raptor/blob/036af6464f6517c13bed17416c7317391d733db4/data/shader.lisp#L89-146
2:36:13
aeth
I guess the next step is seeing if I can generate the check-types in the setter automatically and perhaps doing the constructor type checks (via the generated function) automatically
2:37:30
Bike
but let me see if i have this right- you define a global function for every slot that takes an instance and checks that slot?
2:39:14
aeth
Bike: I define a check-foo that checks the type of every slot that has a reader. This can be called separately since CLOS objects can't really be trusted even with the constructor and setters having type checks.
2:40:03
aeth
I also add :before to every writer to ensure that the types are checked. Atm, I do this manually, but it probably won't be that hard to do it automatically now that I have everything set up.
2:40:27
Bike
you could just define a :before on (setf slot-value-using-class) since you have your own slotd class anyway.
2:40:58
aeth
Bike: And that would cover with-accessors, with-slots, and the constructor all together?
2:55:41
equwal
After several years of lisping this CLOS stuff still confuses me a great deal. In one ear and out the other. Hopefully it will click sometime.
2:58:00
equwal
I just have a hard time remembering all the details, and knowing when it is better than the functional paradigm I am accustomed to.
2:58:51
equwal
Do you recommend any resources? I've read Peter Siebel's book and Graham's On Lisp sections on CLOS, but I don't really get still.
3:11:11
equwal
I think the main problem for me is that CLOS is so much bigger than any object orientation I have tried to do before. 'Thing's huge.
3:12:13
aeth
And it's just underspecified enough for there to be annoying incompatibilities between implementations.
3:13:06
xsperry
what is your opinion of lisp-1 vs lisp-2 as far as functional programming go? and is there a way to reduce boilerplate in lisp-2 when doing that style of programming with some smart use of macros?
3:16:01
equwal
Well I like doing things like this ((lambda (x) x) 1) in scheme, whereas in lisp you must do (funcall #'(lambda (x) x) 1) which is not as cool.
3:17:14
aeth
symbol-macrolet <http://www.lispworks.com/documentation/HyperSpec/Body/s_symbol.htm> like in with-accessors <http://www.lispworks.com/documentation/HyperSpec/Body/m_w_acce.htm>
3:17:30
aeth
it won't help you with that particular case (although you *can* drop the #') but it can help when funcalling named things
3:17:32
equwal
But you get to do things like (define list (list) list) and have it work, whereas (define list (lst) lst) is not so good. I'm not really sure, but I know I've seen very good discussion on both sides.
3:19:31
xsperry
no. just calling a function stored in f variable, and then calling the function it returned
3:21:40
equwal
Yeah partial application is a mess. I'm not sure where I stand on the lisp-1 lisp-2, definitely pluses to both sides.
3:23:00
stacksmith
Good morning. Apologies for slightly off-topic question.. Can someone help me out with roswell? I royally screwed up my environment by deleting an old version of sbcl-bin...
3:24:07
xsperry
I only played with clojure briefly, but if f is a variable that stores a function that returns a function, I am pretty sure what I typed above will work.. ie ((f 10) 20)
3:25:16
equwal
Right, but you can make the function f like (partial f 10) out of a function (defun f2 (x y) something)
3:26:13
equwal
So you could do (funcall (partial f 10) 20) or whatever, which is marginally more readable I guess.
3:27:33
xsperry
actually I guess what I'd really like is do it in CL like haskell does it. where this would be just f 10 20 (since (defun f2 (x y) ..) equivalent in haskell is really just a function that takes one argument and returns a function that takes another)
3:28:13
xsperry
which would be ((f 10) 20) in lisp syntax, even if we defined f as (defun f (x y) ..)
3:28:15
xsperry
which would be ((f 10) 20) in lisp syntax, even if we defined f as (defun f (x y) ..)
3:28:35
equwal
Yes, I know exactly what you mean. You don't want to have to (defun f (x) (lambda (y) (+ x y)))
3:33:38
aeth
Bike: "you could just define a :before on (setf slot-value-using-class)" I can't get that to work. It doesn't seem to be called.
3:34:31
aeth
The only thing that has any noticable effect at all is (defmethod slot-value-using-class :before (class object slot) ...) which gives an SBCL error, which makes sense because I'm probably redefining some built-in.
3:35:05
aeth
loke: I'm trying (defmethod (setf slot-value-using-class) :before (new-value class object (slot slot-with-checked-type)) ...)
3:36:53
loke
aeth: I'm pretty sure you are notpicking up slot-value-using-class from the correct package (which is why you need to use SB-MOP, or load closer-mop so that you get a standard interface to it)
3:38:00
aeth
loke: Yes, and if I M-. it it'll take me to SBCL's definition (or it would if it had a valid builddir)
3:38:31
aeth
(defmethod (setf slot-value-using-class) :before (new-value class object (slot slot-with-checked-type)) (format t "~S ~S~%" new-value (slot-definition-checked-type slot)) (check-type new-value integer))
3:38:43
aeth
That should have two visible side effects. It should print and it should almost always fail
3:40:56
equwal
I whipped up some partial application last month and just uncovered that file, I'll just dump the code here. The function we are looking at is called partial. This is why I brought up this "solution," which really solves a different problem then "how can we write (funcall (funcall ...) better, and instead solves the problem "how can we take a two argument function and make it partially applied to one argument."
3:41:25
equwal
(eval `(partial-aux ,func ,@args))) ;; Example call: (funcall (partial #'subst 1 2) '(1 2 3)) --> (1 1 3)
3:45:31
xsperry
equwal thanks a lot for the effort! but I was thinking of tackling this from the other way around.. from the call site. so I can use all the functions that are available.
3:47:03
xsperry
(defun f (x y) .. ) to turn (f 10) into (lambda (x) (f 10 x)). and also to make curried functions callable like this ((f 10) 20), not like this (funcall (f 10) 20)
3:57:50
aeth
Bike, loke: This is what I have now. https://gitlab.com/zombie-raptor/zombie-raptor/blob/1e63646bb9af1d00223b9130868274915398b62a/util/util.lisp#L445-491
3:59:20
aeth
e.g. I can set the name to 42. (let ((s (make-instance 'shader :name :hello :stage :fragment-shader :source ""))) (setf (zombie-raptor/data/shader::name s) 42) (zombie-raptor/data/shader::name s))
4:00:05
xsperry
Bike interesting! I'll play with your and equal's code. I am curious, and I must be missing something, but why would the other thing require silly level of hacks? ((x 10) 20) is only legal in CL if x is lambda, as far as I know. so can't we just prepend all ((x .. ) .. ) forms with funcall?
4:00:06
aeth
I stripped out as much as I could and I've been changing around as much as I can in those 50ish lines for the past few hours
4:00:58
equwal
Look at Bike's solution, or https://rosettacode.org/wiki/Partial_function_application#Common_Lisp for a macroless thing that messes with the symbol table.
4:01:52
equwal
But you can't ((f 10) 20) without scheme. I'm trying to recall why, but I suspect Bike knows the specific reason.
4:01:53
Bike
yes. it's essentially like the definition on rosetta here, though maybe with a compiler macro too
4:03:52
loke
Technically, it works in scheme because the first element in a form is evaluated, while it isn't in CL
4:04:58
Zhivago
There is no principled reason that ((f 10 ) 20) shouldn't work in CL also -- it's just not supported.
4:06:52
xsperry
just so we are both on the same page, I am talking about this syntax only working in custom macro, that would walk the entire tree, and prend funcall to all such forms where car is a list. why wouldn't this work?