freenode/#lisp - IRC Chatlog
Search
18:20:04
aeth
I think I finally have a decent shader class (the rest of the file is still a mess, though): https://gitlab.com/zombie-raptor/zombie-raptor/blob/302de75034dfd3a3350de8fe2a31cd631cfa72d3/data/shader.lisp#L57-142
18:22:54
aeth
I've noticed several things: (1) I could check everything I check in check-shader at compile time in the shader creation macro (afaik) instead of or in addition to during shader creation and (2) check-type on a destructuring-bind (or any local bind) is dangerous because it makes you think that you can correct it, but you're just correcting a temporary, soon-to-be-discarded lexical scope variable
18:24:49
aeth
I could also check for equality and if the variables aren't equal at the end update them. The problem with that is that destructuring-bind can get really complicated.
19:14:26
borodust
Xach: I missed one dependency for the lib i suggested to add to main quicklisp. Should I create a new issue or just putting info about it into existing issue (with libs that depends on it) is enough?
19:15:58
borodust
https://github.com/quicklisp/quicklisp-projects/issues/1445#issuecomment-367437114
19:46:35
NJM8
Hello! I am reading through SICP and need some help on exercise 1.9. The goal is to compare the process of two different programs, one iterative and one recursive, but the code from the book seems to run forever. Can anyone help?
19:52:38
NJM8
That's what I thought when reading though but here is the result: https://pastebin.com/g323aGq6
19:53:45
pjb
NJM8: however, you can do the exercisess in Common Lisp. Several people have done that (unfortunately, a nice blog with all the answers doesn't seem to exist anymore).
20:06:59
stacksmith
It was a sad day when MIT replaced 6.001 that used SICP with a Python class... We can celebrate 10 years of Lisp illiteracy this year, I believe.
20:07:39
pjb
It was not exactly a replacement: scheme was still used for CS major. The Python class was for non-CS majors.
20:15:16
shrdlu68
Is there a way to compile all functions that call an inlined function when said inlined function is recompiled?
20:26:31
stacksmith
ACTION is picturing pjb laughing contageously and slapping his knee up while implementing a recompilation mechanism.
20:27:12
|3b|
if M-x slime-who-calls (C-c C-w C-c) works, i think you can C-c C-k in the resulting list buffer to recompile everything it found (not automatic though, but implementation of slime-who-calls might help with implementing previous suggestion)
20:28:11
flip214
shrdlu68: if your ASDF has correct dependencies set, all required functions should get reloaded, too.
20:28:27
stacksmith
It may be wise to wrap optimization-related declarations into a macro that makes them go away during development...
20:32:09
stacksmith
If I had a dime for every time I had to remove .cache and .fasls I would have a few bucks now. Of course I shouldn't have screwed around prematurely optimising things that wound up thrown out anyway. But I am not that wise.
20:42:55
flip214
anybody wants to debug a quux/lparallel/sbcl issue? I'm too tired (or too stupid, take your guess ;).
20:47:59
flip214
phoe: https://pastebin.com/5nmbABZf includes the reproducer, the stack traces, and my (failed?) expectations
20:48:31
flip214
I'll go back reading some papers now - if you have any information, please just jot it down here, I'll read the scrollback tomorrow.
20:50:16
flip214
phoe: the division-by-zero is expected, yes. I'm causing it with the "wrong" argument.
20:50:32
flip214
but this is just an example of an error that can happen; this one is easy to reproduce.
20:51:24
flip214
phoe: the division-by-zero is expected. that the tcp socket hangs and quux becomes unresponsive is what I don't want.
20:52:23
flip214
and there's a HANDLER-BIND in hunchentoot/util.lisp, but that doesn't seem to be used...
20:54:07
phoe
...you could possibly interrupt all kernel workers for good's sake, you'll get all the traces with some of them being actually useful
20:58:21
flip214
phoe: I believe that the second error (posted in the same paste) simply kills the quux request dispatcher, and that this is the reason it stops working.
21:41:45
Nouv
Does macro expansion happen at compile time, or does every lisp implementation that supports macros also come with an interpreter built in?
21:42:21
phoe
specifically, to compile Lisp code, you have to macroexpand all macros that are in it.
21:43:01
phoe
And some of them don't come with interpreters enabled by default. See SBCL that compiles everything by default.
21:43:54
Nouv
Just starting to study assembly at uni so wondering how everything works at a lower level
21:45:45
Xach
Nouv: the nice thing about lisp is you can skip the lexing and parsing by using the reader...
21:46:56
earl-ducaine
And has a very succinct description of 'compile' and 'interpretter' and the difference between the two
21:48:13
phoe
a function is something that gets called normally, allocates some stuff on the stack, has return values, et cetera
21:48:35
phoe
a macro is a function, except it is called at macroexpansion time, and its task is to transform some Lisp code into some other Lisp code
21:51:54
Nouv
pjb: I'm not specifically using common lisp (the goal is to roll my own), so looking to understand the theory
21:55:17
k-hos
in cl if you attempt to read out of a strings bounds what happens? error? nil? garbage?
22:17:53
DBeepBeep
Hey, I need to free some resources in an external library when an object is no longer referenced.
22:19:44
phoe
just remember not to close over the finalized object in the finalizer. this creates memory leaks.
22:20:26
phoe
be sure to test your finalizer with some simple print statement - (make-instance 'finalized-class) and then (trivial-garbage:gc :full t) until you see your print occurring.
22:26:39
|3b|
and remember that they may never be called, so try to free things manually as well if possible, and just use finalizer as a backup
22:44:52
k-hos
so what do I need to do if I want to use the same name for something that lisp uses already
22:51:56
specbot
Introduction to Packages: http://www.lispworks.com/reference/HyperSpec/Body/11_aa.htm
22:53:42
phoe
stacksmith: something that was used for loading additional libraries in ancient times.
22:59:44
pjb
stacksmith: you have two cases: you're loading a system and you want to avoid loading twice the same file (or the same dependency). Then provide/require is a mechanism that could be used. However if you use it, the second case: you have loaded a system, made modifications in its sources, and now you want to load it again, to get the updates; it will fail if you used provide/require, since the system has already been provided, it
23:00:46
pjb
Instead, we use asdf to resolve the DAG of the dependencies and to ensure files and dependencies are loaded only once. Also, asdf is able to reload stuff when files have changed.
23:01:36
pjb
And of course, we use quicklisp which wraps over asdf, since systems are obtained from the internet nowadays, which was not something common (or at all automatic) when provide/require were invented.
23:05:43
stacksmith
pjb: So as intended it worked because one rarely reloaded source files but rather worked in-image?
0:54:18
pmc_
I was following along in PCL Chapter 2 with SBCL/SLIME/emacs on Windows. It reads "To quit you can use a SLIME shortcut: at the REPL, type a comma. Then you will be prompted for a command." When I press comma at the REPL, SBCL stops reasponding. I do not get a prompt at the bottom of the Emacs winodw. Any ideas why?
2:11:15
Xach
in the implementation of parse-integer that parameter is checked and changes how the function behaves.
2:15:57
comborico1611
So far i am pleased with Practical Common Lisp, but i always like to have a backup.
2:36:16
Xach
pfdietz: what kind of incompatibility is most problematic for you? the one that springs first to my mind is package names.
2:39:58
pmc_
Xach: It turns out SBCL prints an error message when comma is entered at the REPL. I guess SLIME and emacs are not expecting that.
2:40:34
Xach
pmc_: the possible problem is that you are not using the "fancy" repl, which was once the default but now is "optional"
2:41:27
Xach
At any rate, M-x slime-repl-<command> will also do whatever ,<command> is described to do.
2:42:31
Xach
pmc_: I'm not sure. possibly the slime manual. i use (slime-setup '(slime-fancy)) to get it
2:43:15
Xach
pfdietz: that specific example stems from the same desire to fake out code that thinks it's on allegro
2:46:50
Xach
pfdietz: I've wished to somehow relate system loading to packages defined, but haven't worked it out yet
2:53:11
pfdietz
I think standarization and usage of local nicknames would help, but all the lisps would have to get together for that.
2:54:54
pfdietz
This came up for me because I'm trying to load as many systems as I can from quicklisp to provide raw material for mutation testing.
4:39:05
whatsupdoc
My function takes as input a list that is always is of the form ((a b)(a c)(a d)) where a is the same number or atom
4:46:32
Zhivago
It appears that you are complaining that recursively processing all but the first element of a list does not process the first element of the list ...
4:49:51
Zhivago
In what regard is the first element not incorporated given that ((1 2) (1 4) (1 6)) outputs (2 4 6)?
4:54:58
whatsupdoc
i try something like this, but this is just dumb https://pastebin.com/raw/8KtkxeZu
4:55:55
Zhivago
Just write two functions -- one to do the whole job, and one to do the recursive bit.
4:56:59
Zhivago
You pretty much had it with your (second (car q)) (undistribute-recursive (cdr q)) except for the stupid bits.
4:57:58
Zhivago
Although if you really want a single function, you can compute it recursively -- you just need to consider the return path.
4:58:58
Zhivago
Think of the solution for ((1 2) (1 4) (1 6)) and the solution for ((1 4) (1 6)), then think of how to get from the latter to the former.
4:59:44
Zhivago
Remember in the recursive approach you are reducing ((1 2) (1 4) (1 6)) to some operation plus the same reduction upon ((1 4) (1 6)) and so on.
5:02:16
Zhivago
They need to start with a class on "Questions: How to ask and answer them intelligently".
5:02:38
aeth
There are two kinds of academic Lisp. Academic Lisp that follows conventions and academic Lisp that does not follow conventions.
5:04:41
beach
whatsupdoc: This is not a channel for newbies. But if your purpose is to learn Common Lisp (CLISP is not an abbreviation for Common Lisp, it is an implementation of Common Lisp) we can help you. But then, you first have to use the conventions and the tools that the people here use.
5:05:42
learning
this is an academic question (ie not building something just trying to understand), can i see all of the generic functions that take a specific class as an argument
5:05:45
beach
whatsupdoc: However, if your purpose is to have someone do your homework for you, so that you don't have to learn Common Lisp, then you might be out of luck.
5:06:45
Zhivago
whatsupdoc: What does undistribute-recursive produce given ((1 2) (1 4) (1 6))? How about for ((1 4) (1 6))?
5:12:10
beach
learning: If you are using SBCL, you could try (sb-mop:specializer-direct-generic-functions (find-class 'character))
5:12:21
Zhivago
So, shouldn't we expect (1 (2 4 6)), (1 (4 6)), (1 (6)) given ((1 2) (1 4) (1 6)), ((1 4) (1 6)), and ((1 6))?
5:16:01
beach
learning: Yes. CLOSER-MOP is one of those wonderful compatibility packages though, so you can use it independently of your implementation.
5:18:12
aeth
whatsupdoc: Consider the problem of doing foo at compile time. Clearly, that's possible in dozens of languages.
5:18:59
beach
whatsupdoc: We can't. Like I said, we are silly people. Quit before it's too late, or you won't want to go back to your current languages ever again.
5:19:40
Zhivago
whatsupdoc: So your thesis is wrong -- become less ignorant and ask a more intelligent question.
5:19:58
learning
i got to a point where i needed to commit to a language if i wanted to get better at programming. so i chose the one that fit my personality type, the one with outlandish promises of how amazing it is. that's why i chose lisp. it took me years before i actually got to the point where i could explain using lisp over other languages. and ive been a slightly less shitty programmer ever since
5:20:14
Zhivago
whatsupdoc: Now, understanding how 'add' works, can you see how your problem has a similar recursive structure?
5:22:03
aeth
(and (typep 10 'number) (typep 10 'real) (typep 10 'rational) (typep 10 'integer) (typep 10 '(signed-byte 64)) (typep 10 'fixnum) (typep 10 '(unsigned-byte 32)) (typep 10 '(integer 0 1000)) (typep 10 '(mod 360))) ; not an exhaustive list
5:22:17
learning
lisp has no types, 2 types, blue types, red types: http://sellout.github.io/media/CL-type-hierarchy.png
5:23:21
Zhivago
whatsupdoc: Just pretend that you're not a completely useless human being and look it up.
5:24:32
learning
the problem with trolling lispers is that we can't wait to talk to anyone about lisp
5:26:06
Zhivago
beach: Eventually some of them unlearn their acquired stupidity sufficiently to be able to learn.
5:28:27
Zhivago
Certainly -- it comes from viewing stupidity as a set of learned skills to help prevent learning.
5:32:36
beach
whatsupdoc: You seem to know nothing about elementary software engineering. If you submitted such non-idiomatic code to me, I would give you a failing grade.
5:33:45
Zhivago
He means that you write code like a retarded monkey might, if given sufficient drugs.
5:33:46
learning
i end all my lisp lines with semicolons just to remind myself that it's my choice not the computer's
5:33:50
beach
whatsupdoc: Your code doesn't even follow the formatting conventions of Common Lisp. Maybe you have not been taught that code is mainly a means of communication between developers and not between a developer and the computer.
5:34:15
beach
whatsupdoc: So the first thing you need to do is to respect the conventions that the people reading your code are used to.
5:34:29
aeth
learning: You can even write C in Lisp if you non-portably use type declarations in declare or portably use check-type and pretend that that's good enough (it usually is)
5:34:55
beach
whatsupdoc: I think if you were to read a few existing Common Lisp programs, you would see how different they look from the code that you show us.