freenode/#lisp - IRC Chatlog
Search
23:56:21
fiddlerwoaroof
Also, integrating ABCL in a java project is pretty straightforward: I spent an hour or so playing around with it, and it wasn't too difficult to figure out how to embed it in a java application.
0:02:13
dim
ah, abcl, sometimes I'd like to produce a pgloader.jar for the JVM, and in that version use the JDBC drivers
0:06:42
fiddlerwoaroof
The company I work for has a significant amount of clojure code, although I'm not on one of the teams that works with it
0:09:38
rpg
IIRC there's a Scheme that is designed especially to be compiled into a Java program as an extension language. Is that maybe Kawa?
0:15:44
aeth
Well, the choice is to either have a lisp-2 and require (funcall #'foo 42) which makes higher order functions less elegant or have a list-1 with tons of name collisions and make naming things less elegant (e.g. (define (foo l1st) ...) or (define (foo lst) ...) or (define (foo l) ...) when you can just (defun foo (list) ...) in CL)
0:16:30
fiddlerwoaroof
marvin3: I don't like having to pick a name for variables/arguments based on whether or not there is already a function by the same name
0:17:31
marvin3
unless it is a function you actually use in that scope you can just shadow it with a variable name. so for less commonly used functions it isn't an issue
0:18:03
aeth
One possible alternative would be to break the language up into smaller packages, instead of having one big (:use :cl) so you don't have a name conflict
0:18:29
_death
I think this post presents some good arguments: https://adeht.org/usenet-gems/data-hygiene.txt
0:18:40
aeth
And yeah the problem mostly shows up with list in Scheme, especially since you use lists in Scheme more than in CL ime
0:18:57
fiddlerwoaroof
But, when I used to write python all the time, I'd frequently have bugs where I had accidentally shadowed a built-in function and then attempted to call it
0:21:37
rpg
I could really use a common lisp with a type-checker, TBH. Wouldn't have to be brilliant, but would save me a lot of stupid bug time.
0:22:13
aeth
I use type declarations all of the time. Unfortunately, semantically, it won't type check on all implementations and in some implementations it will just type assume. On SBCL, it probably type assumes with (safety 0) but never do that.
0:23:19
fiddlerwoaroof
But, I'd love to have a way to write blocks of code with ML-style type inference that seamlessly interoperate with CL
0:23:23
aeth
The problem with CL, or at least SBCL, is that functions (except when inlined) are basically barriers where all type information is lost unless you declare them all over again, for the most part. (or use the, which is very similar to declaring)
0:23:47
aeth
I would love to have full program type checking, that reruns if I change a function's signature in the REPL
0:24:11
fiddlerwoaroof
There are some really nice things in Haskell (e.g. return-type polymorphism) that would be nice to use in CL
0:24:29
aeth
I'm not even sure that full program type check warnings and type inference is impossible in CL. Just... track the functions.
0:25:01
rpg
I was just reading an article about Instagram open sourcing some code that auto-generates type declarations from Python. I was wondering if something like that could be done for CL. But it actually depends on your code *running*, and if my code runs, then typically I don't have such bugs.
0:25:08
aeth
The CL problem is that (foo 42) might return a fixnum now, but it could be redefined in 10 seconds to return a single-float. Or a list.
0:26:00
fiddlerwoaroof
Of course, you have to treat everything that gets checked as a single compilation unit
0:26:13
rpg
Fare: I'm getting the XMLS release fixed up a bit, but I saw your MR. I am running the ASDF tests now. If they pass, I will merge.
0:27:05
aeth
What stops the implementation from rechecking if a function gets recompiled? It would just need to check users of #'foo when #'foo is recompiled, and then rerun those checks. Obviously, you wouldn't want that in the final program, but it could help before then.
0:28:01
aeth
fiddlerwoaroof: redefine #'foo, the data structure that tracks users of foo is checked, the type signature is found to be incompatible, warning happens
0:28:26
aeth
I guess one problem is that you wouldn't be able to use this for type inference in the final program to improve performance (e.g. automatically telling map which sequence it's working on)
0:28:36
fiddlerwoaroof
Also, nice type systems allow propagating all sorts of information that makes recompiling parts of the program less useful
0:29:27
aeth
fiddlerwoaroof: There are some parts of a program where treating every function as a T-returning black box makes sense. And then there are some, particularly in a hot loop, where you probably don't want that behavior.
0:29:55
aeth
And at the moment you're probably going to fill that part with the or declare to give type information, anyway.
0:30:16
aeth
Type information that could possibly be inferred if functions weren't the boundary for type inference
0:30:53
aeth
Types have two uses: catching bugs and performance. Everyone seems to focus on the first use these days.
0:30:54
fiddlerwoaroof
To me, the correctness-checking parts are the least interesting parts of a type system
0:31:17
aeth
If the compiler knows the types of everything, it can do magical optimizations to really make things run fast
0:33:33
aeth
Inferring immutability is probably afaik one of the most important things about a type.
0:34:24
_death
to me, types and type systems are something that's overblown to the point of being more harmful than useful
0:36:00
aeth
To me, I want software where everything that can be done before runtime is done before runtime. Types are helpful there. As are Lisp-style macros. And especially Lisp-style macros that know the type of things.
0:37:00
xenon-
_death did you have experience with more modern type systems, with type inference, etc? not the kind of types that exist in java/c++/c and friends
0:40:30
_death
xenon: do you have experience with people who used such languages and aren't praying at that particular altar? :)
0:41:37
fiddlerwoaroof
There are a bunch of things I don't like about a language like Haskell, but the way you can use the type system to propagate information about your program at compile time is really cool
0:42:28
aeth
_death: If you have a long-running loop, you want all of the work done ahead of time that you can get away with. If you're using the language as a Unix script, it might not be worth the time.
0:42:40
rpg
aeth: got to go, but one thing -- I think there are two very different purposes for type systems. One is to help with correctness, for which you need very thorough type inference, and complex types (or, as in Java, the types don't help you get correctness). The other is type information to allow the compiler to do magical things. It's not clear to me that there's a type system that gives you both.
0:44:13
aeth
rpg: Well, you give the behavior you want, the compiler (or the macro with type information!) decides the fastest route it knows that produces equivalent results. So you want both a magical compiler and correctness.
0:47:30
aeth
In SBCL, what limited type information you can give provdies both afaik. e.g. disassemble something with and without type declarations, especially if it's dealing with numbers or sequences.
0:48:48
_death
apropos, I thought Guy Steele made a good joke when he asked about those formalisms type theorists like so much, which are expressed in first-order logic, which is untyped..
0:49:03
fiddlerwoaroof
With a haskell-style type inference, you wouldn't need the result-type argument of map, but (aref (map #'+1 '(1 2 3)) 0) and (car (map #'+1 #(1 2 3))) would both work
0:49:54
aeth
fiddlerwoaroof: you need the result type in CL because you can say (map 'list #'+ 'some-vector 'another-vector)
0:50:29
fiddlerwoaroof
Yes, in haskell the type system would realize that #'aref takes a vector and automatically pick the right implementation of map
0:51:51
aeth
fiddlerwoaroof: But aref is generic over all arrays. The compiler will know you want a 1D array, and nothing more. Do you want a T array or an array of the most specific type it can use (e.g. '(unsigned byte 8) or something) or the most general not-T type it can use (e.g. 'fixnum or something)?
0:52:21
aeth
But you could think up an example where you both do the aref and then e.g. return the array too
0:52:59
fiddlerwoaroof
The idea is that, since the compiler knows what type your result is supposed to have, it can use that information to do generic function-like dispatch, at compile time
0:54:04
marvin3
haskell does the same thing with literals. 1 is of Num a => a type, which can, depending on a context, be Int, Integer, Double, or any other type that implements Num
0:54:34
fiddlerwoaroof
Yeah, this is why I want to have a little common lisp DSL that does haskell-style type checking
0:54:37
_death
meanwhile, if I want fast code I can generate assembly in Lisp, or write opencl code, or write a C module or whatever..
0:54:42
aeth
fiddlerwoaroof: I think you can do that in CL, if the macro system knows the type information and you write the right macro. Iirc, type information in macros was proposed but rejected.
0:54:49
caffe
i'm having a bit of a stumper regarding sb-ext:run-program... i can get it to run one-liners, but despite :input *standard-input* :output *standard-output*, i can't get it working for anything that has interactive prompts
0:55:51
aeth
_death: Ideally, you don't want to directly write assembly, you want to have a conversation with the compiler to try to produce the correct (disassemble #'foo) result automatically. Then it stays portable, but slow, in other circumstances and you probably save effort anyway.
0:55:56
fiddlerwoaroof
I have a friend who did something like that in Racket: https://github.com/lexi-lambda/hackett
0:57:13
aeth
fiddlerwoaroof: I think (I haven't had the time to look into it) you can do something with this library: https://github.com/Bike/introspect-environment
0:57:41
aeth
Unfortunately, it only supports SBCL, CCL, and CMUCL. If ECL supported the ncessary features, too, that would make a huge difference.
0:58:03
fiddlerwoaroof
Yeah, I think the common lisp type system is too powerful for good type inference :)
0:58:13
aeth
_death: A compiler with enough information will generate better assembly than you can write by hand. The problem is when the compiler doesn't have enough information.
0:59:36
aeth
fiddlerwoaroof: I suspect that that's a problem with C being high-level PDP-7 assembly and not really matching modern hardware too well.
1:00:27
fiddlerwoaroof
I think auto-vectorization, like auto-parallelization is a surprisingly hard problem
1:00:45
_death
aeth: sometimes it's enough just to be able to generate the instructions you need for the particular case..
1:01:18
aeth
fiddlerwoaroof: But in something like Lisp, you don't need auto-vectorization, you can make anything look like it was a built-in part of the language. Auto-vectorization is afaik more like C programmers wanting to stick to their increasingly-outdated for loops.
1:01:55
_death
aeth: you have all the control you need then, and an assembler is much faster than an optimizing compiler as well
1:02:21
aeth
Make a language where the problem isn't hard, rather than trying to make C-style semantics do something totally alien to the PDP-7 it was designed for.
1:08:35
caffe
not any one in particular... mostly a set of bash scripts that prompt for a few lines of input and exit
1:09:11
Xach
I'm actually thinking of making something expect-like for sbcl's run-program pty stuff.
1:12:08
Xach
caffe: no, just use the :pty argument to run-program and you will have a lot lower-level control over input and output of the process
1:13:11
Xach
fiddlerwoaroof: you don't need to directly open a pty, run-program does it on your behalf.
1:15:24
fiddlerwoaroof
Cool, I just meant to say that you don't need to get the user's pty, you just start your own---implicitly or explicitly
1:31:13
fiddlerwoaroof
https://github.com/sbcl/sbcl/blob/f685c4dacde06c9a2bcb2be5f24eca987d4f4188/src/code/run-program.lisp#L708
1:31:46
fiddlerwoaroof
It's also available here: http://www.sbcl.org/manual/#Running-external-programs
1:37:56
fiddlerwoaroof
Does anyone know if lispworks automatically adds (:use :cl) to a defpackage without any (:use...) clause)
1:42:41
caffe
(run-program "/bin/program" '() :input *standard-input* :output *standard-output*) gets the farthest, but fails at the first interactive prompt of the program being run
1:46:50
fiddlerwoaroof
Even in the terminal, it shows the output, but doesn't really respond to input
1:47:39
malice
well, for me, if working with sbcl, if I create a code.lisp (run-program "/bin/echo" nil) and then run it like "sbcl --load code.lisp" - it will work
1:48:07
malice
for clim - I remember trying to debug something in there with *standard-input* and *standard-output*, and it looked like they were changed somehow
1:48:37
malice
so e.g. #'print wouldn't print anything to standard-output, at least with slime, but slime changes *standard-output* too
1:49:19
malice
I mean, if the simple "echo" program works for you in SBCL then other programs should work too
1:51:41
caffe
no, as in when a bash script i'm trying to execute (or just read itself) just goes nowhere. it doesn't respond to input
1:59:55
malice
well, if I do (run-program "/usr/bin/python" nil :input t :output t) in my terminal, it opens Python interpreter just fine
2:01:48
fiddlerwoaroof
but this doesn't: sbcl --eval '(run-program "/usr/bin/python" '"'"'() :input *standard-output* :output *standard-input*)'
2:03:38
fiddlerwoaroof
This doesn't work: sbcl --eval '(run-program "/usr/bin/python" '"'"'() :input *standard-input* :output *standard-output*)'
2:05:13
caffe
now, one more question... is there a way to do this and have it return to sbcl's prompt upon exiting?
2:06:16
malice
If I run the bin/python example and then call quit() in Python, it returns to REPL just fine
2:06:40
malice
fiddlerwoaroof: this *might* have something to do with "If t, the standard output for the current process is inherited." bit (I'm guessing though)
2:10:30
malice
caffe: then I don't really know what to do. (run-program "usr/bin/python" nil :input t :output t) pasted into SBCL after running "sbcl" command
2:16:50
fiddlerwoaroof
it's really annoying to me that the python library cffi interferes with the lisp one in google search results
6:59:06
drmeister
::notify shiho - pull clasp, cando and the master branch of quicklisp/cl-jupyter and rebuild everything. I fixed the python crashes when evaluating cells in Jupyter notebooks. It was a threading problem.
6:59:19
drmeister
::notify Kevslinger - pull clasp, cando and the master branch of quicklisp/cl-jupyter and rebuild everything. I fixed the python crashes when evaluating cells in Jupyter notebooks. It was a threading problem.
10:08:31
loke
beach: No need to invoke him. I'm not ashamed of the fact that I still find toilet umour incredibly funny.
10:13:35
loke
And here's another swedish metal song, different band, different style and probably more popular, but also good: https://www.youtube.com/watch?v=_FSFIOGNYyM
10:18:58
beach
Boy, band members are such good instrumentalists these days. A few decades ago, they were mostly just bad.
10:22:14
dim
well in my experience pop music band players have always been quite good, but you would typically pay no attention to them, only to the front man