libera/#commonlisp - IRC Chatlog
Search
8:08:11
zacque
Hi, can I define the QUOTE special operator with either DEFUN or DEFMACRO from the CL package?
8:09:56
zacque
I tried but I don't think it can be done, since DEFUN evals its argument and DEFMACRO evals the expanded form
8:11:37
rotateq
I mean it reminds me again about the metacircular semantics paper from Baker, for example writing LABELS with FLET.
8:15:08
zacque
rotateq: > "Please try before that some more simple things." <= Huh? What do you mean?
8:24:41
Nilby
it's very enlightening to read the original one page lisp eval function, where quote is implemented in one short line
8:28:55
zacque
But instead of importing the "seven primitive" from CL package, I try to redefine them with functions from CL package
8:29:34
Nilby
i think the one in the lisp 1.5 manual is easier to read, but how to quote is there on page 7
8:59:04
jackdaniel
you just replace {}[]()begin,end with uniform pair (), and pull the operator inside the list (instead of leaving it in front of the expression)
9:19:17
horroar
Let's make it simple. dbotton: Did you figure my use of the term "the jew in charge" was hostile?
9:22:16
jackdaniel
if you ever wondered, password managers do wonders with recalling, ehm, passwords
9:27:01
rotateq
Thank you jackdaniel, as I've seen it similar. But maybe more operator effort is now needed.
9:28:48
jackdaniel
either way, in my expierience, trolls after a few bans got bored; the thing that feeds them is attention
9:36:35
jackdaniel
I don't think that there is such strong negative correllation between knowing math and behaving unacceptable, but that's offtopic either way
9:39:21
rotateq
When I use the :type option to specify another type than T for a slot and then again in a DEFCLASS form that inherits this slot, the two types are connected by AND.
9:42:23
jackdaniel
great; I have a thing to say about auxiliary methods and code maintainability - having them greatly increases a risk of non-obviosu bugs ,p
9:42:33
rotateq
And how a slot can be defined and behaves is defined via standard-effective-slot-definition and generic functions like slot-value-using-class, right?
9:43:33
rotateq
auxiliary methods are some that are needed in some other that are visible to the outside? just that i get it right
9:43:58
jackdaniel
you have primary methods and auxiliary methods. the latter are :after, :before and :around
9:44:29
jackdaniel
probably there could be more if you are really interested in more esoteric method combinations
10:51:30
jackdaniel
wasn't uiop advertised as a stand alone library that you may pull from quicklisp? ,p
10:52:08
jackdaniel
I'm not planning to update asdf since 3.2 release (and forward) broke too many things - afaik these are still not fixed
10:53:13
shka
jackdaniel: well, i feel like i miss something, you mean that uiop/launch-program is actually implemented for ECL?
10:54:12
jackdaniel
last time I've checked launch-program and run-program in uiop had some horrible indirection ingrained
10:59:44
jackdaniel
contrapunctus: yes, there were some problems with gather-op on recompilation too
11:00:18
jackdaniel
(because it tried to pack .so files in a single archive), but I think that this one is ifxed
13:06:37
jackdaniel
fourt and fourthmost, cursory glance at this code is enough for me to feel compelled to give you an advice - don't bother with macros until you get a good grasp of programming without macros
13:09:45
flip214
jackdaniel: but confusion is the best way to realize how much there's still to learn!
13:10:39
flip214
Got me a good one when I wrote a macro that declares a class and a WITH-macro for that class
13:10:55
flip214
jackdaniel: well, how would you see that you don't understand something - unless you feel confused?
13:12:02
jackdaniel
I don't feel confused about rust, but I'm aware that I don't know anything about it ,)
13:12:46
jackdaniel
also, there is a difference between being confused by something new and confusing oneself with going too deep into the water
13:13:32
zacque
> "what makes you think that an atom doesn't need evaluation" <= Oh, makes sense! I'm being naive here. I thought simply comparing the symbol to NIL will do...
13:14:32
jackdaniel
if you want to check whether something has a known value at compilation time, you may do (when (constantp <foo>) (eval foo))
13:16:36
rotateq
zacque: But did you learn the basics by now? Or that the lambda list of CL:IF is (test then &optional else).
13:22:16
rotateq
What would make a bit more sense can be to think about how to write IF with COND or COND with IF if this level is yet achieved. Or how WHEN and UNLESS are written.
13:24:46
jackdaniel
(defmacro if (test true false) `((lambda () (or (and ((lambda () ,test)) ((lambda () ,true))) ((lambda () ,false))))
13:25:09
zacque
Thanks! My confusion comes from me thinking that special operators in Lisp have to be defined as macros...
13:25:49
jackdaniel
special operators may be defined by a wizard inside the implementation, they don't have to follow rules
13:26:16
rotateq
zacque: No, you can view them as elementary, we have 25 special operators. Macros are programs that generate other programs.
13:27:34
zacque
With that realisation, I think I can define it easily as a function wrapper around CL:IF, see: https://paste.debian.net/1240695/
13:28:10
zacque
Since NIL is not yet defined to evaluated to itself, I'll simply check (EQ <FOO> 'NIL)
13:30:01
jackdaniel
perhaps you are in a situation, when the value of <foo> is not known to be nil at compilation time?
13:30:31
zacque
Oh, maybe the first thing I should do is define NIL to evaluate to NIL and T => T...
13:30:34
Bike
IF as a function does not work. with your if, (if t (print "a") (print "b")) prints both.
13:32:09
_death
one could define a FIF function.. it would receive test, consequent, and alternative functions, and pick which of the latter two to call based on the result of calling the first
15:11:34
mrcom
For anyone who so my msg about "can't dump..." (and cares), it appears that SBCL started treating a DEFCONST struct object as a literal in (more) places.
15:12:25
edgar-rft
bollu: not in the emacs sense, in Common Lisp you can use :before, :after, and :around methods instead
15:13:58
jackdaniel
if you declaim your function notinline, then you may replace it with a trampiline
15:14:11
jackdaniel
there you could put your advices at the expense of performance penatly for a trampoline
15:14:28
mrcom
What I was depending upon was it being treated as a singleton, so I had a latent bug in my code.
15:14:28
bollu
maybe this is an XY problem. I want to add some logging around my calls to `uiop:run-program`. I can just search and replace `uiop:run-program` with `run-program-wrapper`. I was hoping I could use some CL facility to make this nicer
15:47:52
White_Flame
the *slime-events* buffer does show what's being communicated, but I don't know if that form is what goes over the wire directly
15:48:48
jackdaniel
there were other languages that used slime, i.e clojure -- https://github.com/technomancy/swank-clojure
15:50:24
White_Flame
if you have the repl and *slime-events* visible, and you enter (+ 1 1) in the repl, you'll see messages for the parameter documentation for #'+, as well as the presentation rendering for the results
15:53:19
bollu
I'm https://github.com/slime/slime/blob/master/swank.lisp#L865-L870 <- this seems to be where messages are sent over the stream?
15:53:55
bollu
https://github.com/slime/slime/blob/68c58c0194ff03cd147fcec99f0ee90ba9178875/swank/rpc.lisp#L100-L107 <- this seems to be the encoding?
15:58:02
bollu
Naive question: why is there no """21st century""" Common LISP IDE if it seems somewhat easy to talk to a LISP Repl via SWANK?
15:59:00
White_Flame
but it's also more of an editor than an IDE, eg no project management, no connection between files, etc
15:59:35
bollu
I'm reasonably happy with emacs; I was more wondering about the state of the ecosystem
15:59:54
jackdaniel
bollu: I've mentioned numerous well regarded IDE programs that have support for common lisp
15:59:58
White_Flame
I, for one, am a reluctant emacs user because it's simply the common case for lisp dev
16:00:11
beach
bollu: We are (very slowly) working on such a thing, but it won't use a wire protocol to talk to a Common Lisp implementation. It will run in one.
16:01:38
bollu
beach by "it will run in one", do you mean the IDE will run within a common lisp implementation?
16:05:02
beach
Well, at least one participant in this channels has said something to the effect of "I will NEVER use an IDE that runs in the same Common Lisp image as the code being developed."
16:07:09
jackdaniel
that's not unreasonable given that lisp images happen to get corrupted. I know that SICL plans to make a "safe" system that may always recover itself from user program errors, but people act on things they know
16:07:22
beach
I think the reasoning is that the Common Lisp system might crash, and then you would also lose your editing session. But then, I think the Common Lisp system should be fixed so that it doesn't crash.
16:07:35
jackdaniel
perhaps this person will change their attitude when they will learn that sicl is indeed that sturdy
16:08:22
beach
It is true that many (all?) current implementations allow the programmer to do unsafe things, and then it could indeed crash.
16:10:57
_death
an operating system can enforce process quotas and limit their effect on the rest of the system.. if you want everything to be in a single Lisp image, you probably need to implement such mechanisms
16:13:07
beach
_death: I think there are several possible levels of safety. At the very least, the system should not crash as a result of a silly mistake such as blowing the call stack or allocating too much live data.
16:13:39
beach
_death: But if the programmer really wants to do things like FFI, then it is hard to prevent I guess.
16:14:01
mrcom
bollu: When you're comparing development environments you're really comparing, for example, Java+Jetbeans vs. Lisp+Emacs.
16:16:12
mrcom
"Wouldn't it be nice if you could do a one-click refactor and rename a function." Yep, it would.
16:17:55
mrcom
However, that's a relatively simple thing for Java. You basically just replace one set of text with another. All of the code needs to be parsed, but it's just static text in the end.
16:19:05
mrcom
Lisp development, on the other hand, is a living, breathing thing. Typically you're right in the middle of an actively running program.
16:20:53
mrcom
Just replacing the text is theoretically more complicated. Technically, you need to handle reader macros, compiler macros, normal macros. All of which can arbitrarily modify not only the text but the state of the program.
16:21:43
White_Flame
however, these are complexities that the IDE should assist with, not just leave you to text buffer editing as it does now :-P
16:22:10
mrcom
Emacs basically throws up its hands as being too intractable a problem and just lets you change text characters.
16:24:06
mrcom
White_Flame: Yep, but a very daunting problem. I think it's been addressed piecemeal with... Emacs code.
16:25:39
jackdaniel
it is true that lisp implementations maintain various pieces of image information
16:25:44
White_Flame
I would see something like walking you through all locations of a symbol, and giving you quick access to change them to the new name vs leave it as is, if it's not a function call or #' reference to the symbol
16:26:04
jackdaniel
i.e who-calls-function and source location could be used to identify pieces of text that would need to be changed and recompiled
16:36:44
Guest74
I'd love to live in a world where a perfect programmable common lisp editor existed that could be run in your main process.
16:37:17
Guest74
meanwhile, I'm constantly reminded of the negative consequences of running my window manager in my main process.
16:39:27
Demosthenex
and i'm flattered they accepted my spatial navigation module into their contrib repo
16:40:19
Demosthenex
i'm worried about trying mu4e in emacs for email, because mutt is always up. i can't imagine also using an emacs WM.
16:42:37
Guest74
I should probably look at how stump manages errors because of nonconforming apps. asynchronous clx errors are a nuisance. I'm not sure what the experience of emacs wm users is, i think there's one of them around here somewhere.
16:44:38
_death
in fact you could try and do general Lisp development in the stumpwm process, to find out about possible issues :)