freenode/#lisp - IRC Chatlog
Search
17:10:42
littlelisper
(set-macro-character #\] (get-macro-character #\))). does this mean that the reader replaces ']' by ')'?
17:11:17
pjb
littlelisper: if reading something starting with ) makes any sense! The reader macro on #\) just signals an error.
17:12:28
pjb
littlelisper: notice that to read lists, READ uses a function similar to READ-DELIMITED-LIST (but not this function, since it is not able to read dotted-list). This function can be used in a reader macro for #\[ to read lists terminated by #\].
17:13:26
pjb
Now, the reader macro for #\) will probably mention #\( in its error message. This may not be the best choice for #\], since it would be confusing to the user. It would be better to implement your own reader macro for #\] with a specific error message.
17:14:08
pjb
Notice that you also want to make #\] a terminating reader macro, so you can write [a b c] and not have to write [ a b c ] ; <- notice the space.
17:14:42
pjb
Happily, this is what happens by default (the optional non-terminating-p parameter is nil by default).
17:15:46
pjb
If the macro was non-terminating, it would be that if there was no space before, it wouldn't be interpreted as a reader macro, but as a consituent character of the previous token.
17:17:45
pjb
For example, # is a non-terminating reader macro: (quote (a#b c##d)) #| --> (|A#B| |C##D|) |#
17:29:17
gendl
Fade: I just upgraded Slime the quick & easy (and probably dangerous) way -- manually copied the slime-2.21 into quicklisp/dists/quicklisp/software/slime-v2.21, then edited quicklisp/dists/quicklisp/installed/systems/swank.txt to point to that one.
17:31:04
gendl
Anyway, I usually install quicklisp clean each time anyway rather than trying to update in-place. That's probably overkill, but another reason I do it is to keep down the size of the quicklisp directories that we distribute ourselves with Gendl and Genworks GDL releases.
17:50:27
MichaelRaskin
beach: some cleanups help, but I am not sure how to break 30x slowdown in compilation speed. Or 30x runtime slowdown, but runtime doesn't feel completely absurd, at least.
18:30:08
makomo
gendl: your software is interesting stuff and a good showcase of what CL software looks like
18:31:31
makomo
gendl: for example "G102 Video 3" isn't very informative (and has no description either), and i think that's it's very interesting to see
18:31:46
makomo
including "common lisp" somewhere in the description as well would allow people to find common lisp stuff more easily as well :-)
18:32:23
makomo
(i'm watching the video because i'm interested in what the software does and how it's used btw)
18:51:19
Smokitch
What is the difference between generic dispatch and multiple dispatch? And is generic dispatch just called generic because of generic functions?
18:53:21
dlowe
"generic dispatch" is the process of calling the correct method given a generic function.
18:53:42
dlowe
"multiple dispatch" is the process of deciding which method is correct by using the types of multiple arguments.
18:54:26
dlowe
In other languages with "objects," typically generic dispatch is only based on the type of one of the parameters.
18:56:37
makomo
and where does the adjective "generic" come from? i suppose it's just from the name "generic function", i.e. "the dispatch within a generic function"
19:02:06
dlowe
I speculate that it's generic with respect to applying the function. The normal function call is a specific case of a generic function.
20:48:49
MichaelRaskin
beach: and of course it is a completely different story what to do when a condition is signalled in the debugged thread…
21:00:52
varjag
is there a simple way to convince hunchentoot to not treat + as whitespace in request parameters?
21:22:02
White_Flame
but you should probably be using a function to safely encode your parameters instead of special casing it
21:45:10
MichaelRaskin
beach: also an interesting question what exactly should happen for step-over for a form that contains a go or throw that might land inside or outside that form.
21:47:11
White_Flame
in my experience in other languages with thrown exceptions, that tends to just continue running, unless you have "pause on exceptions" set
21:48:13
MichaelRaskin
If I already take 30x hit for both compilation and runtime, adding actual logic for handling that might be a good idea…
22:16:47
White_Flame
is there a moderator for #lispcafe? kinda needs it as epony went there from here
22:59:19
MichaelRaskin
beach: I am not sure throw between the instances of a recursive function can be distinguished in a portable way.
23:03:24
White_Flame
why not? if there's a potential throw destination in a stack frame, you can't tail recurse
23:06:30
White_Flame
sure, manually externalize your own stack of active handlers so you can let TCO do its thing unfettered
1:12:05
Xach
mfiano: i have to work through http://report.quicklisp.org/2018-06-25/failure-report.html and fix everything. some of it is my new debian 9 test environment, some of it is not.
1:20:45
aeth
MichaelRaskin: How? I tried macroexpanding outside of the symbol-macrolet and inside and I couldn't get either. e.g. this just gives me (+ foo foo): (let ((bar 42)) (macroexpand-1 `(symbol-macrolet ((foo (expt bar 2))) (+ foo foo))))
1:21:31
aeth
I've tried moving the macroexpand-1 around in different places, and quoting and unquoting different things.
1:21:33
MichaelRaskin
When you macroexpand-1 with 1 argument, you are macroexpanding in the global environment
1:22:04
MichaelRaskin
To notice a local symbol-macrolet — as well as for macrolet — you need to expand in the local lexical environment
1:24:42
MichaelRaskin
(Also, macros + scope = fun effects that we don't talk about because we lack proper words for them)
1:37:50
MichaelRaskin
A macroexpand-1 call cannot know the calling lexical environment, a macro expansion function defined with defmacro and used because of a macro invocation is allowed to be aware of lexical environment at the call site.
1:57:10
stacksmith
Good morning... Could someone confirm that in (defun foo(a) (macrolet ((bar (b) `(list ,b a)))...) bar's a is not foo's parameter a? I am confused by CLHS example - it seems to imply that lexicals above the macrolet are not accessible, but later states the opposite...
2:06:22
stacksmith
So the comment "The parameters x and flag are not accessible at this point" is referring to the macro-expansion function itself (as opposed to the expansion) But then there is a really ominous "but the consequences are undefined if the local macro definitions reference any local variable or function bindings that are visible in that lexical environment", referring to the lexical environment of the macrolet definition. That is sti
2:10:25
stacksmith
In my book quasiquoting/splicing lexicals in the scope of the macro definition is a kind of a reference to a local variable binding (that seems to be prohibited).
2:13:06
stacksmith
LdBeth: could you clarify - I've been thinking of macrolet as a local defmacro...
2:19:53
stacksmith
Bike, SBCL happily expands foo's a right into the list. I was assuming CLHS means to say that values of lexicals are not accessible to the expander (because it runs at compile time and only symbols are availble) but the macro is free to expand lexicals like in my example. But it really says something else - and what it is I cannot figure out.
2:21:27
Bike
(defun foo (a) (macrolet ((bar (b) `(list ,b a))) (bar 'c))) is identical to (defun foo (a) (list 'c a))
2:25:13
stacksmith
Bike, please explain - if the macro function knows nothing about A... Does it not expand to (list 'c a)? It has to know about the binding...
2:28:44
stacksmith
OK, I was considering the act of expander copying a name as knowing something about the binding, but I see that it's better to say it does not. So all the warnings really have to do with the expander's environment, right?
2:30:18
stacksmith
CLHS stating things like "but the consequences are undefined if the local macro definitions reference any local variable or function bindings that are visible in that lexical environment.".
2:30:48
Bike
if you have (let ((a (some-long-computation))) (macrolet ((foo () a)) ...)) it's a problem because obviously the long computation only happens at runtime
2:31:13
Bike
but ((foo () 'a)) is fine because it's not using the value, it's just returning a symbol that happens to name a variable sometimes.
2:31:51
White_Flame
stacksmith: issues like this is why many macros ask you to provide variables for them to use in bodies
2:32:47
White_Flame
ie, in (with-open-file (stream "foo.txt") ...) you give it the variable named 'stream, instead of using a variable that it expands to and hope everything matches
2:33:26
White_Flame
but macrolet is always within a lexical scope, so if it expands references to lexical variables in its outer scope, that's a generally safe expansion
2:33:35
stacksmith
Yeah, that makes sense with macros that provide a lexical environment to the body... I was concerned with the opposite - a macro consuming the existing lexicals...
2:34:42
White_Flame
in the macrolet examples above, the value of lexical variable A is never accessed during the expansion. It's simply a literal symbol in a source code expression that is being generated
2:36:17
stacksmith
I've always assumed that, but reading CLHS confused me a bit. Probably because I was not thinking of bindings incorrectly and wrongly thought of symbols in a macro as bindings. Obviously, they are just symbols at that point.
2:42:15
White_Flame
however, in classic LISPs there were f-expressions, which are sort of like macros, but take source code and execute it
2:43:04
White_Flame
those things do have the full runtime per-invocation environment available to them
2:43:06
aeth
Afaik it's like using EVAL at runtime, and isn't very efficient, and that's why it got dropped
2:43:38
Bike
you can't really compile them and their existence further implies that the lexical environment has to be available at runtime
3:49:53
asarch
Reading about CLOS and the way it does OOP, I've come to realize that is also possible (more or less) the same with the C programming language
3:51:14
asarch
It seems that the main developers of this widget toolkit knew about the CLOS techniques and they implemented across this toolkit
3:52:04
asarch
In C++ using GTK+, you could create a window with: Window my_window; and the change the properties with: window.set_tite("Hello GTK+ world!");
3:53:01
asarch
On the other hand, with C you must: GtkWidget *my_window = gtk_window_new(); gtk_window_set_title(GTK_WINDOW(my_window), "Hello, GTK+ world!");
3:54:32
asarch
For every action to the window (resize it, clicked it, close it, etc), you must declare a callback function
3:56:23
asarch
This is, however, made it with the C style: void my_callback_for_a_click(); g_signal_connect(my_window, "clicked", my_callback_for_a_click, "somedata");
3:57:06
Bike
a function that can be specialized on any parameter or more than one parameter, instead of just one as in C++ dispatch.
3:57:52
p_l
asarch: creators of GTK+ wrote GIMP sometime after going crazy from writing a compiler in Common Lisp for assignment
3:57:56
asarch
Yeah, actually there is a function to "refresh" a widget on the screen: gtk_show(my_window); or gtk_show(my_button); or gtk_show(my_some_other_widget);
3:59:09
p_l
asarch: you might want to lookup "COS", "C Object System", which is as direct port of CLOS as possible :)
4:27:13
p_l
pillton: "A couple of students at Berkeley, Spencer Kimball and Peter Mattis, decided they wanted to write an image manipulation program rather than write a compiler in scheme/lisp for professor Fateman (CS164). "