Re: asm-based clojure yet?

2013-05-17 Thread Gary Trakhman
I think these qualify as low-footprint clojures: https://github.com/clojure/clojurescript on node.. https://github.com/takeoutweight/clojure-scheme compiles to native https://github.com/halgari/mjolnir llvm targets. On Fri, May 17, 2013 at 7:10 AM, atkaaz wrote: > Ok, weird question: is there

Re: asm-based clojure yet?

2013-05-18 Thread Gary Trakhman
Immutability, persistence, closures without a serious garbage collector sounds hard. On Sat, May 18, 2013 at 1:09 AM, atkaaz wrote: > Thanks very much everyone! I'm looking into all of those, but currently > planning to read Julian's pdf. I didn't want to say anything until I had > something de

Re: asm-based clojure yet?

2013-05-18 Thread Gary Trakhman
atkaaz wrote: > your comment caused me to be reading this > http://prog21.dadgum.com/134.html > (at least) > > > On Sat, May 18, 2013 at 6:17 PM, Gary Trakhman wrote: > >> Immutability, persistence, closures without a serious garbage collector >> sounds hard. &

Re: More idiomatic way to find the first non-nil function result?

2013-05-20 Thread Gary Trakhman
boolean algebra... demorgan's laws.. etc.. http://en.wikipedia.org/wiki/De_Morgan's_laws On Mon, May 20, 2013 at 1:38 PM, Jeb wrote: > Is there a term/phrase that describes this style of programming (as > opposed to nested ifs, for example)? > > > On Wednesday, May 1, 2013 12:46:36 PM UTC-5, Ce

Re: Design/structure for a game loop in clojure

2013-05-20 Thread Gary Trakhman
I thought this approach was interesting: http://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/ A key insight I've seen promoted in other places is to use flattened structures and identities instead of nested object hierarchies, thus your handy sub-lists may be represented as graph queries

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Gary Trakhman
Is this not sufficient? file-seq https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4478 On Mon, May 20, 2013 at 4:28 PM, Jim - FooBar(); wrote: > have you considered using mapcat recursively? something like this > perhaps? > > (defn list-all-files [^java.io.File dir] >

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Gary Trakhman
. > > Jim > > > On 20/05/13 21:39, Jim - FooBar(); wrote: > > actually yes it is! :) I thought file-seq was going down one level only > but looking at the implementation it seems it goes down all levels...I'm > trying it out now > > Jim > > On 20/05/13

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Gary Trakhman
Ramesh, I think the main problem is you're trying to do a recursion over a tree, so you're blowing a stack if you're not careful, concat is lazy so I think you're just shifting the problem around, file-seq gets around this by using tree-seq, which uses 'walk', which is a linearization of the tree.

Re: asm-based clojure yet?

2013-05-22 Thread Gary Trakhman
emacs does this navigation stuff.. M-. and M-, . For uses of a function, try grep -R or rgrep. On Wed, May 22, 2013 at 1:30 PM, atkaaz wrote: > Looks like I forgot to enable the paging file (windows virtual memory was > disabled) and that is why my eclipse/firefox would crash when running out >

Re: How to: reduce boolean operations?

2013-05-23 Thread Gary Trakhman
A while back I saw some java slides that elude me now, they mentioned approaches to safety like defensive copying, immutability, etc.. their conclusion at the end, that I seem to remember, was it only really made sense to validate user input, a sort of wall, where anything past the wall is assumed

Re: Future/Promise and not using threads

2013-05-30 Thread Gary Trakhman
Maybe an easy solution: wrap the first future in another future that blocking-derefs, then performs your extra computation? Do an extra 'realized?' check for the optimization you mention. That would still consume threads in the case that it's not realized, but I think it gets you what you want.

Re: Future/Promise and not using threads

2013-05-30 Thread Gary Trakhman
e of these that uses the unbounded agent thread-pool, but you would be free to return one using reify or something. https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6320 On Thu, May 30, 2013 at 5:14 AM, Gary Trakhman wrote: > Maybe an easy solution: wrap the first f

Re: What is the status of Clojure on LLVM or C?

2013-05-30 Thread Gary Trakhman
I just thought about this recently, but does the value-oriented nature of clojure mostly void the need for a cycles-aware GC? It seems like you won't ever have cycles without identities, or pointers (java references). Maybe this would be a problem only when you need identities, ie deftype or defp

Re: What is the status of Clojure on LLVM or C?

2013-05-30 Thread Gary Trakhman
7;orange wrote: > > > On Thursday, May 30, 2013 2:21:36 PM UTC+2, Gary Trakhman wrote: >> >> I just thought about this recently, but does the value-oriented nature of >> clojure mostly void the need for a cycles-aware GC? It seems like you >> won't ever have cy

Re: What is the status of Clojure on LLVM or C?

2013-05-30 Thread Gary Trakhman
(atomic inc & dec). So if you have two > cores reading (not just writing) from the same hash-map, they'll be > fighting over the cache lines that the refcount is stored in, and that'll > kill performance. > > Timothy > > > On Thu, May 30, 2013 at 8:47 AM, Gary Tr

Re: Use of io!

2013-05-30 Thread Gary Trakhman
What if you really want the 'bad' effects on retries? We need io! versions and non-io! versions of side-effect functions :-) On Thu, May 30, 2013 at 1:24 PM, Sean Corfield wrote: > On Thu, May 30, 2013 at 1:10 AM, Alex Baranosky > wrote: > > Do any of you ever use io! ? I've never used it, bu

Re: Use of io!

2013-05-30 Thread Gary Trakhman
Well, more seriously, I would be against any facility that prevents me from doing something potentially useful that I might want to do. Sprinkling potential problem spots with io! might make more sense in an application than a library. On Thu, May 30, 2013 at 1:27 PM, Gary Trakhman wrote

Re: What is the status of Clojure on LLVM or C?

2013-05-30 Thread Gary Trakhman
ts. Consider multi-core, now the >> refcounts have to be thread safe (atomic inc & dec). So if you have two >> cores reading (not just writing) from the same hash-map, they'll be >> fighting over the cache lines that the refcount is stored in, and that'll >> kill

Re: What is the status of Clojure on LLVM or C?

2013-05-30 Thread Gary Trakhman
>>> to increment and decrement the refcounts. Consider multi-core, now the >>> refcounts have to be thread safe (atomic inc & dec). So if you have two >>> cores reading (not just writing) from the same hash-map, they'll be >>> fighting over the cache lines that the

Re: Idiomatic way to write dependency resolving algorithms?

2013-05-31 Thread Gary Trakhman
You can express the algorithm using reduce with the set as an accumulator. Also, consider: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4969 and related hierarchy functions. On Fri, May 31, 2013 at 12:33 PM, Alice wrote: > (def graph > {"a" {:dependencies ["b" "

Re: Best IDE

2013-06-04 Thread Gary Trakhman
I used eclipse emacs+ for about a year for java code once I had started writing clojure in emacs, it made me more productive, but it was a hassle to set up. Unfortunately, when eclipse updated itself to juno, it broke, and there is still no support. Going forward, I think this is a more compellin

Re: WSS Clojure client

2013-06-04 Thread Gary Trakhman
nginx is a web server, and I don't think what you want. You probably want to use apache httpclient or a wrapper library. I hate all the wrapper libraries, and I've used clj-http and clj-apache-https. A quick google search turns up an alternative, seems promising: https://github.com/victor-github

Re: WSS Clojure client

2013-06-04 Thread Gary Trakhman
egant, but it's likely less tested than the java libs. I guess I'll change my answer to, 'it depends'. :-) On Tue, Jun 4, 2013 at 3:13 PM, Michael Klishin wrote: > 2013/6/4 Gary Trakhman > >> I hate all the wrapper libraries, and I've used clj-http and >>

Re: [ANN] alpacas: a new Clojure source viewer

2013-06-04 Thread Gary Trakhman
Just fyi, most clojure libs are published under EPL or Apache licenses, of course the choice is up to you :-). GPL has some restrictions that would prevent the lib from being used in many projects. from the EPL wikipedia page: 'The EPL 1.0 is not compatible

Re: importing a java class which 'requires' your namespace in a static block

2013-06-05 Thread Gary Trakhman
One problem with doing this in a static initializer is that you lose the relevant exception. I would try moving this to a constructor or lazy-load it, and you might get a better error message. On Wed, Jun 5, 2013 at 1:28 PM, Jim - FooBar(); wrote: > Hello everyone, > > weirdness strikes again!

Re: Making things go faster

2013-06-06 Thread Gary Trakhman
> Note that the problem is actually the Clojure startup time, *not* the JVM > startup. JVM starts up in about 0.1sec on my machine. The rest of the time > is spend loading Clojure code, compiling all the core namespaces etc. > > That's one way to look at it, another is that clojure's design tightly

Re: How to cleanly interface with a Java lib that requires mutability?

2013-06-07 Thread Gary Trakhman
sounds fun, have you seen this yet? http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/ On Fri, Jun 7, 2013 at 3:21 PM, Denis Labaye wrote: > Hi, > > I'm writting Clojure code that is used by a Java framework (Fitnesse's > slim for those who knows). >

Re: Reflective method invocation

2013-06-11 Thread Gary Trakhman
The result can be JVM-dependent. I've solved a bug in our codebase that was due to JDK 7's reflection preferring a different constructor for an object than 6, which was fixed by explicitly wrapping the ambiguous argument in (boolean). Whatever the behavior, it's best to not rely on a specific bro

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Gary Trakhman
2 cents, I don't see the value in mixing and matching lower-level constructs between test frameworks, which also sounds hard. I see a lot of value in what the SPEC provides, standardized test-reporting, metadata and runner infra. This makes tooling's life easier, and would ease the burden of using

Re: In what OS do you code?

2013-06-14 Thread Gary Trakhman
Linux. I started making the investment 12 years ago with RedHat 6.2 and Slackware, so the extra fuss-time tradeoff is worth it for me, since I can minimize it by now. I can have a working clojure system from scratch in 20 minutes, which I've demonstrated here: http://gtrak.wordpress.com/2012/12/1

Re: In what OS do you code?

2013-06-14 Thread Gary Trakhman
Yes, I installed the OS, too, that includes emacs, auto-complete, ac-nrepl (I had some problem and had to look stuff up, I can do it faster now). On Fri, Jun 14, 2013 at 9:54 AM, Denis Labaye wrote: > > > > On Fri, Jun 14, 2013 at 3:52 PM, Gary Trakhman wrote: > >> Linux.

Re: A* Graphe implementation

2013-06-16 Thread Gary Trakhman
What do you need to do, more specifically? For a basic clojure introduction, check out: http://dev.clojure.org/display/doc/Getting+Started On Sun, Jun 16, 2013 at 5:42 PM, Clojurist wrote: > Hey everyone, I'm having a project where i have to create an app for A* > algorithm, and the thing is t

Re: Need to render some entities moving across a grid

2013-06-17 Thread Gary Trakhman
For something quick and dirty, have you taken a look at quil? It's pretty easy to get started. https://github.com/quil/quil On Monday, June 17, 2013, vemv wrote: > I'm implementing a program D. Hofstadter describes in *Fluid Concepts: * > https://github.com/vemv/jumbo/* *Even in the original t

Re: First day with Macros

2013-06-17 Thread Gary Trakhman
Unquoting 'camel-case-method-name' is going to try and replace the symbol with it's value during compile-time in the context of the macro itself. also, reify isn't going to work if you need a named class to actually wire up your servlet, for example with a web.xml. Also, consider that you'll need

Re: First day with Macros

2013-06-17 Thread Gary Trakhman
; (for [meth ~meths] >(let [[method-name args & body] ~meth > camel-case-method-name (hyphenated->camel-case ~method-name)] > (camel-case-method-name ~args ~@body) > > Still it is not working :( > > How to fix it? > > On Tue

Re: What the recommended way now to create an instance and override its methods?

2013-06-18 Thread Gary Trakhman
I think you need to read something comprehensive before any of these replies start to make sense, I would recommend Joy Of Clojure, or some good blog posts. This might be a good starting point with some links for further reading: http://tech.puredanger.com/2011/08/12/subclassing-in-clojure/ To un

Re: First day with Macros

2013-06-18 Thread Gary Trakhman
th ~meths] >>>(let [[method-name args & body] ~meth >>> camel-case-method-name (hyphenated->camel-case >>> ~method-name)] >>> (camel-case-method-name ~args ~@body) >>> >>> Still it is not working :( >

Re: Best practice for looping

2013-06-22 Thread Gary Trakhman
Do you have the stack trace? It's not simple to run the code, but I made a github project so we can look at it easier. https://github.com/gtrak/grad-descent-test When I run (gradient-descent example-grad [0 1] 0.001 0.001) Here's the actual problem: grad-descent.core> (pst *e) StackOverflowError

Re: Best practice for looping

2013-06-22 Thread Gary Trakhman
LazySeq.java:42) clojure.lang.LazySeq.seq (LazySeq.java:60) clojure.lang.RT.seq (RT.java:473) clojure.core/seq (core.clj:133) clojure.core/map/fn--4087 (core.clj:2426) nil user> On Sat, Jun 22, 2013 at 1:10 PM, Gary Trakhman wrote: > Do you have the stack trace? It's not simple to

Re: what execurtes what in clojure

2013-06-22 Thread Gary Trakhman
Check out https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj#L404 and https://github.com/clojure/clojure/blob/master/src/jvm/clojure/main.java On Sat, Jun 22, 2013 at 7:20 PM, jayvandal wrote: > in a project file the > :main my-website.server) > Is this like a go to statem

Re: Packaging data_readers.clj with a Clojar

2013-06-22 Thread Gary Trakhman
I don't think there's a way to make aliases for reader literals, which you would want in order to avoid breaking this rule: "Reader tags without namespace qualifiers are reserved for Clojure." from http://clojure.org/reader#The Reader--Tagged Literals But I haven't tried it myself, is that the cas

Re: Best practice for looping

2013-06-24 Thread Gary Trakhman
pst is printstacktrace, it's in the clojure.repl namespace and comes with clojure. Sometimes lein or something makes it available automatically, but if it isn't, you can (use 'clojure.repl) to get to it. http://clojure.github.io/clojure/clojure.repl-api.html#clojure.repl/pst Yes, switching to ma

Re: Pure/deterministic functions, as values in the compiler

2013-06-26 Thread Gary Trakhman
The first thing I think of along these lines is codeq http://blog.datomic.com/2012/10/codeq.html When I first heard about it, I thought it might have potential for code reuse and whole-program optimization. If you've ever imported something that causes irrelevant classes to take up space in your

Re: I'm starting to wonder if I'm the only person using clooj ...

2013-06-28 Thread Gary Trakhman
I wanted to try out 0.4.1 on my desktop, is there a trick to getting it to run on windows? It errored out with something that looked like OSX-specific AWT usage. I can look at it more deeply some time. On Fri, Jun 28, 2013 at 10:06 AM, Lee Spector wrote: > > On Jun 28, 2013, at 4:53 AM, Rich M

Re: I'm starting to wonder if I'm the only person using clooj ...

2013-06-28 Thread Gary Trakhman
Happens on linux too: gary@gary-dell:~/dev$ java -jar ~/Downloads/clooj-0.4.1-standalone.jar # java.lang.ClassNotFoundException: com.apple.eawt.FullScreenUtilities at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

Re: Sharing result of macro's calculation with the body

2013-07-01 Thread Gary Trakhman
Whenever I make a macro like this, I pass the symbol to be captured as an argument to the macro. Any collisions would be more explicit and less surprising. On Mon, Jul 1, 2013 at 11:21 AM, Baishampayan Ghose wrote: > Hi, > > What you need is called an anaphoric macro (via symbol capture). > Clo

Re: Web crawling tree traversal

2013-07-05 Thread Gary Trakhman
I wrote this a while ago, here it is :-) https://github.com/gtrak/betamore-clj/blob/master/src/betamore_clj/core.clj On Thu, Jul 4, 2013 at 1:23 PM, Amir Fouladi wrote: > Hi everybody > > I'm a clojure newbie, so I'm sorry if I'm asking a dumb question. > I'm trying to write a program to crawl

Re: Can't figure out how to merge this dern map.

2013-07-08 Thread Gary Trakhman
I think the destructuring you're trying to do uses [ ]. Apply/reduce merge is the general answer. On Mon, Jul 8, 2013 at 11:16 AM, Alexander Solovyov wrote: > The simplest way I see is > > (apply merge (filter identity '({:apple "red and crunchy"} nil nil {:Numb > 1} nil nil {:Field "FRUIT.Desc

Re: Can't figure out how to merge this dern map.

2013-07-08 Thread Gary Trakhman
Into is reduce-conj, and this relies on a special-case of conj for maps and map entries. I find it hard to read, so I would vote for apply/reduce merge. This is weird and unexpected, so please don't: user> (into {:c :d} [{:a :b}]) {:c :d, :a :b} user> (into {:c :d} {:a :b}) {:c :d, :a :b} On M

Re: Confused about exception handling

2013-07-08 Thread Gary Trakhman
Clojure doesn't have checked exceptions, but it uses a java compiler trick called sneaky-throws to rethrow and catch them, so versions past 1.3 don't wrap them in RuntimeExceptions. Generally, clojure won't go out of its way to protect you from exceptions or catch them for you, but it's idiomatic

Re: Clojure: Elegance vs. Performance?

2013-07-09 Thread Gary Trakhman
The TCO macro already exists: https://github.com/cjfrisz/clojure-tco On Tue, Jul 9, 2013 at 1:39 PM, Ben Wolfson wrote: > On Tue, Jul 9, 2013 at 10:28 AM, Mikera wrote: > >> >> A reasonably simple optimisation would be to automatically identify >> self-recursion in tail position and convert it

Re: ClassCastException in APersistentVector.doEquiv with custom implementation of IPersistentVector

2013-07-09 Thread Gary Trakhman
>From the lack of extending java's Collection in IPersistentVector or associated interfaces, it seems like the intent is for every implementation to extend (proxy) APersistentVector. Is that sufficient for what you're trying to do? None of the methods in there are final. On Tue, Jul 9, 2013 at

Re: clojure interpreters?

2013-07-09 Thread Gary Trakhman
An issue with an interpreter is keeping semantics in sync with canonical clojure. Unfortunately, since 'Clojure' is a superset of java's semantics, it's possible to have different behavior with regards to classloading and such. Environment-as-a-value means decoupling vars and such from being globa

Re: test run startup time

2013-07-10 Thread Gary Trakhman
Real work is done with a repl embedded into a text editor with live eval. Running tests is just a function call away, clojure.test/run-tests. Here's a modern starting point: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded On Wed, Jul 10, 2013 at 1:36 PM, Brian Craft wrote:

Re: ClassCastException in APersistentVector.doEquiv with custom implementation of IPersistentVector

2013-07-10 Thread Gary Trakhman
in the present case that's >> fine? >> >> I'm just remembering that Collection is an interface and not a class, so >> I guess that's not too bad since I can add it to my reify. >> >> [1] http://clojure.org/datatypes >> >> Than

Re: Clojure: One language to rule the Web

2013-07-11 Thread Gary Trakhman
It's true that many of these systems are equivalently powerful and redundant, but the dominant forces driving them are social, not technical. Fred Brooks's 'The Mythical Man-Month' is the classic book on this topic. In an ideal world, where information flowed freely and instantly, all these menti

Re: Performance Patterns

2013-07-17 Thread Gary Trakhman
I have a variant of the timings macro that I used to profile some numeric code recently. You sprinkle it in your code, and it aggregates timings during a run by keywords of your choice.: (def ^:dynamic *times* nil) (defmacro timek "Evaluates expr and prints the time it took. Returns the va

Re: Interest in a Full Featured Clojure Blog Engine

2013-07-18 Thread Gary Trakhman
Django's pretty good at this with it's auto-gen'd Admin interface, if we had something comparable it would be compelling to a large audience, but I worry that it becomes 'frameworky' at a certain point, and clojure has a bias against that. On Thu, Jul 18, 2013 at 11:10 AM, Timothy Washington wrot

Re: ns defaults

2013-07-18 Thread Gary Trakhman
Could you abuse a reader literal? Seems like it could work at first glance. On Thu, Jul 18, 2013 at 4:34 AM, Jozef Wagner wrote: > Compiler loads and refers clojure.core namespace for each new namespace. In > my projects, I often have one or two namespaces I use nearly in every other > namespac

Re: Robo VM

2013-07-22 Thread Gary Trakhman
Seems like it would need reflection and classloaders for loading ASM bytecode, and the run-time would thus need its compiler, I can't tell from the site whether that's the case. If there's no reflection, then it would be a pain to make clojure work. But, I see it says: 'The standard classes (java

Re: Can we please deprecate the :use directive ?

2013-07-23 Thread Gary Trakhman
We should scour clojuresphere for uses of 'use' and automatically post github issues to the projects of interest, and redefine the ns macro to issue a warning with use. Does anyone actually like 'use'? Require is always more evident. On Tue, Jul 23, 2013 at 2:17 PM, Jozef Wagner wrote: > +1, :

Re: Can we please deprecate the :use directive ?

2013-07-23 Thread Gary Trakhman
ote: > For much the same reason, I've been using :require with :as and a > one-or-two-letter alias, so I can do x/whatever. Generally works well. > > > On Tue, Jul 23, 2013 at 1:38 PM, Lee Spector wrote: > >> >> On Jul 23, 2013, at 2:27 PM, Gary Trakhman wrote:

Re: Can we please deprecate the :use directive ?

2013-07-23 Thread Gary Trakhman
short alias >> seems a better approach for teaching / explaining things but I'm sure >> I'm guilty of :use in earlier blog posts about Clojure (... checking >> ... yup, three blog posts from early 2012 contain :use, mostly with >> :only, so those should be updated to use

Re: Can we please deprecate the :use directive ?

2013-07-23 Thread Gary Trakhman
ersely proportional to its effect, so it takes extra effort to limit its effects. A limited scope by default is what I mean by 'good', for similar reasons that clojure goes with 'immutability by default'. On Tue, Jul 23, 2013 at 3:57 PM, Lee Spector wrote: > > On Jul 23

Re: Can we please deprecate the :use directive ?

2013-07-25 Thread Gary Trakhman
You could also do (use 'clojure.test) below the ns form. One thing that generally annoys me with 'ns' is that people feel it's some magical thing that has to be in the head of every file, like java imports, but it's really just a macro. It just goes to show that conventions are important. Curiou

Re: map from list of maps

2013-07-25 Thread Gary Trakhman
user> (into {} (map (juxt :a :b) [{:a "blah" :b "ack"} {:a "red" :b "blue"}])) {"blah" "ack", "red" "blue"} On Thu, Jul 25, 2013 at 5:34 PM, Brian Craft wrote: > Is there a better way to do this, making a map of certain keys from a list > of maps? > > > (apply hash-map (mapcat (fn [x] [(x :a)

Re: is intellij idea a good ide for clojure development?

2013-07-25 Thread Gary Trakhman
You can pick and choose your level of bloat with emacs. It's pretty good at being a lisp editor. I don't customize mine much, been using it for a year and a half, and I was 80% as productive as I am now within just a few weeks, though I realize there's a lifetime left to learn. Starter-kit + 24-

Re: is intellij idea a good ide for clojure development?

2013-07-25 Thread Gary Trakhman
'jumping to a symbol's definition (and back again)? Those didn't seem to be there last time, and I'd struggle to live without them on a project of any size.' Besides paredit, this is absolutely the most important feature for me day-to-day. Nothing will replace emacs unless it has that. The emac

Re: How convert from string to symbol?

2013-07-25 Thread Gary Trakhman
It might be more clear if you simply show sample inputs and outputs. Something like this: in: "name" out: 'name probably what you want is: (symbol (name x)) works for keywords too, cuts off any namespace prefix. On Thu, Jul 25, 2013 at 9:29 PM, wrote: > Hello, > I have a problem how we

Re: Does this abstraction have any existing name?

2013-07-26 Thread Gary Trakhman
Why does this need to be a macro? It doesn't actually manipulate code. Just turn this: (~f n# ~@args) into (apply f n args) in the function implementation. On Fri, Jul 26, 2013 at 11:49 AM, Yoshinori Kohyama wrote: > Hello group. > > I wrote a tiny macro to apply a function to values in lowes

Re: Can we please deprecate the :use directive ?

2013-07-26 Thread Gary Trakhman
This post takes quite a lot of things to extremes, but I think the main argument still stands. We need good defaults, not to totally change clojure into a newbie-friendly thing at the expense of what makes clojure special. This proposed change fixes a pervasive pain point in many codebases becaus

Re: is intellij idea a good ide for clojure development?

2013-07-26 Thread Gary Trakhman
Open-source developers are paid for their work in lots of ways that may/may-not involve cash. Commercial devs and products are not necessarily evil, and can be good for the community. Who cares if software gets bought over and over again? That's the beauty of software! Competition actually still

Re: Clojure for Desktop UI Design Application

2015-01-13 Thread Gary Trakhman
On Tue Jan 13 2015 at 2:05:03 PM Christopher Small wrote: > > On the other hand, while the web app route may feel a bit overwhelming, it > really is worth learning. Once you program web, you can deliver to any > platform. It's ubiquitous. And once you get the hang of it, the paradigm > isn't reall

Re: Embedded systems and transpiling Clojure to Nim

2015-05-01 Thread Gary Trakhman
Have you guys seen pixie yet? It seems like there's overlap for the requirements here. https://github.com/pixie-lang/pixie On Fri, May 1, 2015 at 5:46 AM, Herwig Hochleitner wrote: > I think Nim is pretty cool (conceptionally, haven't used it yet) and full > of wonderous features: From the han

Re: is destructuring implemented as a macro?

2015-05-13 Thread Gary Trakhman
You can only safely assume that the first symbol (defn) is a macro, it turns out 'destructure' is a function called by the macro (which might call other functions/macros that call other functions/macros :-). https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4233 On Wed, May

Re: Opinion on core.async vs callbacks in abstract APIs?

2015-06-01 Thread Gary Trakhman
I think this is one of those cases where the rules are different for libraries than applications. Does your lib need to pull in core.async, and does it need to be coupled to a specific version? If it's a building block sort of lib that clojure and the community prefers, I think the answer is no.

Re: [BUG?] loading Clojure source files from various data sources (classloading)

2015-06-03 Thread Gary Trakhman
Have you considered registering custom URL scheme handlers? That's an available point of extension at JVM process-level. It should be possible (though I don't know how painful) to implement custom URL connections that grab from anywhere: http://skife.org/java/url/library/2012/05/14/java_url_handle

Re: (slurp nil)

2015-06-03 Thread Gary Trakhman
This is a bad idea, but you can extend IOFactory to nil within your own programs: https://github.com/clojure/clojure/blob/master/src/clj/clojure/java/io.clj#L182 to return your nullreader. On Wed, Jun 3, 2015 at 3:28 PM Elric Erkose wrote: > @tassilo Your concern could be addressed with a NullRe

Re: 1.7.0b2, lein, cljc and tests

2015-06-19 Thread Gary Trakhman
Leiningen needs to support cljc, right now only the compiler does, and clojure-maven-plugin since a few days ago. https://github.com/technomancy/leiningen/issues/1827 On Fri, Jun 19, 2015 at 9:41 AM Colin Yates wrote: > First - cljc is (for me) a huge upgrade over cljx, which was a great > solu

Re: [ANN] Clojure 1.7.0 is now available

2015-06-30 Thread Gary Trakhman
You'll have to bump instaparse versions: https://github.com/clojure-emacs/refactor-nrepl/issues/53 On Tue, Jun 30, 2015 at 12:57 PM Robert Beaupre wrote: > Is anyone else getting the following error with 1.7.0 when running lein > repl? All I did was change from 1.6.0 to 1.7.0. > > #error { > >

Re: confusion about some paragraph in book "clojure programming" By Chas Emerick, Brian Carper, Christophe Grand 2012

2015-07-22 Thread Gary Trakhman
I am looking at the definition of fn and I can't see where let is used inside the function definition: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4335 I think they're saying the binding forms are equivalent in power (destructuring), not implementation. On Wed, Jul 22

Re: Clojure equivalent of 3-level enumeration in Ruby?

2014-06-20 Thread Gary Trakhman
I don't think you need plumbing for this. On Friday, June 20, 2014, gvim wrote: > On 20/06/2014 14:28, Dave Della Costa wrote: > >> Rather than start with the code you are trying to duplicate, consider >> the data structure(s) that you have as input and the data structure you >> want to end up w

Re: Workflow: cljx, cljsbuild & tdd in one process

2014-06-20 Thread Gary Trakhman
You can get some manner of memory pressure relief by using the G1GC (which lets the OS reclaim memory) and forcing GC's once in a while. Leiningen has 2 JVMs. In my ~/.emacs.d/init.el: (setenv "LEIN_JVM_OPTS" "-XX:+UseG1GC") will catch the leiningen JVM. In my ~/.lein/profiles.clj :jvm-opts ["-

Re: How to know if an agent throw an exception?

2014-06-20 Thread Gary Trakhman
You should give it an error-handler: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/agent On Fri, Jun 20, 2014 at 12:46 PM, Hussein B. wrote: > Hi, > > When using send-off of an Agent, how to know if any exception is happened? > Since AFAIK, agents are executed in different

Re: reload dependencies

2014-07-21 Thread Gary Trakhman
You don't need to run 'lein deps', simply cider-restart and they will be updated automatically. If you want to get really fancy and modify them at runtime, take a look at pomegranate: https://github.com/cemerick/pomegranate and the alembic project made for this use-case: https://github.com/pallet

Re: Clojure 1.7 and invokeStatic

2014-08-06 Thread Gary Trakhman
I think that also implies that the JVM can't inline across the fences, so there's another cost. On Wed, Aug 6, 2014 at 3:42 PM, Mike Thvedt wrote: > I don't want to question your microbenchmarks, but I'm not sure you have > the correct interpretation. > > Read memory fences have little to no co

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-30 Thread Gary Trakhman
Can you monkey-patch the meta function itself to draw from a map of object to meta? On Saturday, August 30, 2014, Francis Avila wrote: > It would probably help if you said more about the source of this > atom-holding object. Is it a plain Java class? A deftype/defrecord? Is it > final? > > > If

Re: Resources for intermediate/not-absolute-beginner Clojurians

2014-08-30 Thread Gary Trakhman
Eventually you'll have to come around to reading implementations. The Joy of Clojure is a very thoughtful book, but lib authors aren't going to go through the same amount of trouble. Reading code gets easier and rewards faster the more you do it. On Saturday, August 30, 2014, Christopher Small

Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Gary Trakhman
It works inside of lein because lein adds REPL-y to the classpath of the project, which adds clojure-complete. Cider used to be coupled to this before we gutted it. On Mon, Sep 1, 2014 at 4:56 PM, Stuart Halloway wrote: > And now, answering part of my own question. It appears the following >

Re: multimethod, record, type, and protocol pitfalls?

2014-11-05 Thread Gary Trakhman
You don't need to import the record if you use the auto-gen'd factories, ->RecordName and map->RecordName. You can and also shouldn't import the java interfaces created by protocols. It's possible to interactively develop this way, but you really have to know what's being eval'd and what types ar

Re: Mutable local variables

2014-11-10 Thread Gary Trakhman
@Jacob, your specific use-case is much cleaner with cond-let: http://crossclj.info/fun/flatland.useful.experimental/cond-let.html Example: (cond-let [b (bar 1 2 3)] (println :bar b) [f (foo 3 4 5)] (println :foo f) [b (baz 6 7 8)] (println :baz b) :else

Re: [ClojureScript] Re: [ANN] freactive - high performance, pure Clojurescript, declarative DOM library

2014-11-23 Thread Gary Trakhman
The two best ones I can think of right now Halogen: they're known as highly reactive elements. Precipitate: both a noun and a verb, the solid that falls out of a solution, or to bring about such a reaction. Other chemical-ish names considered Enantiopure - Containing compounds of only a single ch

Re: Is there a tool to display all the references to a symbol in a project?

2014-12-03 Thread Gary Trakhman
I use grep or ack. It's not exact, but it works. On Wednesday, December 3, 2014, Yehonathan Sharvit wrote: > Is there a tool to display all the references to a symbol in a project? > > Preferably without using emacs. > > Thanks. > > -- > You received this message because you are subscribed to th

Re: resolving "eval"-created ephemeral classes that do not get unloaded

2015-01-12 Thread Gary Trakhman
There's no need to use eval when reflection will do. On Mon, Jan 12, 2015 at 6:45 PM Wei "pw" Peng wrote: > I have a problem with stacking ephemeral dynamically generated classes > that do not get unloaded, and therefore the host JVM's class count > constantly increases. > > My situation is like

Re: Clojure for Desktop UI Design Application

2015-01-13 Thread Gary Trakhman
You made the analogy to games/graphics, React model treats the DOM akin to a graphics buffer, and they themselves present it as similar to the doom3 architecture. In practice, it feels a lot like a scene graph, with the update/render methods on every component. I don't know how easy it is to fit

Re: Clojure as first language

2020-09-28 Thread Gary Trakhman
Clojure is a fine language to learn on, but there are going to be some complex details along the way. I think there are 2 approaches to entry into programming that you might consider. You can start with the basic fundamentals of computation and work up into software engineering. For that, clojure

Re: Clojure as first language

2020-09-28 Thread Gary Trakhman
o those. I know Python does. > > Thanks again > > On Mon, Sep 28, 2020 at 7:40 PM Gary Trakhman > wrote: > >> Clojure is a fine language to learn on, but there are going to be some >> complex details along the way. I think there are 2 approaches >> to entry into pro

Re: clojure.spec

2016-05-25 Thread Gary Trakhman
Is there a public way to get the registry's spec at a keyword? I can envision other libs being built around the spec registry, and I'm trying to write a small one (coercions) to see if I can use spec for this use-case. Is that non-sanctioned kind of thing going forward? The likely candidate seems

Re: clojure.spec

2016-05-25 Thread Gary Trakhman
I answered my own question in the specific case, this seems to work: (defn to-int [x] (try (Long/parseLong x) (catch Exception _ nil))) (s/def ::intable (s/conformer to-int)) (s/conform (s/cat :ints ::intable) ["5"]) > {:ints 5} On Wed, May 25, 2016 at 8:36 AM

Re: [ANN] Clojure 1.9.0-alpha1

2016-05-25 Thread Gary Trakhman
It would be helpful to make clojure.spec available as a lib for 1.8. I have opted to backport clojure.spec (a 30-second copy/paste job) into our application running on 1.8 for an easy transition, and maybe others would be more comfortable bringing in a lib until 1.9 is further along. That would a

  1   2   3   4   5   >