freenode/#lisp - IRC Chatlog
Search
11:31:56
luis
aeth: LOOP is useful for many things besides collect. Parallel iteration, for instance. Also, iterating over sequences. And of course, it shines when you want to do all of those things at once.
11:35:29
luis
ck_: you can probably hack slime to make it always show the macroexpansion of loop inline using macrostep-expand. That way you could see the true way at all times.
11:36:12
jackdaniel
luis: is it possible to make slime inline macroexpand things put under macrolet?
11:46:49
luis
jackdaniel: looking at swank-macrostep::enclose-form-in-context, it looks like the mechanism can sometimes fail, so you might have come across one of those scenarios. Also, it doesn't work for slime-expand-1 (C-c RET)
11:48:36
ck_
luis: there's slime-trace-dialog-autofollow-mode, which was maybe originally intended to do something like we discussed (?), but it is acting pretty weird when I set it. Do you have any experience with that?
11:56:03
ck_
depending on [mysteries of the universe], it opens the inspector on the thing below the point
12:45:01
jdz
Because you're probably reading the line from a stream, and the stream should not be always open, and you should be using WITH-OPEN-FILE (or at least WITH-OPEN-STREAM).
12:47:41
jdz
But you probably don't want to push single-element lists, just (push (read-line ...) *user-input*).
12:48:08
no-defun-allowed
FIlystyn: have you written any other Lisp? That's not valid Lisp syntax, nor does it look very nice.
12:49:17
no-defun-allowed
Right, that's better. Now, you can remove the spaces between parens and names.
12:50:32
no-defun-allowed
Yeah, you should never have any space between names and their closest parens basically.
12:51:12
no-defun-allowed
And you will probably get better responses on #clschool, even if there's less participants.
13:11:25
pfdietz
A problem that LOOP or ITERATE (or any complex macro) should address: how can code walkers descend into this without expanding the macro?
13:14:22
pfdietz
The general problem is: do something to all the forms in a piece of program text. So, how do you find all those forms?
13:16:00
pfdietz
The old example I keep looking at is Waters' COVER package. It adds coverage annotations at all the branch points in code (inside a DEFUN or whatever).
13:16:22
pfdietz
And it has to cheat a bit to do that. And as a result, it doesn't work with code that uses ITERATE.
13:17:56
Bike
shivers's loop involves some kind of "low level" macros; skimmed the paper, don't really get it, still has something called syntax-rules
13:18:05
chris4197
I am really liking lisp so far. Even though I just know the basics of the basics so far.
13:29:30
jackdaniel
if you like melding with CL implementations I can suggest ECL, if you like clos-ology I can suggest McCLIM (I'm working on both projects so I will be able to help)
13:29:56
jackdaniel
if you look for some other bits and pieces you may look at projects at sharplispers group on github and try to fix issues in them
14:21:33
pfdietz
chris4107: there are json and xml parsers in CL already. Best to just use an existing one. If you feel the need to hack on one, improving test suites is always welcome.
14:28:22
Xach
I think it would be easier than xml but not as easy as json processing, and also when you're done you'd have something useful
14:29:23
Xach
cl-ppcre source code is also very interesting to read and worth studying to learn CL features
14:32:45
Xach
jdz: i would use it to decide how to process network data without first converting it to strings, which is costly in both time and space on my favorite CL (sbcl)
14:33:46
Xach
but if the data is utf-8 or ascii or whatever, being able to find interesting subsequences and doing targeted conversion would be handy
14:35:50
Xach
Here's the thinking. Converting 100mb to strings to search for the string "foobar" is more wasteful than converting the string "foobar" to octets and searching without conversion.
14:37:12
Xach
This comes up when parsing binary data in structured formats, whether on disk or over the network or whatever.
14:37:46
jdz
Xach: In my case I'm also looking for interesting bits in binary blobs, but then sometimes the blobs are UTF-16 encoded strings, and such thing would not help much, so I'm always converting.
14:39:11
jdz
Well, every other octet is 0. If I was looking for a specific string, then yes. But I'm looking for patterns.
14:40:21
jdz
Xach: Yes. I understand that such patterns can be translated from string into binary form.
14:44:25
Xach
Oh, and it's incomplete to say it only comes up in binary contexts. A text file is a binary file on disk. Writing grep with cl-ppcre loses because the conversion is expensive. If you matched without converting it would lose less.
14:45:03
jdz
I still have not proved to myself that this change https://github.com/jdz/cl-ppcre/commit/89d89c8477841d83ff7d83b26cdf51aaea9ce76e should be merged upstream, but it works for me.
14:45:41
jdz
But then, I think that not confusing octets with characters is a really great feature of CL (just look at all the Python2 vs. Python3 mess0.
14:47:43
Xach
chris4197: cl-ppcre is a really fun read and shows a cool way to handle stuff like that.
18:51:26
Bike
you mean like a local recursive function? because if it's globally defined you can just treat a recursive call like any other call to a global function