2016-05-17
| 01:30 | ilevd | How I can setup timbre to print exceptions? |
| 01:31 | dysfun | it doesn't "print exceptions", but you can log an exception object you have caught |
| 01:31 | ilevd | And uncaught exceptions? |
| 01:34 | ilevd | Hm, it seems I need to set stdout, stderr to file to do this |
| 01:35 | dysfun | you can register a global uncaught exception handler |
| 01:35 | dysfun | and log it |
| 01:38 | ilevd | Thanks, I think it's what I need |
| 01:39 | dysfun | but you really should try and catch exceptions in your code |
| 01:43 | ilevd | I know, now I need quickly find an existing error |
| 01:43 | dysfun | ah :) |
| 03:11 | ilevd | Errors in pmap aren't caught by setDefaultUncaughtExceptionHandler -_- |
| 03:12 | dysfun | another reason not to use pmap |
| 03:13 | ilevd | Or i forgot to use doall.. |
| 04:00 | ilevd | I do (future (try ... (catch Exception e (log e))), but message isn't infromative: java.util.concurrent.ExecutionException: java.lang.NullPointerException |
| 04:00 | ilevd | Any ideas? |
| 04:01 | dysfun | nullpointerexception means you've tried to call something as a function and it was null, or a function argument to a java function was null |
| 04:02 | ilevd | I expected some stacktrace, maybe line number |
| 04:04 | amalloy | blame whatever that log function is |
| 04:12 | ilevd | I can blame only myself |
| 04:19 | ilevd | .getStackTrace, .getMessage, .getCause return nil or java.lang.NullPointerException |
| 04:53 | TMA | ilevd: the java.util.concurrent.ExecutionException wraps java.lang.NullPointerException |
| 04:53 | TMA | ilevd: therefore .getCause returns the wrapped java.lang.NullPointerException |
| 04:53 | TMA | ilevd: try .getStackTrace and .getMessage on the java.lang.NullPointerException from .getCause |
| 05:40 | ilevd | @(future 10) |
| 05:40 | ilevd | ,@(future 10) |
| 05:40 | clojurebot | #error {\n :cause "no threads please"\n :via\n [{:type java.lang.SecurityException\n :message "no threads please"\n :at [clojurebot.sandbox$enable_security_manager$fn__857 invoke "sandbox.clj" 94]}]\n :trace\n [[clojurebot.sandbox$enable_security_manager$fn__857 invoke "sandbox.clj" 94]\n [clojurebot.sandbox.proxy$java.lang.SecurityManager$Door$f500ea40 checkAccess nil -1]\n [java.lang.Threa... |
| 05:50 | paolo_ | hey guys, i'm having problems using eval: i can't use clojure.math functions inside the expression to be eval-ed, can anyone help me? |
| 05:57 | TEttinger | clojure.math may need to be required again in the evaled code, but I'm half asleep what am I doing |
| 06:09 | Guest48 | if I'm using map to execute a function a bunch of times on a sequence, and my call to map immediately finishes and the function I'm executing does not executed (as the log statement never runs) - what fundamental point is it likely I'm missing? I can log the sequence just before I run the call to map, and it has some elements in it |
| 06:10 | TMA | Guest48: map returns a lazy seq; if you do not force the realization, it will never be realized |
| 06:10 | Guest48 | ah so I should (doall (map ... ? |
| 06:11 | Guest48 | the behaviour seems different in the repl |
| 06:11 | TMA | Guest48: if you map for the side effects, then yes. |
| 06:11 | TMA | Guest48: because the result is realized for printing out |
| 06:12 | TMA | ,(= nil (map println [1 2 3])) |
| 06:12 | clojurebot | false |
| 06:12 | Guest48 | TMA: thanks loads. I had a feeling there was some fundamental thing I was not grasping |
| 06:12 | TMA | Guest48: see -- if the result is not printed, then it is not realized even in the REPL |
| 06:13 | TMA | ,(= nil (doall (map println [1 2 3]))) |
| 06:13 | clojurebot | 1\n2\n3\nfalse |
| 06:13 | Guest48 | oooh |
| 06:13 | Guest48 | It is taking me a while to grasp these fundamentals despite an embarrassing amount of time tinkering with clojure |
| 06:14 | Guest48 | thanks for your very useful explanation and example |
| 06:14 | TMA | Guest48: it'll just click together sooner or later, keep trying :) |
| 06:14 | Guest48 | :) yup will get there in the end! |
| 06:14 | Guest48 | yes everything is now exactly working as expected |
| 06:14 | Guest48 | thanks! |
| 06:15 | TMA | you are welcome |
| 10:35 | sdegutis | How are you? |
| 10:43 | sdegutis | Okay. |
| 10:45 | fijro | When evaling a var, you don't have to type out the whole namespace. I type `+` instead of `clojure.core/+`. In my program I need to simulate this behaviour - and would like to know where in the Clojure source code I can study how that works? In what function is the 'full' name of a var completed? |
| 10:46 | justin_smith | fijro: eval uses the bindings of the current namespace to figure out how to resolve a symbol |
| 10:46 | justin_smith | fijro: you don't need to simulate the behaviour, you can call resolve |
| 10:46 | justin_smith | ,(resolve '+) |
| 10:46 | clojurebot | #'clojure.core/+ |
| 10:47 | hiredman | fijro: in the compiler if I recall there is a method named resolveSymbol |
| 10:48 | fijro | justin_smith: thank you, that's great to know. I need to reimplement that function, because ns in my app is a list that begins with a list that begins with a symbol 'ns. Don't know if I have misunderstood clojure, but feels like the ns part of it was not programmed in the clojure way of 'everything is data'... |
| 10:48 | hiredman | fijro: but you are likely to be more interested in resolve and ns-resolve |
| 10:48 | justin_smith | fijro: ns is a macro, it creates a namespace object |
| 10:48 | justin_smith | fijro: a namespace object owns some hash-maps from symbols to vars |
| 10:49 | fijro | hiredman: justin_smith: great to know. Thank you. The coffeeshop I'm coding in is closing and I've got to get going, but thanks! |
| 11:53 | sdegutis | Found a nice way of saying "(:quantity x) > 1" |
| 11:53 | sdegutis | ,(map (comp pos? dec) (range 3)) |
| 11:53 | sdegutis | Hahahhahaha |
| 11:53 | clojurebot | (false false true) |
| 11:53 | sdegutis | I know it's cheating but totally worth it |
| 11:54 | dysfun | not (comp pos? dec :quantity) ? |
| 11:54 | sdegutis | Yeah that. |
| 11:54 | sdegutis | But I got lazy and didn't want to make maps. |
| 11:55 | sdegutis | I wonder if there's a shortcut for (comp dec dec) |
| 11:55 | sdegutis | Man, I should make one. Fricken, what is it again? The thing that adds them together. |
| 11:55 | dysfun | yes, but it's longer |
| 11:55 | sdegutis | Repeatedly? |
| 11:55 | sdegutis | iterate? |
| 11:55 | sdegutis | Yeah apply iterate repeat dec n |
| 11:55 | sdegutis | or something |
| 11:57 | sdegutis | ,((->> dec (repeat 2) (apply comp)) 3) |
| 11:57 | clojurebot | 1 |
| 11:58 | sdegutis | ,(def dec-by #(->> dec (repeat %) (apply comp))) |
| 11:58 | clojurebot | #'sandbox/dec-by |
| 11:58 | sdegutis | ,((dec-by 2) 7) |
| 11:58 | clojurebot | 5 |
| 11:58 | sdegutis | Surely it can be prettier. |
| 12:01 | sdegutis | Granted this is only a stepping stone for pos? |
| 12:01 | sdegutis | Something like greater-by? |
| 12:03 | sdegutis | Oh wait that reads unlogical. |
| 12:03 | sdegutis | And that ladies and gentlemen is why I do not write helper functions. |
| 12:40 | momerath | contains? is broken for transient sets; can anyone recommend a working equivalent? Allocation profiling definitely justifies trying to make this set transient. |
| 12:42 | hiredman | https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentSkipListSet.html |
| 12:43 | hiredman | why people use transients for anything other that fast creation of a collection, I have no idea |
| 12:43 | momerath | ah- yeah, I guess I could use that; thanks hiredman! |
| 13:14 | sdegutis | momerath: transients should only be used briefly and turned into non-transients as soon as possible |
| 13:15 | sdegutis | momerath: the purpose of transients is to increase performance in creation of data sets in spots where performance matters |
| 13:15 | momerath | sure- that's true of the set in question, though the function is complex; it's very much an inner-loop |
| 13:17 | momerath | I used a plain java.utils.HashSet and I'm now allocating about 15% less in what might be called a cycle |
| 13:18 | dysfun | if you're in a tight loop, it's what mutables were made for |
| 13:32 | justin_smith | dysfun: I'm gonna get a decorative noose to hang on the wall and have a plaque by it that says "The Tight Loop". |
| 13:32 | justin_smith | momento mori kind of thing |
| 13:36 | dysfun | justin_smith: that's just asking to be involved in some sort of event where a coworker goes crazy and hangs your manager with your tight loop |
| 13:36 | dysfun | and you're gonna be prime suspect |
| 13:36 | justin_smith | that's why I wouldn't have a petard (which are notorious for hoisting their owners) |
| 13:37 | dysfun | in six months time, you'd better hope we start the "free justin_smith" campaign |
| 13:37 | dysfun | "free justin_smith, the rest of us have had to answer clojure questions" |
| 13:54 | sdegutis | hello |
| 13:55 | will_sm | hello |
| 14:01 | sdegutis | Fk freeing justin_smith. I refuse to answer Clojure questions. |
| 14:01 | sdegutis | Wait, how's that go? |
| 14:21 | sdegutis | What's a thing for like has-fraction? |
| 14:21 | sdegutis | Like, if you were to divine things, then it's intergral. |
| 14:21 | sdegutis | Like, (f 1/3) is false, but (f 2/4) is true |
| 14:21 | dysfun | wut? |
| 14:22 | justin_smith | dysfun: he's asking for a test for rationals vs. irrational numbers |
| 14:22 | dysfun | oh |
| 14:22 | dysfun | then he should have said so! |
| 14:22 | sdegutis | I just mean 'does this thing have anythig beside szeroes after the decimal?" |
| 14:22 | MJB47 | i though ti was a test if a fraction could be simplified or not? |
| 14:22 | MJB47 | ah ok |
| 14:22 | sdegutis | How do you say this mplore simply? |
| 14:23 | justin_smith | sdegutis: how does 2/4 satisfy but not 1/3 ? |
| 14:23 | MJB47 | justin_smith said it well i think |
| 14:23 | sdegutis | "Is this thing really an integer?" |
| 14:23 | sdegutis | justin_smith: 2/4 is 2.0 1/3 is 0.33 |
| 14:23 | MJB47 | 2/4 is not an integer |
| 14:23 | luma | 2/4 is 0.5 |
| 14:23 | justin_smith | sdegutis: wat |
| 14:23 | idev | where can I read an analysis of datomic vs relational model ? |
| 14:23 | sdegutis | Maybe (float x) = (int x) is what I want? |
| 14:23 | justin_smith | oh, he meant 4/2 |
| 14:23 | sdegutis | justin_smith: yes, 4/2 |
| 14:23 | sdegutis | Thanks |
| 14:23 | idev | I'm trying to figure out if EAV or Relational Model is the right appraoch for my needs |
| 14:23 | MJB47 | oh |
| 14:23 | sdegutis | I do not understand math very well. |
| 14:24 | justin_smith | ,(defn integral [n] (== (int n) n)) |
| 14:24 | clojurebot | #'sandbox/integral |
| 14:24 | justin_smith | ,(defn integral? [n] (== (int n) n)) |
| 14:24 | clojurebot | #'sandbox/integral? |
| 14:24 | justin_smith | ,(integral? (/ 4 2)) |
| 14:24 | clojurebot | true |
| 14:24 | justin_smith | ,(integral? (/ 2 4)) |
| 14:24 | clojurebot | false |
| 14:24 | sdegutis | Yeah that's what I was thinking of a spossible solution |
| 14:25 | sdegutis | But is it the RIGHR one? |
| 14:25 | will_sm | you're testing a string? |
| 14:25 | justin_smith | sdegutis: definitely use == instead of = |
| 14:25 | sdegutis | I'm testing a denomenator and a numerator |
| 14:25 | sdegutis | I have both individually |
| 14:25 | sdegutis | They may be combined into a ratio if need be. |
| 14:25 | luma | there's integer?, which returns true for int, long, bigint and biginteger |
| 14:26 | sdegutis | luma: but I have two ints |
| 14:26 | sdegutis | Actually two longs. |
| 14:27 | sdegutis | e.g. 11500/9 |
| 14:27 | luma | ,(integer? 4/2) |
| 14:27 | clojurebot | true |
| 14:27 | luma | ,(integer? (/ 4 2)) |
| 14:27 | clojurebot | true |
| 14:27 | sdegutis | Why the crap does this warn on reflection (= (double 11500/9) (long 11500/9)) |
| 14:27 | sdegutis | ,(= (double 11500/9) (long 11500/9)) |
| 14:27 | clojurebot | false |
| 14:28 | sdegutis | Ah, == not = |
| 14:28 | will_sm | is this the same as checking if (= 1 (gcd n d)) |
| 14:28 | sdegutis | will_sm: hmm interesting idea |
| 14:28 | sdegutis | will_sm: what does gcd do? it's not in clojure.core |
| 14:28 | will_sm | greatest common divisor/factor, not in clojure |
| 14:29 | luma | ,(integer (/ 11500 9)) |
| 14:29 | clojurebot | #error {\n :cause "Unable to resolve symbol: integer in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: integer in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: integer i... |
| 14:29 | luma | ,(integer? (/ 11500 9)) |
| 14:29 | clojurebot | false |
| 14:29 | sdegutis | luma: int |
| 14:29 | luma | sdegutis, why isn't integer? good enough? |
| 14:29 | sdegutis | Oh heck yeah, interger? works! |
| 14:29 | justin_smith | ,(integer? (/ 4 2)) |
| 14:29 | clojurebot | true |
| 14:29 | will_sm | , (defn gcd [a b] (if (zero? b) a (recur b (mod a b)))) |
| 14:29 | sdegutis | ,(map integer? [4/1 4/2 4/3 4/4]) |
| 14:29 | clojurebot | #'sandbox/gcd |
| 14:29 | clojurebot | (true true false true) |
| 14:30 | sdegutis | Heck yeah!!! |
| 14:30 | justin_smith | ,(integer? (/ 4 2.0)) |
| 14:30 | clojurebot | false |
| 14:30 | sdegutis | Great job everyone. |
| 14:30 | justin_smith | sdegutis: as long as you never see floats, that should work |
| 14:30 | sdegutis | Never ever. |
| 14:30 | sdegutis | I have two longs. |
| 14:31 | sdegutis | What the crap? |
| 14:31 | sdegutis | (defn integer? [n] (or (instance? Integer n) (instance? Long n) (instance? clojure.lang.BigInt n) (instance? BigInteger n) (instance? Short n) (instance? Byte n))) |
| 14:31 | sdegutis | That's it's real definition, no foolin |
| 14:32 | sdegutis | Oh, it's because of / |
| 14:32 | sdegutis | ,(type (/ 4 2)) |
| 14:32 | clojurebot | java.lang.Long |
| 14:32 | sdegutis | fricken, |
| 14:32 | sdegutis | whatthecrap |
| 14:32 | justin_smith | ,(type (+ (/ 1 2) (/ 1 2))) |
| 14:32 | clojurebot | clojure.lang.BigInt |
| 14:32 | sdegutis | ,(for [i (range 5)] (class (/ 4 (inc i)))) |
| 14:32 | clojurebot | (java.lang.Long java.lang.Long clojure.lang.Ratio java.lang.Long clojure.lang.Ratio) |
| 14:33 | engblom | ,(type (/ 1 2)) |
| 14:33 | clojurebot | clojure.lang.Ratio |
| 14:34 | sdegutis | ,(for [i (range 5)] (class (/ (inc i) 4))) |
| 14:34 | clojurebot | (clojure.lang.Ratio clojure.lang.Ratio clojure.lang.Ratio java.lang.Long clojure.lang.Ratio) |
| 14:35 | sdegutis | ,(clojure.lang.Numbers/divide 4 2) |
| 14:35 | clojurebot | 2 |
| 14:35 | sdegutis | That's why. |
| 14:35 | will_sm | sdegutis, so have you solved the problem? |
| 14:35 | sdegutis | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L155-L160 |
| 14:36 | sdegutis | will_sm: technically yes, but I won't be satisfied until I understand why '/ gives me the answer I want so easily. |
| 14:38 | sdegutis | which uses https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L1012-L1033 |
| 14:39 | sdegutis | which in my case of two longs always uses https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L417 for ops() ctor |
| 14:43 | sdegutis | so (/) with two Longs uses https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L489-L506 |
| 14:44 | sdegutis | And oh look, it has a variable named "gcd" just lik will_sm was talkin bout (maybe-ish) |
| 14:44 | luma | yes, it's the same function |
| 14:44 | luma | greatest common divisor |
| 14:44 | will_sm | (gcd 2 4) |
| 14:45 | will_sm | ,(defn gcd [a b] (if (zero? b) a (recur b (mod a b)))) |
| 14:45 | will_sm | (gcd 2 4) |
| 14:45 | clojurebot | #'sandbox/gcd |
| 14:45 | will_sm | ,(gcd 2 4) |
| 14:45 | clojurebot | 2 |
| 14:45 | will_sm | ,(gcd 3 4) |
| 14:45 | clojurebot | 1 |
| 14:46 | will_sm | ,(gcd 6 8) |
| 14:46 | clojurebot | 2 |
| 14:46 | sdegutis | Yall are good at math |
| 14:47 | will_sm | I almost became a math major, glad I chose to earn a good living instead |
| 14:47 | sdegutis | i have no fricken clue what this code does in my last link |
| 14:48 | sdegutis | but whatever, i trust that its doing the right thing based on what will_sm said plus his anecdotal qualifications |
| 14:50 | sdegutis | WHY WILL NOT THIS WORK |
| 14:50 | sdegutis | ,(clojure.lang.Numbers$LongOps.) |
| 14:50 | clojurebot | #error {\n :cause "No matching ctor found for class clojure.lang.Numbers$LongOps"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: No matching ctor found for class clojure.lang.Numbers$LongOps, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6875]}\n {:type java.lang.IllegalArgumentException\n :m... |
| 14:50 | bikeshedr | will_sm, hey, don't discourage me :p |
| 14:52 | sdegutis | I almost worked at factory third shift for the rest of my life, until my hobby combined with a series of strange events led to me becoming a competent software engineer. |
| 14:52 | kwladyka | wow.... i was rejected by Cognitect because i didn't know emac shortcuts.... recruitment process is totally random monster |
| 14:52 | sdegutis | Sh!t, 90 are integers but 29 are not. |
| 14:53 | hfaafb | how many does Cognitect employ |
| 14:53 | sdegutis | kwladyka: I was rejected by them because I am awkward and lack proper social skills. |
| 14:53 | sdegutis | kwladyka: but my employer is pretty happy with me so I guess cognitect missed out :P |
| 14:53 | will_sm | bikeshedr, if it makes you feel better, I will be working in hell/imperative programming for at least the next year |
| 14:54 | sdegutis | kwladyka: meaning, don't worry if they rejected you, they probably missed out on a great employee by not hiring you :P |
| 14:54 | kwladyka | sdegutis yeah... and i get in the same time feedback i have very strong skills etc..... but emacs... |
| 14:54 | sdegutis | will_sm: what lang? |
| 14:54 | dysfun | imperative programming isn't *necessarily* hell |
| 14:54 | will_sm | Haven't started yet but they use C++, Python, Java, & Go |
| 14:54 | bikeshedr | will_sm, a little :) |
| 14:54 | sdegutis | kwladyka: meh it's just one editor out of many, granted it's pretty darn great |
| 14:54 | sdegutis | will_sm: oh wow, you'll have fun with that one |
| 14:54 | dysfun | it just makes it a lot easier to make mess |
| 14:55 | sdegutis | will_sm: life is a waterslide where you die at the end |
| 14:55 | sdegutis | Hmm. How to figure out how many decimal places a thing has |
| 14:55 | kwladyka | i really cared about that job and put a lot of energy in that, but during one pair session i was talking with true emacs user |
| 14:56 | sdegutis | (= (map f [1/4 2/4 3/4 4/4]) [2 1 2 0]) |
| 14:56 | sdegutis | What's f? |
| 14:56 | kwladyka | damn... do you know good Companies coding in Clojure which looking remote contractor? :) |
| 14:56 | dysfun | what is a "true" emacs user anyway? |
| 14:56 | kwladyka | dysfun only emacs matter, your editor sucks |
| 14:57 | kwladyka | dysfun but i think you have distance to it :) ( i hope ;) ) |
| 14:57 | dysfun | no, it's just that i deal with so much shit software on a daily basis that emacs is comparatively unannoying except when it randomly breaks during upgrade |
| 14:58 | dysfun | all software sucks, all hardware sucks |
| 14:58 | dysfun | anyone telling you otherwise is a liar |
| 14:58 | kwladyka | i was trying emacs last 7 days very intensively. In my opinion emacs had great time, but time has changed :) |
| 14:58 | kwladyka | dysfun true |
| 14:59 | MJB47 | my biggest issue with emacs was i spent too much time configuring emacs |
| 14:59 | MJB47 | instead of actually working on whatever i needed to work on |
| 14:59 | MJB47 | :( |
| 14:59 | dysfun | you do eventually get it into a steady state where it works 'enough' |
| 15:00 | will_sm | I limited myself to tweaking emacs for 10 min, every other week |
| 15:01 | ben_vulpes | > emacs |
| 15:02 | ben_vulpes | > works enough |
| 15:02 | ben_vulpes | how true |
| 15:02 | ben_vulpes | it helps to only scratch one itch at a time |
| 15:02 | kwladyka | dysfun what you will stack with things like colour syntax for .less files :) |
| 15:02 | kwladyka | *but |
| 15:02 | ben_vulpes | "dang it would be neat if focus jumped to the compile buffer on compilation failures" |
| 15:02 | kwladyka | i am trying atom editor, it looks very good, first impression is very strong |
| 15:02 | dysfun | you will hate it before long |
| 15:03 | ben_vulpes | that's the webkit one? |
| 15:03 | dysfun | text editors are not meant to run in the browser |
| 15:03 | dysfun | i think it's browser and/or node-webkit |
| 15:03 | MJB47 | electron |
| 15:04 | MJB47 | which is like node webkit |
| 15:04 | kwladyka | dysfun i don't have to use all features |
| 15:05 | dysfun | yeah, emacs people think that for the first week or so |
| 15:05 | kwladyka | but for using it as emacs it looks very good, but still i spend only few hours with it |
| 15:05 | kwladyka | *it - atom editor |
| 15:06 | dysfun | 'using it as emacs' |
| 15:06 | dysfun | er, no. you have missed the point of emacs |
| 15:06 | engblom | kwladyka: Somehow I think you spend too much time thinking about the tools rather than coding :) |
| 15:06 | BamBalaam | Hi everyone! Does anyone know of a Clojure and/or Overtone that does music pitch detection? |
| 15:07 | kwladyka | engblom i was forced to it as you can see from my recrutiment process |
| 15:07 | BamBalaam | If not, any hint on any library for signal processing? |
| 15:07 | dysfun | hrm, i can't help but notice there's a big lack of signal processing libraries listed on clojure toolbox |
| 15:08 | will_sm | BamBalaam, IDK, but if straight pitch detection can't be done, you can use a Fourier transform to pick out the most dominant frequencies |
| 15:09 | dysfun | https://sourceforge.net/projects/dsplaboratory/ |
| 15:09 | engblom | BamBalaam: If you get something like that done, please drop me on PM a link to the project. I know a person needing a such library |
| 15:10 | dysfun | http://www.source-code.biz/dsp/java/ |
| 15:11 | BamBalaam | will_sm: it could be a good idea, for a quick and dirty first draft. I see how I could implement a FFT but not how to split open the music track in clojure |
| 15:11 | BamBalaam | dysfun: thanks for the links, will go through them |
| 15:12 | will_sm | BamBalaam, what is the source of the audio? Is it files? |
| 15:12 | BamBalaam | engblom: Whatever I achieve will never be extremely good |
| 15:13 | BamBalaam | will_sm: Yes, music files |
| 15:14 | BamBalaam | I think I'll start with really simple tracks just with basic notes/chords. If the solution works with more complex tracks, better, but not strictly necessary |
| 15:15 | will_sm | Found this lib for working with audio files, https://github.com/candera/dynne |
| 15:17 | BamBalaam | will_sm: thanks, will have a look at it ! :) |
| 15:30 | kwladyka | dysfun no, i didn't but as i said i was using atom only 2-3 hours and i don't know too much about it yet. But generally it looks like you can do with it everything like with emacs. Only one thing what you can't do is run on ssh. |
| 15:35 | sdegutis | How do you tell if a double only has 2 digits after the decimal? |
| 15:38 | justin_smith | will_sm: even fourier is tricky - the stuff actually implemented (fft) doesn't give you the actual frequency, it gives you a set of evenly spaced bins and you need to figure out the centroid from that using statistical methods |
| 15:40 | justin_smith | BamBalaam: overtone is just a DSL for the supercollider API, it can use all the UGens that supercollider defines and they are well documented, including multiple pitch detection methods |
| 15:41 | justin_smith | BamBalaam: this article compares three methods https://ccrma.stanford.edu/~kermit/website/scpitch.html |
| 15:42 | justin_smith | but frankly given examples and documented usage, it's a lot easier to just use sc directly and overtone just makes using it more complex |
| 15:42 | will_sm | justin_smith, gives a histogram of frequencies over some time interval. But yeah, given you still have lots of other problems such as start/end, chords, bin parameters and smoothing... how do ppl do it! |
| 15:43 | justin_smith | will_sm: but the frequencies have no relationship to the input |
| 15:43 | justin_smith | will_sm: they are just evenly spaced based on the algorithm parameters |
| 15:43 | justin_smith | finding the actual frequencies in the input requires statistical analysis |
| 15:43 | BamBalaam | justin_smith: I'm not extremely familiar with the supercollider API since I'm just starting with Overtone (or clojure for that matter!). It has pitch detection? |
| 15:44 | BamBalaam | justin_smith: thanks for the article, will read it, it's interesting! |
| 15:44 | justin_smith | BamBalaam: it has multiple pitch detection algorithms |
| 15:44 | BamBalaam | justin_smith: ok great, thanks for the information! :) |
| 15:45 | will_sm | justin_smith, wat. Fourier transform takes a signal and decomposes it to sine waves |
| 15:45 | justin_smith | will_sm: for example, if your bin is enough samples for 1/20th of a second, your detected frequencies will always be 0, 20, 40, 60, 80, 100, .... hz |
| 15:46 | justin_smith | to detect a 90hz input you either naively assign 80 or 100, or you use the spectrum spread behavior of the algorithm to derive the actual centroid |
| 15:48 | BamBalaam | oops, quit irssi by mistake |
| 15:48 | will_sm | justin_smith, use a higher resolution than, in practice I haven't had issues with aliasing, but then again, i don't have much practice |
| 15:48 | BamBalaam | but thanks everyone for the pointers in the good direction :) |
| 15:49 | justin_smith | will_sm: my point is that the fft only gives specific frequencies in the output, and will give you data per bin, and the frequencies of the bins are fixed by the algorithm, and have nothing to do with your input |
| 15:50 | justin_smith | will_sm: often the naiive usage is sufficient, but with a little interpolation / analysis you can do a lot better |
| 15:50 | justin_smith | but no, fft never actually gives you "the frequency of the input", the algorithm simply isn't capable of such a thing |
| 15:53 | will_sm | justin_smith, interpolation on results of fourier or resample audio? Have any source? |
| 15:54 | justin_smith | interpolations of fft to find centroids that are the actual input frequencies |
| 15:56 | justin_smith | will_sm: even the wikipedia page for fft will tell you that if your bin spacing is 20 hz, there will be no 90 hz bin - it's not even possible. The energy of a 90 hz input will be split evenly into the 80 hz bin and 100 hz bin. If you naiively scan for the bin with the most energy, that can cause a fundamental at 90 hz not to be detected |
| 15:56 | will_sm | or double the samplerate |
| 15:57 | justin_smith | will_sm: that's outside the algorithm, and you have the same problem again if you try a 95 hz input |
| 15:57 | will_sm | I mean, take your audio and change the sample rate |
| 15:57 | justin_smith | point is that fft never gives you the actual input frequency directly, but statistical methods on fft results can |
| 15:58 | justin_smith | will_sm: all that matters is the bin resolution in hz, but sure, changing input frequency can help you get more bin precision |
| 15:59 | justin_smith | but I think this is all a bit OT for this channel |
| 16:00 | will_sm | yeah, and we're getting nowhere lol. I might research it more later |
| 16:01 | BamBalaam | your discussion is super interesting though haha |
| 16:01 | BamBalaam | I'm just an extreme noob in the subject |
| 16:02 | BamBalaam | and my teacher simply totaly overevaluated the difficulty of the subject, given how we have close to no knowledge in signal processing |
| 16:02 | BamBalaam | (I know the basic math behind it, and that's...pretty much it) |
| 16:03 | BamBalaam | But I just might take the easy way out and try to use supercollider functions in Overtone (still gotta check how that's possible) and that might just be it |
| 16:04 | will_sm | when I installed supercollider, it came with the SuperCollider IDE, you can try that. I have yet to try it. Think I'll stick to standalone music hardware |
| 16:04 | justin_smith | BamBalaam: overtone definstrument is a macro that generates supercollider instrument definitions that are loadable by the supercollider synth server, that runs separately (it's a c++ program) |
| 16:04 | justin_smith | and then overtone talks to the scsynth server via UDP |
| 16:06 | justin_smith | BamBalaam: also, there are very friendly interactive tools for this stuff in matlab too |
| 16:06 | BamBalaam | justin_smith: I see. So in theory I could read the music file into a buffer, and use definstrument to interface with supercollider? I'll look into it |
| 16:07 | BamBalaam | justin_smith: I know. Unfortunately I really *HAVE* to use Overtone. It's... Silly. |
| 16:07 | BamBalaam | *shrugs* University |
| 16:07 | justin_smith | yeah, sounds about right - though supercollider is much more oriented to real-time, while mathematica makes it easier to do offline analysis |
| 16:07 | justin_smith | ahh, got it |
| 16:07 | dysfun | julia is gonna shit all over mathematica one day |
| 16:08 | will_sm | justin_smith, you know if there is any significant latency from overtone->supercollider or supercollider->jack |
| 16:09 | will_sm | I was really dissapointed with julia. Well, it was mostly the arrays. Weren't as good as numpy |
| 16:09 | sobel | i want to like Overtone more but i own a copy of Ableton Live |
| 16:09 | justin_smith | well, overtone doesn't even touch the signal data, and jack is going to get the best latency performance available usually |
| 16:10 | justin_smith | sobel: that's like saying "I want to like clojure but I already have excel" - these are tools of different levels of power designed for different kinds of tinkering |
| 16:11 | dysfun | justin_smith: i want to like clojure but i already have a banana |
| 16:11 | sobel | it's like saying "i want to like clojure but i already have excel AND know all its macros, have friends who regularly send me excel sheets, know how to extend it in C++ when needed, know how to interface it to all the services i need to integrate with my organization, ... |
| 16:12 | sobel | i want to like clojure but i have a hammock |
| 16:12 | dysfun | then go lie in your hammock and stop trying to write code |
| 16:12 | dysfun | it won't make you happy |
| 16:12 | sobel | . o O (one day) |
| 16:12 | justin_smith | sobel: if you needed to get an array of detected pitches in hash-maps as edn from ableton live, how would you do that? |
| 16:13 | will_sm | export to midi and convert to edn |
| 16:13 | sobel | justin_smith: probably export detected pitches through some interface in Max |
| 16:13 | dysfun | yeah, and how's the emacs support for ableton? |
| 16:14 | sobel | it's pointless |
| 16:14 | sobel | that's how it is ;) |
| 16:14 | justin_smith | I'm just saying, these are different kinds of tools - you can get a csv out of excel too of course, but they are really oriented for different approaches |
| 16:14 | justin_smith | max is just supercollider with point and click instead of text |
| 16:14 | dysfun | it's 2030 and the libreoffice import csv function still doesn't work by defualt |
| 16:15 | sobel | i used to do tons of CLI music/synthesis but i could not even come close to a good creative workflow that way |
| 16:15 | justin_smith | and ableton began life as a crazy max patch |
| 16:15 | Gh0stInTheShell | "Now it's the year three thousand and thirty, everybody wants to be an MC." |
| 16:18 | will_sm | Don't have windows anymore, I miss my DAWs |
| 16:18 | dysfun | can we invent our own expansions for acronyms we don't recognise? |
| 16:22 | sdegutis | Why is it that (/ 23000 18) must exist |
| 16:22 | sdegutis | ,(/ 23000 18) |
| 16:22 | clojurebot | 11500/9 |
| 16:22 | sdegutis | ,(double (/ 23000 18)) |
| 16:22 | clojurebot | 1277.777777777778 |
| 16:22 | sdegutis | fricken.. |
| 16:22 | dysfun | you'd love number theory sdegutis |
| 16:23 | sdegutis | dysfun: I'm guessing I'd actually find it incredibly inconvenient |
| 16:24 | will_sm | your hatred for these numbers is irrational |
| 16:25 | dysfun | inconvenient? |
| 16:25 | dysfun | i dunno, a lot of number theory is pretty important |
| 16:26 | dysfun | e.g. RSA derives its hardness from number theory |
| 16:26 | will_sm | Are you trying to count infinite decimal places now? |
| 16:31 | will_sm | sdegutis, so what project are you working on? |
| 16:32 | sdegutis | will_sm: a commercial website |
| 17:08 | sdegutis | ,(double 95/15) |
| 17:08 | clojurebot | 6.333333333333333 |
| 17:08 | sdegutis | thanks OBAMA |
| 17:25 | kenrestivo | that's interesting. the compiler has no problem with [:timestamp] but pukes on [:@timestamp] |
| 17:26 | kenrestivo | tells me that there's an unmatched delimiter [ |
| 17:26 | kenrestivo | not being able to handle :@timestamp puts a cramp in using elasticsearch from clojure |
| 17:26 | kenrestivo | ,(select-keys {} [:timestamp]) |
| 17:26 | clojurebot | {} |
| 17:26 | kenrestivo | ,(select-keys {} [:@timestamp]) |
| 17:26 | clojurebot | #<RuntimeException java.lang.RuntimeException: Invalid token: :> |
| 17:27 | kenrestivo | :( |
| 17:27 | justin_smith | kenrestivo: that's terrible, but you can use [(keyword "@timestamp")] but the better option is not keywordizing |
| 17:27 | kenrestivo | ,(select-keys {} [(keyword "@timestamp")]) |
| 17:27 | clojurebot | {} |
| 17:27 | kenrestivo | i like keywords |
| 17:27 | justin_smith | but you want to use "keywords" with invalid names |
| 17:27 | kenrestivo | also clj-http does that when you {:as :json} but i can manually work around that |
| 17:28 | kenrestivo | is :@ invalid? |
| 17:28 | justin_smith | ,(select-keys {(keyword "@timestamp") ::yes} [(keyword "@timestamp")]) |
| 17:28 | clojurebot | {:@timestamp :sandbox/yes} |
| 17:28 | TEttinger | I'd assume so, since @ is the deref macro |
| 17:28 | justin_smith | yeah, you are messing with the reader there |
| 17:28 | kenrestivo | oh, reader macro. grrr.. |
| 17:28 | TEttinger | at-timestamp |
| 17:28 | kenrestivo | i can mangle the names on ingress to remove @'s |
| 17:29 | TEttinger | can you use strings? |
| 17:29 | justin_smith | so you can use the keyword function, or accept that you want to look things up that are not valid keywords and switch to string lookup |
| 17:29 | justin_smith | I guess there's mangling too, but that's the least simple option |
| 17:29 | kenrestivo | i hate strings so i'd rather sanitize the keys. |
| 17:30 | justin_smith | invalid keywords are worse than strings |
| 17:30 | justin_smith | ,(keyword "\n\n\n") |
| 17:30 | clojurebot | :\n\n\n |
| 17:30 | kenrestivo | hahaha |
| 17:30 | kwladyka | what is the difference between paredit and parinfer? |
| 17:30 | justin_smith | paredit has commands for moving parens, parinfer moves parens when you indent |
| 17:30 | TEttinger | ,(keyword "@$&^\ufeff()") |
| 17:30 | clojurebot | :@$&^() |
| 17:31 | kwladyka | justin_smith thx |
| 18:08 | sdegutis | How do you say "this double has no more than 2 decimal places, I'm sure of that"? |
| 18:08 | sdegutis | Or better yet, "this double ends with a repeating decimal place"? |
| 18:14 | sdegutis | Ah |
| 18:14 | sdegutis | (integer? (* x 100)) |
| 18:14 | sdegutis | Got it. |
| 18:15 | amalloy | .(integer? (* 1.05 100)) |
| 18:16 | amalloy | ,(integer? (* 1.05 100)) |
| 18:16 | clojurebot | false |
| 18:17 | sdegutis | ,(integer? (* 100 (/ 52373 10))) |
| 18:17 | clojurebot | true |
| 18:17 | sdegutis | ,(integer? (* 100 (/ 23000 18))) |
| 18:17 | clojurebot | false |
| 18:26 | amalloy | those aren't doubles |
| 19:18 | toastycj | I read or heard somewhere that clojure syntax is a derivative of another general language ? I couldn't find reference to it anymore after googling a bit. |
| 19:18 | toastycj | If somebody can let me know, it will be great. |
| 19:18 | toastycj | It's not lisp, from what I heard. |
| 19:19 | justin_smith | the closest relative is scheme |
| 19:24 | ben_vulpes | is let a recur target? i'm losing my mind over here |
| 19:24 | ben_vulpes | it shouldn't be right RIGHT? |
| 19:24 | justin_smith | no |
| 19:25 | amalloy | that question is curiously urgent when lacking punctuation |
| 19:26 | amalloy | like you're not just emphasizing the question, you're grabbing me by my collar and shaking me. "right RIGHT?" |
| 19:27 | ben_vulpes | yeah well when you feel the world moving under your feet and the only sane answer is "no you're wrong and stupid for making the mistake in the first place"... |
| 19:31 | TEttinger | toastycj, clojure can be described as a dialect of lisp, in the same way scheme is a dialect of lisp, and common lisp is a dialect of lisp (usually when people say Lisp without qualification they mean common lisp or the early lisps that predate common lisp) |
| 19:32 | TEttinger | clojure makes more departures from scheme and lisps in general than many other implementations, syntax-wise |
| 22:53 | sdegutis | amalloy: sometimes they are |