freenode/#lisp - IRC Chatlog
Search
9:37:36
Grue``
I need a simple thread pool library that actually works (requirements: 1: must be able to wait until all tasks in the pool are finished, 2: must not use sb-thread:interrupt-thread to send signals to threads)
9:39:58
shka
anyway, I would try lparallel as It is my personal default for everything concurrency related
9:41:16
Grue``
"`end-kernel’ should not be used as a substitute for properly waiting on tasks with `receive-result’ or otherwise." what's the correct way to finish all the tasks then?
9:43:17
p_l
make all tasks have an end (triggered or natural) that gives out a result for receive-result ?
14:50:47
xmonader
beach, I've checkmany macro that takes a test cases and a function called test-v1 that uses (and it works okay with loop for f in forms)
14:51:07
xmonader
problem is with test-v2+ version and checkmany macro 2 that trying to use dolist macro
14:51:50
beach
In the second case, you removed the comma as well as the LOOP, so now the second backquote is no longer inside a comma.
14:54:01
beach
xmonader: Also, the PROGN exists in the first case because the loop is going to generate a list of things at compile time, and those things must be wrapped in a PROGN since the macro only returns a single form.
14:54:35
beach
xmonader: In the second case, the DOLIST is not executed at compile time, so it is a single form, which means the PROGN is no longer required.
14:56:40
beach
xmonader: In the LOOP case, f is a form. In the expansion (as you can see when you macroexpand), report-result is called both with the value of the form and the form itself.
14:57:34
beach
xmonader: So if a form is [say] (= (+ 1 2) 3) then the call will look like this: (report-result (= (+ 1 2) 3) '(= (+ 1 2) 3))
15:01:24
beach
You will have something like (progn (dolist (f ((= (+ 1 2) 3) (= (+ 1 2 3) 6) ...)) ...))
15:07:51
beach
... and when you say (report-result ,f ',f), the comma before f makes f refer to something outside `(progn (dolist ...)) but there is no f outside.
15:08:27
beach
xmonader: He is doing the computation at compile time by preceding the LOOP with a comma.
15:08:57
beach
xmonader: You kind of removed the main point of the macro by not doing the DOLIST at compile time.
15:09:57
beach
xmonader: Now, if you can tell me what the purpose of this modification was, we might be able to patch it up.
15:10:33
xmonader
beach, not really a purpose it just came to my mind why not to use dolist instead :D
15:12:42
beach
I never use dolist myself, but you will have to precede it with ,@ just as with LOOP, and you will have to return a list of forms pretty much the same way the LOOP did.
15:17:14
beach
(defmacro checkmany2 (&body forms) (let ((result '())) `(progn ,@(dolist (f forms result) (push `(report-result ,f ',f) result)))))
16:12:35
flip214
Posterdati: This is not a file name, but a directory name. therefore probe-file does not work.
16:12:56
flip214
you could test for some specific file in there, or rely on other standard mechanisms...
16:21:53
Bike
puthash is not a standard function. sbcl defines an internal puthash that it uses to modify hash tables.
16:24:52
Bike
you can (defun puthash (key table value) (setf (gethash key table) value)) if you want. i don't know why you'd want to, though.
16:26:12
compro
simply because i will have to write less. don't know why this decision was made in the first place
16:28:39
Bike
and if there is a puthash kind of function, setf can just expand directly to it, so it's just as efficient.
16:31:46
Bike
drdo: yeah, i didn't say anything to you. i hardly know the filesystem functions anyway
16:34:44
Bike
oh, yes, well. the standard is mostly solid, so there's not a lot of impetus for improvements.
16:35:03
Bike
and when there are it's not impossible to get widely used extension standards, such as bordeaux threads and CFFI.
16:36:54
Bike
the C++ book i learned some programming for in middle school is worth jack shit now. tragic.... (it wasn't good to start with, but still)
16:37:26
beach
I am very pleased that I can :USE the COMMON-LISP package without having to fear symbol collisions in the next iteration of the standard.
16:39:10
Bike
but, i think haskell is worthwhile to learn, and also that learning one thing or another thing should not be a competition.
16:42:38
beach
compro: Oh, you are in the wrong channel then. Common Lisp is not a good example of a functional programming language.
16:44:01
beach
compro: So if functional programming is what you want, Haskell or some ML variant might be preferable. Or Clojure, I guess.
16:47:43
beach
compro: Oh, and by the way, PUTHASH would be a strange thing to want in functional programming, since it has side effects.
16:51:21
beach
compro: Not sure what you are asking, but "functional programming" typically means programming without side effects, so that calling a function returns a new object rather than modifying an existing one: https://en.wikipedia.org/wiki/Functional_programming
16:53:09
cromachina
instead of a hash table, you would probably end up using a tree or heap. further reading: https://www.cs.cmu.edu/~rwh/theses/okasaki.pdf