freenode/#lisp - IRC Chatlog
Search
1:11:03
pjb
It's easy, it presents a nice and rather complete tutorial of CL, it presents famous algorithms in a very clear and modern way.
1:14:44
edgar-rft
pjb wanted to say that PAIP is also an introduction to CL, but for much more advanced programmers, so it always depends on what you expect :-)
2:44:08
fiddlerwoaroof
minion: memo for asarch: EQ checks whether two things are the same object, not whether their values are equal. For strings, your choices are STRING= (possibly faster, but less generic) or EQUAL (possibly slower, but more generic)
3:30:54
edgar-rft
p0a: Practial Common Lisp is available online for free: <http://www.gigamonkeys.com/book/>
4:30:30
fiddlerwoaroof
hmm, maybe I don't understand your question, there is a pathname component that is the version to be opened
4:33:22
fiddlerwoaroof
You might also be able to find some information in the Symbolics user manuals about how versioning worked on the lisp machines
5:01:56
fiddlerwoaroof
The "normal" string representation of a pathname puts version last, I'm not sure how much that depends on the standard
5:02:33
fiddlerwoaroof
that is, I'm not sure if the standard specifies any particular format for the string representation of a pathname
5:59:54
asarch
I have this source code (the first part) and when I evaluate it I get (the second part): http://paste.scsys.co.uk/583325
5:59:54
minion
asarch, memo from fiddlerwoaroof: EQ checks whether two things are the same object, not whether their values are equal. For strings, your choices are STRING= (possibly faster, but less generic) or EQUAL (possibly slower, but more generic)
6:15:08
no-defun-allowed
asarch: (declare (ignore ent)) is how you tell the Lisp compiler you won't use a variable
6:46:32
asarch
One stupid question: how do you measure the speed of a program in Common Lisp? I mean, whether you decide to use (defun ...) or (defmacro ...) for your operations?
7:00:24
Ukari
is it possible to rename a symbol by import-from like this, https://plaster.tymoon.eu/view/1229?
7:21:06
Ukari
I create a method named '(defmethod of (&rest rest))' in a package and want to export it, it's name is short and can't dispatch between the same name functions
7:22:32
Ukari
I won't care about the method (defmethod from ((seq sequence))), because if there is a same named method (defmethod from ((list list))), confilt won't happens because it could be dispatched
7:27:09
beach
The word "dispatch" means choosing between several methods of a generic function, based on the arguments passed to that generic function.
7:27:10
Ukari
If I could rename a symbol when import it, the code will be shorter instead of package-foo:conflict-name
8:22:21
bonz060
I joined this channel to try to see what all the fuss about lisp is. My boss went on this tirade on how lisp and design thinking go hand in hand. I don't quite understand this yet but I'm willing to give it a shot. Totally noob question(which I'm sure has been asked a bunch of times), but why lisp? Even though it's not imo used in alot of places?
8:24:51
emaczen
bonz060: It is a programmable programming language, the minimal syntax of lisp is a tree which you can easily manipulate using the same code you write your programs with.
8:28:24
bonz060
Grue`: Right now I use Python heavily at work. For exploratory things, I've been hacking around Haskell.
8:30:04
Grue`
well if you like messing around in ipython but hate pasting code into it and restarting it all the time then lisp is for you
8:33:10
buffergn0me
There is a lot of very well thought out stuff in Lisp. Macros are great, but even without them it's great
8:34:03
bonz060
buffergn0me: I'm looking into lisp because I've learnt so much from me boss. Dude showed me some literate programming workflow in org-mod and that has been such a helpful thing to how I write software. I'm currently going through http://www.gigamonkeys.com/book/
8:38:13
buffergn0me
One thing that is very different between Lisp and Python and Haskell, that I think is a great advantage, is how easy code editing and refactoring is with a fully delimited syntax
8:38:30
MichaelRaskin
If you want to have a bridge between your Python experience and Lisp concepts, you could start with Julia β it wants to compete with SciPy and MATLAB, but it also borrows a lot from Common Lisp, although changing some details to fit their vision
8:39:39
MichaelRaskin
Lisp syntax is not always and fully simple, but indeed most of the time it is.
8:42:21
buffergn0me
That is an advantage as well - that it is almost always (OPERATOR <maybe-binding-forms> <other forms>), which makes things easy to remember and look up, but what I mean is because everything is like that, and everything is an expression, moving code around is just a few keystrokes and just works
8:44:52
bonz060
MichaelRaskin: I don't think I want a bridge right now. Julia seems to be a language used for data science stuff. Right, I want to commit m'self to learning languages that will have some impact on how I think about "design", not the language implementation "features". That's what I like about Haskell. It forced me to learn some type theory and how type safety can save tonnes of debugging time. That plus I damn right
8:48:28
buffergn0me
Grue`: Weird, nothing comes up on CLiki. I wrote https://oneofus.la/code/radix-tree.lisp a while ago, I don't think it's very good though
8:49:10
MichaelRaskin
Julia is a reasonable purpose language that happens to use Data science as a marketing direction.
8:51:08
MichaelRaskin
With Lisp the problem is that it supports so many paradigms it doesn't really make you change your thinking (but provides a good test polygon if you want to try out some ideas β which are likely already usable there)
8:52:37
buffergn0me
IDK, there is a lot of stuff possible in Common Lisp that definitely changed my thinking, and some of it is still completely unique
8:53:51
buffergn0me
WRT design, Paul Graham's On Lisp and Doug Hoyte's Let Over Lambda are pretty unique when it comes to DSL design
8:54:48
buffergn0me
I do some Common Lisp contracting (last contract was some work for a client with an existing installation last fall)
8:55:47
buffergn0me
I started out my career doing Common Lisp and it made it very easy to get places early on
8:56:57
buffergn0me
You get to learn a ton and it definitely does help design thinking WRT to showing you what is possible
8:59:55
buffergn0me
Learning CLOS is definitely worth it, if for no other reason than it shows you that OO is not BS and that you can avoid the Java pattern-swamp over-architected garbage
9:03:53
bonz060
Why is OO not BS? Can you articulate it further? I've come to appreciate FP and building programs by composing functions(which I know is also possible in lisp since functions are first class citizens)
9:04:33
no-defun-allowed
I've heard it's much more pleasent when you abstract well, and it seems CLOS and Smalltalk encourage that better than most "object-oriented" languages.
9:06:05
bonz060
Tbh, I've never really got the whole premise of OO. It appears that patterns were a way of working around the mess that's created by some OO code that people wrote over the years.
9:06:23
no-defun-allowed
buffergn0me: Alan Kay disowned C++ (and probably Java in meaning?), so it's cool to say they're not OOP.
9:06:59
buffergn0me
Message passing is equivalent to function calls. That's how Scheme got started (it was supposed to be an implementation of the Actors model, now popularized by Erlang)
9:07:13
MichaelRaskin
Patterns are when you cannot express a control structure in code (because the language is too limited, so you write a book about it instead)
9:07:24
beach
bonz060: I think it is a mistake to learn Common Lisp in order to use it as a functional language.
9:07:44
bonz060
I've come to learn not to use niche concepts when writing code for maintainability's sake. In other words, writing really dumb code that other hoomans can read and understand. Java can make it hard to do that... especially when pattern-gallore is at play.
9:10:26
no-defun-allowed
Well, frankly beach opened me up to CLOS, since the other "OOP" languages I had worked with were boilerplate hell and I expected CLOS to be the same.
9:10:28
buffergn0me
CLOS basically generalizes message dispatch into pattern matching on types, which if you know Haskell, you realize makes a lot of things very easy
9:10:34
beach
Because you are then going to miss out on the power of generic functions in Common Lisp.
9:11:58
bonz060
beach: I guess that's why I'm here. To figure out what pitfalls to avoid :) What are generic functions?
9:12:05
buffergn0me
Also all the great low-level stuff like gotos, bit-banging, SHIFTF/ROTATEF, and all of the adjustable/displaceable array stuff
9:12:27
no-defun-allowed
(Haskell has a weak form of generic functions, called "typeclasses", but they are second-class to my knowledge. One cannot make a list of values that implement `show`, for example.)
9:12:59
no-defun-allowed
Generic functions are functions that act differently when given different types (or in some cases, values), basically.
9:13:44
beach
no-defun-allowed: It is important that the different methods are not required to be physically all in the same place.
9:15:54
no-defun-allowed
This means a programmer can create a method for a generic function after the class has been created, and also even after the generic function has been created.
9:17:11
no-defun-allowed
For example, you might wish to create a method for PRINT-OBJECT for an inbuilt type such as HASH-TABLE. In other OOP languages, that wouldn't be possible as you didn't create the HASH-TABLE class.
9:17:46
bonz060
Since lisp is so interactive, is unit testing easy to do? I met a lisper yesterday and he frankly admitted ho doesn't unit test cause he does not need to. There was some cognitive dissonance there for me in m'head. What are your take on this?
9:18:05
no-defun-allowed
(Excuse me for a moment, though, can one portably redefine a method like that? I'm not so sure really.)
9:18:33
buffergn0me
no-defun-allowed: That's a great point. It also makes it explicit that the meaning of a "message" depends on not just the type of object that it is sent to, but the types of the objects that make up the message.
9:18:36
no-defun-allowed
I unit test, but I only do it after I'm reasonably sure my program is correct. While I'm developing, I test it a lot in a REPL.
9:19:43
no-defun-allowed
Another excellent freedom that kind of method definition gives you is that methods can dispatch on any combination of types of inputs, and even some object identities can be tested on.
9:19:46
buffergn0me
Another place where the uniformity of syntax is a great advantage. You can easily copy-paste code from the REPL into a file of tests
9:20:23
no-defun-allowed
For example, a cheeky programmer might define a factorial function as (progn (defmethod factorial ((x (eql 0))) 1) (defmethod factorial ((x unsigned-byte)) (* x (factorial (1- x)))))
9:23:36
buffergn0me
And these generic functions also make unit testing easier because they make mocking easier
9:24:05
buffergn0me
There are a lot less chains of unneeded dependencies between objects in CLOS code
9:25:50
emaczen
bonz060: CLOS is itself defined as an OOP so you can even override the methods that define standard CLOS and have customoized object systems
9:32:35
buffergn0me
Python has some metaclass stuff as well. Someone at a place I used to work decided that since metaclasses work so well for things like a Python ORM, it would be a good idea to use them for business logic. Huge mess ensued.
9:38:49
buffergn0me
Kiczales, Rivieres, and Bobrow wrote a well-known book about the CLOS meta-object protocol, The Art of the Metaobject Protocol, that is supposed to be a guide to that kind of system design
9:40:21
emaczen
bonz060: CCL is a common lisp compiler that uses metaobjects to interact with Cocoa on OSX -- you can use defclass and defmethod on cocoa objects
9:42:20
buffergn0me
I personally have tried to read the book and did not understand it. A lot of very intelligent people that I respect say those ideas make for very good software design, so my plan is to get back to trying to learn it
9:42:41
bonz060
buffergn0me: I think that book is too abstract. Perhaps something I may read as I get more advanced.
9:43:50
bonz060
buffergn0me: In you opinion, what makes for good s/w design. For me, I'd prioritize maintainability which encompasses a bunch of other things.
9:46:21
buffergn0me
bonz060: The only general rule I have is to avoid making things complicated. So many people make things hard for themselves.
9:47:51
beach
bonz060: Common Lisp has syntactic abstractions in the form of macros, which is a unique feature of Lisp.
9:47:54
buffergn0me
The whole idea behind OO design patterns was to prioritize maintainability, and what happened is they just made things more complicated
9:51:34
no-defun-allowed
Now, even if you take up OOP, there are solutions better solved by metaprogramming and functional programming, bonz060.
9:52:29
no-defun-allowed
For example, the whole mapreduce computing pattern is just those two functions as they are named in CL, in order of application.
9:52:30
MichaelRaskin
Well, no longer completely unique now that Julia has normal macros. And Rust might end up with reasonable procedural macros eventually
9:53:02
no-defun-allowed
So you should be approaching problems with multiple thinking hats, and CL will let you mix them pretty easily.
9:53:34
no-defun-allowed
Generic functions let you use higher order functions, eg (mapcar #'gf list)
9:54:11
no-defun-allowed
They're currently barking up the wrong tree, trying to manage a lex stream or something.
9:55:52
MichaelRaskin
They have only agreed to commit to the format on the level of token stream, but actual macros are written in terms of ASTs using an extra library anyway
9:56:37
MichaelRaskin
Unlike Common Lisp, they do have a language spec that updates from time to time, so they separate levels of commitment somewhat
10:03:25
MichaelRaskin
The AST nodes are just records, and you have quasiquotes, and you are expected to use records for everything in the normal code, too.
10:04:46
no-defun-allowed
I do intend to implement homoiconicity in my toy language. There's quote syntax, and my CL generator generates code to generate the objects (though this should be a literal value).
10:05:32
no-defun-allowed
However, I'm not sure how macros fit in a Smalltalk like language. My impression was that changed order of evaluation was made very clear using lambdas. Anyways, back to CL?
10:06:47
bonz060
no-defun-allowed: You are plunging into language design? How did ya get into that universe?
10:07:04
ggole
MichaelRaskin: you can encode the AST for a language in almost any language, but usually you need special purpose structures (like a set of record types or an ADT or something)
10:08:12
no-defun-allowed
bonz060: boredom, and also there had better be teaching languages better than Python.
10:09:24
MichaelRaskin
ggole: but what if ADTs _are_ the go-to types of choice for normal code, too?
10:10:26
no-defun-allowed
The only better language that is fit for learning is Racket with Swindle (or is it just Swindle?). I don't mean to poke at CL, but it is sometimes quite arbitrary, and I think it hinders learning from nothing.
10:10:28
ggole
eg, in OCaml, the expression 1 + 1 is quite different from BinOp(Add, Int 1, Int 1) (or whatever)
10:10:30
bonz060
no-defun-allowed: The way some people in me life are big python fan-bois woOt woOt. But to be fair, python gets work done quickly. And it has a vibrant community. I get paid to write python code. And I try to make it as idiomatic as it can get :) :)
10:12:56
bonz060
no-defun-allowed: Haskellers make the same argument for Haskell. I figure, just be curious. Suspend judgement until you know enough to be dangerous with said language... then you can air them opinions, from an objective pov.
10:15:17
no-defun-allowed
bonz060: I go to school and I try to blurt out two hours' worth of Python, and hit a metaphorical wall. It's a significant drop of productivity from my SLIME padded cell.
10:16:09
no-defun-allowed
Not to say I can't work in Python, I'm pretty good at it, but it's a very big drop in productivity.
10:22:34
no-defun-allowed
So, I have pretty close to 5 years of experience in Python, and I've found after 1.5 in CL I'm more productive in Lisp. What does that say about Python?
10:29:45
no-defun-allowed
(You can probably scrape off a year or two off learning one programming language after you know another, but that's a third of the time!)
10:30:27
no-defun-allowed
The only alternatives I knew of were C++, Java and Haskell, and none of those looked great to me.
10:31:10
no-defun-allowed
Of course, you can almost make an alphabet-teaching list using programming language names, but not every language is promoted equally.
10:35:57
bonz060
no-defun-allowed: What made python for you unproductive? Do you think other people would share your opinion if they moved to CL? Personally, I'm looking into CL because of some sense of deep intellectual curiosity that is constantly being fired up at meet-ups and sometimes at work(when someone goes on a rant on how they wished one of our stack was in some form of lisp)
10:37:24
bonz060
no-defun-allowed: Since you've been using CL for 1.5 years, what was your learning path?
10:38:12
no-defun-allowed
The interactive REPL/SLIME interface is pretty much why I stuck around, since it gets you out of the slow run-fix-restart loop.
10:39:00
no-defun-allowed
Common Lisp is pretty dynamic and utilises a lot of late binding to redefine classes and functions at runtime.
10:39:54
verisimilitude
Common Lisp is more dynamic than Python, but also more efficient, bonz060, in addition to having a standard with multiple implementations.
10:41:59
no-defun-allowed
Yeah, CL is also much much much faster, somewhere around 1.5 to 3 magnitudes usually.
10:43:24
akater
What is the point of quicklisp-slime-helper? It creates a config potentially duplicating and potentially contradicting init.el, and it depends on alexandria. I don't see how it's useful at all.
10:44:55
akater
A newcomer is eager to use it, and I just don't think it's a good idea which is weird since Xach made it (?).
10:45:17
no-defun-allowed
But, if the moon is positioned correctly, it works well enough to get SLIME running for a while.
10:47:01
akater
bonz060: Arguably, every Lisp user is into language design. βIn Lisp, you don't just solve a problem, you write a sublanguage to solve it in.β
10:47:24
no-defun-allowed
Yeah, SLIME is pretty damn good, I think only Interlisp and a few Smalltalk IDEs compare.
10:48:26
no-defun-allowed
Though, the language I designed isn't a Lisp, since I already wrote a transpiler for a friend's Lisp-lookalike and it wasn't very exciting.
10:48:29
verisimilitude
If you're just starting out, this is one of the only things CLISP is good for.
10:49:50
bonz060
akater: Why is language design so intriguing? As far as I'm concerned(at least for me), I want to get shit done in a way that I won't hate myself 2 weeks from now. I also get that "language design" vibe from some hard core haskellers. What's so fascinating about language design?
10:50:34
no-defun-allowed
CLISP is the best out of the box, yeah. Fun fact: CLISP was freed after an argument between the developer and RMS about licensing on readline.
10:50:45
akater
bonz060: My point is, in Lisp people tend to do it not because it's fascinating but because it's natural in their workflow.
10:51:11
verisimilitude
I'm familiar with it, yes, no-defun-allowed; interestingly, it's not mentioned by name when it's mentioned that putting unique libraries under the GPL resulted in at least one program being released under the GPL.
10:51:34
no-defun-allowed
Macros make it pretty simple for simple changes, and code walking (except for arbitrary CL, ironically) is trivial in Lisp.
10:51:55
akater
bonz060: but yes, everything becomes intriguing and fascinating once you get productive with it.
10:52:26
no-defun-allowed
ACTION is now going to sleep, please defer questions to someone who isn't half asleep thanks (:
12:33:42
aeth
verisimilitude: I wouldn't say that CL is more dynamic than Python. Common Lisp can be dynamic, and it can be not particularly dynamic, and really, quite the opposite of it if you hardcode everything in one giant macro that generates one function.
12:46:37
p_l
I'd say CL is less dynamic than Python, but that's related to obscure details of implementation in Python
12:47:06
p_l
you can program in similar style in CL, but it's very old and low-efficiency in terms of speed way
12:48:21
p_l
no-defun-allowed: funnily enough, RMS position is afaik not necessarily defended by GPL