freenode/#lisp - IRC Chatlog
Search
17:58:54
srandon111
why for example in other lisps such as clcojure the usage of macros is not encouraged ?
18:05:51
fiddlerwoaroof
srandon111: my experience with Clojure is that many of the developers come from other languages to it and, so, they don't see the value of macros
18:08:06
fiddlerwoaroof
Another problem is that some macros (go in core.async) use code-walkers to do major program transformations and end up pretty brittle
18:12:13
conjunctive
srandon111: They believe macros are more difficult to compose than functions, and tend to design interfaces around hash-table literals.
18:16:46
srandon111
is there any good resource walking you step by step from simple examples to more commples examples ? conjunctive
18:20:48
conjunctive
srandon111: I agree with fiddlerwoaroof, Practical Common Lisp is a great introduction.
18:20:50
conjunctive
I have heard good things about Let Over Lambda, for working extensively with macros.
18:21:52
fiddlerwoaroof
Let Over Lambda is a bad introduction because a couple of its examples dont' work
18:23:18
phoe
after reading multiple Lisp books, I've often come back to Graham's ANSI CL, Practical Common Lisp, On Lisp, CL Recipes
18:23:20
White_Flame
on lisp does make a bunch of little utility macros that aren't possible to write as functions
18:25:19
White_Flame
regarding let-over-lambda, having used codebases written to its style, I vehemently oppose it for actual work
18:26:20
phoe
srandon111: a library that is considered by some people to be an essential supplement to the CL package
18:27:50
conjunctive
srandon111: You can find the repo at https://gitlab.common-lisp.net/alexandria/alexandria
18:28:21
White_Flame
although as a learner, the simpler On Lisp utilities are easier to see how they're written
18:28:44
White_Flame
if you go through the alexandria source code, there's a lot more mindfulness to optimization and ease of use that makes it more complex
18:29:49
conjunctive
On the topic of Lisp books, would you recommend any prelimary material for the MOP book?
18:31:02
jcowan
LOL is a careful and thorough explanation of how to do things with macros that are not even worth doing.
18:35:46
fiddlerwoaroof
the first couple chapters of AMOP are a fairly good example of how to design a complex system in common lisp and wrap in in macros
19:15:30
ahungry
http://rosettacode.org/wiki/Compose_function#Common_Lisp - thats a good sample if you want to just roll your own, its pretty simple/small
20:33:25
pjb
srandon111: people tend to discourage the use of what THEY cannot master. For example, in C, it is strongly discouraged to use inner functions, since it's impossible to write them. In C++ it's discouraged to use OOP, since they cannot do multiple inheritance correctly. etc.
20:56:03
aeth
pjb: "Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?" https://en.wikiquote.org/wiki/Brian_Kernighan
20:56:28
aeth
in particular, anything here in this thread about C's switch is clever: https://news.ycombinator.com/item?id=22789304
20:59:14
aeth
Lisp also makes it possible to have things be undebuggable that are debuggable in other languages. e.g. most uses of the programmable reader
20:59:16
phoe
but it also makes it possible to write 100% clusterfuck code that is impossible to debug even in Lisp
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