freenode/#lisp - IRC Chatlog
Search
17:28:50
beach
On a different subject, today I decided to take a baby step with Second Climacs, as opposed to starting with the full incremental Common Lisp parser. In that spirit, I started writing a special-purpose CLIM top-level output record to display some editor buffer contents, and instead of complicating life for myself, this output record will just display each editor line with no folding (like Emacs does). Instead it will use scroll
17:30:23
beach
The fun part is that, in order to test it, I started writing a small CLIM application that has commands for tracing various functions, for inspecting the application frame, etc. And I am constantly reminded how easy and how much fun it is to write such CLIM applications.
17:31:58
beach
I realize that what I am doing is contrary to the "consensus of the Common Lisp community" (according to some people), which is why I have been referring to it as "secret clandestine technology".
17:37:03
beach
Yes, and Second Climacs was supposed to use CLIM3/CLIMatis, but since CLIM3/CLIMatis is not ready, I am writing a CLIM II GUI for it.
17:41:25
kenanb
I didn't find writing CLIM to be not nearly similar to writing TK in any way whatsoever
17:42:16
beach
Since I have little or no experience with Tk, I will refrain from commenting on the similarity.
17:42:23
kenanb
IMHO McCLIM as an implementation of CLIM in its current state is not ready to be the solution to all GUI problems. But not all GUI applications need every possible nice feature a GUI toolkit would present. for one thing I believe it is already perfectly suited for many graphical tools to aid development, or for prototyping in CL,.
17:43:40
kenanb
the problem is people usually do not know how much they will expect from the GUI toolkit in the future, so they go with the most mature, feature proof and battle tested and cross platform one in the market
17:46:46
beach
kenanb: I think you put your finger on it. Most people are only interested in getting their personal application to work with the knowledge they already have. I am using this secret clandestine technology because I am more interested in making Common Lisp better as a platform for all kinds of things.
17:47:24
beach
jasom: A REPL with full access to CLIM functionality, including graphics, presentation types, etc.
17:48:25
beach
jasom: The input editor for the McCLIM listener is Drei which is the essence of Climacs, extracted to be an input editor.
17:49:49
kenanb
probably half of those gui applications turn out to be perfectly suited to be implemented in almost any gui toolkit, and some would indeed very much benefit from really powerful concepts CLIM provides. Still, I can't blame anyone for going with the seemingly safest route. It is understandable.
17:52:14
DeadTrickster_
if you or someone you know do instrumenting in CL (which I highly doubt sadly) please let me know
17:53:07
kenanb
I personally love the concepts of "presentations", and I think it singlehandedly makes CLIM an important paradigm to work on for the people interested in working on GUI toolkits and to consider using for people that need a GUI library.
17:55:29
kenanb
jasom: there is spec, there is user manual of franz clim, there is user guide of mcclim.
17:58:50
DeadTrickster_
jasom, https://en.wikipedia.org/wiki/Instrumentation_%28computer_programming%29
17:59:51
jasom
DeadTrickster_: there are profilers and of course cl:trace; various logging utilities, all of which would count as instrumentation
18:00:30
beach
jasom: Here is a screenshot of the listener: http://metamodular.com/clim-listener.png
18:01:09
beach
The first output is the result of show class subclasses starting from clim:presentation.
18:01:46
jsgrant
* has still been meaning to mess with (mc)clim a lot more, that the real trivial stuff he's done thusfar.
18:04:34
jasom
for programatically getting timing information, there's a decent library whoose name is escaping me that is x86 specific
18:05:46
jsgrant
It's kinda saddening to me, that qtools are related tech is looking like it's becoming the "better" practical solution for guis. Paulowina even seems to be egged in that direction.
18:08:07
kenanb
beach: while at it, I have a question I was meaning to ask you but was hoping to learn more about before doing so. But I couldn't find any detailed references about it. So I here I shoot: CLIM spec describes the concept of presentation types, it doesn't exactly say why it developed a parallel type system to CL types, McCLIM user guide states CLIM provides its own type system because CL type system is not powerful enough to realize CLIM
18:08:07
kenanb
presentation concepts properly. now my question is: why doesn't presentations try to specialize on a a TYPE system, rather than CLASSES, is it because CLIM tries to let people define different presentations for objects that has the same internal presentation?
18:08:35
jasom
and it only took me 30seconds playing around with CLIM-Fig to get dumped into the debugger
18:17:38
phoe_krk
You can shadow them with new values and all code will be referencing the topmost value it finds for the special variable binding.
18:18:02
jackdaniel
they are cool to use, but code which uses them is hard to maintain / debug / understand / optimize
18:20:34
phoe_krk
jasom: I'm looking at https://github.com/gwkkwg/metacopy which was suggested to me
18:21:00
phoe_krk
basically someone wrote some fairly good code that made me realize things, like, I do have to take circular references into account and somehow handle them
18:24:18
phoe_krk
I can use GOTO and not worry about any side effects that might have broken my code
18:37:15
phoe_krk
The most terrible case I can think of is an object pointing directly to itself, so I don't have a hashtable entry before I copy the object.
18:37:54
phoe_krk
This way I can put the objects into the hashtable entry, and allocate the slots later.
18:39:07
jasom
well what are you putting in the hashtable; I assumed you were just using the hash-table as a set
18:39:46
phoe_krk
I want to index all objects that I copy, so obj1 pointing to obj2 pointing to obj1 doesn't end up in a circular loop
18:40:28
phoe_krk
I want the copier to copy obj1, then to copy obj2, and then find there's already a freshly allocated copy of obj1 and use *it* instead of making a completely new copy into a stack- and memory-blowing loop of doom.
18:40:44
|3b|
other option is to use a placeholder, then go back and patch up anything that copied a placeholder
18:42:42
|3b|
maybe a gensym or otherwise unlikely object is enough, or maybe you want an object that stores what it is a placeholder for... depends on how you intend to go back and patch things up
18:43:25
|3b|
or you can split creation and initialization, and store uninitialized copy then just fill it in
18:45:18
phoe_krk
the moment I see #:COPY-PLACEHOLDER10382 somewhere I can almost surely know things went wrong
18:47:52
phoe_krk
So I don't run into classes which, like, demand specific values on initialization.
18:49:13
phoe_krk
So I'm not triggering some (defclass my-class () ((slot :initarg :slot :initform (error "wtf man"))))
18:49:48
jasom
and as |3b| said you can use change-class from a class with no slots for initialization if the object is a standard-object and
18:51:02
jasom
It is very well specified. You can read all about it in the hyperspec; the main thing to note is that for standard objects you eventually end up in shared-initialize
18:52:11
jasom
it won't go through the initialize-instance methods, but you might want to avoid those anyways for when you are doing a copy
18:52:40
jasom
the problem "deep copy objects" is insufficiently specified to know exactly how you want to handle initialization of the copy
18:54:08
jasom
what about, for example, objects that represent external resources; say a TCP connection. Should you end up with two TCP connections, or two references to the same connection?
18:54:26
phoe_krk
That's the goal of the copier I'm writing: to find out the most-used cases and present them to the user, and to make it able for him to extend the copier with his own cases.
18:56:23
jasom
and you can do a lot in :around and :after methods for UPDATE-INSTANCE-FOR-DIFFERENT-CLASS
18:56:28
phoe_krk
And these two are the cases I want to cover: :SHALLOW, just copying the reference; :RECURSIVE, making a new instance of the object through a recursive MAKE-COPY call.
18:57:30
phoe_krk
Now the tricky part is to write the macros that automatically do this for every class I want to defcopy for.
19:00:37
beach
kenanb: The CLIM presentation type system is richer both than classes and than Common Lisp types.
19:02:05
beach
jasom: CLIM-FIG is a demo, not a finished application. It is in the clim-examples directory after all.
19:06:42
jasom
phoe_krk: note that to get all slots of a class requires MOP which isn't formally part of the lisp specification, but is supported by most implementations to some degree or another
19:07:50
jasom
If you are using MOP, don't worry at *all* about change-class; change-class (on standard-objects at least) is definitely more standardized
19:09:48
jasom
(mapcar #'c2mop:slot-definition-name (c2mop:class-slots (class-of object))) <-- A handy snippet
19:17:28
kenanb
phoe_krk_: as jasom stated, you will probably want to bypass standard instance initialization procedures, probably allocate-instance + copying individual values by mapping on class slot names you gather by the above mapping snippet
19:21:18
kenanb
phoe_krk_: good discussion and references about it: http://stackoverflow.com/questions/11067899/is-there-a-generic-method-for-cloning-clos-objects
21:22:16
RazWelles
Is there a difference between the "?" and "CL-USER>" prompts that show up with slime?
21:24:13
|3b|
you might have if it is different machines, and that is the default prompt of the lisp you use
21:25:17
moore33
RazWelles: Just checked; ? is the CCL prompt if you just run it from the command line.
21:25:47
moore33
RazWelles: You generally don't want to interact with Lisp in the *inferior-lisp* buffer.
21:26:56
|3b|
* is pretty sure it sets it up for proper repl and most of the other stuff you would want
21:27:53
|3b|
but generally, make sure you enable at least the repl contrib, probably the "slime-fancy" contrib (which just loads a bunch of other contribs including repl)
21:39:20
kenanb
zdm: so a nil is not a cons, but a list, which is what a car/cdr expects is either nil or cons
22:10:53
phoe_krk_
kenanb: thanks! Also thanks for the stackoverflow link, I've already read the stuff over there.
22:28:47
kenanb
phoe_krk_: I think you also really want to look at clhs make-load-form for having an overall grasp of the sophistication involved, and how it relates to CLOS approach of completely customizable instance generation.
22:33:03
kenanb
phoe_krk_: CL explicitly leaves some seemingly straightforward procedures un-implemented, because they are actually only straightforward in languages that take more restricted paths
22:35:31
phoe_krk_
Like, (eval (make-load-form instance)) will/should give me an object that is EQUAL to INSTANCE.
22:36:12
Bike
not equal. "similar", a concept with no predicate because it's about loading in different images.
22:36:34
kenanb
... or implements them for built-in classes etc, but avoids defining them for user generated ones explicitly, sometimes only defining some convenience procedures that user may choose to use if one wants behaviour closer to
22:37:34
kenanb
phoe_krk_: "The creation form is a form that, when evaluated at load time, should return an object that is equivalent to object. The exact meaning of equivalent depends on the type of object and is up to the programmer who defines a method for make-load-form; see Section 3.2.4 (Literal Objects in Compiled Files)."
22:39:05
Bike
it doesn't totally work, since similarity is defined in terms of objects in two different lisp instances.
22:40:13
kenanb
phoe_krk_: by doing that you will rob committee of the only word that they had left to define some equality that is "intentionally ambiguous"
22:40:17
phoe_krk_
Equivalent, I understand as: behaving in expectedly the same way the original should.
22:41:06
phoe_krk_
The trouble with EQUIVALENTP is, it would need to be implemented directly in the mind of a programmer.
22:41:21
phoe_krk_
"will this class with three slots do about as well as this one with just two?..."
22:41:43
kenanb
phoe_krk_: no, equivalent, as in "nobody except the actual author of the class should have a say on which two instances are equivalent"
22:42:18
phoe_krk_
EQUIVALENTP should be a generic function that returns NIL in the most general case.
22:49:35
kenanb
you can even define an object-eql that will usually DWIM, and object-equalp that will return T even if only the class names are equal case insensitively
22:50:01
Bike
oh, yeah, that's another thing. two packages are 'similar' iff they have the same name. stuff like that
22:50:13
phoe_krk_
(defun equivalentp (x y irc-connection) (assert (irc-network irc-connection :freenode)) (format (get-stream irc-connection) "hey guys, is ~S equivalent to ~S?~%" x y))
22:54:03
phoe_krk_
As in, a macro that automatically connects to StackOverflow and posts questions related to the string you have it, and returning the code that the most voted answer contained.
23:16:50
kenanb
Bike: by "similarity being defined in two different instances" do you mean object that is returned when you run the make-instance directly and when it is generated from the load-form, or the two different invocations of the same load-form in two different instances?
23:18:52
DeadTrickster_
so cl-statsd is 25% faster than canonical ruby gem and about 40% faster than golang client
23:22:24
Shinmera
ASDF is specifically designed to be upgradeable and if you load the file before ASDF is REQUIREd, nothing can go wrong anyway
23:22:37
Shinmera
Just download it, COMPILE-FILE it, and then LOAD that before anything requires ASDF
23:24:07
kenanb
fiddlerwoaroof: afaik all implementations provide an ASDF version keeping in mind that user might upgrade it
23:25:31
kenanb
fiddlerwoaroof: https://common-lisp.net/project/asdf/asdf.html#Replacing-your-implementation_0027s-ASDF
23:37:36
kenanb
jurov: have you tried (pushnew 1 (member item list)) ? it will not work as well, so pop is really does the reverse of that, but you don't really want reverse of pushnew :) push and pop accept PLACEs as arguments, not the actual object to modify.
23:40:54
phoe_krk
okay, enough two-clientness from my side; let me make another step from icedove to irssi.
23:43:28
kenanb
jurov: delete accepts the actual sequence as the argument. and it will destructively modify the list, but that doesn't mean the variable that holds the reference to the original object will be changed. it usually will, but it is not guaranteed, while (delete 1 *foo*) will change the list that is the value of *foo* (delete 0 *foo*) will not, so always bind the variable to the newly generated list explicitly using SETF. and use
23:43:28
kenanb
non-destructive variants like REMOVE unless you really know you want a destructive operation.
23:44:52
kenanb
so if you are keeping the list in a variable *foo* do (setf *foo* (remove SOME-NUMBER-HERE *foo*))
23:47:08
jurov
kenanb i don't understand the delete problem - you're saying it can cause the binding of *foo* to do what?
23:47:46
kenanb
jurov: actually pushnew is a macro that uses setq in background (which does the same thing as setf in this specific context), so unless the procedure you call doesn't setf as pushnew push and pop does, you need to do it explicitly.
23:50:31
kenanb
jurov: the characteristics of a particular sequence might not necessarily require delete (or a similar destructive function) to do a destructive operation as you might expect. so the binding might stay the same
23:52:59
|3b|
the list passed to DELETE is arbitrarily modified, so is completely meaninless after the call to DELETE
23:53:07
kenanb
jurov: it will always RETURN what you wanted, it doesn't cause the effective binding of the variable to change
23:53:47
kenanb
jurov: which means sometimes the resulting sequence will change, sometimes it will not, delete doesn't care about the variable
23:54:14
|3b|
so after calling (delete x *foo*) the value stored in *foo* is still the same cons, but the /contents/ of that cons (and thus the list) are undefined
23:54:55
kenanb
jurov: I don't know if delete uses any SETF to places in the sequence, but it surely doesn't setf to the variable, by the time delete started working on the VALUE of the variable, it doesn't even know anything about the variable, because variable already evaluated to its value
23:55:56
|3b|
only use DELETE if you have specific knowledge of the list and how it was created, and need the extra performance
23:56:38
kenanb
jurov: the variable is not undefined, you really need to know more about the internals of sequences to understand what it does, so really, to be safe, just do what |3b| says
0:00:41
|3b|
macros have access to the actual variable name or form used to calculate the value, while functions only see the final value
0:02:05
kenanb
jurov: there is no "this", you only think there is an absence of a macro for doing "this" right now because you do not realize the implications of setting a place and modifying data yet.
0:04:20
kenanb
jurov: and don't assume you want to destruct because you want the value of the variable to change, you actually just want to return a new value with the modifications you initially wanted, and bind the variable to that new value.
0:06:09
kenanb
jurov: in order to do that, you modify the value of the variable, and you bind the variable to the returning modified value, hence (setf *foo* (remove stuff *foo*))
0:07:37
kenanb
jurov: for now just avoid the functions that say "destructive" somewhere in definition. and you'll be fine. and start reading Practical Common Lisp, if you haven't started already :)
0:08:42
jurov
ok, thanks. i actually have it open and there's nothing about removing elements from set
0:16:35
jurov
actually these sets are members of alist, and despite my learning difficulties I can see whole datastructure needs much less code than equivalent in C++
0:24:39
kenanb
jurov: list is a simple and flexible data structure that can represent those higher level structures. it can represent many kinds of structures provided the operations required to work with those structures (which doesn't necessarily mean it is good practice to use list to represent them)
0:27:59
phoe_krk_
jurov: lists are quick and easy for the amounts of elements you can easily count using your fingers
0:30:47
jurov
yes. that you can access the same list as a set and as alist entry, is something i haven't seen anywhere else.
0:40:33
cmhobbs
at the risk of asking an inflammatory question, are there any good reasons to use clisp over gcl or vice versa?
0:41:29
aeth
according to common-lisp.net, the two most common are sbcl and ccl. https://common-lisp.net/downloads/
0:42:10
|3b|
clisp is currently unmaintained, and otherwise slow. gcl has historically has ansi conformance problems and was relatively unmaintained for a while
0:42:44
aeth
afaik, ccl is more popular on OS X and sbcl is more popular on everything else (except Windows? not sure which is more popular on Windows)
0:43:30
phoe_krk_
also, according to the current politics, CLISP and GCL are unlikely to receive any support from the GNU.
0:43:50
phoe_krk_
since GNU is focusing on Guile now plus Stallman isn't a Common Lisp man in the slightest.
0:44:24
cmhobbs
phoe_krk_: it's been several years since i've touched common lisp. i didn't know if something else had replaced it
0:44:48
|3b|
there is also sly, which is a fork of slime and has some nice features, but slime still seems more common
0:45:06
aeth
There's the always-promised emacs port to Guile, and there's the new Guix, and I think Guile might be in a few applications.
0:45:34
aeth
But, yeah, I don't think GNU has much of an interest in Common Lisp. Their philosophy is using C and scripting in Guile
0:47:05
aeth
Iirc, there are some BSD pieces, and in areas where there are no public domain, it falls back to BSD
0:47:32
cmhobbs
one last question: is quicklisp popular? it didn't exist when i was using common lisp (or at least i didn't notice it). it seems useful
0:48:24
aeth
cmhobbs: Quicklisp is popular and useful, even for local projects. Just link to your directories in ~/quicklisp/local-projects/ and make sure you have an .asd file
0:50:05
phoe_krk_
and you're able to (ql:quickload :yournamehere) from any Lisp instance that has Quicklisp set up.
0:52:03
|3b|
* likes drawing attention to a small subset of the parens, but is too lazy to actually configure that
0:54:34
|3b|
yeah, that's the subset i'd be interested in, along with matching one under/before/after cursor
1:02:03
kenanb
jurov: no need to hide :) people here use emacs because it is nicely integrated, and probably many like it (I love it), but I don't think CL community can be considered particularly part of Emacs Church.
1:02:04
aeth
I just don't get the vim community. Neovim missed out on the opportunity to call itself vimim.
1:03:01
aeth
emacs lisp is basically a step back in time 20 years afaik. I think most in the CL community would like for there to be a CL emacs, just not enough to make a new one or improve an existing one.
1:03:18
aeth
Although who knows, maybe there's an awesome one in progress that no one here knows of yet
1:05:50
aeth
I suspect the problem is that GNU Emacs is good enough, and there are more interesting things to do.
1:07:16
jurov
i'd like to see some development surprising direction, like editors with outline as first-class feature (like Leo-editor), or even further (I really like DRAKON).
1:09:10
jurov
especially DRAKON is not compatible with usual notion of text, and I hate the mismatch.
1:09:34
aeth
jurov: Well, if it's designed for Common Lisp, you don't really need to make it line-oriented like most editors are.
1:12:44
jurov
aeth, it's not designed for particular language, its goal is to be able to draw the logic in very clear and understandable 2D layout. and it has no import.
1:13:19
aeth
jurov: I'm not familiar with that editor in particular, I'm just saying that s-expressions should be particularly good for exotic approaches.
1:15:21
jurov
it depends. for example, sometimes the algorithm can't be mapped into tree of if statements, and then it uses or emulates goto statements
1:16:20
phoe_krk_
aeth: climacs needs a few people to push it forth along with CLIM implementations.
1:20:21
aeth
phoe_krk_: it might be easier, though less CL, for there to be an editor in Qt or something
1:36:51
kenanb
fiddlerwoaroof: try (asdf:load-system :qtools :force t) but it might be even better if you manually remove qt related libraries in cache and then do loading as always
1:37:37
fiddlerwoaroof
kenanb: I've solved this problem before, I think I have to rebuild everything and maybe reinstall q.
1:38:47
fewdea
Hi all, what is a 'lock' in the context of hunchentoot sessions? "session-db-lock acceptor &key whole-db-p => lock" ... and why is it bad to have concurrent session access?
1:39:33
kenanb
fiddlerwoaroof: I don't exactly know what qt, qt-libs, qtools combination do in the background, so when I have a problem, I usually just try that with simply removing cache for all
2:42:39
Cthulhux`
i have two lists, i loop through one and i want to process the second one at the same time, so when i "look at" the 4th element of the looped list, i want to access the 4th element of the other list too.
2:45:52
kenanb
Cthulhux`: how to do it depends on what behaviour you expect from the iteration exactly, e.g. is it possible that two lists will differ in length? do you want the iteration to depend on the a primary lists or the one that has the max lenght
2:46:40
Cthulhux`
hmm.. in this very case: i have one list of headers and one list of contents, the contents are probably (!) of the same number as the titles
2:47:22
Cthulhux`
making it failsafe is a different thing, /for now/ i assume they are of the same length
2:48:18
kenanb
then if we exclude exceptions, you can simply loop through the elements using two sequential FOR-IN clauses
2:55:57
kenanb
"as" is a synonym for "for", and clhs states "By convention, for introduces new iterations and as introduces iterations that depend on a previous iteration specification." therefore you might use "as" instead of "for" in the secondary iterator clause as a semantic marker that the main iterator is the one that starts with "for" but it is only semantic, that doesn't actually change the behaviour
2:58:21
kenanb
the looping will terminate when the shortest sequence that is fed to one of the "for-as-in" clauses terminates.
3:01:00
Cthulhux`
i noticed that, according to the lispworks manual, "for x being the elements of ..." works too. at least it's verbose.
3:01:08
kenanb
Cthulhux`: some consider it dirty, unlispy etc. but most loops are no rocket science and looping is frequent. so IMHO it's ok. if you really feel like not using it there are mapping constructs, do forms and also the library "iterate".
3:01:55
Cthulhux`
nah, external libraries as aliases for already implemented language core features are not lispy either. this isn't python :-)))
3:04:17
kenanb
also pardon me I mean list when I say sequence, for-as-in is for lists, not sequences in general
3:04:35
kenanb
there are probably other alternatives for iteration that I forgot or don't know about
3:07:12
kenanb
Cthulhux`: iterate is not really an alias for loop, it is a very capable procedure by itself for sure.
3:12:42
kenanb
so far I didn't happen to encounter an iteration problem that I found the solution via loop to be problematic, there are some examples in iterate library page though
3:13:28
Cthulhux`
i'm sure loop can handle all possible cases. i'll just need to learn the syntax, i guess
3:20:46
jasom
one of the examples on the iterate page missed the best solution for one of the examples (the nested collect)
3:21:10
kenanb
Cthulhux`: well, if you don't like loop syntax, iterate is popular enough nobody will criticize you for using it.
3:21:41
fiddlerwoaroof
One nice thing about iterate is that it gives one construct for iterating over any kind of iterable.
3:22:41
fiddlerwoaroof
It's kinda funny, a couple months ago, I use to turn to python for any task that needed a one-off script, now I use lisp.
3:23:46
Cthulhux`
but i wouldn't use it for production anymore. the syntax makes refactoring nearly impossible. (whitespaces are syntax.. really?)