freenode/#lisp - IRC Chatlog
Search
4:05:54
mathu
no-defun-allowed: herb sutter has been at microsoft for like 15 years so he's probably required to use word for papers haha
4:06:12
beach
mathu: Unfortunately, because of some very strong psychological phenomena, C++ programmers reading that paper will likely believe him and avoid looking at Common Lisp.
4:06:40
no-defun-allowed
"we gotta show our incompatible dialect of c++ and absolute bullshit language called c# are good what do we do"
4:06:43
mathu
beach: i feel like if you're reading proposal papers for c++ you're probably not writing a lot of common lisp as it is
4:07:21
beach
mathu: He should avoid making references to something that he knows nothing about and that is untrue.
4:07:37
beach
mathu: I advise you to avoid falling into that trap. We are here for you if you want to learn a better way of writing programs.
4:08:32
beach
mathu: The sooner you do it, the more time you will save over your remaining lifetime.
4:09:38
mathu
anyway, thanks for explaining what the supposed meaning of that code snippet was folks
4:09:53
beach
mathu: If you are a C++ programmer, you have probably already accumulated a bunch of false information about Common Lisp.
4:14:18
beach
I guess I meant to say: "OK. So you have not been told by anyone that Common Lisp is an "interpreted language". Good."
4:15:25
beach
mathu: I said that, because that is some of the misinformation about Common Lisp that ignorant people will spread in order to avoid that others discover its power.
4:17:00
beach
mathu: People confuse "interactive" and "interpreted" because they believe that when something is compiled, it has to generate an executable file. Common Lisp is interactive, but most implementations compile the code on the fly and then immediately execute it.
4:18:24
beach
mathu: In fact, it can compete with C for numeric computations: https://www.lrde.epita.fr/~didier/research/publications/papers/verna.06.elw.pdf
4:18:47
mathu
would you happen to know if haskell's ghci is a compiler of the kind lisp uses or if it's a true-blue interpreter?
4:20:14
beach
mathu: So with Common Lisp, you get the superior power of an interactive language, allowing you to test your code interactively as you code, not having to wait for the compiler and the linker every time. But you still have excellent performance.
4:20:28
mathu
it gives you a REPL, but i wasn't sure if it was the sort of iterative compiler that google is telling me CL has
4:21:39
beach
mathu: Plus, with Common Lisp you get a sane object system that is probably one of the most powerful object systems around, namely CLOS.
4:22:23
beach
mathu: Compared to C++, you also get the superior performance of a tracing garbage collector, compared to the slow new/delete or malloc/free (which in addition is terribly error prone).
4:23:20
LdBeth
GHCi can load compiled though, but it does not compile because GHC compiles really slow
4:27:21
aeth
With SBCL, you can make the same algorithm be up to 35x to 50x faster than slow (non-JIT) interpreters (like Python or Ruby).
4:29:09
beach
mathu: Most people who have invested many years learning some inferior technology are not ready to take in such information, as this essay explains: http://metamodular.com/Essays/psychology.html
5:02:29
no-defun-allowed
my dad always told me i spent too much time messing about with things, that explains a lot
5:02:42
gendl
Ha nice essay. I didn't realize it was written by beach until I got to the end. Then suddenly I heard the whole thing in his voice.
5:04:03
gendl
I had just tweeted something along those lines this morning (for some reason it seems I've taken to "tweeting" lately...)
5:08:24
gendl
beach: not so fast, tiger. My tweets usually get liked/retweeted 1-2 times or so, if i'm lucky lol.
5:10:59
beach
I read up on it a bit more. The origin is form Carol Dweck, who used the terms "open and closed mind set".
5:14:26
russellw
I want to search a string for occurrences of whitespace, so find-if seems to be the right function to use, but returns an element, where I need the position. search returns a position, but wants a subsequence, which in this case I don't have. What's the recommended function to use?
5:16:46
russellw
The position returned is the index within sequence of the leftmost (if from-end is true) or of the rightmost (if from-end is false) element that satisfies the test
5:39:15
aeth
gendl: I noticed the same comment on HN that started that Twitter conversation. This one. https://news.ycombinator.com/item?id=18226339
5:47:03
aeth
I think it can be safe to assume that any program filled with hundreds of giant, hand-written prog blocks isn't idiomatic Common Lisp
5:50:22
aeth
Even the standard doesn't want you to use prog. http://www.lispworks.com/documentation/HyperSpec/Body/m_prog_.htm
5:51:26
pjb
aeth: the opinion expressed in that ycombinator news item is bullshit. Lisp is the most maintainable language. Even when you start from bad lisp code, it's easier to edit it and make it good than from any other programmming language.
5:53:16
pjb
I don't know. I don't use maxima routinely. That is, I've not used it since I installed last time, a few years ago…
5:53:35
jackdaniel
speaking of atomic operations, support for them has been merged to ECL recently (interface is very much like sbcl's cas api)
5:54:15
no-defun-allowed
jackdaniel (IRC): remembering your clim textbox demo, are there resources for theming McCLIM?
5:54:57
jackdaniel
there is no abstraction for theming per se at the moment (of course CLLIM doesn't limit you on that front, it just doesn't have it)
5:55:16
no-defun-allowed
cool! i'll probably write a frontend for netfarm with mcclim if i can make it prettier
5:55:46
jackdaniel
as I said, I haven't finished that yet, I'm working on a support for applications for theming
5:57:56
jackdaniel
this does not work well and is wip, I won't share a code of the scraps being already there
6:02:40
aeth
CASes are useful because you can e.g. just say [1 1 1; 0 1 0; 0 1 1] * [1 0 -1; 0 1 0; 0 -1 1] and get the result of the matrix multiplication (that's GNU octave, not maxima... good syntax for matrices). Even if you're programming it, it's helpful to have an external, probably-reliable, alternate way to get the same result via a CAS to check your answer. Basically, math REPLs.
6:03:01
aeth
(The syntax for all of these CASes would be awful to actually program a non-trivial program in, though. That's why a CAS in CL is useful.)
6:03:54
no-defun-allowed
if there was a COND equivalent instead of IF it would be a bit easier though
6:10:27
jackdaniel
I mean - there are so many fun things to work on as an excercise which are not solved yet in so many software libraries, that hacking something what is already there is a waste
6:16:30
aeth
You have to write stuff that other people have written before you get good enough to write new stuff
6:18:12
jackdaniel
if this kind of statements were true, we'd be still developing wheel and discovering fire
6:21:28
oni-on-ion
ACTION sees a quit message in another channel just now: "The only real mistake is one in which we learn nothing"
6:23:10
ThJ
so, intro books... "Land of Lisp" or "Practical Common Lisp"? i've been told that either is "the best one".
6:48:14
jackdaniel
slightlycyborg: afaik beach works on a second climacs. first climacs is in quicklisp. I don't have any plans for emacs clone myself, I don't like this editor
6:58:34
aeth
I think "Common Lisp, the #1=(programmable . #1#) programming language" is supposed to be a joke
6:59:08
beach
slightlycyborg: (first) Climacs was my first attempt at an Emacs-like editor written in Common Lisp. It has some limitations that I want to fix, in particular when it comes to analyzing Common Lisp code. Second Climacs is work in progress. I am not working on it right now, but with a bit of luck, progress will be made in the near future.
7:00:52
jackdaniel
ThJ: #1=(foo . #1#) is a self reference, you could expand it as #1=(foo . (foo . (foo . #1#))) ; (ad infinitum)
7:04:00
jackdaniel
(list) is the same as NIL (empty list). there is #clschool channel for basics (ftr)
7:04:40
aeth
(let ((*print-circle* t)) (format t "~S~%" '#1=(programmable . #1#))) or even (let ((*print-circle* t)) (format t "~S~%" (nthcdr 1000 '#1=(programmable . #1#))))
7:05:55
ThJ
jackdaniel: i was trying to use the parenthesis to indicate that i was speaking lisp, not using the english word "list"
7:07:04
jackdaniel
as you can see this caused a misunderstanding, so it might be that such indicator is a poor one :)
7:07:14
slightlycyborg
beach. That is awesome. Do you think it wil be suitable as a daily driver? Do you use it as such?
7:08:46
aeth
I actually found a practical (well, the program itself is impractical) use for *print-circle* and the whole #1= thing recently. https://gitlab.com/snippets/1761668
7:09:33
aeth
The best part is that if I coerced that vector into a list once the need for random access is over the return value itself would be n
7:10:03
beach
slightlycyborg: I fully intend to make Second Climacs extremely good for editing Common Lisp code, so I think I will use it myself for that. For other things, it would take some work to get it to become as competent as Emacs.
7:10:40
slightlycyborg
beach: ya, I suppose you don't plan on implementing a cl->el compiler, so all modules will be in cl
7:11:50
aeth
el->cl should be easy (and it has been done at least once before). Common Lisp was literally made so you could port legacy Lisps like Emacs Lisp to it.
7:13:25
oni-on-ion
why would i mention guile randomly, for fun? =) yeh emcascript was a test afaik. a real joke there =)
7:13:34
aeth
Having gone the other direction, and implemented large parts of Scheme on CL, I can say it's not entirely trivial. But Emacs on CL probably could actually be described as trivial.
7:16:19
aeth
oni-on-ion: I'm saying that implementing Emacs Lisp on top of Common Lisp is something you could probably do in a week or less.
7:16:23
oni-on-ion
it has 'languages' like racket does. maybe thats what was not immediately obvious. i dont mean to say that elisp is compatible with guile scheme in the same files.
7:17:03
aeth
And the difference here is that Common Lisp was designed so that you could port "legacy Lisps" (Lisps with classic design decisions like Emacs Lisp choose) to it
7:17:59
aeth
So e.g. the EL:LET macro would just be the LET macro with (declare (special foo)) for every foo bound in the LET
7:18:36
beach
slightlycyborg: No, that would not be practical. Part of the reason for writing it in Common Lisp is to get a better architecture. That goal would be defeated if I had to support Emacs Lisp code without modification.
10:07:13
slightlycyborg
flet on a already defined function, does it work like let on a dynamic variable?
10:09:11
jackdaniel
I think that at one els there was an overview of dynamically scoped functions, but I don't remember which
10:10:18
jackdaniel
also compare (flet ((foo () 4)) (funcall 'foo)) with (flet ((foo () 4)) (funcall #'foo)) and (flet ((foo () 4)) (foo))
10:11:40
slightlycyborg
Ok. That sucks. I want to override a function call somewhere deep in my code
10:12:21
slightlycyborg
I'm tweeting out my completed todos, but I want to test todo completion without tweetng them by overriding a function
10:14:13
jackdaniel
slightlycyborg: easy solution would be binding function to a dynamic variable and calling it with funcall
10:16:10
jackdaniel
then when you call (foo) from whatever, it will automagically resolve to the dynamically bound variable having function
10:20:25
slightlycyborg
this wouldn't be a problem if cl was a lisp1 would it? I could dynamically let the fn name and the eval would operate on it properly.
10:21:53
jackdaniel
I think I'm not qualified enough to explain this topic despite having some understanding of it
10:22:34
jackdaniel
reading is yet another source code processing step and doesn't have much to do with calling functions
10:24:22
_death
it has to do with dynamic and lexical bindings, not with namespaces, so lisp1 is irrelevant
10:26:48
no-defun-allowed
Yep. If your function is in the variable namespace, lisp1/2/n doesn't matter too much.
10:26:58
_death
you could (letf (((fdefinition 'my-function) #'some-other-function)) ...) but it's a drastic measure, will affect other threads, and you'd want to declare the name notinline
10:28:12
trittweiler
slightlycyborg, depending on how your code looks like, but one way to do this is to make that piece of code a generic function, and then in your test code, inherit from the TODO object and specialize on that subclass
10:34:53
slightlycyborg
_death: that letf sounds interesting. if I am not using other threads would it cause problems?
10:39:21
jackdaniel
it is hack which you may find sometimes and it bites in the ass if the whole algorithm depends on it *and* you want to make something work in multiprocessing environment
10:40:52
jackdaniel
I believe that solution suggested by me above (using dynamic variables and a trampoline) is 1) suitable for your purpose, 2) safe
10:41:17
jackdaniel
first thing is: CL doesn't have notion of multiprocessing, so it is all implementation-dependent
10:41:30
jackdaniel
second thing: yes, usually dynamic bindings are per-thread, so they are thread-safe
10:42:17
slightlycyborg
Ya, true. I know from experience with *standard-output* that SBCL rebinds per thread, cause I had to lexically close over a variable like top-level that was let to *standard-output*
10:43:20
jackdaniel
all implementations with threads I've tried behave that way (but there are alternative implementation strategies and it would be still a conforming CL implementation)
11:03:50
slightlycyborg
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.5.8433&rep=rep1&type=pdf this is a pretty cool link on how to do dflet.
11:32:11
|3b|
i'm guessing it tries to store whole file in ram (possibly a few copies, for example one base-64 or whatever encoded, and then decoded version)
11:33:05
|3b|
might look at your server lib to see if you can get a stream and copy directly from that to file instead of loading whole thing into ram
11:40:22
shka_
https://stackoverflow.com/questions/434937/how-does-one-use-sbcls-sb-sprof-allocation-profiling
11:40:27
heisig
The dynamic space size of SBCL is specified in megabytes, so 1024 is not that much. Have you tried something like 10000?
11:41:40
|3b|
(which actually is worth checking, what does (room) look like after server is running?)
11:44:51
|3b|
so you might end up with a bunch of copies of the upload if it is dumping whole thing to text for every frame it shows up in or something
11:45:10
_death
right, (ERROR "~@<When attempting to ~A, the slot ~S is missing from the ~ object ~S.~@:>" "read the slot's value (slot-value)" VECTOR #<SB-SYS:FD-STREAM for "file /tmp/tmpGHU3ALSW.tmp" {100 1889413}>)
11:46:08
_death
it looks like you have a file stream already.. maybe it's just a matter of renaming a file
11:47:54
jmercouris
so _death I assume you are suggesting take data (from the let), and somehow copy it to the desired location?
11:47:58
|3b|
i think you are getting different types for the file contents depending on size (or maybe upload format, chunked etc)
11:48:02
jdz
You might at least look at the content-length header and not process requests that are too big.
11:48:31
jmercouris
but I want users to be able to upload files of around 10, 20mb, as they will be uploading CAD files
11:48:56
_death
jmercouris: I'm thinking the framework you use already writes it to a file and passes a stream
11:51:05
|3b|
yeah, i don't think file size is directly the problem (beyond it possibly changing how the server lib handles the data)
11:52:01
jmercouris
I remember some warning in the sbcl man page about when it tries to use more virtual memory than is allocated it causes a crash or something
11:52:13
jmercouris
I don't know, I'm just shooting in the dark here, but I figured I'll try the simple thing first
11:53:12
jdz
Just making it less likely to happen, but more likely to happen in most unfortunate moments.
11:53:14
_death
you're assuming the stream is a flexi-stream that has vector storage, but that ain't so
11:54:05
|3b|
but with more ram it might give you a backtrace from that instead of from thje error handler running out of memory
11:55:08
jdz
I had the impression that the heap exhaustion error is first, as a result of which the slot in the instance is not set, which causes problems when generating the backtrace.
11:55:09
|3b|
i think your problem is that you just need to treat the file as a stream, and read parts from it and write to your destination file rather than treating it as a sequence
11:55:56
|3b|
yeah, looks like with big files you get a stream to a temp file instead of an in-memory flexistream
11:57:54
|3b|
(you could also try to detect file streams and move the file, but that risks conflicts with the server trying to delete the temp file or whatever)
11:58:51
jmercouris
jdz: This is a common lisp library, I think you and I both know there is no documentation beyond the readme
12:08:37
jmercouris
it is now a #<SB-SYS:FD-STREAM for "file /private/var/folders/98/plnqpl8j7k51bmshc0c9r60r0000gn/T/tmpJAIDFZTC.tmp" {1002DA7753}
12:09:24
|3b|
right, i think the only thing you can rely on is that it is a stream you can read from
12:13:38
jmercouris
so I should just use (with-open-file ...) and then put "s" as the output stream?
12:13:47
|3b|
just get rid of the DATA variable, and replace write-sequence call with (alexandria:copy-stream (first |file|) s)
12:14:14
jmercouris
ok I already did the first part, I kept it in a let though so it is still (data (first |file|)), just easier for me to understand taht way
12:15:44
_death
and then there's already the fd-stream buffering.. so maybe it's not a big issue.. better profile
12:16:39
jmercouris
so, alexandria copy stream is agnostic of flexi stream or of a sb-sys:fd-stream?
12:16:42
|3b|
(unless you have lots of uploads, performance probably doesn't matter too much, and if you do you might want to keep ram per client down anyway)
12:17:29
|3b|
well, flexistream and fd-stream are implementation details to the streams API in general
12:18:36
|3b|
there is a non-standard but pretty much universally implemented extension called "Gray streams" that lets you make your own stream types that work with the normal stream APIs, flexistreams is an example of that
12:19:23
_death
for a long time I felt uncomfortable with CL streams.. one day it occurred to me that the discomfort comes from Gray streams, which mostly just took the user's interface and adapted it to an extender's interface, resulting in a mess of a protocol.. I looked at Franz' simple-streams, and it's much better.. and SBCL also implements that, although I had to fix a bug there to make it work
12:21:44
|3b|
jmercouris: well, FDs can be pretty much anything streams can... files, TTYs, memory maps, serial ports, etc
12:21:48
shrdlu68
CLHS glossary: "stream n. an object that can be used with an input or output function to identify an appropriate source or sink of characters or bytes for that operation."
12:22:51
jdz
jmercouris: I brought it up because in CL a stream is basically the same thing a file descriptor is in Unix: an opaque object that can be used with some functions (call it a protocol, or an API).
12:24:26
_death
I would say not all sockets fit the stream abstraction.. tcp, yes, because it's a stream oriented protocol.. udp, no, because it's datagram oriented
12:24:40
python476
jmercouris: heh, I hate when I click on simple shit years after the fact, but at the same time, you're now free to roll
12:25:52
python476
there was a new paper from a team that decided to make an OS out of the 'everything is an object' out of curiosity
12:26:08
jmercouris
my question is related to a webserver, I'll be redesigning the static site to be dynamic soon
12:26:59
|3b|
ioctl is a result of "everything is a file, whether file ops make sense for it or not" :/
12:35:53
shka_
jmercouris: you will have to load shorter file because if you out of memory before getting the result, you are not getting the result
12:36:25
jmercouris
now I think it is just maybe web-server issues, or my internet connection, because locally I can load massive files