freenode/lisp - IRC Chatlog
Search
15:08:55
phoe
Lisp is an interactive programming language and SLIME is a toolkit that allows the programmer to leverage this.
15:16:37
pjb
slime contains a nice debugger that works the same with all the implementations, so you don't have to learn the debugger of each implementation.
16:16:23
beach
Ah, the one on CLOS programming. More than one year. The first one to come out is called "Concrete and Abstract Data Types with Algorithms".
16:17:16
beach
I use self publishing. It gives better margins and I don't have to listen to the crap of a publisher.
16:20:29
beach
I use a self-publishing company that uses print-on-demand technology, so there is no bulk cost associated with a book. Just a per-unit cost.
16:26:59
beach
The interesting part about the book on data types is that I implemented and tested all my data types and all my algorithms in Common Lisp and wrote a translator that converts the Common Lisp code to something that looks more like a traditional algorithmic language.
16:27:37
beach
The advantage is that 1. the algorithms can be tested. 2. People who are allergic to parentheses can still buy the book.
16:30:52
beach
Either they were written by people who don't know that pointers exist, so they use integers and tables in their algorithmic language.
16:31:14
beach
Or they are written by people who have not followed the evolution of computer architectures for the past decades.
16:32:18
beach
Apparently, the majority of books on the subject get something simple like binary search wrong.
16:34:00
beach
One question is what happens if there is no object corresponding to the one being searched for.
16:34:20
beach
The other is that the published algorithms make many more key comparisons than are needed.
16:35:29
beach
And the book makes things more realistic. Existing books assume that all objects are integers.
16:36:15
beach
So readers of traditional books don't see the difference in cost between a key comparison and an index comparison in terms of cost. Both are integers after all, right?
16:38:17
beach
For "stack" they either suggest a list, so if you have a stack of DNA letters, you waste 64 bits for each bit represented.
16:38:46
beach
Or else they suggest an array, which blows real-time properties because you have to re-allocate when it is full and there is no bounded size for that.
16:40:18
beach
I refer to whether I can realistically suggest such a data structure in a library without being ridiculed, and I don't think so.
18:01:24
samlamamma
I'm in the debugger after a break, I wanna check the value of a dynamic variable. How do I do so? Is there a way of getting a REPL while in the SLIME debugger?
18:06:56
|3b|
hit i on one of the backtrace entries to "inspect in frame" and enter the variable name (probably including package), or e to "eval in frame", d for "pprint eval in frame"
18:24:00
pjb
samebchase: dynamic variables may have different bindings in different threads. If you want to inspect the value in the thread that is in the debugger, use e on the frame where you want to evaluate the expression.
18:49:14
learning_
I want to do (+ "hello" "world") => "helloworld" i tried defining + as a generic function but i get "Error: The function + is defined as something other than a generic function." When continued, the image removes the previous definition for + at which point lisp breaks because it can't do addition lol.
18:52:11
pjb
(defun your-package:+ (&rest args) (if (every 'numberp args) (apply (function cl:+) args) (do-whatever-you-want args)))
18:54:48
pjb
https://gitlab.com/com-informatimago/com-informatimago/blob/quicklisp/common-lisp/invoice/invoice.lisp#L399
18:55:22
pjb
In this file, we define a dispatching reader macro #m to read money amounts in specific devises.
18:56:09
pjb
https://gitlab.com/com-informatimago/com-informatimago/blob/quicklisp/common-lisp/invoice/invoice.lisp#L180
18:57:20
learning_
ok. sorry for the slow response just took me a while to understand. had to play around with it in the terminal. that's really cool
18:58:30
pjb
That's the advantage of IRC over phone or video: there's a level of asynchronism that is well adapted to these kind of technical discussions.
18:59:10
pjb
Notice that there's already a concatenate function: (concatenate 'string "hello" "world") #| --> "helloworld" |#
19:00:06
pjb
(defun ! (&rest string-designators) (apply (function concatenate) 'string (mapcar (function string) string-designators))) (! :hello #\space "world") #| --> "HELLO world" |#
19:00:49
pjb
It the first programming language I learned, the concatenation operation was denoted with infix ! "Hello"!" "!"world!" --> "Hello world!"
19:04:03
learning_
i used a lambda. i didn't know apply could be used like that. (reduce (lambda (a b) (concatenate 'string a b)) args)
19:06:02
pjb
Actually, there's a little problem as I used it: if we pass more than (- call-arguments-limit 2) arguments to !, then it's possible that an implementation break on this apply call.
19:07:50
learning_
but won't the number of args passed to concatenate be limited by the number of args passed to !
19:07:55
pjb
Since we can pass call-arguments-limit arguments to !, and I prefix one argument for concatenate, concatenate may receive (1+ call-arguments-limit) arguments, which would break.
19:09:01
pjb
Happily, call-arguments-limit is at the minimum 50, which is more than enough, unless you get your original argument list from random data (lists).
19:09:42
pjb
(and some implementations don't impose any limit, so you can go as high as half the ram used for stack space).
19:39:39
elr99
Hi guys. I am trying to compile pgloader, i dont have root on the pc so I installed sbcl in a home directory and Ive set the SBCL_HOME directory but when I try to cpmpile I get the error (REQUIRE SB-BSD-SOCKETS NIL) and Im inside the debugger. Using google Ive tracked it down to Slime: https://github.com/slime/slime/issues/162 they mention a fix using " specifying :env in the lisp implementation definition" and a piece of
19:39:39
elr99
code..but where do I input that to be used for my make command inside hte pgloader directory?
19:55:03
elr99
there isnt a quick way to setup slim? if you look at the link it seams like a simple solution..
19:59:41
Bike
also, if you built sbcl yourself, i guess make sure that you do have the sockets contrib.
20:14:34
elr99
Shinmera: um..this is for a production server so i just need it to get pgloader installed for a mysql --> postgres migration
20:22:29
elr99
Shinmera, bike: here is a pastie: https://www.pastiebin.com/5975054cb158b I am on 12.04 which has the pg loader version 2 in repos, but the current
20:26:02
Bike
so do you have the module? i think it should just be in modules/ in the sbcl directory.
20:54:44
_user
helo everyone, i have a case, and I'm using a parameter as one of the cases, setf'ing the parameter to a new value doesn't seem to change the case, here is my code: https://pastebin.com/yFUXM7Sk
20:55:00
_user
I assume this has something to do with case macro expanding out the code or something?
21:01:02
elr99
bike: it worked when setting INSTALL_HOME when compiling slbc and then settinh SLBC_HOME to the lib directory
21:01:57
_user
this code needs to be extremely efficient as it will get called relatively frequently
21:02:37
Bike
if you want it to do a lookup, so that you can change the variable, you need it to actually do that rather than use a constant. and case only does constants.
21:04:16
Bike
of course, if that's the only variable case you could use cond/if for the variable, and case for the constants.
22:18:22
holycow
aha, finally someone found this video: https://www.reddit.com/r/lisp/comments/6p0riq/william_byrd_on_the_most_beautiful_program_ever/
22:47:32
axion
Anyone that uses paredit for CL, could you tell me what the ) key is bound to in a lisp-mode buffer?
23:29:01
edgar-rft
aion: I don't use paredit, but C-h k ) in a Lisp buffer should tell you what the ) key is bound to
23:35:47
axion
thank you pjb. i am trying to figure out if smartparens has something like it, where it condenses stray closing parens if you have whitespace between point