freenode/#lisp - IRC Chatlog
Search
22:13:24
jmercouris
is there a way to do (loop for item in list collect ...) and have the index of "item"?
22:28:28
pjb
phoe: no, that's the point, there is no "the" index of item! There are several indices of item!
22:28:57
pjb
(loop with list = '(1 2 1 2 3 4 1 2 3 4) for item in list collect (positions item list)) #| --> ((0 2 6) (1 3 7) (0 2 6) (1 3 7) (4 8) (5 9) (0 2 6) (1 3 7) (4 8) (5 9)) |#
2:44:57
vtomole
Good :). I really enjoyed the paper, will have to study the code a bit longer though specifically %apply-nQ-gate
2:46:19
vtomole
From the paper "Since qubits live in a two-dimensional space " should it be "Since a qubit lives in a two-dimensional space"?
2:52:14
vtomole
What is the performance comparison of implementing linear alg operations instead of handing them over to BLAS?
3:47:03
vtomole
stylewarning: Looking for feedback on the new pull request: https://github.com/tarballs-are-good/quantum-interpreter/pull/1/commits
9:50:44
makomo
say i have a CASE form and i want to run a bit of code before/after the CASE form, depending on whether any of the cases within the CASE was actually hit
9:51:31
makomo
i could do it by adding WHENs before/after the case and then checking for all of the symbols within the case, but this duplicates all of those symbols
9:53:33
ludston
Alternatively, you could yield a non-null value from all of your cases and wrap it in an if or when expression
9:54:38
makomo
plus, it requires me to save that value then somewhere, which means the whole CASE needs to be wrapped within a LET, producing "ugly" indentation
9:54:52
makomo
if i opt for (setf) instead of returning, then i'm again duplicating code within the clauses
9:56:12
ludston
In that case, whether or not this is a better way to do this, I would have the case return a lambda and then wrap the clauses around that
9:56:26
makomo
another style/philosophy issue: where do you draw the line between "i'll just write a macro for it and introduce my own control structure" and "i should probably just let this bit of duplication be, it's not worth the reader's effort to decipher what i meant"
9:58:20
makomo
you want to run some common code, then special code for every clause, then again common code
9:59:17
makomo
i also thought about that, and that's an upcoming optimization, but isn't *that* important
9:59:48
ludston
(let ((c (case "jobbo" ("jobbo" (lambda () (something)))))) (when c (setup) (funcall c) (cleanup)))
10:00:21
makomo
so for example, you can't rely on the check being saved in the after body, if the before body never existed
10:01:23
makomo
in the after body, you can't rely on the check being saved/done already, if the tbefore body never existed**