freenode/#lisp - IRC Chatlog
Search
9:38:46
pyc
Do you use Lisp in production? I am mostly a Python programmer and I am thinking if I should learn Lisp.
9:39:14
pyc
I am okay with the learning for the joy of learning but I have found that I can make the most out of a new language only if I am also using it to develop useful software that I care about.
9:48:28
ecraven
me, it's mostly different Schemes. people definitely use clojure. so pick one ;) [probably CL, in #lisp ;)]
9:51:24
rdap
pyc: take this with a grain of salt, as i'm still relatively new to Lisp; but I feel that learning lisp has been useful for writing better code in languages that aren't lisp
9:53:49
rdap
the last time i spent some time with lisp, i was able to come back to C and see an improvement
9:54:20
fiddlerwoaroof
pyc: I've written lots of useful software in Common Lisp but it's mostly tools for personal use, not for work
10:32:11
pyc
ecraven: jackdaniel: What kind of applications do you write in production with Common Lisp?
10:32:48
aeth
pyc: From a different angle (not necessarily more important, just not covered yet)... The SBCL implementation of CL has very good performance. Not C-level, but probably Java-level (but AOT-compiled instead of JIT-compiled, so with slightly different specific characteristics)
10:33:32
aeth
Performance isn't the most important thing, but it does enable different things you can do with it, especially if you're going for an all-in-one-language approach.
10:36:00
aeth
Don't expect C/C++ levels, but probably only 3x slower... more like... what compilers were 20 years ago before they got really crazy with the optimizations.
10:36:58
aeth
And C/C++ (I say that because they're usually part of the same compiler suite) usually does some really bad optimizations that break reliability, anyway.
10:38:30
akssri
aeth: SBCL can produce numerical code that is roughly within 30% of C-code without SSE/AVX optimizations.
10:39:18
aeth
akssri: yes, and I'm guessing it's the "without SSE/AVX optimizations" that probably makes it "300%" instead of "130%"
10:41:21
schweers
aeth: you can get /really/ bad behaviour with (safety 0). Segfaulting on a function called with the wrong number of arguments, for instance.
10:43:03
schweers
I guess if you have code which is really small and simple (like, you could do it in C), but needs to be blazing fast, you might get away with it, /if/ you tested it very thoroughly. But I wouldn’t do it unless I had very compelling reasons to even try it.
10:47:41
schweers
Anyway, SBCL has impressive performance even without type annotations given something like (optimize (speed 3) (space 3) (safety 1))
10:49:36
aeth
Depends on what you're doing. Type annotations matter for numbers and sequences because it de-generics things, and it matters for arrays because it removes bounds checks. Past that, doesn't matter much ime.
10:49:52
agspathis
FWIW, i'll submit a recent example of SBCL, applicable for Lisp in general i think, too): a friend of mine wanted to do some linear algebra in real time. The scenario was that he has some sensors recording human movement live and would like to compute some quantities on the fly. He used sympy to precompute the operations to be carried out symbolically, using the "export to C++" function of sympy. Both gcc and clang choked on the large
10:49:52
agspathis
file produced (unless he turned off optimizations completely). Using emacs, I transformed the file into sexps, which were then parsed and compiled into separate lambdas (a process which took about 20 secs -- gcc/clang were taking about 5 minutes before giving up). With only a few type declarations, the lisp version of the update was about twice faster than the C++ counterpart, but I left it there, since due to external (management)
10:53:41
akssri
btw has anyone here used AVX/SSE intrinsics with SBCL ? I'm not sure how to make SBCL emit movapx with simple-arrays.
11:11:58
makomo
phoe: flip214: is that a meeting i hear? :-) perhaps a friend and i could join as well (if you don't mind), but we won't be in genova until ~14:00 (+- X minutes for checking in and what not)
11:12:27
makomo
not sure if you had anything in plan for that afternoon, but if you did, it'd be cool to meet up :-)
11:12:30
flip214
aeth: install a reader macro that allows to use [], {}, «» etc. instead of only (), that helps
11:13:14
flip214
makomo: don't know about the afternoon. Sunday 10:00 a few people will be at the ELS location.
11:14:27
makomo
yup, i just read above. :-) we won't be there by 10:00, but we're right across the street though, so it should be like 1-2 minutes of walking to get to the hotel once we're checked in
12:02:33
phoe
so it seems there will be a meetup on Sunday at the ELS venue at 10:00 - and we'll travel from there
12:17:52
makomo
phoe: cool :-). we won't be there before 14:00 most likely so i'll let you know what the situation is on the day of the meetup so we can sync up
12:19:44
flip214
phoe: "travel" as in "talk a walk" (so no notebooks) or as in "to the next wifi for lisp hacking"?
18:19:20
p_l
Xach: essentially a bit extended form for data produced by read, so you get also things like position in file etc.
18:20:50
Bike
i don't know about "bit extended", but is that like the cst reader in eclector? where a CST is a standard-object that has a position and such
18:21:26
pjb
p_l: it has been done, using com.informatimago.common-lisp.lisp-reader.reader cf. com.informatimago.common-lisp.lisp-text.source-text too.
18:21:47
pjb
p_l: unfortunately, I don't remember who did it, rather completely, to read sources and generate documentation.
18:22:35
pjb
p_l: also, notice that some CL implementation already note the source position and slime uses it.
18:27:11
flip214
is there a YAML reader that returns such extra data like line number etc.? Would help with error messages (for semantic reasons)
19:49:38
moldybits
(ccase 1 (1 2)) in SBCL yields the error: "Variable name is not a symbol: 1." question 1: ccase does accept a place, such as (nth 0 x), so that error message is a bit misleading? question 2: is it even mandated that this should be an error? the spec says keyplace might *possibly* be used later as a place, but that's only for when all normal-clauses fail, which isn't the case here.
20:00:03
sjl_
Yeah, SBCL should probably say "1 is not a place" or something that doesn't imply you can only use symbols there.
20:04:13
moldybits
pjb: but you say it is mandatory? you mean that that is the only "sensible interpretation of the intent", or is there something more than that?
20:04:52
Bike
it looks like the error is because it writes out (setf 1 ...) and then setf has that compile error
20:05:15
Bike
which could probably be changed, since (setf 1 foo) is also wrong and "variable name is not a symbol" doesn't fully encompass the wrongness
20:05:20
sjl_
I could see an argument that (ccase 1 (1 2)) could produce 2. In practice, I'm much happier having a compile-time warning.
20:06:28
moldybits
i'm getting the impression that the lisp community is not as anal with the spec as some other languages? :p
20:06:59
pjb
moldybits: it's probably better to signal an error, incase you write (ccase (sin 0) (0 'yay)) and (sin x) is not a place!
20:12:13
Bike
in this case sbcl has interpreted the (setf 1 ...) form as being a genuine error, something that when executed would have to signal an error
20:12:29
Bike
but when you are merely COMPILING the form it doesn't drop into the debugger, it just prints a message like "hey this is gonna break"
20:14:07
sjl_
Right, which seems to fit what the spec says (minus the error message being less than ideal)
20:14:25
Bike
but as you noted, that's only when all the normal clauses fail, which doesn't actually happen
20:16:10
moldybits
okay, so sbcl's expansion of ccase contains a (setf 1 ...) form, and it tells me this will break if evaluated, but it never actually evaluates that part in this case. okay, now it make sense.
20:17:26
sjl_
> ---a form; evaluated initially to produce a test-key. Possibly also used later as a place if no keys match.
20:17:43
jackdaniel
I remember I saw an interesting dicussion about compile-time errors for ccase (initiated by previous ecl maintainer), I'm not sure though if it was implementers mailing list or ansi-tests one
20:18:12
phoe
sjl_: "If the store-value restart is invoked, its argument becomes the new test-key, and is stored in keyplace as if by (setf keyplace test-key). Then ccase starts over, considering each clause anew."
20:18:39
pjb
The first problem is "used later" when you talk about a form to be compiled. "later" is a dynamic run-time notion. (ccase 1 (1 2)) is a compilation time program-error.
20:19:06
Bike
i think the right thing to do would be to give the setf thing a better warning error whatever, and then the righter thing to do would be to have ccase check for placeness itself and signal a warning or whatever, but why would this code be written in the first place
20:29:11
jackdaniel
I'd personally prefer having compilation error on errors which may be detected at that time (and definetely I wouldn't like magic like: else clause is invalid code, so it should never trigger, so whole form collapses to 42, I've read something like that happens in llvm c++ compiler - https://blogs.msdn.microsoft.com/oldnewthing/20140627-00/?p=633/)
20:30:55
phoe
jackdaniel: C++ compilers have pedantic modes luckily, and they are able to detect UB and error on them instead of optimizing them away
20:35:16
jasom
please confirm that I'm not going insane: *random-state* is thread-local in SBCL, right? The disassembly certainly makes me think so ...
20:36:38
jasom
ACTION is trying to parallelize work that heavily uses cl:random and is finding that the run time is identical no matter how many threads are used
20:38:56
jackdaniel
jasom: what makes you think, that *random-state* is bound to different objects on different threads?
20:38:58
Bike
even if it is thread local, if they all share the same random-state object they might only update it through lokcs?
20:39:59
verisimilitude
It's rather satisfying to have a program that entirely lacks undefined behavior.
20:40:38
verisimilitude
Common Lisp does make it easy to introspect on the environment, of course, so it's also easy to simply check if the implementation can support the program, beforehand, which still makes it a valid program.
20:40:59
Bike
the random state has to be updated in an organized way, yeah? probably have to do some loopy cas biznis at best
20:41:31
jackdaniel
phoe: what is undefined behavior in a standard may be well defined in an implementation
20:43:12
verisimilitude
Common Lisp is, in the vast majority of cases, a very well defined language.
20:43:38
verisimilitude
There's a difference between a nonstandard extension and undefined behavior.
20:44:28
verisimilitude
There's a league of difference between adding threads to Common Lisp and signed integer overflow in C.
20:45:45
verisimilitude
Ada gets along just fine, because it actually recognizes that overflow can happen, unlike C, which simply ignores it.
20:46:28
verisimilitude
So, you get an exception in Ada, and you get program misbehavior or chunks of code removed by the compiler, in C.
20:46:52
jasom
ACTION remembers some comment on ISAs (RISC-V I think?) where people were requesting efficient traps of signed integer overflow, and the answer was "compilers don't use that" the response was "compiler's don't use that because it's not efficient on most architectures" ... chicken and egg problem.