freenode/lisp - IRC Chatlog
Search
9:15:35
beach
phoe: OK, I'll ask here, since you seem to ignore your PMs. Why is it hard to imagine techniques that will guarantee the integrity of an operating system in the presence of concurrency? Every desktop and mainframe operating system does it.
9:27:35
shka
i want to have same style of api for calling remote processeses and ones on the local machine because it would greatly simplify construction of distributed systems
9:29:32
shrdlu68
This is strange. A function returns 3 closures, I bind the first two using multiple-value-bind, dicarding the third. Someone is calling the third one.
9:32:13
beach
shrdlu68: Normally, if you are in SLIME, you can then get the source code of the point of the call.
9:32:54
beach
shrdlu68: I put this in my .sbclrc: (declaim (optimize (speed 0) (debug 3) (safety 3)))
9:33:43
mood_btf
Note that that doesn't guarantee permanent high debug values. For that, add (sb-ext:restrict-compiler-policy 'debug 3)
9:35:29
mood_btf
shrdlu68: The only form in the (values) is the single (with-slots ...), which returns the third lambda
9:36:06
mood_btf
So the only lambda ever returned is the third one, and the first and second are ignored
9:37:46
beach
shrdlu68: Unrelated, but still: you might want to use accessors instead of slot values directly, and use WITH-ACCESSORS instead of WITH-SLOTS.
9:39:31
beach
shrdlu68: If you use SLIME-INDENTATION, there is no need to put a newline after the LOOP keyword. Your LOOP body will be indented properly then.
9:43:24
shrdlu68
How exactly do I go about getting slime indentation? Do I need to have slime running?
9:44:02
beach
In your .emacs, you put (slime-setup '(slime-fancy slime-tramp slime-asdf slime-indentation))
9:45:04
shrdlu68
I am, I just don't like slime running, it opens too many buffers and I tend to be editing multiple files.
9:47:07
shrdlu68
Thanks, emac's indentation has forced me to adopt a few work-arounds, like putting a new-line immediately after the loop keyword.
11:30:24
shka
filwisher: and when i'm using, i'm kinda doing it manually, without extra tools like grovel
11:32:45
shka
then cffi:load-foreign-library (or something like that, i can't remember function name) should work
11:32:53
filwisher
I can recompile to .so but I'm unclear about integrating shared libraries with common lisp
11:33:46
shka
i'm not sure if asd is handling this, but what i do is to use this: https://common-lisp.net/project/cffi/manual/html_node/load_002dforeign_002dlibrary.html
11:35:45
shka
(cffi:load-foreign-library (asdf:system-relative-pathname :overmind "lib/libqmlisp.so"))
11:37:20
shrdlu68
It seems to me ironclad's sha512 isn't right. Could someone try hashing something and compare it to sha512sum's output?
11:56:37
phoe
On my machine, it sha512s to "6308d8f6a7ccc9f77e41be5331a52c71c0bb28ecbd4669b960d60dd505dfde9ddd7a30cd26bb308010b3819699daba7caeb791bf6a4153605fe56d1fd3d5df41"
12:03:00
shaftoe
http://www.method-combination.net/blog/archives/2017/03/07/nibbles-and-ironclad-releases.html
12:03:06
shrdlu68
Wait, they released a new version recently, and last time I opened an issue on github (hardly two weeks ago), I got a response.
12:03:08
shaftoe
This is also an appropriate time to announce that I will no longer be maintaining nibbles, ironclad, nor any of my other Common Lisp packages.
12:50:33
chrnybo
An around-method modifies an argument, stores the rest of the arglist in REST. How to splice the arguments stored in REST into call-next-method?
12:54:28
chrnybo
Thanks! I got confused by only quoting the call-next-method, which gave the runtime error "UNDEFINED-FUNCTION: CALL-NEXT-METHOD is called outside the body of a method.".
15:44:29
Ukari
(funcall ((lambda (f) (lambda (&rest x) (apply f x))) (lambda (a &key x y z) (+ a x y z))) 5 :x 1 :y 2 :z 3)
16:00:01
beach
Ukari: Not in general, no. EQL can not be used to compare lists, other than for identity.
16:06:15
shka
so stuff like (let ((l (list 1 2 3))) (flet ((l (a) (elt l a))) (call-me-maybe l) (l 1)) is complete crap in lisp-1
16:19:02
beach
jusss: Furthermore, a "lambda form" is just data. Perhaps you mean "a function"? They are not the same.
16:21:23
beach
jusss: When READ has processed the first one, it is a list with the CAR being another list. But when READ has processed the second one, it is a list with the CAR being the symbol LAMBDA.
17:19:49
jdz
shrdlu68: there is split-sequence in quicklisp, and cl-ppcre can also split strings (using regular expressions).
17:38:22
presiden
question, what does the code snippet in this channel topic means. #1=(programmable . #1#)
17:40:54
whiteline
it is the description of a circular list containing only the symbol PROGRAMMABLE, this list being a single cons cell where CAR points to PROGRAMMABLE and CDR points to the cons cell itself
18:10:31
KZiemian
(defun plot (fn min max step) (loop for i from min to max by step do (loop repeat (funcall fn i) do (format t "*")) (format t "~%")))
18:15:01
phoe
in other words, you can put function objects in a FUNCALL call, and this function will be called. You can also put symbols in a FUNCALL call, and whatever function is bound to that symbol will be called then.
18:15:35
phoe
for standard functions you can use the #' notation, because you expect that the function will never change.
18:16:04
phoe
but for functions that you actually expect to change as the program runs, such as some callbacks that you might modify, you might want to put a symbol there instead of a function object.
18:16:30
phoe
this way, the symbol will be resolved to a function each time the FUNCALL is executed, and it will take into account changes of the symbol's function definition.
18:26:53
beach
"required" is a strong word. It is something I want to do so as to make source tracking available and precise.
18:27:52
beach
Since it is the first time something like this has been done, I am bound to make several design mistakes on the way.
18:31:09
shka_
anyway, idea is that i will be able to bootstrap and use SICL with sbcl even on my own?
18:32:25
beach
First-class global environments are tricky though. For performance reasons, they must be part of the core system. The compiler needs to know what to do.
18:33:44
shka_
i just wanted to figure out when i will be able to implement smalltalk style version control
18:34:41
beach
I might make it easier to set up this SICL-inside-SBCL environment so that people can try it out. But I have other things I need to work on too.
18:37:11
phoe
...I really dislike how CL:ASSOC and ALEXANDRIA:ASSOC-VALUE have their arguments swapped around
18:42:02
shrdlu68
I mean by updating emacs code, for example to adopt the same indentation as slime does.
18:49:49
Ukari
i see "a variable defined using defglobal with a proclaimed type of fixnum" in this document
18:51:28
phoe
I have realized that I can fix so many issues with SETF by simply replacing LET with SYMBOL-MACROLET
18:54:13
pjb
phoe: (mapcar (function funcall) (list #'elt #'alexandria:assoc-value) '(#(a b c) ((a . "a") (b . "b") (c . "c"))) '(1 b)) #| --> (b "b") |#
18:56:05
pjb
phoe: the point is that you have functions to find elements in collections, and some of them have the element as first argument, others have the collection as first argument. If you want to use those function in an homogeneous way, it's bad, you need the arguments in the same order.
18:58:08
Ukari
shka_, thank you, it looks like that i don't know things about declare and declaim so i went wrong
19:01:43
pjb
Also, assoc returns an entry while assoc-value returns the value of the key-value pair in the a-list.
19:44:15
phoe
All it says is, "Wait until THREAD terminates. If THREAD has already terminated, return immediately."
19:51:02
shka_
i had code for you that essentially spawns thread, executes function on it and returns value (blocks if it is not ready yet)
19:58:35
shka_
phoe: join-thread follows posix semantics and posix join-thread will just return status
19:59:15
phoe
and from what I see, SBCL, CCL, ECL and ABCL all return the return values of the function
20:02:01
Bike
it's not totally simple, it means thread objects have a slot for them to store values in. which i guess is like a promise.
20:05:13
phoe
if implementations provide a way to fetch return values from threads, then this should be leveraged in a compatibility library.
20:06:54
phoe
the moment a thread becomes a promise, the programmer has one abstraction less to think of.
20:07:06
shka_
this is fundamental, low level library for interacting with OS, not abstraction layer
20:07:54
phoe
because what you say is, BT is a fundamental, *low-level* library for interacting with OS that accidentally makes use of *high-level* functionality offered by implementations
20:08:40
phoe
good, then BT on some implementations is high-level and I am free to leverage that fact.
20:09:05
phoe
and perhaps state that the implementation was able to fetch a return value through returning a secondary T/NIL value.
20:10:46
phoe
if an implementation's join-thread actually makes sure to return the thread's value, then I'm free to use that fact
20:13:44
phoe
https://github.com/Clozure/ccl/blob/003917cbbce90b7a7b5fa4bf90e9fe424e5637e9/level-1/l1-processes.lisp#L739
20:14:37
aeth
I rely on this in one of my unpublished libraries that I wrote to help me with Project Euler code, with something that could only go under 1 sec when parallelized
20:16:08
phoe
minion: memo for sionescu: I need to work on a JOIN-THREAD-VALUE function that returns two values: the value of JOIN-THREAD and T/NIL depending on whether BT determines that the value of JOIN-THREAD is guaranteed by the implementation to be the return value of the function the thread was called with.
20:17:39
aeth
Hmm... Run something in one second. Oh the good old days. What's funny is that I then went on lowered my impatience standards. Now I have to do *everything* in under 1/60 seconds or precompute it ahead of time.
20:19:43
aeth
Both SBCL and CCL have impressed me with their performance. (I mostly used scripting languages before CL, though.)
20:23:55
phoe
I want to iterate over a list using LOOP and do something extra on every 5th element. What is the simplest way of achieving that?
20:24:38
pjb
(loop for item in list for i from 0 do (something item) when (zerop (mod i 5)) do (something-extra item))
20:25:28
aeth
I do something similar and I have with counter = -1 do (incf counter) instead of for i from -1
20:26:04
pjb
Yes, depends on whether you want to do the extra on the 0th 5th 10th, … or on the 4th 9th 14th …
20:28:53
aeth
right, so it's "for i from 0" instead of "with i = -1 do (incf i)", saves some complexity
20:43:40
phoe
(do () (t) loop for x = 42 and foo being equal to the value of (+ 4 20) finally return nil)
20:43:55
_death
aeth: the other day I implemented multiple-value DO (reading On Lisp again nowadays) before reading PG's attempt.. my style is quite different, but there is at least one nontrivial point, which PG ignored and mine implements poorly
20:50:27
aeth
I have probably written more declarations in the past year than everyone here combined :-p
20:53:21
aeth
I'm considering writing a define-function that uses defmethod style syntax like e.g. (define-function foo ((x fixnum) y (z single-float)) (+ x y z)) but the issue would be how to handle &optional and &rest. Iirc, defmethod's solution is to not handle them.
20:58:28
aeth
&rest would be trickier. Might not be possible. Can you even type a list? I had to make sure a &rest was all of one type once, and I got around that by essentially (map nil (lambda (x) (check-type x foo-type)) rest-args)
21:00:07
pjb
(defstruct typed-list type list) (defun push-typed-list (x l) (etypecheck x ((typed-list-type l) (push x (typed-list-list l))))) (defun pop-typed-list (l) (pop (typed-list-list l)))
21:01:01
aeth
pjb: like with lazy lists and a few other things, built-in support would be much better than building it.
21:01:51
aeth
And, imo, queues. I use a struct for vector queues, but it is a bit strange that queues aren't supported in vectors or lists when stacks are supported in both.
21:06:33
aeth
Oh, you're right, it's trivial if you're writing them with lists, but not trivial to add to all lists, unless you want to increase overhead of lists by tracking the last cons.
21:06:34
pjb
Well, this is the fundamental criticism of Common Lisp: it freezes the implementations (theorically), so you cannot easily add this kind of stuff. Now on the other hand, we're using open source implementations, so you can always add those extensions.
21:07:07
pjb
Notice also that clisp can be compiled with the option of a 3-slot cons cell, and you could use this third slot to store a type for the car…
21:08:20
aeth
pjb: Imo, CL with a robust set of collections built into the language would be amazing. Immutable sequences, lazy lists, typed conses, etc.
21:10:52
aeth
pjb: If someone could get some optional extensions into SBCL, CCL, and ECL (and maybe some up and coming ones like Clasp and SICL), then someone could get a de facto standard going.
21:11:25
_death
there are many ways in which it shows its age.. some are desirable, others less.. different people disagree on what falls where
21:11:31
pjb
But then also, CL was designed after the Internet, and even after GNU; it's harder, in the context of easily shared software sources over the Internet, to deploy your own extensions in your local implementation: now it may become incompatible with shared software!