freenode/#lisp - IRC Chatlog
Search
6:56:59
White_Flame
also, a big ol' "In general," in the beginning of shrdlu68's quote leaves leeway there, too
6:57:34
pillton
"Should signal an error of type type-error if index is not a valid sequence index for sequence. "
6:58:52
shrdlu68
I should pay closer attention to exception types, never noticed array out of bounds exception was not standard.
6:59:35
White_Flame
sanity is relative to time frames. Pathnames, for instance, are kind of insane nowadays
6:59:41
beach
The purpose of WSCL is to clarify many such situations, like requiring errors to be signaled in safe code.
7:00:23
pillton
I must admit. I have never really understood the definition of safe code given clhs 1.4.4.3.
7:23:54
beach
Hard to quantify of course, but it is probably worse than most people think after a casual read of the Common Lisp HyperSpec. But I am guessing it is not as bad as some languages like C.
7:43:59
jackdaniel
what is awesome lisp? also, that is pretty dumb advice, unless provided as a simplified instruction for a real newbies.
7:44:25
jackdaniel
if we didn't care about portability, but "just write" for sbcl there wouldn't be a need for a standard and we'd be in a similar situation python or clojure are
8:08:40
beach
jackdaniel: The concept of a standard that is independent of implementations and of the organizations that supply implementations is pretty hard to grasp, especially these days, when single-implementation languages and benevolent-dictator languages are not only commonplace, but also used by industry projects that think of themselves as being serious.
8:17:51
jackdaniel
I can imagine our civilization getting doomed; only printed standards and programs survived
8:18:40
jackdaniel
of course I'm half-joking here, but looking at standards this way may help making the topic a little easier to grasp
8:21:24
beach
But, and I know I have said this before, for any industry project that thinks of itself as being serious, using a language with an independent standard is a must, or else they must take precautions and figure out what to do if the "language" they have chosen should disappear, quit being maintained, or be altered in some major way.
8:21:46
beach
They might have to hire compiler experts then. And they probably don't even know where to find one, nor what to pay such a person.
8:28:00
dim
beach: what about companies using their own home-grown and home-steered projects/language, such as Google with Go or Mozilla with Rust (I think), or Oracle with Java?
8:30:53
beach
dim: That's fine because they will then have hired people who are capable of maintaining that stuff.
8:40:29
aeth
akkad, jackdaniel: I find a good compromise between painful portability and no portability is to write for one implementation and then test it on one or two supported others. Technically, they could all violate the standard in the same way, but at least you're not tied to *one*
8:42:49
aeth
It's pretty easy to run on both SBCL and CCL. On the other hand, ABCL and CLISP are probably the hardest to support.
8:43:43
aeth
CLISP is... unusual. I think its fixnum is 48 bits. Its long float is arbitrary precision. etc.
8:44:44
Cymew
beach: If that is the old implementation I'm thinking of, I think it is such a corner case that it can be disregarded for compatibility reasons.
8:45:24
dim
as soon as that's possible, I'll have a look at having pgloader.jar and also using JDBC on that platform, that'd be great really for supporting some commercial databases and other niche ones
8:45:43
aeth
Cymew: CLISP is the interpreted implementation that's semi-active (no new release in a long time, but not dead), but tons of resources from 2000-2010 recommended it so it'll live for a long time.
8:47:01
White_Flame
the 3 major things is that it's slower than native compiled implementations, it has fast bigmath, and it's easy to get running on new/unsupported platforms
8:47:05
Cymew
White_Flame: I have read descriptions of its implementation of CLOS to be very peculiar.
8:47:26
beach
Cymew: karlosz is in fact writing a Cleavir-based compiler for CLISP as a GSoC project.
8:50:03
aeth
I'd say that the most annoying thing about CLISP is that it doesn't support single-float and double-float specialized arrays. When a specialized array isn't supported, you just get T arrays instead. *Tons* of libraries assume float arrays (or byte arrays) even though the standard only requires bit and character arrays. Those libraries will (slowly) run in CLISP, but without any sort of benefit in the type system.
8:51:23
aeth
Implementations with long-float (not just CLISP) also have an interesting issue with pi. pi is technically long-float, but in most implementations that's also a double-float so some people erronously assume pi is a double-float. So CLISP has the opposite issue there, where it supports something (long-float) that most popular implementations don't.
8:55:39
aeth
(CLISP does support byte arrays, so I might have been unclear there. I was just saying that that's another thing libraries assume.)
8:57:17
White_Flame
that's a problem I keep hitting. Half the libs want specialized VECTOR, the other half want specialized SIMPLE-ARRAY
8:59:06
_death
when I started learning lisp I used clisp on windows (and sbcl on linux) .. it was slow, but usable for many tasks.. it also has a small image size
8:59:19
aeth
White_Flame: a (simple-array single-float (*)) is a (vector single-float *) afaik (but not the other way around afaik)
8:59:49
aeth
_death: And there's the right answer for what you do NOT want to use SBCL for. When you need a small image size!
9:00:38
White_Flame
yeah, flexi-streams will build a vector for me, then I need to convert to simple-array to give it to the websocket lib
9:02:09
_death
flexi-streams has many faults.. some of them can be fixed without creating backwards compatibility issues, but that particular one I'm not sure
9:02:16
aeth
A simple-array is usually what you want if you even remotely care about performance (assuming you're not using one of the features that a nonsimple array has). It gives more guarantees as to the structure of the thing.
9:04:34
White_Flame
yep, I think a real failing of the spec is that simple-vector cannot be specialized
9:05:28
White_Flame
however, when you think about it, when you're dynamically building up a buffer from a stream, the backing data can't be simple
9:08:17
aeth
You would need some way to communicate that it's only meaningful up to a certain index. A general library should probably just use the 2nd return value to do it, but I'd personally put it in a struct to store the value.
9:09:07
aeth
Obviously this is probably going to waste space (but also risk running out of space), but make things faster.
10:04:16
White_Flame
aeth: needing human involvement in a communications crossbar doesn't seem like the greatest idea...
10:04:54
White_Flame
"oh, I need to wait for the admin to notice the server's sldb window before my response gets returned"
10:07:25
lthms
i was wondering, has anyone here tried to write some async database code in common lisp? do you have anything to advice?
10:07:59
phoe
beach: I'm alive, I just did things that I didn't really enjoy doing. The stuff that's required to function and such, but nothing really enjoyable.
10:08:37
phoe
lthms: that's a pretty big question when it comes to choosing databases though; what are your needs? what kind of data will you store? what functionality for modifying and retrieving it will you need? how is your data modeled and structured?
10:08:51
White_Flame
lthms: threads, messages, just the same as any other language. Just make sure your DB connector library is threadsafe
10:09:16
phoe
because there are object stores in pure Lisp, there are bindings to various SQL and NoSQL databases out there.
10:09:47
White_Flame
lthms: depending on your workload, maybe put your requests into a job queue and have some fixed number of DB connections pulling from it
10:10:45
phoe
well, yeah, I've been using postgres recently and it's just a matter of making ten connections to the database, and suddenly you can have ten DB queries running at once.
11:20:34
ebrasca
#<SB-SYS:FD-STREAM for "file /dev/sdc1" {10052C9813}> is not a binary input stream.
12:12:18
jmercouris
I'm trying to take a long string, and split it into stringths of a max length, but only at word boundaries
12:17:32
jmercouris
Interestingly enough, I am asking because I want to make "pargraphs" of text in Vecto
12:18:18
Xach
The general strategy I use is to categorize characters as breakable, then add words, and when a threshold is reached, go back to the last breakable character.
12:18:19
TMA
jmercouris: if it is meant for human consumption, I recomend you to look up the algorithm used in TeX.
12:18:56
jmercouris
TMA: it is meant for humans, but not really, it is just a legal requirement, nobody reads it
12:23:55
jmercouris
because I see these defgenerics, and I assume I have to implement methods for them
12:24:20
Xach
jmercouris: You could specialize them on characters, and use other context to give meaning to "width".
12:24:55
Xach
jmercouris: https://www.xach.com/tmp/glyphlayout.lisp shows how i used it for http://wigflip.com/minifesto/
13:07:45
dlowe
I managed to work that out for a tiny irc client I wrote. I needed something to break long titles in a tooltip
13:11:19
dlowe
The main work is done by .{0,79}(?=\s+|$) which says, basically, any number of characters up to 79 which is followed by a space or end of line.
13:29:49
dlowe
\S{0,79} captures the case where there wasn't any space, so it just breaks it at the boundary
14:36:52
jmercouris
how can I do (loop for item in list do ...) and also have an index? e.g. a count of how many elements I've iterated?
14:40:47
TMA
jmercouris: add another for clause: (loop for i in '(a b c) for j from 1 collect (cons i j))
14:44:06
jmercouris
that's from this line: variable-clause::= with-clause | initial-final | for-as-clause
14:46:45
jmercouris
and you know this because of this line: [name-clause] {variable-clause}* {main-clause}*?
14:47:53
jmercouris
and then a main clause can be composed of: main-clause::= unconditional | accumulation | conditional | termination-test | initial-final ?
14:52:52
jmercouris
gotcha, it is good at least that there is a chat log to persist some domain knowledge
14:54:13
beach
I guess so. In this case, though, there is no additional information compared to the Common Lisp HyperSpec.
15:05:31
beach
YAY! My Common Lisp implementation of Doug Lea's allocator algorithm just passed the test consisting of 10 million randomly generated ALLOCATE and FREE operations.
15:06:37
beach
I use two basic operations, one for reading a memory location and one for writing a memory location. In the test, I am simulating those operations by reading and writing to a Common Lisp vector.
15:07:32
beach
In a real system, those would be replaced by special operators that actually read and write memory.
15:09:17
beach
So much for the idea that it is impossible to write memory allocators, garbage collectors, etc., in Common Lisp.
15:12:35
beach
I am guessing in a similar way. They must have had Lisp function able to access raw memory.
15:14:33
beach
There has been considerable progress in garbage collection since, mainly thanks to Java.
17:52:45
PJ_
I am considering learning common lisp, as I really like the lisp paradigm. However, I am starting to do a lot more high-level GPU work, what are the recommended GPU options for common lisp that are readily maintained? Also is openacc a possibility?
17:57:26
PJ_
not really rendering, ie not gaming/images etc. More compute on the GPU, linear algebra and other big compute
17:59:26
TMA
PJ_: you need to use GPU driver libraries that have C (or C++) in mind. anything else is an uphill battle -- and that includes the popular python bindings for the machine learning on GPU
18:02:07
PJ_
@TMA thanks, that seems to be my main barrier to entry. Currently doing a lot of deeplearning, machine learning and general data analysis in python. This is great, but I would like to
18:02:53
TMA
PJ_: it can be done in common lisp, the interactive development is certainly great, but it has its cost too
18:03:36
PJ_
use the expressiveness of lisp in some cases. Dabbled in clojure and I liked the lisp way :), but GPUs are becoming more and more prevalent.
18:08:37
TMA
PJ_: nowadays it is similar to the driver support early this century: if you wanted to use the hardware, you had to use microsoft windows or write your own. today the gpu support for non-c/c++ languages is the same: write your own;; it has been done already, but do not expect mainstream-level support available
18:30:18
pjb
(logior #b0111 #b1110) #| --> 15 |# and (bit-ior #*0111 #*1110) #| --> #*1111 |# are basically O(1).
18:31:22
PJ_
@pjb cl-cuda looks great, it does seem more lower level though, if there isn't a higher level alternative, then it seems that may be the way to go. Just more stuff to learn :)
18:42:06
phoe
I have a graph described by a list of edges. Which library-and-function should I use to check if the graph contains cycles?
18:47:36
jasom
PJ_: you may also consider looking at clasp, which was specifically designed for allowing lisp to drive C++ libraries (I've not used it myself though)
18:51:20
kaun
Yeah, is there a CL function to detect the presence of a cycle? Maybe whatever *print-circle* nil would use?