Re: Preparing proposal for presentation on replikativ

2016-08-02 Thread Ashish Negi
Hi Christian Thanks for replikativ and asking suggestions. I would like to also know about general problems (both of domain and language) you faced while developing library, and how / how not clojure helped you ? -- You received this message because you are subscribed to the Google Groups "Clo

Re: Exception : cannot create ISeq from Long when empty list is present.. ?

2016-07-25 Thread Ashish Negi
Thanks James.. I will now add a vector after first.. -- 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 pos

Re: Exception : cannot create ISeq from Long when empty list is present.. ?

2016-07-24 Thread Ashish Negi
the code throwing exceptions is below it : https://github.com/ashishnegi/joy-of-clojure/blob/master/src/joy_of_clojure/chap16_thinking_programs.clj#L76 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

Exception : cannot create ISeq from Long when empty list is present.. ?

2016-07-24 Thread Ashish Negi
I am writing a soduku solver.. Everything works but since i am interested in first solution.. when i write `first` after https://github.com/ashishnegi/joy-of-clojure/blob/master/src/joy_of_clojure/chap16_thinking_programs.clj#L58 I get {:type java.lang.IllegalArgumentException ;; :message "Do

Re: [Review] Slow server, not maxing out CPU

2016-07-20 Thread Ashish Negi
with core async `go` you can not do blocking IO or any time consuming work. `go` uses fixed threadpool (no of cpus + 2 or something). and in your async-handler you are using `https://clojure.github.io/core.async/ Try with `future`. https://clojuredocs.org/clojure.core/future Simplest would be to

Re: Preparing a proposal for EuroClojure presentation about Clojure and GPU, high-performance computing - suggestions welcome

2016-07-14 Thread Ashish Negi
Not any specific request.. but i would be highly interested in showing ML in clojure landscape.. showing something end to end.. debugging and optimization tips would be great. I will be waiting.. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Secondar Sorting in spark using clojure/flambo

2016-07-08 Thread Ashish Negi
Should not be `package` in `:import` be the actual package name of ` RFMCPartitioner` ? see examples at https://clojuredocs.org/clojure.core/import like : (ns foo.bar (:import (java.util Date Calendar) (java.util.logging Logger Le

Joy of Clojure : Backward running lisp ??

2016-06-22 Thread Ashish Negi
I am reading joy of clojure. In the "forward to second edition" William E Byrd and Daniel P Firedman says : *As with recursion, the art of defining little languages encourages—and rewards—wishful thinking. You might think to yourself, “If only I had a language for expressing the rules for leg

Re: [ANN] defn podcast ep.3 : A tour of REPLs feat. Mike Fikes :)

2016-06-16 Thread Ashish Negi
Thanks for the podcast.. I would highly appreciate one on Machine Learning in Clojure. On Tuesday, 14 June 2016 13:42:25 UTC+5:30, Vijay Kiran wrote: > > Hello Everyone! > > We published the third episode of defn yesterday in which we take a tour > of REPLs in Clojure Land. > > We are very gratef

[ANN] Advenjure 0.2.0 - An interactive fiction game engine

2016-06-08 Thread Ashish Negi
Looks cool. Thanks. -- 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 unsubscribe from this group,

[ANN] Advenjure 0.2.0 - An interactive fiction game engine

2016-06-08 Thread Ashish Negi
Looks cool. Thanks. -- 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 unsubscribe from this group,

Re: [ANN] New Clojure Podcast: defn

2016-05-20 Thread Ashish Negi
The notes has : ``` Credits: *Music:* Thanks to the very talented *ptzery* for the permitting us to use his music on the opening and closing of the podcast. This track is Melon Hamburger. You can hear more on his SoundCloud . *Audio:* Thanks to the audio wizard

Re: [ANN] New Clojure Podcast: defn

2016-05-20 Thread Ashish Negi
One suggestion : Please provide a short description for every podcast episode. This helps immensely. On Thursday, 19 May 2016 11:13:44 UTC+5:30, Vijay Kiran wrote: > > Hello Everyone, > > Just wanted to let you know that we started a new podcast about Clojure: > https://defn.audio > > We publi

Re: Ghosts in the machine

2016-05-14 Thread Ashish Negi
Great post !!! -- 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 unsubscribe from this group, sen

Re: Unum in Clojure/ClojureScript?

2016-05-06 Thread Ashish Negi
Wow.. mind blown away.. Thanks for sharing this. For the implementation part, How would you do it as Clojure level ? Are you asking about just testing the concept (i think this is what python "port" is doing) or being able to use the number representation system in practice ? Any ideas for gen

Re: Using a try catch inside a future

2016-04-29 Thread Ashish Negi
Also, it means that bug is not in future or threads but in threaded-function itself which is swallowing all the exceptions.. Future is cancelled but it is just that bad-thread is not stopping. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post t

Re: Using a try catch inside a future

2016-04-29 Thread Ashish Negi
https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html#cancel%28boolean%29 may explain why future-cancelled? is returning true.. After this method returns, subsequent calls to isDone()

Re: Using a try catch inside a future

2016-04-29 Thread Ashish Negi
To stop any thread.. interrupts are send to it. And threads handle this by throwing exception so that programmer can decide what to do depending upon the kind of exception it gets. (you may get different exceptions) Since you are catching the exception, your thread is never stopped.. and hence

Re: ANN: Eventually Consistent Datatypes 0.1.0

2016-04-26 Thread Ashish Negi
Nice.. I was going through the Readme.. but it looked complicated. Can you write simple cases where this would be useful ? -- 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 fr

Re: Puzzle solving in Clojure

2016-04-13 Thread Ashish Negi
Thanks puzzler for the explanation. I tried out your `unchunk` and its works nicely.. I then googled around about chunk and memory issues.. I found most issues about chunking and stack overflow.. here.. https://stuartsierra.com/2015/04/26/clojure-donts-concat [which is very good read for

Re: Puzzle solving in Clojure

2016-04-12 Thread Ashish Negi
@Cornelius Goh According to my current understanding.. Tail Call Optimization comes in picture when the `recursive-call`'s return value is not used after its return. Then we do not need the stack.. But my permutation is not like that.. and hence can not be Tall-Call-Optimized.. -- You received

Re: Puzzle solving in Clojure

2016-04-10 Thread Ashish Negi
Though i am not totally sure why it is working.. How removing repeated calls solved the problem of memory ? Other difference is not using `for` loop.. Do post your findings.. if you get it. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: Puzzle solving in Clojure

2016-04-10 Thread Ashish Negi
Your permutations is being called again for similar inputs.. Try using this and see that similar inputs like (2 3) are coming again for (permutations [1 2 3 4]) (defn permutations [s] (prn s) ;; This will print input (lazy-seq (if (seq (rest s)) (apply concat (for [x s]

Re: Clojure library

2016-04-03 Thread Ashish Negi
By default build tool : lein would not do AOT i.e. create .class files. So, your jar with `lein uberjar` would have .clj files. You can verify with un-tar the jar. If you have a `-main` then you can use :skip-aot for not doing aot.. see https://github.com/technomancy/leiningen/blob/master/samp

Re: Mutual Recursion Doesn't Compile

2016-04-01 Thread Ashish Negi
Yeah.. protocols are more right answer to this problem , rather than using declare. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please

Re: [ANN] Quil 2.4.0 and improved live editor

2016-03-26 Thread Ashish Negi
Have never used Quil.. but always amazed by the drawings.. Just wanted to thanks for the amazing work.. Do we have examples of where people are using Quil ? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure

Side Effects and compiler optimzation

2015-02-19 Thread Ashish Negi
I tried to find old threads for my question but could not find any suitable answer. My question is that unlike haskell, which separates I/O side effect code from pure code, and hence can easily do other optimizations like auto-caching results, out of flow execution etc, what is the clojure way

Re: Optimizing code : Fun but now paining me

2014-10-17 Thread Ashish Negi
Places where drop is being used : 1. https://gist.github.com/ashishnegi/ef3c65182c09c154126b#file-shunting-algo-clj-L218 2. https://gist.github.com/ashishnegi/ef3c65182c09c154126b#file-shunting-algo-clj-L250 drop-while at more locations in code. On furthur thinking it looks like if they ret

Re: Optimizing code : Fun but now paining me

2014-10-17 Thread Ashish Negi
Thanks @Gunnar and @barnardH For this time i have been asking you to look at code and find performance points which is not that good way. so i think i better start asking specific questions how dump it may sound : [ i m a newbie ] I hope that normal things that i know about list and vectors hol

Re: Optimizing code : Fun but now paining me

2014-10-17 Thread Ashish Negi
Ok so i am back with this and rechanged the code and used another algorithm : created by great Dijkstra Shunting Yard algo which creates the infix to postfix conversion. My implementation here : https://gist.github.com/ashishnegi/ef3c65182c09c154126b Now, i have only one test case unsolved whi

Re: Optimizing code : Fun but now paining me

2014-10-15 Thread Ashish Negi
Problem is to evaluate a calculator string containing * / + - and brackets like "2+3*(4+2)/2/2" and the grammar for this is right associative for operators and precendence is as we know : ->unaray, brackets >*/>+- Also answer should be in (mod 17) which require

Re: Optimizing code : Fun but now paining me

2014-10-14 Thread Ashish Negi
@bernardH Thanks bernardH for your help. 1. Why subtract 2 ? It is an euler theoram : for finding Modulo inverse , I have written the formula in comments just above the line. ToMod is a big prime number. Euler says for (a/b) mod P where P is big prime number == (a * (b ^ (P-2))mod P) mo

Re: Optimizing code : Fun but now paining me

2014-10-14 Thread Ashish Negi
@BG Glad to know i am interacting with you :) Of course i understand that you are not criticizing me.. I have refactored my code and have made a gist.. that may help.. I have put some comments. https://gist.github.com/ashishnegi/a9ae3fb3c270c7d3742e please share your comments on that. I am reall

Re: Optimizing code : Fun but now paining me

2014-10-14 Thread Ashish Negi
Also just for the record.. My first post had Main code and the code that i used it for testing separated by a line saying * Test *** there I am concerned about the Main code and testing code is there if somebody wants to just put every thing in repl and try few

Re: Optimizing code : Fun but now paining me

2014-10-14 Thread Ashish Negi
@Baishampayan Ghose You caught me right.. i am a novice in clojure.. But most of my functions are smaller ( upto problem requirement ) and self containing.. so i think that you might be having issues with some particular function.. If that is so.. i can put some comments and refactor that part

Re: Optimizing code : Fun but now paining me

2014-10-13 Thread Ashish Negi
Thanks juan I thought that people would prefer the code.. and just wanted to have them glanced at it.. and tell if i am missing something basic. But here is a little list of things i tried : The problem is that of evaluation calculator expressions containig *,/,+,- and (, ) and the grammar for

Re: Optimizing code : Fun but now paining me

2014-10-13 Thread Ashish Negi
It would be great if you people can help me with the optimization and it may work.. or can just guide me towards resources.. :) Thanks -- 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 Not

Re: Optimizing code : Fun but now paining me

2014-10-13 Thread Ashish Negi
It would be great if you people could help me with the optimization .. just few tricks and it may work.. or guide me towards the resources.. On Monday, 13 October 2014 18:40:15 UTC+5:30, Ashish Negi wrote: > > I am competing in an online competition and the scenario is like this : > I c

Optimizing code : Fun but now paining me

2014-10-13 Thread Ashish Negi
I am competing in an online competition and the scenario is like this : I coded with my basic knowledge of clojure and got 11 out of 20 testcases and others being timed out and one being runtime error.. I started optimizing my code and read https://groups.google.com/forum/#!searchin/clojure/perf

Re: my Modulo Inverse in clojure Seems to give wrong answer

2014-10-13 Thread Ashish Negi
nt to try with e.g. > 1000N (note the N; that makes it a bigint). I don’t know of any > nice syntax for describing extremely large bigints; e.g exponent notation. > > > hth > lvh > > > > On 13 Oct 2014, at 10:20, Ashish Negi > > wrote: > > > > >

my Modulo Inverse in clojure Seems to give wrong answer

2014-10-13 Thread Ashish Negi
Hi I am programming in clojure and though the problem of modulo inverse has nothing to do with language i am stuck at this code - (defn EulerDiv [x p] (let [ToMod (+ p 2)] (loop [num 1 toPow (int p) numDouble x] (if (= 0 toPow) num (let [numDouble2 (rem (* numDoubl

Re: Calculating the number of timestamps logged within a specific time period

2014-07-17 Thread Ashish Negi
You need not reverse the list for counting requests per second. If the data is in sorted order, you can start with any direction. Take the first as the base and keep separating untill you get 1 second or X units like 1000 milliseconds if your data is in milliseconds. The count would be an item of

Re: Local variable

2014-07-08 Thread Ashish Negi
you can make that variable "error" as an Agent and change it asynchronously or as a Ref if you want the change synchronously. other part of the code remains same. On Tuesday, 8 July 2014 19:10:54 UTC+5:30, Cecil Westerhof wrote: > > In Clojure you can define a local constant with let, but I need

Fibonacci Heaps and Dijkstra's algorithm

2014-07-08 Thread Ashish Negi
I came across this article : http://maryrosecook.com/blog/post/the-fibonacci-heap-ruins-my-life The user says that he can not use fibonacci heaps efficiently in clojure because since the memory location of nodes changes, it is not possible to have a pointer to the nodes to get faster access to

Why clojure does not have pure lazy-evaluation like Haskell ?

2014-07-08 Thread Ashish Negi
I am new to clojure and finding it great.. :) I came across a paper - Why functional programming matters ? at www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf to quote it : "This paper is also relevant to the present controversy over lazy evaluation. Some believe that functional language

Re: Clojure Pretty Printing with Blogger

2014-06-04 Thread Ashish Negi
Hi i am trying to pretty a clojure code : my emacs version is 24.3.1 my org file is : #+BEGIN_SRC clojure (defn foo [x] (reverse (let [A (reduce (fn [x y] (if (= (:L x) y) (assoc x :T (conj (:T x) y)) (assoc (assoc