You could also use uiop/stream:read-file-lines. It reads the file into a list of strings. No macro necessary. In this case, I am pretty sure you would write this as a function. (If it wasn't already a defined function)
Actually yes that's a good shout, my particular setup does include uiop, however my understanding is that not every implementation has uiop so I was sticking to the standard library. In future yes I think I would use uiop functions for that, I just wanted to demonstrate another macro since it was such a repetitive task.
@@NeilMunro Good catch on uiop not being everywhere. I only ever use sbcl so I didn't even notice. I am still new so that is good to know. Regarding macros, I can't explain it very clearly but I feel like macros are better used when the alternative is typing the same type of abstraction over and over again. If you can simply use a function, maybe macros aren't the best option. I saw a video recently from the Lisp Weekly Issue 4 where they wrote a macro that created a class, and a corresponding method for parsing a configuration file so that they wouldn't have to repeat the code structure. Another really cool example of macros was in chapter 8 of practical common lisp where they were used to create a testing library. Anyway. Thanks for making these videos I would have appreciated seeing more of these when I first got started learning Common Lisp.
For others watching these videos and enjoying them as much as I am (which is to say a lot), i think there are two small mistakes in the macro. on line 17 i think it should be `(when ,stream and i think you probably want to do a "collect" and not a "do". are you planning on making some more common lisp videos? :)
@@NeilMunro oh, I'm not sure. I think I'd like to learn more about practical things, like http libraries and json parsing or SQL libraries and the like, or working with quicklisp, asdf, Roswell etc. But what I most like about your videos is the fact that you sound to me like you really enjoy making them and I find that infectious :)
You're awesome for making these. Excellent work, keep it up. If I could make a suggestion, a search for a video on what hooks are comes up empty, frustrating since theyr'e all over emacs init files. Lambdas/currying/etc also not a lot, frustrating since many learn lisp for that madness. Would love to see those topics explored if you ever feel inclined.
Thanks for the feedback! Really glad you're enjoying the videos. I'm not sure I'm 100% confident with emacs hooks etc, my journey is actually with a vim background, it's why I use things like doom emacs (and previously spacemacs), I can't seem to unlearn the vim bindings. However lambdas, absolutely, I'll put that on my list of videos, I do sometimes struggle to know what to start talking about next, so this is a massive help. Currying and partial function application is a very nuanced subject, personally a very exciting and fun subject, they're not actually the same! I'll also certainly keep this in mind and see about putting a video together for those as well. If I may, specifically what would you feel you want to know about the subjects?
@@NeilMunro I've just heard functional guys praise lisp. Hard to be specific without knowing a lot. a lambda use case where it would be a hassle without them would be great, maybe some things on map/filter/reduce. To be honest, lisp is so liberal with what you can do, any direction you take I'm sure will be great! This format of lisp tutorial has been missing from youtube for many years! Keep up the great work!
@@stoatcode7001 Ok, so I'm finishing up my File IO series (the 7* videos), the next block I'll focus on functional stuff, so if not next week, certainly the week after. I do like map/filter/reduce and functional programming in general. So I'll have just as much fun playing with examples as you hopefully will learning it!
You could also use uiop/stream:read-file-lines. It reads the file into a list of strings. No macro necessary. In this case, I am pretty sure you would write this as a function. (If it wasn't already a defined function)
Actually yes that's a good shout, my particular setup does include uiop, however my understanding is that not every implementation has uiop so I was sticking to the standard library.
In future yes I think I would use uiop functions for that, I just wanted to demonstrate another macro since it was such a repetitive task.
@@NeilMunro
Good catch on uiop not being everywhere. I only ever use sbcl so I didn't even notice. I am still new so that is good to know.
Regarding macros, I can't explain it very clearly but I feel like macros are better used when the alternative is typing the same type of abstraction over and over again. If you can simply use a function, maybe macros aren't the best option.
I saw a video recently from the Lisp Weekly Issue 4 where they wrote a macro that created a class, and a corresponding method for parsing a configuration file so that they wouldn't have to repeat the code structure.
Another really cool example of macros was in chapter 8 of practical common lisp where they were used to create a testing library.
Anyway. Thanks for making these videos I would have appreciated seeing more of these when I first got started learning Common Lisp.
For others watching these videos and enjoying them as much as I am (which is to say a lot), i think there are two small mistakes in the macro.
on line 17 i think it should be
`(when ,stream
and i think you probably want to do a "collect" and not a "do".
are you planning on making some more common lisp videos? :)
I like making them, but I changed jobs and so im finding myself with less free time as I did, I’d like to go back to them, and will try to when I can
If I may ask, what topic would you like to see next, if there was another video?
@@NeilMunro oh, I'm not sure. I think I'd like to learn more about practical things, like http libraries and json parsing or SQL libraries and the like, or working with quicklisp, asdf, Roswell etc. But what I most like about your videos is the fact that you sound to me like you really enjoy making them and I find that infectious :)
You're awesome for making these. Excellent work, keep it up. If I could make a suggestion, a search for a video on what hooks are comes up empty, frustrating since theyr'e all over emacs init files. Lambdas/currying/etc also not a lot, frustrating since many learn lisp for that madness. Would love to see those topics explored if you ever feel inclined.
Thanks for the feedback! Really glad you're enjoying the videos. I'm not sure I'm 100% confident with emacs hooks etc, my journey is actually with a vim background, it's why I use things like doom emacs (and previously spacemacs), I can't seem to unlearn the vim bindings.
However lambdas, absolutely, I'll put that on my list of videos, I do sometimes struggle to know what to start talking about next, so this is a massive help.
Currying and partial function application is a very nuanced subject, personally a very exciting and fun subject, they're not actually the same! I'll also certainly keep this in mind and see about putting a video together for those as well.
If I may, specifically what would you feel you want to know about the subjects?
@@NeilMunro I've just heard functional guys praise lisp. Hard to be specific without knowing a lot. a lambda use case where it would be a hassle without them would be great, maybe some things on map/filter/reduce. To be honest, lisp is so liberal with what you can do, any direction you take I'm sure will be great! This format of lisp tutorial has been missing from youtube for many years! Keep up the great work!
@@stoatcode7001 Ok, so I'm finishing up my File IO series (the 7* videos), the next block I'll focus on functional stuff, so if not next week, certainly the week after. I do like map/filter/reduce and functional programming in general. So I'll have just as much fun playing with examples as you hopefully will learning it!
Functional programming video series starts Friday