freenode/lisp - IRC Chatlog
Search
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**
10:04:19
ludston
makomo: I've found that if you have conditional behaviour, it's often better to delay executing that behaviour by passing it around in higher order functions, since then it is trivial to add logging later
10:05:40
ludston
makomo: Often, conditional behaviour is going to be triggered by some user-input, and the user will input data outside of the range that you predicted, so you will want to anticipate this
10:06:40
ludston
makomo: And by that I mean, anticipate that you will screw up your code, not "try and make sure that all of the inputs are santized"
10:10:23
makomo
i think i see what you mean. so you're referring to the process of actually writing the code, not the runtime behavior of the program
10:12:11
puchacz
by the way, is there "case" with different test instead of default "eql"? or I would have to write a macro (or use one of the libraries)?
10:13:55
loke
puchacz: To your question. You asked if there is such a macro, or if you have to write it yourself. The answer to that question is “yes”.
10:15:20
loke
siraben`: Also, I believe it mentions lispbox or some other similar package which are no longer devloped. You should be looking at Portacle.
10:15:23
makomo
siraben`: skip the part about "lispbox" in the beginning and use something like Portacle instead
10:15:38
siraben`
Fortunately I know how to use Emacs, so I'll find a way to customize my current configuration to work better with CL
10:16:13
loke
makomo: There is a STRING-CASE in Quicklisp which is likely much faster than what you'll be able to write.
10:16:40
makomo
loke: probably, i had no idea though. i expanded it into a COND which uses STRING-EQUAL lol
10:17:07
makomo
loke: what kind of optimization could it do. hash the strings and compare the hashes perhaps?
10:17:16
loke
makomo: smartparens was less efficient last i looked. That said, it also seemed to be easier to learn, so perhaps it's a good idea for beginners.
10:18:30
makomo
ludston: i just learned something :D. i use spacemacs's lisp-state for my sexp operations though
10:18:50
makomo
the keybinds aren't the shortest, `SPC k <something>` and then just `k <something>` once you're in the state
10:18:58
loke
makomo: it finds common prefixes and constructs a tree based on that. Then it compares multiple characters by OR-ing the differences and comparing to zero. It has hand-optimised assembly for SBCL so that it only does a comditional jump every four characters (if I remember correctly)
10:22:16
loke
teh code contains this comment, showing the output: https://gist.github.com/lokedhs/beddab3cdfbc72ebcad9df72939efd80
10:26:15
loke
makomo: Please do, because last I looked at it, changes in recent SBCL has reduced the performace of it. It's still faster than your typical macro, but the hand-optimised version of NUMERIC-CHAR= doesn't seem to be applied correctly, causing more conditional jumps than it used it.
10:26:51
ludston
That's pretty neat. I wonder if it could be generalised to deal with other lists, or even trees.
10:27:03
loke
I think it's because some of the internals that he was using have changed. If you can fix that, you'll be a hero :-)
10:31:23
ludston
It's a bit complex. I wonder how close the output is to something like (case (aref input 0) (#\f (when (eq (aref input 1) #o) (case (aref input 2) (insert rest of tree here)))))
10:36:52
ludston
Oh you can see the macro output just aboe the assembler output. I can answer my own question. Yes it is pretty much identical to that, but for some reason he's gone with numeric-char= instead of doing a lookup
10:41:36
ludston
Because he thinks that doing 6 separate char= comparisons is going to be faster than #'equal?
10:43:42
ludston
I don't understand lol. Why be like, "I know how to compare strings faster than the people writing the compiler"?
10:49:17
jmercouris
I'm trying to understand how to use the default database configuration in Caveman2: https://github.com/fukamachi/caveman#database
10:49:38
jmercouris
I've edited my config.lisp file to have a database: https://gist.github.com/bd40654c9256e2556554a37a8ee7a98a
10:50:12
jmercouris
the thing I don't understand is this sentence: "db in a package myapp.db is a function for connecting to each databases configured the above."
10:50:25
jmercouris
and then it shows the following snippet below: "(use-package '(:myapp.db :sxql :datafly))"
10:51:53
jmercouris
seems the function does exist, just wasn't being picked up by company, had to look for it in the source
11:21:52
jmercouris
shrdlu68: Well, I'm in a slime repl, and then calling the function to launch my application
11:24:21
jmercouris
when I say env, I mean environment variables, like `set --export some-var some-value` in a normal shell
11:24:55
jmercouris
so I can't just set some environment variable in my .bashrc .profile or whatever
11:25:36
shrdlu68
I don't think you share the same env as emacs, since your implementation is exec'd.
11:26:14
shrdlu68
One way would be to launch your implementation with the variables, like "FOO=BAR /usr/bin/sbcl"
11:27:26
shrdlu68
I don't think it's possible to "inject" environmental variables, except by manipulating the data structure that holds the environmental variables.
12:23:10
dim
Xach: hi! do you know off-hand how to implement streaming uploads with zs3? by that I mean that you only ever have a small part of the content to upload in the client's memory...
12:38:47
Xach
dim: Hmm, I don't know, sorry. I'd have to look at what drakma provides and how zs3 uses it.
12:39:11
Xach
dim: i know there are chunking upload APIs that could be used regardless of what drakma provides, but i also know that is not in ZS3 right now.
12:43:45
dim
yeah I was thinking about https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html “Multipart Upload Overview” specifically
12:44:34
dim
I don't think I can use drakma level facilities here, the whole point is that I don't know the size of the content I am uploading until the end, because I am already receiving the content in a streaming fashion
12:45:36
dim
I could always use my already existing batch facility and create multiple S3 files, one per batch, and manually consider them as a multiple upload thing, though
12:46:04
Xach
dim: Interesting. I haven't thought about how S3 supports incoming objects of unknown size.
12:47:25
dim
apparently you can upload up to 10_000 chunks of 5MB content, and the last chunk “closes” the multi-part upload, and it can even be done in parallel
12:49:25
dim
my use case is (of course) pgloader related: a customer needs support for AWS Redshift as a target; and I just discovered that Redshift (a fork of PostgreSQL 8.0) doesn't have the COPY FROM STDIN feature, instead you need to COPY FROM S3://, basically
12:50:00
dim
so I'm going to do MySQL | S3 | Redshift, all in streaming, and without having to load the full contents of a MySQL table in pgloader memory if I can avoid it, of course
12:52:51
dim
well it's a SMOP as they say, and if using the S3 multipart upload protocol isn't possible with current zs3, I think it's going to be easier for me to do something that looks like it with plenty of "small" objects that are manually managed in pgloader, I don't actually need any other tool to see that as a single file per source table anyway, and also I will be able to have more concurrent processing
13:39:59
pjb
Full name is better than abbreviation, because full names can be found in dictionaries.
13:42:03
pjb
google for bhattacharyya and you find it directly. Google for bhat, bhat-dist, anything and you're lost.
13:42:26
pjb
shka: so indeed, you could even name it bhattacharyya-distance since bhattacharyya is a proper name actually.
13:44:07
MichaelRaskin
shrdlu68: those who try to cut distance out of Hamming distance will be punished by coding FFT with Hamming window
13:46:30
pjb
Modern editors and IDEs have a lookup function that will search in dictionaries, wikipedia, google the current selection (or symbol-at-point).