libera/#commonlisp - IRC Chatlog
Search
18:28:39
Guest74
my only problem with people saying use emacs for common lisp because it 'indents properly' is that you get a rude awakening when pasting stuff because emacs by default does not indent CL properly since it sticks in a bunch of tabs.
18:31:01
aeth
It also doesn't indent properly without SLIME, and without the libraries in question loaded into an active SLIME REPL
18:31:15
aeth
because it uses some things like the distinction between &rest and &body to inform its indentation
18:31:46
aeth
and without loading the library, it's going to assume that the macro is a function unless it's a COMMON-LISP built-in
18:32:32
aeth
Forgot to Quickload it before modifying it? Well, that means that you've just messed up your file's indentation.
18:53:23
Guest74
phoe: if I steal your rotation stuff you did for imago what would be the best way to credit you? Mind you I still haven't looked at it.
18:55:16
Guest74
I guess I can stick that in the commit message? It seems like a comment in code isn't sufficient attribution, at least in my mind.
18:56:17
phoe
also be cautious not to take too much imago code along the way if your code isn't LLGPL
18:57:11
Guest74
yes, I'll do both. I guess I should probably have asked a more git specific method of attributing a commit to someone else. Though I'll probably have to change the code somewhat as all my stuff uses linear arrays.
18:57:50
Guest74
rotations is the only thing I don't have(besides 90 degree rotations/mirroring), and everything is lgpl.
19:01:00
Guest74
just took a look, looks like I can just change a few function names and it should work as is.
19:03:08
phoe
Guest74: remember to grab the updated code from imago and not from my commit, there were some fixes made later on
19:37:00
Josh_2
I used to use http://wiki.c2.com/?ImageBasedLanguage but the site appears to be dead :cry:
20:02:50
nij-
Hi! I'm using sly in emacs. However, its completion doesn't work. When I do M-x sly-next-completion, a message says "No buffer named *sly-completion*." Anyone had this issue before?
23:43:43
jmes
When I use the executable of my program (built with asdf:make & sbcl), my (format t "...") output only gets displayed in a terminal after I exit the program. In SLIME it's fine. I'm pretty clueless so any ideas would be appreciated.
23:45:54
jmes
for example I have a prompt like (format t "Enter something:") and then a read-line. Even though I can enter something to be read and everything else works as intended I won't see the prompt text until I SIGINT the program
3:40:45
pillton
Bike: I was referring to operations involving AREF like (dotimes (i (length array)) (incf (aref array i))) where there is nothing you can do to hint that the index given to AREF and (SETF AREF) is always valid for ARRAY (well, something more sensible than (declare (optimize (speed 3) (safety 0)))). A "sufficiently smart" compiler could possibly derive that example, but what about more operations for more complex data structures e.g. a
3:40:45
Colleen
pillton: Bike said 13 hours, 36 minutes ago: "I think there should be another operator or operators introduced which either avoid using AREF or ensure that every call to AREF does not require checking its arguments." what do you mean?
3:40:45
pillton
heap? One could argue that the cost of the index check is negligble compared to some of the heap operations and thus not worth exploring.
3:41:39
pillton
Bike: Perhaps a better example is (dotimes (i (length array2)) (incf (aref array1 (aref array2 i)))).
3:43:49
pillton
Bike: I get the concurrency argument, but I think there is something more fundamental that needs to be addressed.
3:45:51
pillton
Maybe the problem goes away if you define operations which operate on "blocks" with a fixed length i.e. simd operations?
3:47:03
pillton
But there has to be a safer way to implement optimize operations like matrix multiplication, SVD, proximity operators, heaps without resorting to (declare (optimize (speed 3) (safety 0))).
3:47:58
yottabyte
how do you all feel about this? https://github.com/cl-boost/threading. I found such macros useful in clojure
4:13:39
Bike
pillton: short version would be like, the ability to declare that an array's length is some other variable.
4:18:03
Spawns
lisp macros can call any functions eval'd before the macro definition yeah? how does that work?
4:18:52
Spawns
i am at the point where the next thing i need to implement in my lisp is macros, but I'm not sure how to deal with generating bytecode and expanding macros that depend on programs, which are bytecode
4:19:43
Spawns
i am thinking to compile and interpreter a single expression at a time, and the compiler is going to have to be able to pass in data to be expanded while compiling
4:20:29
Bike
Spawns: generally, the lisp compiler has access to a lisp interpreter or other way to evaluate lisp code. it then just calls the macro function on the code.
4:20:41
Bike
pillton: it is. makes your type system uncomputable and stuff. but lisp's already is, so hey
4:21:24
Bike
"this array is x long, so if (0 <= y < x), (aref array y) doesn't have to bounds check"
4:21:32
moon-child
Bike: why would you need an interpreter? Aside maybe from bootstrapping, I see no reason why you could not compile the macro body
4:23:14
Bike
i didn't mean to say you couldn't use it. i am trying to explain this to someone who is perhaps not familiar with the internals of lisp implementations.
4:26:29
beach
Spawns: It shouldn't matter whether your Lisp functions are implemented as bytecodes, primitive functions in assembly, interpreted functions, native code, or anything else. A macro is expanded by a call to the macro function which is given an S-expression (and an environment in Common Lisp), and which returns another S-expression.
4:50:30
beach
Spawns: It is very hard to help you with this thing, because you are implementing a language for which we have no specification. So we have no way of knowing what kind of restrictions or generalizations your language has compared to Common Lisp. The best thing we can do is to let you know how things would be done in a typical Common Lisp implementation.
4:52:55
beach
Spawns: So with that in mind, in Common Lisp, a macro function is just an ordinary function that takes two arguments, a form and an environment object. The function builds a new form and returns it. It doesn't matter, then, whether the macro function is coded in assembly or something else.
4:55:23
beach
Spawns: You can check this for yourself in a Common Lisp implementation: (funcall (macro-function 'when) '(when foo bar baz) nil)
4:55:37
Josh_2
Okay I have found that annoying bug again, ofcourse it occurred when I deployed my application to my VPS
4:57:27
Josh_2
Okay https://plaster.tymoon.eu/view/2871#2871 here I have at the top my macro, then in the middle the function using the macro and then at the bottom a condition that is signalled when evaluating a function (in a different package) that is using the function in the middle
4:58:29
Josh_2
Not sure why I am getting this error, the reason I had to use keys is an attempt to make conversion from destructuring-bind to with-hash-keys easier
5:15:23
asarch
If I have: '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")), how could I remove (:id 2 :name "pizza")?
5:23:21
moon-child
could use EQ if you guarantee structure-sharing ahead-of-time. Or use a hash table if you have a bunch of elements to remove
5:23:55
asarch
Then I could have '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")) and then a list of ids '(1 2)
5:24:23
asarch
(loop for element in '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")) do (remove-if ... <- ?
5:27:09
moon-child
remove-if says exactly what it does: you're removing some elements from a list. It is more specific
5:32:52
asarch
But how can I pass the list of the elements I want to delete?: (remove-if (lambda (x) (member x '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")))))
5:36:45
moon-child
(let ((ids-to-delete ...)) (remove-if (lambda (x) (member (getf x :id) ids-to-delete)) list))
5:37:31
moon-child
ids-to-delete is available to the function you create, so we say that the function closes over ids-to-delete
5:38:39
akoana
just for fun, what about (set-difference '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")) '((x 1) (x 2)) :key #'second :test #'equal)
5:39:46
asarch
(remove-if (lambda (x) (member (getf x :id) '(1 3))) '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")))
5:42:14
moon-child
ACTION considers pointing out that j's 'hook' combinator obviates the misdirection, decides against it
5:42:39
asarch
(set-difference '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")) '((:id 1 :name "taco")) :key #'second)
5:52:28
Spawns
is it possible to have my interpreter's implementation of conses as an immutable data structure but provide a mutable api to the lisp itself? do any cl implementations do something like that?
5:53:22
Spawns
i am sort of confused how you could implement that, since lists don't store pointers going backwards
5:54:39
Spawns
appending and pushing is easy, but doing set-car or whatever to an element in the middle is tricky