Re: Default values

2015-02-21 Thread Ulises
What's happening is that you have multiple optional arguments chained together. Optional arguments are passed as a list (or seq?) of arguments, so if you pass them down to another function that also takes optional arguments they get wrapped in yet another list. An option to stop this is to use appl

Re: How to refactor data safely?

2014-05-22 Thread Ulises
How are you accessing the data? I suppose that if you were accessing (maybe you are) the data via helper functions, that's where most of the refactoring should happen. On 22 May 2014 09:17, Jakub Holy wrote: > I have a nested data structure, used by a bunch of functions that presume > knowledg

Re: Clojure Office Hours

2014-04-28 Thread Ulises
Thanks for the pointer Jakob. I've updated the form accordingly. Cheers, On 28 April 2014 10:56, Jakub Holy wrote: > I too have booked a session with Ulises and am excited about it :-) > > @Ulises It would be nice if the timezone of the session was mentioned on > the bookin

Re: Clojure Office Hours

2014-04-25 Thread Ulises
> > And if you are in Europe, remember that Ulises is still offering, at what > looks like 1300-1400 UTC (I think): > https://ucb.youcanbook.me/<https://www.google.com/url?q=https%3A%2F%2Fucb.youcanbook.me%2F&sa=D&sntz=1&usg=AFQjCNGoo6exDmYGhdu-4qu3L9tL2v8AkQ> >

Re: Clojure Office Hours

2014-04-18 Thread Ulises
for screen sharing, as well as Google hangouts. Once you've booked an appointment with me please email me privately to arrange the pairing set up so that I can be ready for you :) Cheers On 18 April 2014 10:35, Ulises wrote: > Inspired by Leif's offer, I've decided to offer Cl

Re: Clojure Office Hours

2014-04-18 Thread Ulises
Inspired by Leif's offer, I've decided to offer Clojure office hours as well. I'm based in the UK so I reckon the times will be more amenable to those in Europe (not sure the times will be good for those in Asia unfortunately.) Sadly the offer is limited to 1h a day, but hopefully it'll still be

Re: How did you learn Clojure?

2014-03-21 Thread Ulises
When I started learning clojure back in 2010 I decided to give a presentation about it at work. That set a deadline (about 3 months) in which I had to learn the language. Having said that, I learnt /the language/ however wroting code (toy or not) reading other people's code, getting code reviews (a

Re: [ANN] Buffy The ByteBuffer Slayer, Clojure library to working with binary data

2013-12-04 Thread Ulises
While we're on the subject, I found no way of decoding/interpreting an already existing sequence (ByteBuffer) of bytes, but only one that had been created with compose-buff. Am I missing something? On 4 December 2013 07:28, Cesar Canassa wrote: > Hi, > > I see that the repeated-type requires a co

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Ulises
> Could you please let me know which URL and page no. did you find the images > missing on? I noticed the images are visible (for example on page number 21) > when I visited http://www.amazon.com/dp/1782165606/?tag=packtpubli-20 and > clicked on the book image to open the preview. Apologies for th

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Ulises
> Thank you! The book is published very recently and I noticed it took a while > for the printed editions to appear on Amazon. I am getting in touch with > Packt to find out why the kindle editions not on Amazon and whether this is > temporary. Great! Thanks for the diligence. If you're getting i

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Ulises
First of all: Congratulations, looks like a great book! Second, do you know why Amazon doesn't offer the kindle version while Packt says it's available in digital format and displays an Amazon logo (I'm assuming the Amazon logo means it's kindle)? Cheers and looking forward to reading your book!

Re: Best way to pass through named arguments (destructured map)?

2013-09-09 Thread Ulises
If you're not planning on changing the value of your defined index, you can always use partial, e.g.: (def search (partial es/search es-index)) On 9 September 2013 09:42, Mark Mandel wrote: > Hey all, > > Relatively new to Clojure, and I'm wondering if there is a better/simpler > way to handle w

Re: ANN Introducing EEP, a young [event] stream processing library

2013-09-06 Thread Ulises
I'm sure it's a bit early but is there a mailing list for this? I've ran into trouble trying EEP on a really simple flow (the even vs. odds in the docs.) and I'd like to ask a few questions. U On 6 September 2013 02:24, Timothy Pratley wrote: > Awesome! > > Thank you for making this available,

Re: Structing Clojure tests/setup and tear down

2013-05-21 Thread Ulises
Hey Colin, Apologies, I missed your "First - I know about fixtures..." line :) I'd probably +1 Gaz's macro (I've not tested it either but it looks reasonable.) On 21 May 2013 16:05, Colin Yates wrote: > Hi Ulises, > > I don't think I am as that

Re: Structing Clojure tests/setup and tear down

2013-05-21 Thread Ulises
Perhaps you're looking for fixtures? http://thornydev.blogspot.co.uk/2012/09/before-and-after-logic-in-clojuretest.html U On 21 May 2013 15:17, Colin Yates wrote: > Howdy, > > I am using clojure.test and have some questions of how to write idiomatic > Clojure. This really isn't about testing

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Ulises
> Code that matters is code that's used by other people. For me personally > the ability to share my code with others is the thing that makes > programming worth doing in the first place. This is a rather important point. One of the most asked questions (random made up fact) by newcomers to a lang

Re: emacs - how to wean me off the family of Java IDEs

2013-05-01 Thread Ulises
ic typing, I guess grep is the best? >> >> >> On 1 May 2013 12:13, Ulises wrote: >>> >>> > The biggest 'ah - got it' for me was when I realised IDEs are great for >>> > navigating huge object models which are relatively narrow but deep (i

Re: emacs - how to wean me off the family of Java IDEs

2013-05-01 Thread Ulises
> The biggest 'ah - got it' for me was when I realised IDEs are great for > navigating huge object models which are relatively narrow but deep (i.e. lots > of nested relationships). This requires a special set of navigation skills > (cntrl-click to go to declaration, autocompletion etc). Cloju

Re: Parallelizing tasks

2013-04-10 Thread Ulises
Have you tried replacing all your calls to map for pmap yet? On 11 April 2013 03:33, Bruno Kim Medeiros Cesar wrote: > Hello. I am replicating the study made by John D. Cook in > thispost about exact > chaos in Clojure, using rational arit

Re: Opinion on testing strategies?

2013-04-06 Thread Ulises
Forgive me if I completely misunderstood your question. Replies inline. One way is to use `with-redefs`. This technique would be used at every > level along the pyramid (except the bottom level which doesn't call > anything else). > > This would be similar to mocking, correct? If so, what'd be wro

Re: Faster lein

2013-02-20 Thread Ulises
I've been using drip with quite some success (with the exception of midje tests which seem to launch their own jvm every time.) On 20 February 2013 15:53, Buck Golemon wrote: > I see that lein2 has factored out the 'interactive' command. > > Can I use lein1 and expect the various clojure librar

Re: Help on implementing a simple java (openNLP) EventStream interface

2013-02-14 Thread Ulises
nt-stream [input-seq] > (let [remaining (atom input-seq)] > (proxy [EventStream] [] > (next [] (let [current (first @remaining)] > (swap! remaining rest) > (elt->event current))) > (hasNext [] (not (empty? @remaining))

Re: Help on implementing a simple java (openNLP) EventStream interface

2013-02-14 Thread Ulises
How about having your methods access an atom provided in a closure like it's done here: http://kotka.de/blog/2010/03/proxy_gen-class_little_brother.html U On 14 February 2013 13:58, Joachim De Beule wrote: > Hi All, > > I want to turn a clojure sequence into an 'EventStream' java interface in >

Re: Article on Clojure concurrency from "Computing in Science and Engineering"

2013-02-08 Thread Ulises
+1 on pdf On 8 February 2013 10:30, Konrad Hinsen wrote: > The article > >Clojure for Number Crunching on Multicore Machines >by Martin Kalin and David Miller >Computing in Science and Engineering Nov/Dec 2012 > > is in free access at the moment: > > > http://www.computer.org/portal/

Re: Consuming web services in Clojure

2012-11-05 Thread Ulises
Try clj-http (https://github.com/dakrone/clj-http) On 5 November 2012 12:12, N8Dawgrr wrote: > Hi All, > > Does anyone know of a good simple library to call/consume web-services > from Clojure? Note I don't want to create a web-service just call one. > > > > -- > You received this message beca

Re: Midje popularity?

2012-10-17 Thread Ulises
> Does anyone use Midje currently? I most definitely do! And thanks for porting midje-mode to nrepl. I've recently been migrating to nrepl and friends and I was missing my midje-mode! U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Fizz-Buzz and Church Numerals

2012-09-14 Thread Ulises
Hi, I've translated the code in http://experthuman.com/programming-with-nothing to Clojure and here's the result: - https://www.refheap.com/paste/5073/fullscreen (code) - https://www.refheap.com/paste/5074/fullscreen (tests) Cheers, Ulises -- You received this message becau

Re: redefining multimethods at the repl

2012-09-04 Thread Ulises
> Binding to the var instead of the value will allow it to be udpated. Alternatively you could ns-unmap the multimethod before redefining it. U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: (merge) => nil

2012-08-29 Thread Ulises
Don't know why nil is returned instead of {}, but > (+) => 0 > (*) => 1 following that line of reasoning: > (merge nil {:a 1}) {:a 1} > (merge {} {:a 1}) {:a 1} -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

Re: real-world usage of reducers?

2012-08-22 Thread Ulises
Apologies in advance if this is a silly question but have you tried profiling your code to see where the hotspots are? U -- 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 fro

Re:

2012-07-29 Thread Ulises
Here's an edge case for you: (has22 [1 2 2 1]) ; false :) U -- 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 patient with your

Re: atom and lock

2012-07-18 Thread Ulises
Please excuse my ignorance and my late comment, but can you make your 1hr operation shorter? The general advice I've always been given has been "whenever you need to use a resource that might cause contention do it quickly, in and out in a blink". I know that the argument then would be "why do I

Re: General subsequence function

2012-06-27 Thread Ulises
> I'd forgotten that 'into adds things in the "default" place for whatever type > you're using, hence the reversal on lists. I'm not sure if there's a simple > way to get the same type out again while preserving order. How about: (defn sub-seq [start end coll] (take (- end start) (drop start

Re: Explaining the thrush -> operator.

2012-06-10 Thread Ulises
Additional to all the positive comments, I'd suggest you use an operator which is not commutative, otherwise the differences between -> and ->> are less evident. U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to c

Re: Network Visual Layout Algorithm

2012-05-31 Thread Ulises
> I have a contest going with a colleague, where we each have to render a > network layout in SVG.  My gut says that Synthetic Annealing is the right > tool for the job here. I haven't heard of synthetic annealing (I have heard of simulated annealing though) but if you're looking to draw a network

Re: [ANN] clojure-echonest-api

2012-05-24 Thread Ulises
> I am unsure about the atom of api-key, in theory i won't need to change my > api-key, but idk... You can get a lot of api-key gratis which are a little > limited or just one payed api-key that can do everything... My point was that once you've declared api-key {:dynamic true} (which by the way i

Re: [ANN] clojure-echonest-api

2012-05-23 Thread Ulises
> Looking the code again I believe that I should use a future and not an > agent... > I am right ??? I would think so. AFAIK, the advice has always been "if you need to do some computation on another thread don't (ab)use agents, use futures". Additionally, you have[1]: (def #^{:dynamic true} *ap

Re: cld 0.1.0 - Clojure Language Detection

2012-03-01 Thread Ulises
Apologies for hijacking this thread, but this is probably the most relevant place to point you to a simple web-frontend to cld I cooked up in a couple of hours: http://detector-de-idioma.herokuapp.com/index.html Additionally, you can call it as a service like $ url 'http://detector-de-idioma.he

Re: cld 0.1.0 - Clojure Language Detection

2012-02-29 Thread Ulises
> I'm more curious about why the output isn't even deterministic. The > same input string produced three different results. You can see in the FAQ (http://code.google.com/p/language-detection/wiki/FrequentlyAskedQuestion) that: "Langdetect uses random sampling for avoiding local noises(person nam

Re: Literate programming in emacs - any experience?

2012-01-28 Thread Ulises
Here's a paper that might be interesting to folk discussing in this thread: http://www.jstatsoft.org/v46/i03/paper Cheers U -- 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

Re: strange problem

2012-01-16 Thread Ulises
> Any ideas? Perhaps this is what you're after: https://github.com/technomancy/swank-clojure/issues/57 U -- 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 a

Re: Clojure Extension for Chrome

2012-01-08 Thread Ulises
Interesting plugin. I've been pondering for a while about whether it'd be interesting to write clojure (or language X) blog posts in a literate fashion, i.e. with weave and tangle that knew how to download the post and then extract and execute the code. This would come in rather handy since more

Re: Trying to use CDT on 1.3.0

2011-12-10 Thread Ulises
Alternatively you can just do: $ lein plugin install swank-clojure 1.3.3 and have swank across projects without having to add your :dev-dependencies for each one. U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: Get multiple vals from a map

2011-12-01 Thread Ulises
How about using juxt: sandbox> ((juxt :foo :bar) {:foo 1 :bar 2 :baz 0}) [1 2] sandbox> This only works, however, if you use keywords for keys (as they are functions themselves). U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gro

Re: Forcing computation

2011-11-15 Thread Ulises
> I understand that lazy sequences are very useful but sometimes, I want to > compute everything, go away, and have it there when I come back. > How do I do that with a map? > (def x (map fn coll)) you could do (last x) and drop that value. U -- You received this message because you are subscri

Re: Getting index of char from end

2011-11-12 Thread Ulises
Here's my take on it (all caveats apply, e.g. performance): (defn indices-of "Returns the indices of the given char in the string (0 based)." [c string] (map second (filter #(= c (first %)) (partition 2 (interleave string (iterate inc 0)) (indices-of \a "abba") ; (0 3) and hence last-i

Re: Open source Clojure projects

2011-11-09 Thread Ulises
Whenever I see a question like this asked anywhere (and even when I ask the question to myself or others) I usually recommend reading (or read myself): http://prog21.dadgum.com/80.html :) U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: clojure starter package for aichallenge ?

2011-10-25 Thread Ulises
> I failed to mention that both the files are in a directory named > mybot I could be wrong but I think they have to be in the root of the zip file, i.e. no directories. I just zip up ants.clj and MyBot.clj into a file and it works. HTH, U -- You received this message because you are subscrib

Re: clojure starter package for aichallenge ?

2011-10-24 Thread Ulises
in: https://github.com/ulises/ai-challenge PS: I just submitted it and it passed all tests. U -- 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 m

Re: Nested identities in a value-based universe

2011-10-24 Thread Ulises
> The problem with identities of actors comes in when you consider code > like the following: > >  (def trantor (get-actor "Trantor" world-state)) > >  (:hit-points trantor) >  => 10 > >  (def new-world-state ((command "Trantor" :eat "apple") world-state)) > >  (:hit-points trantor) >  => 10     (s

Re: Nested identities in a value-based universe

2011-10-21 Thread Ulises
> Maybe the world's state is that player "Trantor" is at position [15 34]. Now > Trantor eats an appel. The appel is removed from his inventory and his > health is raised by 5 hit points. Did the state of the world change? No. > Trantor is still at position [15 34]. Does the world have to know abou

Re: Nested identities in a value-based universe

2011-10-21 Thread Ulises
> Are you arguing for my option b) then? In which case actors don't have > distinct identities, they are just part of the overall world? Not necessarily as your option b) already gives implementation details (using ids to find actors, etc.). I was mostly thinking out loud to see if anything emerge

Re: partial, but instead of args + additional, get additional + args

2011-10-21 Thread Ulises
How about a potentially ugly workaround: user> (defn sum [ & {:keys [x y]} ] (+ x y)) #'user/sum user> (sum :x 1 :y 2) 3 user> (def inc-sum (partial sum :x 1)) #'user/inc-sum user> (inc-sum :y 1) 2 user> (inc-sum :y 2) 3 user> I know this is a trivial example, but I do quite fancy named arguments

Re: Nested identities in a value-based universe

2011-10-21 Thread Ulises
functions for finding an actor inside the universe and updating it, then you should be good to go. Cheers, Ulises -- 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 post

Re: How to flatten a nested sequence?

2011-10-04 Thread Ulises
your subject contains the answer :) sandbox> (def s1 (seq ["s1" (seq ["s2" "s3"]) "s4" "s5" (seq ["s6" (seq ["s7" "s8"]) "s9"])])) #'sandbox/s1 sandbox> s1 ("s1" ("s2" "s3") "s4" "s5" ("s6" ("s7" "s8") "s9")) sandbox> (flatten s1) ("s1" "s2" "s3" "s4" "s5" "s6" "s7" "s8" "s9") sandbox> (doc flatte

Re: Wrapping an expression inside a function

2011-09-16 Thread Ulises
> Not the right answer. I tried to use the apply function with no > success. > How can I wrap the expression inside a function. Why not use partition and interleave? user> (partition 2 (interleave [:a :b] [:c :d])) ((:a :c) (:b :d)) U -- You received this message because you are subscribed to

Re: is there some gotchas with the contains? function and strings?

2011-08-24 Thread Ulises
I believe contains? tests for the presence of a key in a collection: user> (contains? {:a 1 :b 2} 1) false user> (contains? {:a 1 :b 2} :a) true user> (get [0 2 3] 1) 2 user> (contains? [0 2 3] 1) true user> >From the docstring: "Returns true if key is present in the given collection, otherwis

Re: How to Return Vector of Vectors

2011-07-22 Thread Ulises
An alternative is to use partition together with interleave: user> (partition 2 (interleave [ 1 2 ] [ \a \b ])) ((1 \a) (2 \b)) Combined with (map vec ...) you should get: user> (map vec (partition 2 (interleave [ 1 2 ] [ \a \b ]))) ([1 \a] [2 \b]) user> U -- You received this message because

Re: Constructing clj-http Get Query

2011-07-20 Thread Ulises
try passing a map such as {:query-params {"CA" ca, "street" street ...}}. On 20 July 2011 16:24, Mark Rathwell wrote: > > (require '[clj-http.client :as client]) > (defn make-url [ca street-1 street-2 city state zip] >   (let > [url "http://MailVerify/Lookup/chkAddr.asp?CA=%s&street=%s&STREET2=%s

Re: Lazily read XML larger than memory: my take at parser API

2011-05-31 Thread Ulises
jackson can read/parse large JSON files through its streaming API: http://wiki.fasterxml.com/JacksonInFiveMinutes#Streaming_API_Example U -- 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 No

Re: find first non nil element of sequence

2011-05-27 Thread Ulises
> false is not nil. Ugh! Well spotted :) U -- 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 patient with your first post. To uns

Re: find first non nil element of sequence

2011-05-27 Thread Ulises
You could use identity as a predicate to filter: user=> (def s [nil nil 1 2 3]) #'user/s user=> (first (filter identity s)) 1 user=> U -- 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

Re: RIncater

2011-05-23 Thread Ulises
Ugh! Actually, I was more after a wrapper around the Rserve client more than anything however RIncanter is the closest thing I could find. >        Sortof.  The original author is updating thing so that they work more > cleanly.  In the interim if you want to get it to work modify the project.cl

RIncater

2011-05-20 Thread Ulises
Hi, Is RIncanter still alive? Cheers, U -- 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 patient with your first post. To unsub

Re: Google Refine

2011-05-20 Thread Ulises
> It's a way older older version of clojure but it's in there.  I've played > around with it. You can always replace the jars (and include others such as support for Jython) and even add contrib. I've done that and it works just fine :) The one grief I had with GRefine is that once you create a c

Re: What is the purpose of the Identity function?

2011-05-07 Thread Ulises
I usually use identity as a predicate for functions such as filter, drop-while, take-while, etc. Consider this silly example: imagine you had an operation that fetches stuff from a resource (DB, network, etc.) and that upon failing it returns nil. Additionally, imagine that you're interested in ru

Re: Getting the all the key values from hashmaps inside a vector

2011-04-20 Thread Ulises
If your keys were keywords, e.g. :key1, you could simply map them as they are also functions: (map :key1 ({:key1 "value1"} ...) U -- 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: ANN: Clojure Atlas (preview!)

2011-04-19 Thread Ulises
I just clicked on "Try it" and only got to a short blurb and a subscribe form. Is this the right behaviour? U -- 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 membe

Re: Open Source Projects for Beg/ Intermediate

2011-04-17 Thread Ulises
> So, questions to Carin, Alex and Alan (and Ulises): What interests > you? What problems do you have that you'd like solutions for? Knowing > that, folks might be able to point you at existing projects to take > part in (or might confirm no such project exists and they

Re: Open Source Projects for Beg/ Intermediate

2011-04-16 Thread Ulises
> I disapprove of discouraging people from offering to help with OSS: > that's how you get started and how you get good. Well, it's not really discouraging. Or at least, I don't see it that way. I see it more like encouraging to contribute but not regardless of personal interest. Personal interest

Re: Open Source Projects for Beg/ Intermediate

2011-04-16 Thread Ulises
Not long ago I was faced with the same dilemma: I am learning clojure and to practise and improve my skills I'd like to contribute to an open source project. Which one should I pick? And then I came across this: http://prog21.dadgum.com/80.html Enjoy :) U -- You received this message because y

Re: Adding key values in a list of maps

2011-04-15 Thread Ulises
> user=> (->> p (map :b) (reduce +)) Alternatively: user> (def p '({:a 1 :b 2 :c 4}, {:a 2 :b 3 :c 5}, {:a 3 :b 4 :c 6})) #'user/p user> (:b (apply merge-with + p)) 9 Depending on whether you'll want the other sums or not, this approach might be appropriate. U -- You received this message bec

Re: Clojure Interop With Java Using Eclipse.

2011-03-31 Thread Ulises
This has worked for me. Modify depending on your case. CAVEAT: I built a fatjar using $ lein uberjar which I then added as an external dependency in Eclipse. This included the clojure jar, the contrib and potentially lots of other stuff I had in my project. It is not entirely clear to me if one ne

Re: gen-class and state...

2011-03-24 Thread Ulises
> You need gen-class when you want (or have to) derive from another > class. defrecord/deftype/reify don't allow that, while gen-class/proxy > do. I suppose this is for when you want to add fields to an already existing class? (I'm assuming that adding methods could be done with extend/extend-prot

Re: gen-class and state...

2011-03-24 Thread Ulises
Sorry for hijacking but I wouldn't mind some clarification on the subject. Right now I can get java classes and interfaces with defprotocol and defrecord and the world is good. Can somebody please educate me in the uses/needs for :gen-class and friends? Keep in mind that I haven't really done mu

Re: Monad Lessons

2011-03-10 Thread Ulises
I'd love to assit too (I like the fact that it'd be interactive). Just to let you know I'm on GMT (for when you schedule things). Cheers, U -- 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

simple map-reduce framework

2011-01-27 Thread Ulises
Hi, I've just implemented a simple map-reduce framework which mimics the steps involved in the workflow of a Hadoop job. It basically amounted to implementing a helper function to emit results and the shuffle-combine step which happens in between a map and a reduce task. Please consider that I am

simplistic M/R framework

2011-01-27 Thread Ulises
Hi, I've just implemented a simplistic map-reduce framework which mimics the steps involved in the workflow of a Hadoop job. It basically amounted to implementing a helper function to emit results and the shuffle-combine step which happens in between a map and a reduce task. Please consider that I

Re: Moderately off-topic: installing emacs on OSX

2010-12-09 Thread Ulises
> I would still like to see slime in action, however. I have two emacs > installed, GNU and Aquamacs. macports is still not able to do anything Sorry if this sounds silly but have you tried with carbon emacs? I heard from old time hardcore emacsers that that is the best emacs for OS X (I'm not one

Re: priority queue for scheduling events in the future

2010-11-23 Thread Ulises
> Does anybody know of an implementation for a priority queue that can > be used for scheduling events in the future?  I would like to put a > map associated with a timestamp into the queue and be able to pull out > all maps at or before a given time in order. You can do so with a combination of t

Re: println from within a thread

2010-11-20 Thread Ulises
> This is how I'm running the test in the slime-connect buffer: How are you running the swank process? I usually run it as lein swank. Whenever I print inside a spawned thread I get the output in the console where I started swank. U -- You received this message because you are subscribed to the

Re: A suggestion for the next Conj

2010-11-03 Thread Ulises
Are there any plans on having an edition of the Conj somewhere in europe? If not, I'd like to suggest we have one over here :) U -- 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 p

Re: reducing terms in vector

2010-10-28 Thread Ulises
> A little stuck on how to do this efficiently.  I have data that looks > like this > > ( [ [1 2] [3 4] [5 6] ... ]  [ [5 6] [7 8] [9 0] ... ] ...) > > I am trying to sum the vector pairs, e.g > > [6 8] [10 12] [14 6] Try: user> (def all-pairs '([ [1 2] [3 4] [5 6] ] [[5 6] [7 8] [9 0]]) ) #'use

Re: creating a function from a sexp

2010-10-27 Thread Ulises
> Is it possible to write such a function? Perhaps you're looking for partial? user> (def x 10) #'user/x user> (let [y 5] (partial + x y)) # user> ((let [y 5] (partial + x y)) 1) 16 user> U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: Improving Contrib

2010-10-22 Thread Ulises
I know this may be a silly question but: how does one get started helping with contrib/etc.? I'm only starting to learn clojure but I've found the community so helpful and thriving that I cannot help but to want to help ... what is the first step? U -- You received this message because you are s

Re: Nested For(s)

2010-10-19 Thread Ulises
Alternatively you can do: user> (def x 5) user> (def y 7) user> (take (* x y) (cycle (range x))) (0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4) user> U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, s

Re: var vs. symbols

2010-10-11 Thread Ulises
> Hope, that helps. It does indeed. So, def either creates or looks up a var of the name of the symbol given and then every time eval comes across a symbol it tries to lookup a var of the same name? (just read http://clojure.org/special_forms#def which I should've read before posting) Cheers an

Re: var vs. symbols

2010-10-11 Thread Ulises
> Eh. No. I don't think so. The Var has a name and the symbol has a > name. And an unqualified symbol is resolved to the "closest" Var with > the same name (conveniently derefing the var to get its contents). > This might be in the same namespace or in a different namespace which > was :use'd. I'm

Re: var vs. symbols

2010-10-11 Thread Ulises
> So I would say: "Unqualified symbols in the namespace the def happened > in will resolve to the def'd Var." (of course only after the def > happened!) so in theory one could have a symbol foo bound to a var bar? U -- You received this message because you are subscribed to the Google Groups "C

Re: var vs. symbols

2010-10-11 Thread Ulises
> I guess one should use "mapping" instead of "binding". The var is mapped to > the symbol "foo" in the namespace *ns*. > I'm saying that because functions for inspecting namespaces are (ns-map), Ah! Excellent, thanks. U -- You received this message because you are subscribed to the Google Grou

var vs. symbols

2010-10-11 Thread Ulises
Hi, I'm sure this has been asked before (although I couldn't find anything other than this StackOverflow thread http://stackoverflow.com/questions/2320348/symbols-in-clojure) and, in addition to that thread, I have a clarifying question: Am I right if I say that when I do (def foo "1") I'm creati

Re: Trouble understanding let

2010-10-10 Thread Ulises
>> What is it I get wrong? As the others said, you have no expressions being evaluated in the body of let and hence you get nil. The way I understand let is that you define some bindings to be used in the body of let which will cease to exist (if they didn't exist before the let expression) after

Re: Is This Function Idiomatic Clojure?

2010-10-07 Thread Ulises
My take on this. I know it's convoluted, I know this is probably not the best and not even a good-enough solution, but it's what I have so far (needless to say, I'd welcome comments on my code :) (defn explode [ [k vals ] ] (map #(vector key %) vals)) (defn update-map [ m ] (partial apply assoc m)

Re: anonymous fn or partial?

2010-10-01 Thread Ulises
> There is a subtle difference in how fixed arguments are handled. > partial evaluates the arguments only once while fn evaluates them on > each call. For side-effects free code the former can yield better > performance. To recap: Ah! What a nice caveat! (also applies to taking macros as arguments

Re: anonymous fn or partial?

2010-09-30 Thread Ulises
> The two styles are ok. > Matter of taste. > (partial ...) have probably a slight cost I wouldn't worry about > except if profiler tells me to worry. Excellent. > If you want to have something looking like (+ 2) with multiple args > possible, I would advocate the best way might be to > add a rea

Re: anonymous fn or partial?

2010-09-30 Thread Ulises
> Think about it for a moment. What should  ((+ 2) 1)  return? A > function with the next elment add on to it? So it would return a > function that adds 3 to its args or the result? How can you know what > the caller wants? That's a very good point which I hadn't considered. Perhaps the evaluatio

Re: anonymous fn or partial?

2010-09-30 Thread Ulises
> You can also consider the following: (map #(+ % 2) [1 2 3 4]), which I did consider #(...) but didn't include it in the example as I tend to prefer (fn [..] ...). For some reason my brain parses (fn...) much better than #() (it looks more explicit). If partial is a special case of #(..) could t

anonymous fn or partial?

2010-09-30 Thread Ulises
Hi, Newbie here with a simple question: what is the preferred way of mapping a function to a seq? Use an anonymous function or use a partial? Consider this: user=> (map (fn [n] (+ 2 n)) [1 2 3 4 5]) (3 4 5 6 7) user=> (map (partial + 2) [1 2 3 4 5]) (3 4 5 6 7) user=> I know that the answer is