freenode/#lisp - IRC Chatlog
Search
19:38:20
dxtr
So do anyone here have experience with snooze? I don't understand the routing here really
20:39:51
fouric
Does anyone know of a (library containing a) function that allows me to "invert" the order of nested calls so that they read left-to-right?
20:40:19
fouric
e.g. (reduce #'+ (mapcar #'1+ foo)) -> (lrread (x foo) (mapcar #'1+ x) (reduce #'+ x))
20:42:09
fouric
Shinmera: do you have a few minutes to elaborate on your toplists repo, or should i just read the code
20:44:51
fouric
I get the feeling that for some types of deeply-nested function+macro forms, it would be easier to read left-to-right than the other way around.
20:45:17
fouric
I was specifically thinking of dataflow programming - not that I have any experience with it, but it doesn't hurt to look around.
20:46:16
Bike
i only know dataflow programming when you actually draw it out instead of doing it textually
20:46:19
fouric
Part of it might be that I don't have enough experience to know that this isn't really something that I need - but I'd at least like to find out for myself.
20:48:00
fouric
Why would forms other than function calls, literals, and symbols (are literals and symbols called "forms"?) interfere with the making of such a macro?
20:49:04
Bike
well, how i understand your conception of this function is you give it a form, and it rewrites it to avoid nesting.
20:50:15
Bike
nesting is easy to understand with function calls; the elements of the cdr of the call are evaluated normally, so you can rewrite recursively and such
20:52:23
fouric
I was envisioning a macro where you give it a syntax like (llread (x out-sym) (foo x) (bar x) (baz x)) and it gets expanded to be nested: (baz (bar (foo out-sym)))
20:55:01
fouric
I think that I could write it in a reasonable about of time - but it feels like this is something that might be desirable enough to be included in a utility library like Alexandria - but it isn't in Alexandria, and I don't know how to describe it in such a way that my search engine can find it.
20:55:20
Bike
mm. no, i don't think it exists. there is a similar macro in uiop somewhere, though...
20:55:42
Bike
https://github.com/fare/asdf/blob/master/uiop/utility.lisp#L106-L109 let me find an example
20:57:20
fouric
OK, cool - not exactly what I need, but I didn't know that it was in UIOP, and I might need it some day, so thanks!
20:57:53
Bike
(defmacro llread ((name initial) &body forms) (if (null forms) initial `(llread (,name (let ((,name ,initial)) ,(first forms))) ,@rest forms)) or something
21:11:12
_death
there are those arrow libraries, and also see https://adeht.org/usenet-gems/malleability.txt
21:15:05
fouric
I'm beginning to realize that one of Lisp's greatest strengths is the ability to create a DSL that allows you to express your ideas in the most clear or concise way possible.
21:15:51
_death
right, and you need a good taste so that what's clear to you won't be a total mess to others
21:16:30
fouric
It feels like Lisp makes programming even more like art by removing many of the mechanical restrictions that other languages have.
21:31:07
Shinmera
The idea is you can create lists of items, and people can sort them according to how they rate them, then compare how they rated things.
21:31:31
fouric
_death: https://adeht.org/ is very, very interesting to me. I don't suppose that you know of any similar sites or pages collecting articles/posts like those?
21:31:44
Shinmera
It's something I did a while ago to discuss which games me and my friends liked best of 2017, and I thought it might make a nice thing to have in general.
21:32:44
fouric
(sorry, not trying to shove you into making it easy for me to use - I'm happy to wait, and I would try to contribute myself if I had a bit more time)
21:43:30
fouric
I tried Haskell *briefly*, then gave up - Common Lisp is much easier, mechanically. Both those languages are still on my list of things to learn, but far enough down that it'll be a few decades until I get to them.
21:46:55
aeth
I think the only language more expressive than Lisp, and in a very different way, is assembly. There, you can do literally whatever you want, and probably very efficiently, although not portably. (And C is not sufficient portable assembly.)
21:47:30
aeth
Assembly fairly directly translates to/from s-expressions, too, so it probably wouldn't be too hard to give it real macros. It already has real functions.
21:49:08
aeth
_death: All we need is more languages with define-vop so someone can write a define-vop portability library.
21:49:42
aeth
CL isn't a particularly concise language if you take away the macros (including the built-in macros)
21:50:37
aeth
tagbody and go can fairly directly be translated into asm. Just "namespace" the tags to mimic the contained goto effect.
21:59:33
aeth
fouric: My point is that with asm, you can trivially add Lisp-style macros and then use Lisp-style macros to write Lisp-style abstractions (although you're working with registers instead of lexically scoped variables and special variables)
22:01:16
aeth
whoman: You'd have to write the macro system in another language instead of directly in asm (unless you first built up all of the abstractions necessary, which would be a waste of time because CL exists)
22:01:26
_death
I also found http://canonical.org/~kragen/sw/urscheme/compiler.scm.html a very neat example, starting from very little ending with a working compiler
22:42:09
pjb
aeth: well, writing lisp (or anything) in assembly is rather easy and fast: you just need to implement a few "primitive" functions and assembler macros, and use them systematically. It may be syntactically inconvenient, but you can achieve a higher level of abstraction quickly and easily enough.