freenode/#lisp - IRC Chatlog
Search
21:17:21
jmercouris
slightlycyborg: I'm not very familiar, but I remember there being some basic documentation in the source IIRC
21:20:31
jmercouris
I wish I could help you, I gave up (temporarily) on using bsd sockets in SBCL, as it is an ext and I didn't want to be too tightly married to SBCL
21:21:07
jmercouris
slightlycyborg: did you look at this: https://github.com/cffi-posix/cffi-socket?
21:21:55
slightlycyborg
Ok. I will probably make the switch. I have just enjoyed using other specific sbcl features like their threads
21:23:19
Bike
a list of at least two elements, where the first element is a sequence and the second is a ub16.
22:15:07
aeth
It's pretty hard to scale past 6k LoC because at that point you can start really abstracting and make each change fairly neutral in line count
22:47:22
_death
"can't even parse a single proper Prolog term".. because prolog syntax is so essential to it?
22:49:57
_death
also, when it uses the term "functions" it seems to mean functions in the mathematical sense..
23:58:39
montxero
Hi, I have a question regarding docstrings. Which one of these formating is more "canonical"? https://pastebin.com/g43tEgJn
0:30:33
stylewarning
montxero: I actually don't add newlines to my docstrings at all unless im starting a new paragraph
0:48:56
emaczen
ealfonso: It isn't something you would regularly do, but I'm sure there is an applicable scenario to do so
0:54:53
ealfonso
I''ve seen the pattern of exporting within a file rather than centrally in a defpackage form
1:18:00
aeth
Don't use something that's deprecated because a future version of the standard might remove it!
1:20:40
no-defun-allowed
so to really be in good form, your code better not use remove-if-not or importing outside defpackages :P
1:22:17
rpg
Bike: I'm not finding this in CLHS, either. But I recall getting warnings about uses of `IMPORT` and `EXPORT` at top level
1:23:56
rpg
There's some language in the DEFPACKAGE-ADDITION issue that explains why it's better to use DEFPACKAGE, but not to the extent of deprecating top level use of IMPORT and EXPORT.
1:24:59
rpg
ACTION kind of wishes the committee hadn't made the default for package use be implementation-dependent...
1:25:18
aeth
no-defun-allowed: Well, that's controversial because all the foo-if-nots are deprecated, but the foo-if (complement #'bar) equivalent forms aren't optimized, which you'd expect if they were idiomatic. So they're deprecated functions where everyone ignores the deprecation and good luck actually removing them in the future.
1:26:49
aeth
So do you do (remove-if (complement #'evenp) #(1 2 3 4)) and future-proof your code against a removal that probably won't happen or do you do (remove-if-not #'evenp #(1 2 3 4)) and get a faster program?
1:32:29
aeth
rpg: It's not up to you if there will be a future standard or not. It's up to the core developers of SBCL, CCL, etc. (Unless you are one, in which case it's fractionally up to you.)
1:33:00
aeth
rpg: I don't see any talks about a standard in any of their channels, so it's doubtful to happen in the next 5 years, but forever is a long time.
3:04:26
slightlycyborg
I basically want to call a function that writes to a socket whenever I write to a stream
3:11:31
slightlycyborg
I don't know what that would mean. However, I think I can just make a socket-stream
3:13:48
buffergn0me
slightlycyborg: You can use MAKE-BROADCAST-STREAM to take a bunch of streams. When you write to that broadcast stream, the same thing is written to all of them
3:23:01
Elronnd
Has anyone used ningle? Is there a good way to serve binary files with it aside from loading them into memory and returning them?
3:25:50
anamorphic
I have this function, (defun (setf attribute) (new-value handle attribute-name) ...) and it would be more useful if I returned `handle' instead of `new-value' (then I could chain things if I needed to). Is there anything wrong with returning an argument other than new-value from a setf function?
3:38:57
slightlycyborg
I know have the jankiest augmented reality machine imaginable. I took an rpi with a 3.5 inch lcd, mounted that to a bike helmet so that it hangs directly in front of my face. I then used SBCL sockets to create a *helmet-stream* so I can print things to my helmet console using (format *helmet-strea* ...)
3:52:29
mathu
herb sutter referenced defun defun () 3 in a talk; what is the tl;dr on what that does? :P
3:54:56
mathu
the context is he's describing how you can go too far with giving users control over Words of Power and language mechanics. he says "google defun defun 3" in the talk, which leads me eventually to http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0707r3.pdf if you search "defun" here you can see
3:56:06
Bike
(defun defun () 3) would mean to define "defun" as a function of no arguments that returns 3, but that's illegal because defun is already a standard macro
3:56:28
no-defun-allowed
it just says how to piss off people with redefinition and standards violations
3:57:55
mathu
a footnote in the paper on the page that includes (defun defun () 3) says that common lisp added the restriction that standard names are protected, so i take it there is a history where this code worked
3:57:56
no-defun-allowed
see https://hastebin.com/opanedavep.coffeescript for a transcript of it working
3:59:22
no-defun-allowed
beach (IRC): apparently http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0707r3.pdf uses it as an example of redefinition or extensibility or something
3:59:46
no-defun-allowed
>In Lisp and related languages, programmers can redefine other people’s code and even global language facilities (e.g., the notorious (defun defun () 3) in Lisp, or (define define () 3) in Scheme).
4:00:13
no-defun-allowed
>This is powerful, but undisciplined (causes arbitrary global effects up to and including breaking the language itself)
4:00:38
no-defun-allowed
mind you, it's a bit rich from a C++ programmer to say Lisp could get unreadable
4:02:53
no-defun-allowed
mathu (IRC): http://clhs.lisp.se/Body/m_defun.htm#defun may help but if you've never read lisp it may as well be alien
4:03:03
beach
mathu: It sounds like someone who wants do discourage people from using one of the most powerful languages around by spreading misinformation by making people scared of using it.
4:04:03
beach
mathu: The truth is that it is impossible to write a C++ program that is both modular and fast, whereas that is entirely possible in Common Lisp. So Sutter is sending the wrong message.
4:05:03
no-defun-allowed
i have a sample size of three: the author of that and the doofus who steals my laptop's parents.
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.