freenode/#lisp - IRC Chatlog
Search
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). "
5:09:23
beach
MichaelRaskin: In my specification, I wrote that the application may not stop if there is a non-local control transfer.
5:13:09
beach
Actually, I don't think I specified non-local in the specification. But to answer your question, you can't tell from the form itself whether it is non-local or not.
5:13:56
beach
It is local in (tagbody 1 ... (go 1)) but not in (tagbody 1 ... (f (lambda () (go 1))))
5:15:47
specbot
Transfer of Control to an Exit Point: http://www.lispworks.com/reference/HyperSpec/Body/05_b.htm
5:16:43
beach
So, if the transfer is lexical, you can probably have the application stop, but if it is dynamic, then you might have to solve the halting problem.
5:17:48
MichaelRaskin
Well, for go unlike throw you still have to find yourself in instrumented area
5:22:49
beach
But GO and RETURN-FROM are lexical, so you know statically where they end up. Therefore, you can decide to stop at that exit point when you are about to evaluate a form like that.
5:28:55
MichaelRaskin
Actually, supporting GO and RETURN-FROM at the level of LOOP is already a bit annoying
5:41:27
beach
MichaelRaskin: You speak in riddles as far as I am concerned. But then, I am notorious for having a hard time understanding what people want to say here.
5:42:03
MichaelRaskin
Well, step-over is a nice and simple operation when there is no go/throw/return-from inside
5:43:42
beach
Not that it matters much that I don't understand. I just wanted to let you know that I am not following.
5:43:52
MichaelRaskin
And to support that in STEP-OVER I need to implement some special cases carefully.
10:02:33
LdBeth
ACTION uploaded an image: ima_0bf4f93.jpeg (556KB) < https://matrix.org/_matrix/media/v1/download/matrix.org/UiBpynCyqVhBNvKlbIJnRXZo >
11:06:25
minion
arkaros: SICL: SICL is a (perhaps futile) attempt to re-implement Common Lisp from scratch, hopefully using improved programming and bootstrapping techniques. See https://github.com/robert-strandh/SICL
11:06:37
minion
arkaros: Cleavir: A project to create an implementation-independent compilation framework for Common Lisp. Currently Cleavir is part of SICL, but that might change in the future
11:08:11
beach
arkaros: I am also working on Second Climacs: https://github.com/robert-strandh/Second-Climacs
11:10:53
beach
arkaros: If so, here is a list of suggested projects (suggested by me): http://metamodular.com/Common-Lisp/suggested-projects.html
11:12:41
arkaros
Cool i will make sure to look in to it. I'm mostly looking for some lisp code to read and play around with. Im just getting in to lisp. Have some clojure experience but not much
11:13:45
minion
arkaros: direct your attention towards pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
11:14:06
jackdaniel
it shows many important aspects of the language (it is a bit clos-centric though)
11:14:37
jackdaniel
for a different perspective you may take a look at ANSI Common Lisp by Paul Graham (you need to pay for this one though)
11:14:37
beach
arkaros: This project is fairly complete and uses CLOS a lot: https://github.com/robert-strandh/Cluffer
11:14:37
arkaros
Yeah i looked at that a bit. Do you know if it is possible to get that one in a mobi format. Would love to read it on my kindle
11:15:33
jackdaniel
recently PAIP was released in a dead tree form, that should be possible to compile to mobi I think
11:19:37
arkaros
Thanks you guys have been really nice. I would love to get in to lisp a bit more since I really like the simplicity (but at the same time complexity) of the language
11:20:36
beach
arkaros: You can come here for advice when you start producing code. Also, before deciding on what to install and how, you should ask advice.
11:27:15
arkaros
I used to use emacs actually but i prefer vim since i think that it integrates better in my current work flow
11:30:45
arkaros
But at the moment I work as an android developer so i spend most of the time in android studio and use vim mostly for quick edits for git commits and README files
11:33:03
jackdaniel
it is a shame that the only way to be productive in CL is to use emacs, which is pretty awkward editor if you ask me
11:34:02
arkaros
I quite liked emacs. Especially since i used spacemacs that had most of the config premade for me
11:35:39
arkaros
The main issue for me is that I use the reminal quite heavily and the terminal emulator in emacs just wasn't that good imo and tmux+vim just made more sense to me
11:37:35
LdBeth
That’s to say, they just happen to share a fair amount of keybindings, and they all use a dialect of lisp as config language.
11:43:19
dim
jackdaniel: I prefer M-x shell over M-x term, and I've reduced my use of a terminal to almost nil these days