Re: Curious behaviour when requiring clojure.tools.cli

2021-06-14 Thread Thomas Heller
clojure.string/starts-with? was added in Clojure 1.8.0, I see 1.7.0 in the project.clj? See https://github.com/clojure/clojure/blob/b1b88dd25373a86e41310a525a21b497799dbbf2/src/clj/clojure/string.clj#L362 What exactly else is going on I don't know but it all starts from the wrong Clojure

Re: Classpath bug re Clojure 1.10.1.645 when using Figwheel.Main

2020-08-12 Thread Thomas Heller
> > None of these libraries are broken. They just include resources. Also, I > don't think it is realistic to tell library authors to please move certain > files out of the way because my build tool randomizes my classpath. That is > not going to happen. People will keep including things like

Re: Classpath bug re Clojure 1.10.1.645 when using Figwheel.Main

2020-08-11 Thread Thomas Heller
This might be a good incentive for people to keep their published .jar files clean. Unfortunately many published CLJS libs contain the rather common "public" folder with "public/index.html" and often compiled .js artifacts which aren't actually ever used. I do however think that it is useful

Re: Custom test assertions in ClojureScript

2019-09-29 Thread Thomas Heller
Self-hosted should work the same way but it does require compiling the macro namespace in an extra step (ie. the $macros ns is created separately). I don't know how this is done for regular self-hosted. shadow-cljs has an extra build step for this that should take care of creating everything.

Re: Custom test assertions in ClojureScript

2019-09-28 Thread Thomas Heller
Hey, cljs.test/assert-expr is part of the CLJ macro side so it can't be extended from a CLJS REPL. You can write it in a .clj file and use (require-macros 'that.ns) from the CLJS REPL or use :require-macros in the ns form that uses the new assert-expr. HTH, Thomas On Thursday, September 26,

Re: Blocking behavior of >!! ?

2019-05-20 Thread Thomas Heller
gt;!! c 42) should block because there is no buffer available. > > On Sunday, May 19, 2019 at 1:48:16 PM UTC-7, Thomas Heller wrote: >> >> (> by the first go (running in a different thread). So it is blocking until >> something puts another value into c. Since nothing

Re: Blocking behavior of >!! ?

2019-05-19 Thread Thomas Heller
( > The documentation for >!! reads: > > - > clojure.core.async/>!! > ([port val]) > puts a val into port. nil values are not allowed. Will block if no > buffer space is available. Returns true unless port is already closed. > > > I have a case where I believe that the

Re: [Q] Deploying two artefacts/jars with same group/artefactid via Leiningen

2019-03-28 Thread Thomas Heller
I'm doing this in shadow-cljs deploying a normal jar and one with aot. I'm not exactly sure how you'd do that for an uberjar though. https://github.com/thheller/shadow-cljs/blob/master/project.clj#L96-L103 On Thursday, March 28, 2019 at 7:05:39 PM UTC+1, henrik42 wrote: > > Hi, > > I have an

Re: Invalid-token when dereferencing namespaced keywords.

2019-01-30 Thread Thomas Heller
To expand on what Alex already mentioned. There is no such thing as double-colon keywords. Double-colon is a reader alias mechanism that let the reader resolve them so you can type less. (ns foo.bar.xyz) ::hello this is resolved at read-time and identical to actually writing

Re: try catch leaking exception

2018-02-14 Thread Thomas Heller
lazy-seq is the short answer. You are constructing the seq inside the try/catch but it is realized outside of that so no exceptions will be caught. (defn gen-ym-list [from to] (try (->> (p/periodic-seq (f/parse ym-fmt from) (t/months 1)) (take-while #(not (t/after? % (f/parse

Re: :npm-deps and transitive dependencies

2018-01-16 Thread Thomas Heller
You can create a deps.cljs in the root of your classpath for Y and declare :npm-deps there ;; src/deps.cljs {:npm-deps {"the-thing" "version"}} This way the compiler can pick up your npm dependency and install it. On Monday, January 15, 2018 at 9:01:55 AM UTC+1, Lucas Wiener wrote: > > Hi, > >

Re: [Violation] Parser was blocked due to document.write(

2017-11-05 Thread Thomas Heller
This is only an issue in unoptimized code, ie. :none. Without optimizations all code is in separate files which are loaded in dependency order. The default debug loader will load them by appending a script tag to the document. This has pretty terrible performance characteristics but is OK

Re: Prgram uses a lot of swap

2017-02-27 Thread Thomas Heller
> > ​What is the best way to determine the right value for this? I remember > that in the past I had a lot of little Java​ > > ​programs running and got a much better performance by limiting memory > usage. > That is not an easy question to answer. If you make it too small your process may

Re: Prgram uses a lot of swap

2017-02-27 Thread Thomas Heller
Last thing I can come up with is your environment variables or something in your ~/.lein/* folder. Beyond that I'm out of ideas. On Monday, February 27, 2017 at 2:15:18 PM UTC+1, Cecil Westerhof wrote: > > 2017-02-27 13:57 GMT+01:00 Cecil Westerhof >: > >> Maybe you have

Re: Prgram uses a lot of swap

2017-02-26 Thread Thomas Heller
Maybe you are running an old version of leiningen? This might work although JVM_OPTS works fine for me as well :jvm-opts ^:replace ["-Xmx512m"] Maybe you have some other conflicting configuration somewhere that sets it explicitly to 4G? Usually no maximum is set and the JVM will automatically

Re: Prgram uses a lot of swap

2017-02-26 Thread Thomas Heller
Ideally you would run your program without lein, probably as an uberjar. But if you insist on lein you can do "lein trampoline run -m your.main/fn" which will allow the lein process to exit after setting up your program leaving you with only one JVM. To control the memory you can add :jvm-opts

Re: defrecord in cljc

2016-11-12 Thread Thomas Heller
You may overwrite the default IPrintWriter by doing calling extend-type after the defrecord. But CLJS should probably allow the protocol in defrecord itself instead of forcing the default. Not sure if there is an open issue for it. On Friday, November 11, 2016 at 9:29:25 PM UTC+1, William la

Re: need help on `pprint/write` code with better readability

2016-10-24 Thread Thomas Heller
Try https://github.com/weavejester/cljfmt It is specifically written for clj code and not general pprinter. /thomas On Sunday, October 23, 2016 at 1:28:23 PM UTC+2, Jiyin Yiyong wrote: > > I'm using `write` function to generate code very heavily. But small part > of the code are hard to read.

Re: Possible ClojureScript compiler issue...

2016-10-18 Thread Thomas Heller
21 AM UTC+2, John Szakmeister wrote: > > On Tue, Oct 18, 2016 at 2:59 AM, Thomas Heller <th.h...@gmail.com > > wrote: > [snip] > > While this issue can be very confusing you will hardly ever run into it > when > > following best practices. As David sugg

Re: Possible ClojureScript compiler issue...

2016-10-18 Thread Thomas Heller
wn fork > of Closure Compiler. Which is not that scary with git. It is pretty easy to > automate rebasing of a few patch-commits on top of arbitrary complex > foreign repo. > > [1] > https://github.com/google/closure-compiler/blob/5616a66e40c5dc6ec9be9beacfc0ea20d47bbcfc/src/com

Re: Possible ClojureScript compiler issue...

2016-10-16 Thread Thomas Heller
FWIW I investigated the check with "true" and a sentinel value and found them to both have a small performance impact over just checking for a true-ish property. http://dev.clojure.org/jira/browse/CLJS-1658 The impact is really small so it might be worth the trade-off. /thomas On Sunday,

Re: should edn/read call close() on the PushbackReader?

2016-09-02 Thread Thomas Heller
In general Java it is up to the creator of a "stream" to close it, the same applies to Clojure pretty much. Java has "try with resources" and in Clojure you can use "with-open": (with-open [rdr (open-the-reader)] (edn/read rdr {})) This will ensure .close is called in a finally block. HTH,

Re: How to compile with optimizations none when using web workers

2016-05-30 Thread Thomas Heller
Not sure I understand what you mean. What do you mean by "main module"? cljs has a notion of a base module, while shadow-build does not. Typically your ns structure and the requires are enough to establish relationships between them so shadow-build can figure out what needs to be where. If

Re: cljs build goog/base.js is not getting generated properly..

2016-03-06 Thread Thomas Heller
v20151216"] >>[org.clojure/google-closure-library "0.0-20151016-61277aea"] >> [org.clojure/google-closure-library-third-party >> "0.0-20151016-61277aea"] >> >> the full output is here. >> >> https://gist.github.com/8801e6

Re: cljs build goog/base.js is not getting generated properly..

2016-03-06 Thread Thomas Heller
That was an issue with old closure library releases but was fixed a while ago. Try lein clean and make sure there are no conflicting versions being used (via lein deps :tree). -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: [GSoC idea] Pluggable back-ends architecture for ClojureScript compiler

2016-02-22 Thread Thomas Heller
Projects for this already exist but are somewhat dormant. See: https://github.com/clojure/tools.analyzer https://github.com/clojure/tools.analyzer.jvm https://github.com/clojure/tools.analyzer.js https://github.com/clojure/tools.analyzer.clr https://github.com/clojure/tools.emitter.jvm Neither

Re: How to compile with optimizations none when using web workers

2016-02-20 Thread Thomas Heller
Hey, I have seen Servant but I do not like it. In general I do not like solutions that use macros to solve problems a build tool should solve. YMMV. cljs-runtime is the directory used by shadow-build for all compiled files. The structure it creates is that you have one directory, with a .js

Re: How to compile with optimizations none when using web workers

2016-02-19 Thread Thomas Heller
Hello, I'm not quite sure what you are saying here since I do not know boot or hoplon or durable-cells. I can however suggest a "better" solution for Workers: Using Closure Modules. CLJS or boot do not implement them for :none at the moment but shadow-build does. I also have a few extra

Re: If a Java function seems to never return, how do I test?

2015-10-31 Thread Thomas Heller
> > > What could we do to make the Exception visible, assuming there is one? > > Exceptions are ALWAYS visible, the only way they get lost is the try/catch blocks you added in your code which effectively swallow and ignore them. The JVM will not randomly lose an Exception, it is always code

Re: How do I return the data I need from this Exception?

2015-10-08 Thread Thomas Heller
I see no code to ever call (timbre/log :trace (str "in catch-exceptions our reply was: " reply)) Probably just a copy error, other than that things look correct. The JVM is complex, but strange things happening are pretty much always related to programmer errors. If you add that line

Re: Trying to understand Clojure/Java concurrency performance?

2015-10-07 Thread Thomas Heller
FWIW getting 1mil+ connections will requires some OS level tuning even in Erlang. So you are not going to get that in a benchmark that is not set up for this. In the JVM you are going to run into GC problems eventually, depending on how much state/memory you keep per connection. It might work

Re: Trying to understand Clojure/Java concurrency performance?

2015-10-07 Thread Thomas Heller
, pretty much all of it is till going to apply to an app of that scale. Are you sure you are going to need that scale? 1mil connections is a pretty ambitious goal. /thomas On Wednesday, October 7, 2015 at 8:50:47 PM UTC+2, Thomas Heller wrote: > > FWIW getting 1mil+ connections will re

Re: macro help

2015-10-02 Thread Thomas Heller
o > absolutely agree that the cognitive overhead of the macro isn’t justified > here. > > On 2 Oct 2015, at 14:29, Thomas Heller <th.h...@gmail.com > > wrote: > > Have you tried NOT using a macro at all? This code does not need to be a > macro at all if you ask me. > &

Re: macro help

2015-10-02 Thread Thomas Heller
Have you tried NOT using a macro at all? This code does not need to be a macro at all if you ask me. Just a little sketch but things could look just about the same without any macros at all: (let [form {:editing? true :values form-values :validation validation-report

Re: macro help

2015-10-02 Thread Thomas Heller
se this use-case will never need a macro as hiccup very > sensibly uses data so the thing passed to (form) is simply a vector.) > > I am saying, the discussion of whether _this example_ justifies a macro is > mute - I agree it doesn’t. > > On 2 Oct 2015, at 15:01, Thomas Heller

Re: scheduling with core.async?

2015-09-23 Thread Thomas Heller
To be honest I see no point in using core.async or any other library for that matter. Java already solves this problem very well. (ns ... (:import [java.util.concurrent TimeUnit Executors])) (def scheduler (doto (Executors/newSingleThreadScheduledExecutor) (.scheduleAtFixedRate

Re: Clojure/Pedestal vs Go

2015-09-14 Thread Thomas Heller
Hey, this might not be too relevant to your project but since you said "web project" it might be. I cannot speak for Go but Clojure is "fast enough". I went from Ruby to Clojure in one app and the difference was huge (150ms-ish -> 10ms-ish). I'm actually somewhat of a performance junkie and

Re: Just found out about Elixirs function argument pattern matching...

2015-09-08 Thread Thomas Heller
ords are created using > s/defrecord, the factory functions (->, map->) will automatically validate > them? > > I really appreciate you taking the time to clarify things for me. > > -- > Amith > > > > On Monday, 7 September 2015 20:57:46 UTC+5:30,

Re: Just found out about Elixirs function argument pattern matching...

2015-09-08 Thread Thomas Heller
> > > For instance, which one of these to you consider to be the best > representation of a event to set the expiry time: > >[:cache/expire #inst "2015-09-08T12:00:00Z"] > >{:type :cache/expire, :value #inst "2015-09-08T12:00:00Z"} > >#cache.Expire [#inst "2015-09-08T12:00:00Z"] > >

Re: Just found out about Elixirs function argument pattern matching...

2015-09-07 Thread Thomas Heller
FWIW before I came to Clojure I did a lot of Erlang and in the beginning I was at the exact same spot wanting to use pattern matching everywhere because it is so damn cool. Same goes for tagged literals. After a little while I realized that it is just not the way to do it in Clojure and

Re: Just found out about Elixirs function argument pattern matching...

2015-09-07 Thread Thomas Heller
> > > (def Recipient >> (s/either PlaceHolder >> Existing >> OneOff)) >> > > This looks interesting. Where would I actually use this? I mean, if I have > created three records, I may as well implement multi methods or protocols, > right? Even if I don't do those, I

Re: when the body of the request is HttpInputOverHTTP, how do I get the string representation?

2015-08-19 Thread Thomas Heller
No idea what HttpInputOverHTTP is but I'd guess that it is an InputStream implementation. Try (slurp (:body request)) HTH, /thomas On Wednesday, August 19, 2015 at 9:57:57 PM UTC+2, Lawrence Krubner wrote: I know this has been asked before, but Google is interpreting HttpInputOverHTTP as

Re: Using go/! like C#'s async/await

2015-07-30 Thread Thomas Heller
Hey, I made a similar suggestion (minus the ThreadLocal) a few weeks ago, although for slightly different reasons. [1] It should be noted that your async macro does in fact use the dispatcher just like a normal go would, the only difference is that it will start executing immediately in the

Re: [ANN] Introducing Yo-yo, a protocol-less, function composition-based alternative to Component

2015-07-03 Thread Thomas Heller
That article makes it sound like an OOP beast, it is really much simpler than that. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please

Re: [ANN] Introducing Yo-yo, a protocol-less, function composition-based alternative to Component

2015-07-03 Thread Thomas Heller
example I can refer to. Cheers, /thomas On Friday, July 3, 2015 at 9:39:24 AM UTC+2, James Henderson wrote: Hey Thomas, thanks for your e-mail :) On Monday, 29 June 2015 11:25:44 UTC+1, Thomas Heller wrote: Hey, interesting approach but I don't like the nesting and manual wiring

Re: [ANN] Introducing Yo-yo, a protocol-less, function composition-based alternative to Component

2015-06-29 Thread Thomas Heller
Hey, interesting approach but I don't like the nesting and manual wiring of dependencies. I don't quite like that every with-* function remains on the stack as well, but it shouldn't hurt that much. An uncaught exception will also take down your entire system, but I guess you'd have a

Re: ring - setting no-cache for everything?

2015-06-19 Thread Thomas Heller
Cache-control is evil. Users concerned with seeing the most up-to-date information know to hit reload (and probably do anyway, just to be sure), and there's also the option of AJAX polling for that (or whatever precisely sites like Facebook do). I don't even a wrong

Re: Making Java serializables transparently printable and readable

2015-06-17 Thread Thomas Heller
On Wed, Jun 17, 2015 at 9:50 PM, James Reeves ja...@booleanknot.com wrote: On 17 June 2015 at 09:51, Thomas Heller th.hel...@gmail.com wrote: On another note: Sessions in cookies should be VERY VERY small. java.io.Serializable usually isn't small and especially if you go java object - binary

Re: Making Java serializables transparently printable and readable

2015-06-17 Thread Thomas Heller
Hey, the issue is not in clojure.core. It is with ring in this case, it uses clojure.tools.reader.edn/read-string which supports an optional {:readers {...}} argument but there is no way to specify those in ring. Should be a fairly simple fix though, doing anything to clojure.edn won't help as

Re: Making Java serializables transparently printable and readable

2015-06-17 Thread Thomas Heller
, Thomas Heller wrote: Hey, the issue is not in clojure.core. It is with ring in this case, it uses clojure.tools.reader.edn/read-string which supports an optional {:readers {...}} argument but there is no way to specify those in ring. Should be a fairly simple fix though, doing anything

Re: Clojure web server capacity

2015-04-22 Thread Thomas Heller
Hey, I'm curious what you are trying to measure in regards to Clojure. As far as I know there is not a single Web Server actually written in Clojure, they are all written in Java and we just use them. The Compojure benchmark you linked uses the default Jetty Adapter for Ring (like Rack in Ruby

Re: Clojure web server capacity

2015-04-22 Thread Thomas Heller
You should check your sources. http-kit is not written in Clojure and does not use netty. On Wednesday, April 22, 2015 at 11:40:21 PM UTC+2, François Rey wrote: On 22/04/15 20:22, Thomas Heller wrote: As far as I know there is not a single Web Server actually written in Clojure

Re: Reducers question

2015-02-09 Thread Thomas Heller
Cat is just missing a print-method entry. Try (into [] (r/fold 1 r/cat r/append! [1 2 3])), the result is what you'd expect. The n parameter isn't actually about parallelism but partition size. Fork/Join will decide the parallelism. In the case of n=1 the input will be split into 3 partition

Re: Clojurescript :advanced compilation extern only partly working.

2015-01-30 Thread Thomas Heller
. Crispin On Wednesday, January 28, 2015 at 6:23:29 PM UTC+8, Thomas Heller wrote: I just have a guess for you. AudioContext.decodeAudioData parameters are declared as ArrayBuffer, Function, Function but you are passing data which is a String not an ArrayBuffer. Maybe the type inference

Re: Clojurescript :advanced compilation extern only partly working.

2015-01-28 Thread Thomas Heller
I just have a guess for you. AudioContext.decodeAudioData parameters are declared as ArrayBuffer, Function, Function but you are passing data which is a String not an ArrayBuffer. Maybe the type inference thinks you are calling a method that is not defined in the externs? Maybe it will work

Re: Properly parse clojure source code?

2015-01-15 Thread Thomas Heller
https://github.com/clojure/tools.reader is probably your best bet. On Friday, January 16, 2015 at 12:13:22 AM UTC+1, zirkonit wrote: I'm thoroughly confused. If I want to parse clojure code from string without evaluating or caring a lot about its context, I'm out of luck. EDN tools choke on

Re: camelize-dasherize - reinventing the wheel?

2015-01-06 Thread Thomas Heller
If you want to boost performance a bit just memoize the conversion functions. Memoize makes you vurnable to exploits though, better use something with WeakRefs if you convert anything from untrusted sources (eg. guava CacheBuilder). But given your usecase this will probably be the biggest

Re: A (foolish) plan to re-invent IO on top of core.async

2015-01-05 Thread Thomas Heller
I built a PostgreSQL Java client from scratch recently. Since it was not a goal to support JDBC ever I thought about writing it with non-blocking async IO. I played with some ideas but ultimately I decided not to. The reason is quite simple. Async IO works well if you do enough IO to keep one

Re: Creating Hiccup From Code Keeping Formatting and Comments

2015-01-04 Thread Thomas Heller
Here is a crazy idea I had. https://gist.github.com/thheller/ad7dc6234f205cf4a53f Basically it slurps the .clj file of the current namespace, then looks at the form metadata to skip to the line where the (example ...) starts. It then takes the next row as the title, then reads all rows until

Re: Creating Hiccup From Code Keeping Formatting and Comments

2015-01-04 Thread Thomas Heller
Oops, simplified a little. We already have access to the title. ;) On Monday, January 5, 2015 1:09:24 AM UTC+1, Thomas Heller wrote: Here is a crazy idea I had. https://gist.github.com/thheller/ad7dc6234f205cf4a53f Basically it slurps the .clj file of the current namespace, then looks

Re: Using dev/user.clj breaks java compilation

2015-01-02 Thread Thomas Heller
I had a similar problem some time ago. The analysis is correct that Clojure will always load user.clj. As a workarround I just moved the require out of the ns form. (ns user (:require [mdg.meat2])) becomes (ns user) (defn start [] (require 'mdg.meat2 :reload-all) (do-something-useful))

Re: Handling increasingly-intensive processes

2014-12-15 Thread Thomas Heller
Hey, without knowing much about your application/business needs its hard to speculate what might be good for you. The root of your problem might be CouchDB since it was never meant for Big Data and since we are talking tweets I generally think a lot. I'm not sure how your map value looks but

Re: Ring and Compojure with Node.js via Clojurescript

2014-12-09 Thread Thomas Heller
Due to significant platform differences from the JVM to Node.js (no real threads, everything needs callbacks) you'd probably be better off writing something more javascript-y. Porting Ring is probably not likely since everything is async and Ring is not. Same goes for Compojure but that is

Re: Idiomatic way to return a single value from an async function

2014-11-11 Thread Thomas Heller
Hey, what is your definition of an async function in Clojure? I imagine something something that starts a (go ...), if appropriate you can use the result of (go ...) as the result of the function since that is a channel that will receive the return value of the go block when it dies. (defn

Re: Mutable local variables

2014-11-10 Thread Thomas Heller
@Jacob: If you get too many arguments in a loop I found it best to use a map. (loop [{:keys [a b c] :as state} a-map] (cond (and (= a 1) (= b 2)) (recur (update state :a inc)) ;; 1.7+ only, otherwise use update-in ...)) Working with named arguments (vs. positional) is a lot more

Re: io/writer + map/recur

2014-11-01 Thread Thomas Heller
The way you wrote your loop it will only ever run once which means you could take it out. 1 res = take from queue 2 if res nil? terminate 3 if res recur with result from with-open (always nil) 4 back to 2 and terminate Not sure if this is intended but the way it is written it does not make

Re: [ANN] shadow-pgsql: PostgreSQL without JDBC

2014-10-17 Thread Thomas Heller
I meant to do a proper release announcement for quite some time now but simply don't have the time to do it properly. That being said I have now been using shadow-pgsql [1] in production for well over a month and it has been working as expected and stable. A couple million Queries were

Re: Deploy best practices

2014-09-18 Thread Thomas Heller
I use http-kit as a web server as well. My deployment basically looks like this: My main function starts my app, once I have an app instance I attempt to start the http-kit server on a specific port. I do this in a loop, catching all socket already bound exceptions and retrying. Additionally I

Re: Is this a reasonable use of core.async?

2014-09-17 Thread Thomas Heller
core.sync is more about coordination and communication than about doing things in parallel, thats just a pleasant side effect. In your case you don't need anything core.async provides. You could either use reducers or java.util.concurrent.ExecutorService. (let [exec

Re: Is this a reasonable use of core.async?

2014-09-17 Thread Thomas Heller
Uh forgot to .shutdown the exec, proper cleanup is important otherwise the threads might hang arround a bit. On Wednesday, September 17, 2014 1:26:00 PM UTC+2, Thomas Heller wrote: core.sync is more about coordination and communication than about doing things in parallel, thats just

Re: [ANN] shadow-pgsql: PostgreSQL without JDBC

2014-09-03 Thread Thomas Heller
. On Thursday, 21 August 2014 19:00:11 UTC+1, Thomas Heller wrote: Hey Clojure Folk, I'm close to releasing the first alpha version of https://github.com/ thheller/shadow-pgsql a native interface to PostgreSQL I wrote. Its an implementation of the native binary protocol without any intent to ever

Re: Using an atom for a caching map

2014-09-01 Thread Thomas Heller
As much as I like Clojure and atoms, I do not think they are a good fit for caching. Not only is it impossible to address the concurrency issues related to multiple threads loading the same object, but you also have to do expiration and size management yourself. Immutability doesn't help much

Re: Using an atom for a caching map

2014-09-01 Thread Thomas Heller
strange use case, which is nice :-). For more typical server side caching, I agree that Guava would be a great solution. Cheers, Colin On 1 September 2014 20:54, Thomas Heller th.h...@gmail.com javascript: wrote: As much as I like Clojure and atoms, I do not think they are a good fit

Re: [ANN] shadow-pgsql: PostgreSQL without JDBC

2014-08-25 Thread Thomas Heller
On Saturday, August 23, 2014 8:05:37 PM UTC-4, Thomas Heller wrote: EDN/Transit on the backend might be nice, but a little much for me. I'll take it if you feel like a lot of C. jsonb in 9.4 will have to do for now. Transparent encoding/decoding is already built-in to the client though, even

Re: Resolve function or object by name in ClojureScript

2014-08-25 Thread Thomas Heller
It is possible, the question is WHEN? You can make a function callable by name if you export it. (ns myns) (def ^:export testfn [] :foo) can be called like so, must be careful with name munging though: (let [the-fn (aget js/window myns testfn)] (the-fn)) which also works with advanced

Re: [ANN] shadow-pgsql: PostgreSQL without JDBC

2014-08-23 Thread Thomas Heller
, August 21, 2014 at 1:00 PM, Thomas Heller wrote: Hey Clojure Folk, I'm close to releasing the first alpha version of https://github.com/thheller/shadow-pgsql a native interface to PostgreSQL I wrote. Its an implementation of the native binary protocol without any intent

Re: [ANN] shadow-pgsql: PostgreSQL without JDBC

2014-08-23 Thread Thomas Heller
On Sat, Aug 23, 2014 at 11:23 AM, Thomas Heller th.h...@gmail.com javascript: wrote: Hey Kyle, thanks for the Feedback. Appreciate it. I think you misunderstood the meaning of a type in shadow-psql. A type is merely the format of how a given value is represented on the wire

[ANN] shadow-pgsql: PostgreSQL without JDBC

2014-08-21 Thread Thomas Heller
Hey Clojure Folk, I'm close to releasing the first alpha version of https://github.com/thheller/shadow-pgsql a native interface to PostgreSQL I wrote. Its an implementation of the native binary protocol without any intent to ever support JDBC. Mostly because that provides a bunch of features

Re: Newbie: adding items to a global vector in doseq

2014-08-14 Thread Thomas Heller
Hey, it's not how you'd usually do things in Clojure and I'd consider the use of an atom in this place as wrong. I was struggling with Clojure in the beginning too and my code looked pretty much like yours, but the faster you get into the Clojure mindset the easier it will be. This might be

Re: Transducers are Coming

2014-08-07 Thread Thomas Heller
Looks nice, although I still need to wrap my head arround it. I don't believe in micro-benchmarks but I did one anyways cause I was curious how transduce would stack up against reduce (not reducers). https://github.com/thheller/transduce-bench transduce Evaluation count : 2220 in 60 samples

Re: Write/reading java maps and lists using fressian/transit

2014-08-07 Thread Thomas Heller
Both Transit and fressian take a Handler map as arguments to the reader/writer functions/constructors. So its pretty straightforward to replace the default handlers with handlers that do what you want. I have no example handy but it should be documented in both libraries. Transit has

Re: Why does this not give output

2014-08-06 Thread Thomas Heller
dotimes is for doing things n times. doseq is for seqs. Use dotimes when you can, doseq when you can't. On Wed, Aug 6, 2014 at 12:13 AM, Cecil Westerhof cldwester...@gmail.com wrote: 2014-08-05 19:04 GMT+02:00 Thomas Heller th.hel...@gmail.com: If you don't need the result of the for loop

Re: Why does this not give output

2014-08-05 Thread Thomas Heller
If you don't need the result of the for loop (which you don't in your example) use doseq. Same syntax as for but not lazy and no return value (well, nil to be exact) (doseq [i (range 10)] (aset intArr i (int 0))) ... On Tuesday, August 5, 2014 5:41:08 PM UTC+2, Cecil Westerhof wrote: I

Re: CLJS Function clobbering js function of same name

2014-08-04 Thread Thomas Heller
FWIW I was not able to reproduce this behavior? What exactly does your code look like? See the source and the compiled version: https://gist.github.com/thheller/4731f682665d38b1053c Seems to me the shadowing kicked in correctly. eval seems to be missing in :js-globals though.

Re: CLJS Function clobbering js function of same name

2014-08-04 Thread Thomas Heller
I was not able to reproduce Sam's initial problem. eval as I said does not appear in the :js-globals which seems like a mistake. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that

Re: CLJS Function clobbering js function of same name

2014-08-04 Thread Thomas Heller
https://gist.github.com/thheller/4731f682665d38b1053c On Monday, August 4, 2014 3:34:33 PM UTC+2, Nicola Mometto wrote: Try with (fn document [] js/document) Thomas Heller writes: I was not able to reproduce Sam's initial problem. eval as I said does not appear in the :js-globals

Re: [ClojureScript] Re: ANN: ClojureScript 0.0-2277

2014-07-30 Thread Thomas Heller
David its probably best to hold off on that release. It seems the closure-library HEAD version depends on a newer closure compiler version than the one available via maven. At least I'm seeing some renaming issues for advanced compilation. -- You received this message because you are

Re: ANN: ClojureScript 0.0-2277

2014-07-30 Thread Thomas Heller
Sorry, I would be if I could. Trying to track it down, but debugging an optimized build is not exactly easy. :( When using 2277 I have no errors, when using 2277 with the new closure lib release I have some undefined errors. That usually means some sort of renaming gone wrong. Error: Cannot

Re: ANN: ClojureScript 0.0-2277

2014-07-30 Thread Thomas Heller
Geez, 2277 actually works just fine. 2234 doesn't work, but it actually doesn't work with either closure-library version. Forgot that I reverted to 2234 due to the keyword issue. 2277 + [org.clojure/google-closure-library 0.0-20140718-946a7d39] seems fine, except for that keyword issue. Sorry

Re: [ClojureScript] Re: ANN: ClojureScript 0.0-2277

2014-07-30 Thread Thomas Heller
, Jul 30, 2014 at 11:11 AM, Thomas Heller th.h...@gmail.com javascript: wrote: Geez, 2277 actually works just fine. 2234 doesn't work, but it actually doesn't work with either closure-library version. Forgot that I reverted to 2234 due to the keyword issue. 2277 + [org.clojure/google

Re: [ClojureScript] Re: ANN: ClojureScript 0.0-2277

2014-07-29 Thread Thomas Heller
Uhm small hint on how I'd do that? My maven-fu is weak. But given that https://oss.sonatype.org/content/repositories/orgclojure-1311/org/clojure/google-closure-library-third-party/0.0-20140718-946a7d39/google-closure-library-third-party-0.0-20140718-946a7d39.jar does not contain a goog/base.js

Re: [ClojureScript] Re: ANN: ClojureScript 0.0-2277

2014-07-29 Thread Thomas Heller
wrote: Just add sonatype to your :repositories project.clj entry https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L79 David On Tue, Jul 29, 2014 at 4:22 PM, Thomas Heller th.h...@gmail.com javascript: wrote: Uhm small hint on how I'd do that? My maven-fu is weak

Re: Leiningen profile problem

2014-07-28 Thread Thomas Heller
Your issue is probably due to AOT compilation, uberjar aot compiles everything and leaves alot of class files in your target directory (aka classpath). When you run your app afterwards the class file is used instead of the clj file since the .class file is newer. When you run lein clean those

Re: ANN: ClojureScript 0.0-2277

2014-07-26 Thread Thomas Heller
Hey David, CLJS-826 is only partly resolved in this release since it only takes effect with a new closure-third-party release since the current jar is causing the problem. Would be nice if you could build a new closure release and bump the dependency in clojurescript. Thanks, /thomas On

Re: Leiningen resource-paths

2014-07-24 Thread Thomas Heller
Hey, I had this problem with a jar from Bing which is not available on maven. You can use a local repo without any plugins or extra work for others. Try this: Pick a directory for your local maven repo, should be inside your git repo. I'm using maven. Take your jar and run mvn

Re: Leiningen resource-paths

2014-07-24 Thread Thomas Heller
the uberjar so you'll have jar in a jar which java doesnt understand. /thomas On Thursday, July 24, 2014 3:22:37 PM UTC+2, Yura Perov wrote: Dear Thomas Heller, Thank you very much for your reply. As I mentioned in my initial post (sorry, it was a bit long), I successfully managed local

Re: How to return a value from catch block

2014-07-13 Thread Thomas Heller
catch returns the value of the last statement, so instead of the (str) you could just return 0.0. Also don't use read-string if you only expect floating point numbers, otherwise (convert-to-float :hmm) returns :hmm, not exactly a float. Since closure uses Double as the default floating point

Re: 101 on simple and flexible graph query/update?

2014-07-10 Thread Thomas Heller
I usually just give every ENTITY in my system a primary id and structure everything in a nested map. {:people {1 {:id 1 :type :student :name Ben :taking-classes #{1 2}} 2 ...} :classes {1 {:id 1 :name Clojure 101} 2 ...}} This basically looks like a database table. You can

Re: How to access record in a hashmap

2014-07-09 Thread Thomas Heller
Short and simple answer: NullPointerException (def object-locations nil) (object-locations 'bucket) will throw ('bucket object-locations) = nil HTH, /thomas On Wednesday, July 9, 2014 3:48:53 PM UTC+2, Cecil Westerhof wrote: When you have: (def object-locations { 'whiskey

Re: How to access record in a hashmap

2014-07-09 Thread Thomas Heller
Oh and its rare (outside of macros) to use symbols like that. Usually you'd use keywords. (def object-locations {:whiskey :living-room}) On Wed, Jul 9, 2014 at 5:03 PM, Thomas Heller th.hel...@gmail.com wrote: Short and simple answer: NullPointerException (def object-locations nil

  1   2   >