freenode/#lisp - IRC Chatlog
Search
21:23:20
pjb
aeth: definitely. This is why a good way to debug some code, is to rewrite it from scratch!
21:24:21
pjb
which is also a good reason why you should have modular code. So you don't have to rewrite everything, but just the bad module or function.
22:37:16
jasom
aeth: I used to use that Kernighan quote, but I now disagree with it. I think debugging and writing software are different (though not entirely orthogonal) skills. Over the past 10 years I've written very little code for work, but I've debugged others' code a heck of a lot. My debugging skills have shot way up while my development skills have atrophied a bit. I would say at this point that I am better at
22:38:26
fiddlerwoaroof
e.g. when the cleverness/intelligence was in seeing a very simple way to solve a problem
22:40:37
jasom
Also very few bugs are novel. I've on occasion suggested fixes to customers code without having ever seen the code, just from observing the symptoms.
23:25:06
aeth
jasom: I suppose it's more accurately about reading than debugging, as in, it's harder to read (clever) code than to write it. e.g. regex
23:25:27
aeth
I'm not sure that's true, either, though. There are definitely lots of things that take all day to write a handful of lines
23:26:20
fiddlerwoaroof
I've used regexes so much by now that I forget people have trouble reading them :)
23:28:53
fiddlerwoaroof
It's a bit like APL: for someone just getting started the syntax is gibberish, once you've really internalized it, it's the most efficient way to express precisely what you mean in the problem space.
23:30:59
aeth
Idk, I think regex is kind of like sh. It can't scale. Or, rather, it can scale but why would you?
23:43:41
fiddlerwoaroof
Sure, but as a DSL for specifying sets of strings inside a larger program, it's really nice
23:58:00
fiddlerwoaroof
(SETF DRAKMA:*HEADER-STREAM* (SWANK-BUFFER-STREAMS:MAKE-BUFFER-OUTPUT-STREAM))
23:58:40
fiddlerwoaroof
This is pretty nice: I can turn on http-mode in the resulting emacs buffer and get a nice colorized log of http requests next to my repl
0:13:26
jcowan
fiddlerwoaroof: Except that a lot of people don't actually understand the corner cases, such as that normally . does not match newlines, and ^ and $ match beginning and end of line, not beginning and end of string
0:45:24
aeth
vim/sed regex are the same? I wouldn't be surprised if vim, sed, and ed all are slightly (if not more than slightly) incompatible
1:09:56
asarch
One stupid question: how is that, that in Caveman2 you can actually write expressions like @route GET "/" if, as far I know, every Lisp expression should be enclosed in parentheses?
1:10:40
fiddlerwoaroof
aeth: vim/sed I think both can take options to make their syntaxes roughly compatible
1:11:03
no-defun-allowed
asarch: That would require a "reader macro", which sets a function to read the rest of that expression after the @ character.
1:11:20
no-defun-allowed
and honestly, it's really dumb and looks out of place, but indeed it's possible.
1:11:32
fiddlerwoaroof
vim also adds "magic" mode where you have to put a backslash before certain regex chars
1:21:19
no-defun-allowed
I think you could prefix it with ' to get the generated code; but you would probably also need the expression after it that it annotates too.
1:55:00
no-defun-allowed
Okay, if I have a class C1 with a metaclass M1, with a superclass C2 which has metaclass M2 and a slot S, should (slot-value <instance of C1> 'S) invoke the SLOT-VALUE-USING-CLASS method specialised on C1?
1:57:49
pjb
asarch: for example, #S creates and return the structure. (defstruct point x y) (read-from-string "#S(point :x 1 :y 2)") #| --> #S(point :x 1 :y 2) ; 19 |#
1:58:43
pjb
asarch: on the other hand, #' doesn't: (print-conses (read-from-string "#'sin")) #| (function . (sin . ())) --> #'sin |#
2:17:06
rpg
Anyone know of any CL library that will take an OpenAPI/Swagger spec and synthesize a *server* stub? There are two libraries that, although they look unmaintained, promise to provide OpenAPI clients, but I don't see any mention of servers.
3:19:58
Bike
no-defun-allowed: slot-value-using-class uses effective slot definitions, so yeah M2 won't enter into it I don't think.
5:57:56
matzy_
does anyone have a good modern tutorial on how to get a basic hunchentoot server running locally on your machine just to practice?
5:58:17
matzy_
all the tutorials i'm finding are really old or are actually configuring a prod server with the library
5:59:34
matzy_
damn that's even simpler than what i have now. but dont you need to call something in slime to get it going?
6:00:33
matzy_
you cant just paste that in a file and access it from a browser, something has to trigger it to start
6:02:07
matzy_
hmm what do you mean by that? I've always thought of SLIME as the thing that starts your CL system
6:03:02
beach
SLIME is starting your Common Lisp for you. If that system happens to be SBCL, then you can start it by typing `sbcl' at the command line.
6:05:34
matzy_
that still doesn't make sense though. i surely need some command to start the specific api program i wrote though, right?
6:05:59
matzy_
just running sbcl in the directly doesnt load the page on localhost with the correct port
6:08:43
no-defun-allowed
You can use (load "filename") to load a file, or start sbcl using sbcl --load filename.lisp
8:36:50
matzy_
so if i define an *acceptor* (I believe it is a class) and pass it to (hunchentoot:start *acceptor*) (literally that's my code), I get an error
8:45:00
matzy_
literally copying and pasting the third and fourth codeblocks on this page to see how serving files works: https://lispcookbook.github.io/cl-cookbook/web.html
8:47:12
matzy_
whereas the one-liner (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242)) run without any errors
8:49:49
matzy_
so the first example doesn't work either. I should clarify. Directly under the "Simple Webserver" huge heading, there's another "Serve Local Files" big header, and then under that is a "Hunchentoot" header, and it's the subsequent codeblocks that i'm literally pasting in emacs and they're not working
8:50:17
Shinmera
The code is obviously correct so whatever you're actually doing that isn't code must be wrong.