Re: unconditional append to end

2014-02-07 Thread Travis Moy
Ah! That makes more sense. Yeah, after I forced it to realize the sequence, it turned out that concat was a lot slower than sticking it into an array: #'user/r > user=> (def coll (range 1)) > #'user/coll > user=> (def coll-v (into [] coll)) > #'user/coll-v > user=> (time (dotimes [_ r] (count

Re: map semantics

2014-02-07 Thread Sean Corfield
But you're misunderstanding what map does: it converts its collection arguments to _sequences_ and then it processes those sequences. Map doesn't operate on sets, or vectors, or maps, only on sequences. Scala goes out of its way to retain input types as output types on many of its collection opera

Re: map semantics

2014-02-07 Thread Andy C
> Following your intuition, what would you expect from the following? > > (map + [1 3 5] '(2 4 6)) > # => ? > It only gets worse, as the result of below should be undefined (using classic set definition): user=> (map + #{0 1} #{0 1}) (0 2) user=> (map + #{1 0} #{1 0}) (0 2) -- You received this

Re: map semantics

2014-02-07 Thread Mars0i
On Friday, February 7, 2014 10:17:15 PM UTC-6, Andy C wrote: > > But what really bothers me is that laziness / not laziness affects the > result of evaluation as in above example. That is against some fundamental > rules of FP (gotta check how Haskell does it :-P). > Well, it's not really lazine

Re: use/require/import and quoted form

2014-02-07 Thread Matt Mitchell
Can you give a code example? - Matt On Thursday, February 6, 2014 3:15:13 AM UTC-5, Andy Smith wrote: > > Hi, > > I was wondering why use/require and import take quoted forms as their > arguments, other alternatives could be strings or keywords, so what is > special about the choice of quoted f

Re: map semantics

2014-02-07 Thread John D. Hume
On Fri, Feb 7, 2014 at 9:41 PM, Andy C wrote: > I do perceive sets, lists, vector as atoms which are indivisible (well, > this is not true but this is popular meaning) from semantics standpoint. > Therefore map is just a function which processes them as whole, again from > semantics point of view

Re: unconditional append to end

2014-02-07 Thread Mark Engelberg
On Fri, Feb 7, 2014 at 9:08 PM, Travis Moy wrote: > Surprisingly it looks like (concat coll '(:a)) is faster than (conj coll-v > :a). That's not really what I would expect; does anybody have a good > explanation for this? Did I just bork the test somehow, or - I mean, > obviously concat's pretty

Re: unconditional append to end

2014-02-07 Thread Travis Moy
You should use a vector, but it's also possible to use concat. For example, (concat '(1 2 3) [4]) will give you (1 2 3 4). This made me curious as to the best way to get a collection into vector, so I played around with it some: user=> (def r 10) > #'user/r > user=> (def coll (range 1))

Re: map semantics

2014-02-07 Thread Michael Gardner
On Feb 7, 2014, at 22:17 , Andy C wrote: > Having map to produce a lazy seq implies that the input must be serializable > (or linear). That's just what map is in Clojure: an operation on sequences. It works on various concrete types because those can be viewed as sequences; map knows nothing

Re: What is "#" doing in " #+cljs [cljs.reader :as reader] "

2014-02-07 Thread Dom Kiva-Meyer
It's for the cljx preprocessor (https://github.com/lynaghk/cljx). On Fri, Feb 7, 2014 at 7:46 PM, larry google groups < lawrencecloj...@gmail.com> wrote: > > I am looking here: > > https://github.com/jkk/formative/blob/master/src/formative/parse.cljx > > and I see this line: > > #+cljs [cljs.rea

Re: map semantics

2014-02-07 Thread Andy C
I actually like the laziness by default but as you suggest, wish there is a way to switch it on/off for blocks of the code (rather than compiler option). Scala guys did some research and in most practical cases Lists are very short hence they are not lazy and evaluated at once. Just an interesting

Re: Parsing Clojure with instaparse: how to handle special forms?

2014-02-07 Thread Travis Moy
That answers my question pretty well, thanks. On Thursday, February 6, 2014 11:20:42 PM UTC-8, Reid McKenzie wrote: > > Okay. So there's one big thing you're doing wrong here just from reading > your grammars: you are complecting the datastructures and valid _tokens_ > which make up the clojure

Re: unconditional append to end

2014-02-07 Thread Armando Blancas
For efficient appends at the end you need a vector. Using the sequence library can be tricky while you're putting together your data structures because it's likely that you'll not done yet with type-specific functions. You'll need to re-create your vector after using map/filter/etc to be able t

Re: Alternative ->> macro for threading sequences?

2014-02-07 Thread Mars0i
Since a few of these higher order functions--map, filter, reduce, etc.--are so common and useful, I wonder whether there could be sufficient benefit to having some abbreviations for them. I know that some of these characters are already taken, but just to sketch the idea: (--> things %wrangle

What is "#" doing in " #+cljs [cljs.reader :as reader] "

2014-02-07 Thread larry google groups
I am looking here: https://github.com/jkk/formative/blob/master/src/formative/parse.cljx and I see this line: #+cljs [cljs.reader :as reader] So I look here to see what the "#" is doing: http://clojure.org/reader and I read: Dispatch (#) The dispatch macro causes the reader to use a reade

Re: map semantics

2014-02-07 Thread Mars0i
Andy C, I think that in the Clojure world, there is a widespread view that lazy sequences should be the (or one of the) primary datatypes, that iteration should usually produce lazy sequences, etc. They are something like the default in Clojure. Clojure includes a systematically organized and

Re: map semantics

2014-02-07 Thread Andy C
I do perceive sets, lists, vector as atoms which are indivisible (well, this is not true but this is popular meaning) from semantics standpoint. Therefore map is just a function which processes them as whole, again from semantics point of view. Implementation and laziness should not matter really a

Re: map semantics

2014-02-07 Thread Andy C
user=> (map #(mod % 3) #{3 6}) (0 0) user=> (set (map #(mod % 3) #{3 6})) #{0} -- 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 be pat

Re: map semantics

2014-02-07 Thread Atamert Ölçgen
On Sat, Feb 8, 2014 at 3:05 AM, Andy C wrote: > > set-s are indeed a sticky point here since the result of a map would > different depending in the convention. > > No the result would be the same. Only the order of the elements in the lazy sequence would differ, but that's to be expected since se

ANN: core.logic 0.8.6

2014-02-07 Thread David Nolen
The main change is the introduction of a new protocol IVerifyConstraint. Implementations of it will be called before a constraint is added to the constraint store - this is the hook needed for detecting incompatible constraints. More information here: http://github.com/clojure/core.logic Feedback

Re: map semantics

2014-02-07 Thread Andy C
On Fri, Feb 7, 2014 at 7:53 PM, Atamert Ölçgen wrote: > Why should it build a concrete result? > I realize the benefits of using LazySeq and do not have a strong opinion besides things gotta be consistent. Putting practical advantages and having a good default behaviour aside, I was wondering i

Re: map semantics

2014-02-07 Thread Atamert Ölçgen
Why should it build a concrete result? Here's my reasons why it makes sense to be lazy here: - It would use more memory otherwise. Since, if you are transforming a list to a set there's got to a transformed copy of the original data structure when it's materialized. - It might take longer than ne

map semantics

2014-02-07 Thread Andy C
Hi, I have a short question, why map builds up a LazySeq instead of an input collection as found below: user=> (type (map #(mod % 3) #{3 6})) clojure.lang.LazySeq user=> (type (map #(mod % 3) '(3 6))) clojure.lang.LazySeq user=> (type (map #(mod % 3) [3 6])) clojure.lang.LazySeq user=> (type (map

Re: Refactoring as an nREPL middleware

2014-02-07 Thread Alex Miller
This might be an interesting area for a Google Summer of Code project if someone would be willing to mentor such a thing and come up with a high-level plan. http://dev.clojure.org/display/community/Project+Ideas On Friday, February 7, 2014 3:51:29 PM UTC-6, Curtis Gagliardi wrote: > > Hey eve

unconditional append to end

2014-02-07 Thread t x
Consider the following: (cons 1 '(2 3 4)) ==> (1 2 3 4) (cons 1 [2 3 4]) ==> (1 2 3 4) (conj '(a b c) 1) ==> (1 a b c) (conj '[a b c] 1) ==> [a b c 1] Now, I would like something that _always_ * appends to the end cons is almost what I want, except it alway

Re: Is there a prettify command in emacs for clojure?

2014-02-07 Thread Devin Walters
This is something I stole from Phil Hagelberg's starter kit. It doesn't work all the time, and in some cases might do some things you don't particularly want, but I still use it: (defun untabify-buffer () (interactive) (untabify (point-min) (point-max))) (defun indent-buffer () (interact

Re: Refactoring as an nREPL middleware

2014-02-07 Thread John D. Hume
I haven't attempted any code manipulation, just analysis and indexing, but I embarked on a similar idea here: https://github.com/duelinmarkers/insfactor and here: http://github.com/duelinmarkers/insfactor.el. (Nothing Vim-related there, the similar part is trying to put as much as possible of the s

Re: GSoC 2014: org applications now open

2014-02-07 Thread A
A couple ideas put forth: 1. Incanter charts with d3 (http://d3js.org/) ? Perhaps facilitated by Dribnet's Strokes library (https://github.com/dribnet/strokes). 2. Finding ways to integrate Incanter and Clojurescript. Thoughts? -Avram On Monday, February 3, 2014 11:59:24 AM UTC-8, Daniel

Re: Refactoring as an nREPL middleware

2014-02-07 Thread Jason Felice
I think this is an awesome idea. I think it should be easy to build on top of vim-fireplace to integrate with vim, and I will surely beta test for you. On Feb 7, 2014 4:51 PM, "Curtis Gagliardi" wrote: > Hey everyone, I just wanted to get some feedback on whether or not this is > a good idea. I

Room Key is Hiring!

2014-02-07 Thread Thomas Steffes
Room Key is hiring Clojure developers to work at our technology headquarters in beautiful Charlottesville, Virginia. Our backend stack is Clojure / AWS / Solr / Postgres, which fronts a JSON API for our single-page javascript application. See this job posting, or reach out to j...@roomkey.com i

Is there a prettify command in emacs for clojure?

2014-02-07 Thread Taylor Sando
Let us say you had this: (defn create-new-canvas-text [inputs] (let [{text-selected-id :new} (dataflow/old-and-new inputs [:design :params :text :selected-id]) {text-params :new} (dataflow/old-and-new inputs [:design :params :text]) text-value (:value text-params) ]

Refactoring as an nREPL middleware

2014-02-07 Thread Curtis Gagliardi
Hey everyone, I just wanted to get some feedback on whether or not this is a good idea. I've seen clj-refactor.el recommended a decent amount, but as a dyed-in-the-wool take-no-prisoners vim user, I can't use it. I've always thought it was weird that refactoring was so tightly coupled to edito

Re: [ANN] durable-queue: an in-process disk-backed queue

2014-02-07 Thread Zach Tellman
Hi Bob, Right now the API only allows for single puts, and fsyncing is all-or-nothing. However, this is just an artifact of my major use case for the library, which relies on upstream batching of tasks. I'm planning an 0.1.1 release which has an explicit `sync` method, and support for sync-inter

[ANN] Framework One for Clojure 0.2.4 released (MVC mini-framework for web apps)

2014-02-07 Thread Sean Corfield
In case anyone cares :) https://github.com/framework-one/fw1-clj FW/1 is a lightweight, convention-based MVC framework. It is a port to Clojure of FW/1 for CFML (the most popular MVC framework for the ColdFusion Markup Language, in active development since mid-2009). Release 0.2.4 • Ad

Re: ISeq documentation and mutual deftypes.

2014-02-07 Thread Alex Miller
next() should return either the remaining seq or null (think Clojure function next) more() should return either the remaining seq or empty list (like Clojure function rest) Inside Clojure, most seqs extend ASeq, which implements more() on top of the abstract next(): public ISeq more(){ ISe

Re: Confused by Clojure floating-point differences (compared to other languages)

2014-02-07 Thread Lee Spector
On Feb 7, 2014, at 11:45 AM, Andy Fingerhut wrote: > You may also use a let form wrapped around your entire defproject if you want > to avoid the duplication of code present in your example. Thanks -- I actually noticed that after I posted. I don't know why, but I never thought of project.clj a

Re: how to use the G1 garbage collector

2014-02-07 Thread Lee Spector
On Feb 7, 2014, at 11:41 AM, Laurent PETIT wrote: > What if you put "-XX:+UseG1GC" in :jvm-opts ? Ah yes -- I should have seen that even though I may not want to take Gary's suggestion of putting it in .bashrc, he had given me the magic string to include in :jvm-opts too! I will give that a tr

Re: Confused by Clojure floating-point differences (compared to other languages)

2014-02-07 Thread Andy Fingerhut
You may also use a let form wrapped around your entire defproject if you want to avoid the duplication of code present in your example. Andy On Fri, Feb 7, 2014 at 8:22 AM, Lee Spector wrote: > > On Feb 5, 2014, at 11:42 PM, Michał Marczyk wrote: > > > This returns > > > > (.getTotalPhysicalMe

Re: how to use the G1 garbage collector

2014-02-07 Thread Niels van Klaveren
Both G1 and ConcurrentMarkSweep GC are meant to lower pauses (increase responsiveness), but generally increase total running time. So I don't know if it's ideal for the scenario you describe. On Friday, February 7, 2014 5:38:09 PM UTC+1, Lee wrote: > > > On Feb 7, 2014, at 11:35 AM, Gary Trakhma

Re: how to use the G1 garbage collector

2014-02-07 Thread Laurent PETIT
What if you put "-XX:+UseG1GC" in :jvm-opts ? 2014-02-07 17:38 GMT+01:00 Lee Spector : > > On Feb 7, 2014, at 11:35 AM, Gary Trakhman wrote: > > > I do it like this: > > > > in my .bashrc > > > > export JVM_OPTS="-XX:+UseG1GC" > > export LEIN_JVM_OPTS="-XX:+UseG1GC" > > > > > > You can verify th

Re: how to use the G1 garbage collector

2014-02-07 Thread Lee Spector
On Feb 7, 2014, at 11:35 AM, Gary Trakhman wrote: > I do it like this: > > in my .bashrc > > export JVM_OPTS="-XX:+UseG1GC" > export LEIN_JVM_OPTS="-XX:+UseG1GC" > > > You can verify that it's working by checking jvisualvm's view of the jvm-opts > on the relevant processes. Running it syste

Re: how to use the G1 garbage collector

2014-02-07 Thread Gary Trakhman
I do it like this: in my .bashrc export JVM_OPTS="-XX:+UseG1GC" export LEIN_JVM_OPTS="-XX:+UseG1GC" You can verify that it's working by checking jvisualvm's view of the jvm-opts on the relevant processes. Running it system-wide has given me reduced memory-pressure on my lappie with no downside

how to use the G1 garbage collector

2014-02-07 Thread Lee Spector
Does anyone know what to put in :jvm-opts in project.clj to use the G1 garbage collector? I see a lot about how G1 works and how to configure it in web search results, but not this little nugget of info. Also, if anyone has any advice about GC for my use case I'd love to hear it. My use case i

Re: Confused by Clojure floating-point differences (compared to other languages)

2014-02-07 Thread Lee Spector
On Feb 5, 2014, at 11:42 PM, Michał Marczyk wrote: > This returns > > (.getTotalPhysicalMemorySize > (java.lang.management.ManagementFactory/getOperatingSystemMXBean)) > > You could use this in your project.clj, perhaps by including > > ~(str "-Xms" (quot (.getTotalPhysicalMemorySize ...) appr

Re: stch.schema a Prismatic Schema fork

2014-02-07 Thread david
Thanks for pointing that out. Changed defn*, defrecord*, fn*, letfn* to defn', defrecord', fn', and letfn'. Added tests for fn' and letfn'. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.co

Re: Alternative ->> macro for threading sequences?

2014-02-07 Thread t x
I think (->> things (map wrangle) (map pacify) (filter effable) (map #(aggravate % :bees :sharks)) (reduce mapinate {}) is optimal for the following reason: If you're doing "map" and "map alone", i.e. (->> things (map f1) (map f2) (map f3) (map f4)) then you can

Re: GSoC 2014: We need ideas and mentors

2014-02-07 Thread Ambrose Bonnaire-Sergeant
Thank Nikita, added. Ambrose On Fri, Feb 7, 2014 at 9:17 PM, Nikita Beloglazov wrote: > Hi > > I don't have editing rights for wiki so I post project idea here: > *Quil on ClojureScript**Brief explanation: > *Quilis a drawing and animation library for > clojure. I

Re: Alternative ->> macro for threading sequences?

2014-02-07 Thread Korny Sietsma
I tend to agree, I think. I certainly can't think of a syntax that would make me happy. It just feels like a bit of a smell that I keep using ->> to process sequences in similar ways. The data.zip "xml->" macro is an example of something like what I'm thinking about - it lets you process sequenc

Re: [ANN] clara-rules 0.4 released

2014-02-07 Thread Michael Fogus
> The theme of this release is "rules as data" Yay! Great job Ryan. I look forward to checking out your changes. On Thu, Feb 6, 2014 at 10:15 PM, Ryan Brush wrote: > The 0.4.0 release of Clara is up on Clojars. The github page is at [1]. > > The theme of this release is "rules as data", which

Re: [ANN] durable-queue: an in-process disk-backed queue

2014-02-07 Thread Bob Hutchison
On Feb 6, 2014, at 6:45 PM, Zach Tellman wrote: > At Factual we get a lot of data thrown at us, and often don't have control > over the rate at which it comes in. As such, it's preferable that our buffer > isn't bounded by the process' memory, since a temporary blip in throughput > may cause

Re: Parsing Clojure with instaparse: how to handle special forms?

2014-02-07 Thread Reid McKenzie
Okay. So there's one big thing you're doing wrong here just from reading your grammars: you are complecting the datastructures and valid _tokens_ which make up the clojure language with the _meaing_ associated therewith by the language. If you discard such things as destructuring as "part of th

Re: GSoC 2014: We need ideas and mentors

2014-02-07 Thread Nikita Beloglazov
Hi I don't have editing rights for wiki so I post project idea here: *Quil on ClojureScript**Brief explanation: *Quilis a drawing and animation library for clojure. It is basically wrapper over Processing . Currently Quil works only on vanill

ISeq documentation and mutual deftypes.

2014-02-07 Thread Phillip Lord
I've been playing with some code recently. I was wondering how hard would it be to implement, for example ISeq in clojure. The plan was to use deftype and a few bits of other code. The ISeq interface looks like this: public interface ISeq extends IPersistentCollection { Object first(); ISeq

Re: Need help interfacing with ruby digest(hmac-sha256)

2014-02-07 Thread Haim Ashkenazi
Thanks. This solved the problem :) Bye On Fri, Feb 7, 2014 at 12:57 PM, Thomas Heller wrote: > Just a quick guess but it seems like the ruby version base64 encodes the > BINARY version of the digest, while the clojure version encodes the HEX > version of the digest. > > The sign function also

Re: Need help interfacing with ruby digest(hmac-sha256)

2014-02-07 Thread Thomas Heller
Just a quick guess but it seems like the ruby version base64 encodes the BINARY version of the digest, while the clojure version encodes the HEX version of the digest. The sign function also converts to hex, so if you put that into base64 encode you get the same (wrong) result, use the returned

Need help interfacing with ruby digest(hmac-sha256)

2014-02-07 Thread Haim Ashkenazi
Hi I'm trying to interface with a web service that expects a base64 code produced as followed (I included both the direct output of digest and the base64 encoding): require 'openssl' digest = OpenSSL::Digest::Digest.new('sha256') OpenSSL::HMAC.digest(digest, "key", "string") => "\x97\xD1[\xEA\xBA

Re: NoClassDefFoundError after I import with "use" on the repl?

2014-02-07 Thread larry google groups
I am grateful to you for testing. Your feedback sent me down a different road which lead me to the answer. I decided the repl was for some reason not working, so I thought I would run "lein uberjar" and see how the app ran, but when I ran "lein uberjar" I saw that I had an error that kept the