freenode/#lisp - IRC Chatlog
Search
2:29:39
aeth
Technically, I think it *is* a flaw in stumpwm because KDE has some way of working around this without me having to do something. I guess I can take it to the stumpwm channel, though.
2:30:55
didi
aeth: StumpWM is just a Window Manager. KDE is a whole desktop environment. They aren't comparable.
2:34:34
didi
Every time I use `multiple-value-bind' and I don't care about some variables, I dream of writing a macro that would discard NIL variables.
2:38:25
aeth
didi: Imo, they are comparable. The main difference is the lack of a StumpWM suite of applications (which means having to use a terminal, graphical file manager, etc., intended for a different desktop environment)
2:39:54
Bike
the point here would be that stumpwm doesn't have some DE workaround deal, since it just displays windows
2:41:30
didi
aeth: Taking your problem as an example, StumpWM knows nothing about sound, only windows. If you are running some kind of sound server, it wasn't StumpWM that started it.
3:33:12
whoman
other than symbols; paredit to working with lisp in emacs is what macros are to lisp, lets say
3:33:30
pjb
iqubic: as a lisp beginner, I would 1- use the CL implementation in a terminal during 2 days. 2- use the CL implementation in emacs (without slime) during 2 days. 3- use the CL implementation in emacs with slime during 2 days. and finally 4 use CL in emacs with slime and paredit for the rest of my life.
3:35:26
whoman
wrapping/unwrapping and moving left and right parens, are very nice features of paredit
3:45:33
Colleen
beach: drmeister said 8 hours, 22 minutes ago: Above I dumped the environment from within convert-elementary-setq (stored in cleavir-cst-to-ast::*debug-env*)
3:45:33
Colleen
beach: drmeister said 8 hours, 21 minutes ago: This is the environment when compiling one of the PUSH macros in this macro... https://github.com/drmeister/clasp/blob/cst/src/lisp/kernel/lsp/defmacro.lsp#L95 There is no mention of special-variable entries - so I think something is wrong with how the environment is being put together.
3:59:17
ghostyyy
hi, i have heard a lot about lisp macros, does anyone know any useful and practical examples of their usage?
3:59:57
ghostyyy
i googled it but i just get people talking about why macros are cool, ajnd not a lot of practical examples
4:01:25
ghostyyy
oh, i see! are clisp macros different from hygenic scheme macros in any appreciable way? i dont know clisp well, only scheme
4:01:33
beach
ghostyyy: Basically, macros allow the programmer to introduce syntactic abstractions, thereby making it possible to cut down on a lot of boilerplate code.
4:02:45
beach
ghostyyy: Common Lisp macros have the full language at their disposal in order to transform a form to a different form.
4:05:02
Bike
common lisp macros are much simpler. a macro is just a function that you call on source forms, that return macroexpanded forms.
4:05:17
beach
ghostyyy: For someone who doesn't know what macros are for, you seem to know a lot about them.
4:06:32
ghostyyy
i have studied them a bit but i only get academic examples about how to define "cond" fifteen different times a la https://www.cs.indiana.edu/~dyb/pubs/tr356.pdf
4:06:38
Bike
the downside to simpler is that you have to think about actual symbols and worry about a bunch of stuff, but i've never had an issue with it
4:08:01
ghostyyy
iqubic, that only solves one half of the accidental caputre problem, the problem where your macro binds a name already in its context
4:08:15
beach
iqubic: Certain ideas in programming language design want to protect the programmer from himself/herself, so the language is trying to make it impossible to introduce certain problems.
4:08:23
ghostyyy
the other half is where the macro's context binds a name which has the same name as a global
4:18:26
drmeister
Hygienic macros are more important in a Lisp-1, with a single shared namespace for function names and variable names. Common Lisp is a Lisp-2 (or more?) and problems that hygienic macros solve in a Lisp-1 are more conveniently solved with GENSYM.
4:19:38
pfdietz
Also, there's less problem with overriding of functions by local variables in CL. Go ahead and use 'list' as a variable name, none of that schemish 'lst' stuff.
4:19:46
ghostyyy
drmeister, what about the problem i mentioned, where some code shadows a global variable, which is also used by a macro, and then that macro is invoked inside of that context?
4:20:45
Bike
yes. cl also prevents shadowing standard names, which mostly makes that not a problem, though it's not a very "clean" solution
4:21:33
beach
ghostyyy: Not sure whether you are talking about the expansion code or the expanded code.
4:22:05
Bike
(let ((x 4)) (macrolet ((m () 'x)) (let ((x 5)) (m)))) => 5 instead of 4, i'm guessing.
4:22:36
pfdietz
You don't want information to be passed down into macros using special variables. Use the macro environment.
4:23:33
ghostyyy
pfdietz, are you supposed to just pass every function that you plan on using inside of the macro to it via macro arguments?
4:24:03
beach
Bike: Sure, but if it only uses standard functions, the standard prevents shadowing, as you pointed out.
4:24:28
Bike
yeah. i'm just saying, pretty much any macroexpansion has free variables. it's just not usually an issue in practice.
4:24:41
pfdietz
ghostyyy: one thing to remember is that when you compile code, the macros are evaluated at compile time, not when the code they are in is run. So if that code binds a variable later, it doesn't affect the macro at all. The macro is already expanded.
4:26:19
beach
ghostyyy: A macro that expands to the use of a globally defined function that is not standard, is typically defined in the same package as that function.
4:27:19
beach
ghostyyy: So to have an accident, client code would have to write (flet ((package::secret-function (....))) (macro-call ...))
4:27:30
Bike
it's like, i get that common lisp macros are dangerous in theory, and that hygenic macros are safe, but it just has not happened for me
4:27:47
Bike
i have never run into this latter situation in several years of programming and had to be introduced to the possibility by an academic paper
4:28:13
ghostyyy
it honestly has never really occurred to me that someone might not think macro hygiene is an important thing to have, but i guess if its not a problem you encounter often then it makes sense
4:28:57
beach
ghostyyy: Perhaps it does for newbies who don't know about GENSYM, but not for programmers with a bit of experience.
4:29:04
pfdietz
Or, if it does happen, there are so many more common ways to shoot yourself in the foot that it doesn't matter.
4:29:07
ghostyyy
in retrospect i do find it kind of amusing that people have done serious academic research on how to let people get away with shadowing basic operations like cons
4:29:45
ghostyyy
still, i do feel like its a good thing, just that it gives you a nice guarantee that nothing bad will happen, no matter how hard you try
4:29:46
pfdietz
You can shadow CONS in CL. You work in a package where the symbol CONS means something else.
4:30:20
beach
ghostyyy: It is a matter of compromise. The more such guarantees that the language can provide, the harder it gets to use it.
4:31:54
Bike
i do like the conceptual simplicity of it. macro function's just a function you call on some code. obviously you can do all kinds of horrible things in that framework, but programming is all about that anyway
4:35:43
drmeister
ACTION prefers a powerful language that doesn't come with airbags, training wheels and safety rails. Wheee!
4:41:39
pfdietz
In a large project those get added back, layered on top of the language as social restrictions to get a large group of programmers to work well together. Things like "thou shalt not use :: on any symbols in your code".
6:20:41
drmeister
This is generated by the DO* macro and I'm trying to track down where they are coming from
7:57:57
stylewarning
Are there any good tutorials about properly creating a new data type in Common Lisp? I feel as though many data types I create that are public facing are not all that good with respect to things like printing, readable representations/literals, FASL safety, etc.
7:58:50
stylewarning
It would be nice to have a checklist for creating a high quality user data type, be it a new class or structure.
7:59:24
phoe
stylewarning: I think the best idea is to start creating one, fill it with your ideas, post it here, gather comments, update the document, rinse, repeat.
8:00:19
stylewarning
Yeah I may do that. The impetus is to redesign CL-ALGEBRAIC-DATA-TYPE which is rough around the edges in terms of things like respecting print variables.
8:11:36
stylewarning
Maybe FASL safety is a poor term. What I mean is making sure your data structures can be dumped by having load forms and the like
8:45:07
beach
I do that by defining a reader macro `[', so that an object is represented as [package::class :initarg1 value1 :initarg2 value2 ..]. The reader macro simply reads the list and then does (apply #'make-instance list).
9:16:06
Shinmera
stylewarning: You should always provide a print-object method that prints it in a usable way, and possibly a describe-object method for detailed description.
9:16:39
Shinmera
stylewarning: make-load-form is only necessary if you expect it to be useful to use your object as a literal.
10:36:30
loke
Shinmera: isn't it important to use MAKE-LOAD-FORM if you have soemthing like (defconstant +foo+ (make-instance 'my-special-class))
11:45:58
MrMc
For my Bachelor Thesis I would like to write a common lisp library is eBay API worth the while
12:23:25
Colleen
drmeister: Shinmera said 1 hour, 38 minutes ago: https://www.reddit.com/r/Common_Lisp/comments/7twkk9/numerical_libraries_for_scientific_computing_in/
12:24:07
cess11
no, I mean that this company exposes about that many fairly open API:s. you'll probably want to decide which are interesting for your studies.
12:36:02
Shinmera
MrMc: Do you even have anyone that would supervise such a thesis? A professor that would accept and review it?
12:40:25
Shinmera
Not just that, you need to find someone, probably an assistant of the prof, to supervise you for the duration of the thesis. I heavily doubt you'll find anyone that knows Common Lisp, so I heavily doubt you'll find anyone willing to do that.
12:40:28
cess11
also, the others are more verbose and less hackish in their syntax, they are very easy to understand.
12:42:25
Shinmera
Besides, what you're proposing does not sound suitable for a thesis. How would it further science? What kind of prior research would you cite? How does this present anything new? A thesis is more than just implementing a piece of code.
12:42:39
cess11
usually there's something resembling a research question in a thesis, what would yours be?
12:45:03
MrMc
Something along the lines can a language standadised in the past millenium be used for eCommerce today
12:53:14
jmercouris
I got this error from uiop "Program args must all be simple strings", what is a simple string?
12:54:52
cess11
MrMc: if you were to search for something like 'common lisp ecommerce' you'll find some useful resources. if you choose a project you can express formally it will increase your chances of getting someone to grade it.
12:58:17
Shinmera
"If the result-type is a recognizable subtype of vector, and the object is a sequence, then the result is a vector that has the same elements as object. If result-type is a specialized type, the result has an actual array element type that is the result of upgrading the element type part of that specialized type. If no element type is specified, the element type defaults to t. If the implementation cannot
12:59:47
Shinmera
I mean I see no reason for it to not be simple in an implementation, but it doesn't seem guaranteed either.
13:16:27
Xach
jmercouris: i think uiop defers to whatever the implementation provides. on sbcl run-program uses execve.
13:17:04
jmercouris
https://github.com/fare/asdf/blob/master/uiop/run-program.lisp is full of +implementation flags
13:23:17
Xach
The answers are a few M-.s away, except asdf's many wrapping forms might jump you to the wrong place.
13:24:35
mercourisj
Yeah, I've been looking at run-program...I'd need to spend a little bit of time to understand it
13:41:01
pfdietz
(coerce <sequence> 'simple-string) will give you a simple-string, since the value returned by (coerce x y) is of type y.
13:44:50
KZiemian
Xach: I must left reading PCL for sickness of to much theory and to less programming
14:11:19
AeroNotix
PCL is imho the best book to learn CL imho. It doesn't put CL on a pedestal like a lot of books do. It treats the language just as a language. Rather than trying to put a halo of mythology around it.
14:12:53
dlowe
Honestly, it was the most amazing thing for a long time, but these days it's a solid middle-of-the-road language with a lot of history.
14:16:03
AeroNotix
Don't know about that. I use a lot of the new fangled languages and I still find myself thinking how much easier things would be in CL.
14:16:36
AeroNotix
literally the only thing I think CL doesnt have going for it is a good standardized concurrency model. there are good libraries which are portable but still.