Re: Problem with lazy seqs in macros

2018-02-05 Thread Divyansh Prakash
And yes, take-nth is what I wanted!

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with lazy seqs in macros

2018-02-05 Thread Divyansh Prakash
that (:a :b) *really* looks like a seq

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with lazy seqs in macros

2018-02-05 Thread Divyansh Prakash
@Peter Great catch, thanks! I was scratching my head over this.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Problem with lazy seqs in macros

2018-02-05 Thread Divyansh Prakash
Hi!

A while back, I was implementing some datastructures using functions and 
macros.
While implementing hashmaps, I stumbled upon a problem:

(ns hmap)

(defmacro hmap [& kvs]
  "Returns an immutable hashmap.
   Keys must be compile-time constants."
  (if (even? (count kvs))
(let [tups (partition 2 kvs)
  keys (mapv first tups)
  kvs+ (concat kvs [::keys keys])]
  `(fn [k#]
 (case k# ~@kvs+)))
(throw (Exception. "hmap takes an EVEN number of args"


(comment ;; USAGE

  (def m (hmap :a 1 :b 2))
  ;; => #'hmap/m

  (m ::keys)
  ;; => [:a :b]

  (m :a)
  ;; => 1

  (m :c)
  ;; => IllegalArgumentException No matching clause: :c

  )

*(m ::keys)* returns *nil* if *(mapv first tups)* is changed to *(map first 
tups)*.

I had originally used *map*, but seeing that it was not behaving as 
expected,
my friend Divyanshu suggested converting the *keys* binding into a vector,
which made it work.

Some questions -
* Is this because of the lazy seq not being realized in the context of the 
macro?
* Is this correct/expected behavior?

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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-12-12 Thread Divyansh Prakash
I just added `goloop` and `goconsume` to the Clojure implementation, with  
version of `recur` called `gorecur`.

*Example:*

> repl>
> (def ch (chan))
> #'functional-core-async.core/ch
>
> repl>
> (goconsume [v ch]
>   (if (= :ok v)
> (gorecur)
> (println "done")))
> #object[java.util.concurrent.ArrayBlockingQueue 0x30bb0ac9 "[[]]"]
>
> repl>
> (>!! ch :ok)
> nil
>
> repl>
> (>!! ch :ok)
> nil
>
> repl>
> (>!! ch :ok)
> nil
>
> repl>
> (>!! ch :nope)
> done
> nil
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-12-12 Thread Divyansh Prakash
Just remembered that I did give an example in the README, a port of 
braveclojure's hotdog machine.

(defn hot-dog-machine
>   [in out hot-dogs-left]
>   (when (> hot-dogs-left 0)
> (go   (if (= 3 input)
> (go>! [out "hot dog"]
>   (hot-dog-machine in out (dec hot-dogs-left)))
> (go>! [out "wilted lettuce"]
>   (hot-dog-machine in out hot-dogs-left))
>
>
(let [in (chan)
>   out (chan)
>   _ (hot-dog-machine in out 2)]
>   (>!! in "pocket lint")
>   (println (
>   (>!! in 3)
>   (println (
>   (>!! in 3)
>   (println ( wilted lettuce; => hotdog; => hotdog
>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-12-12 Thread Divyansh Prakash
In fact, the JS implementation is much ahead of the Clojure version as of 
right now - with a better parking algorithm and `goconsume` for creating 
actors that park on read from a channel in an implicit loop.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-12-12 Thread Divyansh Prakash
Hi, @halgari! The JS port actually does have this, just haven't found the 
time to port it back.
But basically we can define something like:

(defn goloop*
>   [f initial-state]
>   (letfn [(recur+ [state]
> (goloop* f state))]
> (go
>   (f recur+ initial-state
>
>
> (defmacro goloop
>   [[var initial-state] & body]
>   `(goloop* (fn [~'recur+ ~var]
>   ~@body)
> ~initial-state))
>


 And then use it this way:

repl>
> (def ch (chan))
>
#'functional-core-async.core/ch

 
>
repl> 
>
(goloop [acc 0]
>   (go (if (not= :NIL v)
>   (recur+ (+ acc v))
>   (println "Count" acc
> #object[java.util.concurrent.ArrayBlockingQueue 0x3ddbadf5 "[]"] 
>
 
>
repl> 
>
(go>! [ch 1])
> #object[java.util.concurrent.ArrayBlockingQueue 0x28864bee "[]"]
>
 
>
repl>
> (go>! [ch 4])
> #object[java.util.concurrent.ArrayBlockingQueue 0x5caa5b10 "[]"]
>
 
>
repl>
> (go>! [ch :NIL])
> #object[java.util.concurrent.ArrayBlockingQueue 0x2d40473a "[]"]
> Count 5
>

- Divyansh 

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-11-22 Thread Divyansh Prakash
Thanks for the encouragement, Jay!
I ported the library  over to 
JS, and now we have coroutines in vanilla JavaScript!
Porting it to other systems should be fairly straightforward. 

- Divyansh

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-11-21 Thread Divyansh Prakash
Just a follow up.
I have implemented parking versions of *!*, but (because I'm not 
a sorcerer like *@halgari*) they are rather simple and not as powerful as 
*core.async*'s versions.
I now understand what more *core.async* is doing, and where my 
implementation falls short.
I do believe I have a working implementation of coroutines, though - which 
is awesome! 

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-11-16 Thread Divyansh Prakash
Actually, returns in ~1700ms if I increase buffer width to 1000

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-11-16 Thread Divyansh Prakash
The other example on that thread has stranger charesteristics:

(defn bench []
>   (time
>(let [c (chan 100)]
>  (go
>(dotimes [i 10] ;; doesn't return for 1e5, takes ~170ms for 1e4
>  (>! c i))
>(close! c))
>  (loop [i nil]
>(if-let [x (  (recur x)
>  i)
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-11-16 Thread Divyansh Prakash
Here 's 
a port of a core.async example that I was able to pull of the mailing list.
Performance (in this particular case) seems to be the same.
I'm trying out more examples as I find them.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-11-15 Thread Divyansh Prakash
(which also resolves this blocking go problem ... in a way)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-11-15 Thread Divyansh Prakash
Hi!

I tried resolving that but pre-emption of the current task turned out to be 
a really, really tough problem, and I believe that's why we need the 
core.async macros.

Anyhow, I have updated the scheduler to autopromote go blocks into actual 
JVM threads if they block for more than 10ms - poor man's version of go's 
smart scheduling.

Would love to know your thoughts on this.

- Divyansh

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: functional implementation of core.async primitives

2017-11-15 Thread Divyansh Prakash
Hi!

Thank you for your feedback!

I've made the following changes to my implementation :
- bounded channels with backpressure
- proper thread synchronization
- thread blocks that run on actual threads (unlike go blocks)

TODO:
- alts!
- preserve thread local bindings in `go` blocks (`thread` too?)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


clojure.core/bean throws when passed an empty list

2016-10-04 Thread Divyansh Prakash
Is this desired behaviour?

user=> (bean [])
{:class clojure.lang.PersistentVector, :empty true}

user=> (bean {})
{:class clojure.lang.PersistentArrayMap, :empty true}

user=> (bean ())
IllegalAccessException Class clojure.core$bean$fn__5975$fn__5976 can not 
access a member of class clojure.lang.PersistentList$EmptyList with 
modifiers "public"  sun.reflect.Reflection.ensureMemberAccess 
(Reflection.java:110)

user=> (bean '(1 2 3))
{:class clojure.lang.PersistentList, :empty false}

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble using r/fold to optimise a reduce

2016-04-03 Thread Divyansh Prakash
Thanks a lot for taking the time out to explain this stuff in detail! 
Will go through your solution shortly.

On Sunday, April 3, 2016 at 12:02:48 PM UTC+5:30, Francis Avila wrote:
>
> I had some fun with playing around with faster solutions. 
> https://gist.github.com/favila/0573e3f644dea252bdaaed5be9d1519f
>
> The biggest speedup comes from avoiding set creation in expanded-range 
> (i.e., the function that produces the collection of affected coordinates) 
> and ensuring that the ops run on the accumulating set of on-lights using 
> transients.  clojure.set/* functions require both items be sets and does 
> not use transients internally, so it was much slower.
>
> Another big speedup comes from encoding the light coordinates more 
> efficiently. You can encode a light as a number (in my case, a long, with 
> high bits the x coordinate and low bits the y coordinate) instead of a 
> vector. This creates fewer objects which are easier to hash.
>
> Finally, I tried an approach which doesn't use sets, but instead naively 
> creates a 1000x1000 array of booleans and mutates it in place with every 
> op. This is the fastest approach: 4 seconds on a 2010-era i3! I'm sure a 
> proper matrix library (e.g. core.matrix) could do even better.
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble using r/fold to optimise a reduce

2016-04-02 Thread Divyansh Prakash
Updated code here 
.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble using r/fold to optimise a reduce

2016-04-02 Thread Divyansh Prakash
Just verified - it works and gives the correct answer for shorter 
collections. 
No performance boost though. And fails (?) on larger collections.
Not sure what's happening. The foldvec implementation is also pretty hard 
to understand.

On Sunday, April 3, 2016 at 2:38:26 AM UTC+5:30, Francis Avila wrote:
>
> Your input collection to r/fold is provided by cmds-from-input which 
> returns a lazy-seq (from map) which is not a parallel-foldable type. You 
> can try mapv instead: vectors are parallel-foldable. (Note only 
> PersistentVector and PersistentHashMap have useful coll-fold 
> implementations: all other objects (including sets) fall back on normal 
> reduction: 
> https://github.com/clojure/clojure/blob/d5708425995e8c83157ad49007ec2f8f43d8eac8/src/clj/clojure/core/reducers.clj#L347-L367
> )
>
> Additionally, I'm not sure how this algorithm could be parallelized 
> because the order in which you apply the toggle operation matters! I 
> suspect if you make the mapv change I suggest you will get different final 
> answers.
>
>
>
>
>
>
> On Saturday, April 2, 2016 at 3:24:47 PM UTC-5, Divyansh Prakash wrote:
>>
>> Hi! 
>> I'm solving the problem described here <http://adventofcode.com/day/6>. 
>> I've got the solution 
>> <https://github.com/divs1210/advent-of-code/blob/master/src/aoc/day6.clj>, 
>> but it takes ~50 s to compute.
>> I tried optimising it by replacing the main reduce operation with r/fold, 
>> but it doesn't seem to have any effect on the performance for whatever n 
>> (batch size) I use.
>> Any suggestions?
>>
>> Note: I'm using a MacBook Pro with 8 cores. JDK 7. Clojure 1.8.
>>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble using r/fold to optimise a reduce

2016-04-02 Thread Divyansh Prakash
Even stranger - the parallel version seems to at least produce an output 
(not sure how correct) if run for the first 50 commands instead of 300.

On Sunday, April 3, 2016 at 2:38:26 AM UTC+5:30, Francis Avila wrote:
>
> Your input collection to r/fold is provided by cmds-from-input which 
> returns a lazy-seq (from map) which is not a parallel-foldable type. You 
> can try mapv instead: vectors are parallel-foldable. (Note only 
> PersistentVector and PersistentHashMap have useful coll-fold 
> implementations: all other objects (including sets) fall back on normal 
> reduction: 
> https://github.com/clojure/clojure/blob/d5708425995e8c83157ad49007ec2f8f43d8eac8/src/clj/clojure/core/reducers.clj#L347-L367
> )
>
> Additionally, I'm not sure how this algorithm could be parallelized 
> because the order in which you apply the toggle operation matters! I 
> suspect if you make the mapv change I suggest you will get different final 
> answers.
>
>
>
>
>
>
> On Saturday, April 2, 2016 at 3:24:47 PM UTC-5, Divyansh Prakash wrote:
>>
>> Hi! 
>> I'm solving the problem described here <http://adventofcode.com/day/6>. 
>> I've got the solution 
>> <https://github.com/divs1210/advent-of-code/blob/master/src/aoc/day6.clj>, 
>> but it takes ~50 s to compute.
>> I tried optimising it by replacing the main reduce operation with r/fold, 
>> but it doesn't seem to have any effect on the performance for whatever n 
>> (batch size) I use.
>> Any suggestions?
>>
>> Note: I'm using a MacBook Pro with 8 cores. JDK 7. Clojure 1.8.
>>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble using r/fold to optimise a reduce

2016-04-02 Thread Divyansh Prakash
Thanks a lot, Francis!
I've made the changes you suggest - replaced map with mapv and modified 
apply-cmd to take/return a vector instead of a set (it converts to set 
internally).
My understanding is that reducers preserve the order of operation, so it 
should give the correct answer.
Instead, the simple version now takes ~120 s to run, whereas the r/fold 
version fails with a "UnsupportedOperationException: nth not supported on 
this type: Long" somewhere inside reducers/foldvec/fn. Strange.


On Sunday, April 3, 2016 at 2:38:26 AM UTC+5:30, Francis Avila wrote:
>
> Your input collection to r/fold is provided by cmds-from-input which 
> returns a lazy-seq (from map) which is not a parallel-foldable type. You 
> can try mapv instead: vectors are parallel-foldable. (Note only 
> PersistentVector and PersistentHashMap have useful coll-fold 
> implementations: all other objects (including sets) fall back on normal 
> reduction: 
> https://github.com/clojure/clojure/blob/d5708425995e8c83157ad49007ec2f8f43d8eac8/src/clj/clojure/core/reducers.clj#L347-L367
> )
>
> Additionally, I'm not sure how this algorithm could be parallelized 
> because the order in which you apply the toggle operation matters! I 
> suspect if you make the mapv change I suggest you will get different final 
> answers.
>
>
>
>
>
>
> On Saturday, April 2, 2016 at 3:24:47 PM UTC-5, Divyansh Prakash wrote:
>>
>> Hi! 
>> I'm solving the problem described here <http://adventofcode.com/day/6>. 
>> I've got the solution 
>> <https://github.com/divs1210/advent-of-code/blob/master/src/aoc/day6.clj>, 
>> but it takes ~50 s to compute.
>> I tried optimising it by replacing the main reduce operation with r/fold, 
>> but it doesn't seem to have any effect on the performance for whatever n 
>> (batch size) I use.
>> Any suggestions?
>>
>> Note: I'm using a MacBook Pro with 8 cores. JDK 7. Clojure 1.8.
>>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Trouble using r/fold to optimise a reduce

2016-04-02 Thread Divyansh Prakash
Hi! 
I'm solving the problem described here . 
I've got the solution 
, 
but it takes ~50 s to compute.
I tried optimising it by replacing the main reduce operation with r/fold, 
but it doesn't seem to have any effect on the performance for whatever n 
(batch size) I use.
Any suggestions?

Note: I'm using a MacBook Pro with 8 cores. JDK 7. Clojure 1.8.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Show: Naive data fitting with Nyarlathotep

2015-08-14 Thread Divyansh Prakash
Hey!
Nyarlathotep https://github.com/divs1210/nyarlathotep is a tiny 
mathematical function generator that can be used as a (very naive) data 
fitting tool.
It generates random functions and tests them against provided constraints.
I don't think it's of any practical use, but it is fascinating to watch it 
in action.

- Divyansh

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async: implementing pi.go

2015-08-03 Thread Divyansh Prakash


 does maya automatically handle operator precedence?


maya always evals from left to right. 

(maya 1 + 5 :as six, six * 2 :as twelve, twelve / 3 * 2) ;= 8


- Divyansh 

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


core.async: implementing pi.go

2015-08-02 Thread Divyansh Prakash
I came across pi.go https://golang.org/doc/play/pi.go in the examples for 
go-lang.
I've been trying to replicate it with core.async, and this is what I have 
till now:

(defn term [ch k]
   (go (! ch (- 4.0 
   (* (Math/pow -1 k))
   (/ (- k (* 2) (+ 1)))

 

 (defn pi [n]
   (let [ch (chan)
 f  (atom 0)]
 (dotimes [k (inc n)]
   (term ch k))
 (dotimes [k (inc n)]
   (swap! f + (!! (go (! ch)
 @f))

 

 (defn -main []
   (pi 5000))


This is more or less a direct translation and pretty ugly. Also, it throws 
an interminable stacktrace.
What would be the right way to do this?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async: implementing pi.go

2015-08-02 Thread Divyansh Prakash
Hey, puzzler!
Thanks for the detailed response. Just changing (chan) to (chan n) actually 
worked!
 
I get your displeasure with how 'term' is implemented. 
That's not how I generally code. I'm very new to core.async and was aiming 
for a direct translation of the Go code.

I do get a little carried away with - at times, though.

Also - though optimization wasn't a priority, thanks for taking out the 
time to show alternate approaches along with their use cases. 
I haven't tried reducers yet, so that was new.

I have one more question, though: how does one work in ClojureScript 
without !! ?

- Divyansh

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async: implementing pi.go

2015-08-02 Thread Divyansh Prakash
Makes sense.
By the way - I've refactored my code 
https://github.com/divs1210/go-play/blob/master/src/go_play/pi.clj to not 
use a go block inside 'term', and made it much more readable (IMO) than 
before using my maya library https://github.com/divs1210/maya.
I'm telling you this because I'm not a big fan of writing mathematical 
expressions as s-exps but you seem all for it.
I had written the macros defined in maya quite a long time ago, but you 
just inspired me to push it to clojars, so thanks for that! :)

- Divyansh

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Twitter bot crashing on Heroku

2015-07-27 Thread Divyansh Prakash
Thanks for the response, everyone.

My Procfile says: 

 worker: lein trampoline run


I'm not binding to any port because my app doesn't require it.
How do I do so, though? Will it be available as a part of lein-environ?


-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Twitter bot crashing on Heroku

2015-07-27 Thread Divyansh Prakash
Hi!

I had written a poetry generator http://yushing.herokuapp.com/ sometime 
back and wanted to convert it into a Twitter bot.
I followed this tutorial https://howistart.org/posts/clojure/1 to do so. 
You can find my code here https://github.com/divs1210/yushing-bot.

The bot's working fine from my local machine, but sporadically crashes on 
Heroku with the following message:

 2015-07-27T10:23:06.574908+00:00 heroku[web.1]: Error R10 (Boot timeout) 
 - Web process failed to bind to $PORT within 60 seconds of launch
 2015-07-27T10:23:06.574908+00:00 heroku[web.1]: Stopping process with 
 SIGKILL
 2015-07-27T10:23:07.550373+00:00 heroku[web.1]: Process exited with status 
 137
 2015-07-27T10:23:07.561392+00:00 heroku[web.1]: State changed from 
 starting to crashed


 Some answers on SO suggest that this is because Heroku already provides a 
port to bind to and I might be trying to bind to some other port, but this 
is not the case.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Twitter bot crashing on Heroku

2015-07-27 Thread Divyansh Prakash
Thanks for the response, everyone.

My Procfile says: 

 worker: lein trampoline run


I'm not binding to any port because my app doesn't require it.
How do I do so, though? Will it be available as a part of lein-environ?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


maya - A DSL for math and numerical stuff

2015-01-07 Thread Divyansh Prakash
maya - A DSL for math and numerical stuff.

https://gist.github.com/divs1210/b4fcbd48d7697dfd8850#file-maya

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: CljOS - An OOP system on Clojure

2014-10-26 Thread Divyansh Prakash
Thank you! Clojure is a brilliant language, and this project was supposed 
to prove (mostly to myself) that it deserves the attention I'm devoting to 
it. I cannot even imagine doing something similar in any other language I 
know. I'm not saying it wouldn't be possible, but it certainly won't fit in 
40 lines of readable code!

On Saturday, October 25, 2014 3:27:18 PM UTC+5:30, Gerrit Jansen van Vuuren 
wrote:

 Although as you say in the Readme you should try to avoid OOP in clojure, 
 your code beautifully demonstrates that clojure is a lisp with thread 
 safety baked in, and in a few lines you've added a threadsafe object 
 system to it. Great work, love the simplicity!


-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Demoralising experience trying to install on Win 7

2014-10-25 Thread Divyansh Prakash
I know this is not a real solution, but you can download Clooj 
http://www.mediafire.com/?kxa2an0k0ings and get started right away. It's 
a pretty decent environment, and you can use it till you have a proper 
install.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Writing games in Clojure using Kilvish Game Engine

2014-07-14 Thread Divyansh Prakash
Kilvish  https://github.com/divs1210/kilvishis a simple, lightweight Game 
Engine that I've been working on, that is written as an abstraction over 
awt/swing and is intended for absolute beginners.

There's an example that comes bundled with it (BricksNBall 
https://github.com/divs1210/kilvish/tree/master/examples/bricksnball), 
that I would like to see a version of in Clojure. I've been trying to write 
one myself, but it does not feel idiomatic or simple or easy.

Would someone be interested in contributing such a demo game?

Bonus: would someone be willing to contribute a Clojure wrapper over the 
engine?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Divyansh Prakash
I compare Clojure to acid in this 
http://pizzaforthought.blogspot.in/2014/06/clojurelisp-lsdmeditation.html 
rant.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Divyansh Prakash
(and rant about other stuff I don't know a whole lot about)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Divyansh Prakash
Sorry if you feel that way. Thought i could share my thoughts and start an 
interesting discussion.
That is what the group is for.
You are obviously free to skip anything that doesn't interest you. That was the 
prime reason for the concise title.
I have no intentions of misleading anyone.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cleaner solution, anyone?

2014-05-02 Thread Divyansh Prakash
Exactly!

By the way, I posted the same 
questionhttp://stackoverflow.com/questions/23415815/more-functional-way-to-do-thisto
 stackoverflow.
A. Webb seems to agree with Steve, showing a version using reduced.

Thank you for the response, guys!

On Friday, May 2, 2014 1:38:09 AM UTC+5:30, Guru Devanla wrote:

 Neat, so in your last solution are you trying to get rid of recur and 
 solve 1 - (1/2)^x = time ?


-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cleaner solution, anyone?

2014-05-02 Thread Divyansh Prakash
I've been trying out my code in both Clojure http://tryclj.com/ and 
ClojureScript http://clojurescript.net REPLs.

1. Ratio not being a type in js might cause inconsistencies if not used 
carefully. (for eg in a web app that uses both clj and cljscript)
2. Lazy sequences in Clojure are lazy in word-sized chunks, whereas 
ClojureScript appears to be truly lazy.

This might be important, because the following code *terminates in 
clojurescript, but not in clojure*:

(take 2 (map state (range)))

due to the 2 reasons listed above.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Cleaner solution, anyone?

2014-05-01 Thread Divyansh Prakash
Hey!
I wrote a blog post discussing Thomson's Paradox, and simulated it in 
Clojure-
http://pizzaforthought.blogspot.in/2014/05/and-infinity-beyond.html

The *state* function defined towards the end is not very functional. 
Could someone guide me towards a cleaner approach?

Also, I can't find good code-highlighting tools for blogger/clojure. Any 
suggestions?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Update

2014-04-29 Thread Divyansh Prakash
Why are Clojure features defined in terms of Java classes, instead of as 
bytecode primitives?
For eg: Cons is a class containing two objects: first and rest.
Is this only to achieve Java interoperability, or is there more to it?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Update

2014-04-29 Thread Divyansh Prakash
Thank you for the explanation.
What if I target a non-OO-centric VM (like Parrot or LLVM)?

I've noticed that most Lisp implementations define lambda calculus 
primitives, and then use those as the core.
I wonder what would be if we had bytecode primitives, and defined 
everything else on top of that. 
I don't know to what end, this is just an exercise.

Do you know if this has been done before?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Update

2014-04-29 Thread Divyansh Prakash
I looked into a port of Clojure to Parrot, and it basically does the same 
thinghttps://github.com/ayardley/ClojurePVM/blob/master/src/c/lisp/microlisp/lisp.c
.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Update

2014-04-29 Thread Divyansh Prakash
Why not emit bytecode directly from the language?
Couldn't this potentially lead to tons of specialized optimizing macros? 

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Update

2014-04-29 Thread Divyansh Prakash
Check out my previous reply. The parrot vm provides gc and everything, But 
still the author defines lambda primitives in c, and then builds over it.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Update

2014-04-28 Thread Divyansh Prakash
---IDEA---
I was wondering if we could have a bytecode DSL that would map directly to 
JVM assembler, using either Jasmin http://jasmin.sourceforge.net/ or 
Krakatau https://github.com/Storyyeller/Krakatau.
Then we could define primitives using these bytecode instructions.
For eg:

(defroutine + [a b]
(push! a)
(push! b)
add!
pop!)

that could be used to call:

(+ 2 3) ;= 5

--
We could define the lambda calculus primitives in the same way.
This would be awesome because bottlenecks could be optimized by embedding 
assembly inside Lisp itself.
We could do efficient bit-manipulation, write shader routines, and what not.

--
Thoughts?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Update

2014-04-28 Thread Divyansh Prakash
Jasmin would be a much better choice, btw, because it could be used as a 
dependency in Clojure.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Update

2014-04-28 Thread Divyansh Prakash


 Thanks!

 Exactly what I was looking for.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Starting work on a new dialect on top of the JVM

2014-04-27 Thread Divyansh Prakash
Hey!
I have some ideas that I will be talking about here.
Here's a little introduction.

http://pizzaforthought.blogspot.in/2014/04/lisp-teleology.html

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Quil for ClojureScript

2014-03-11 Thread Divyansh Prakash
Hello!

I am a Java developer, and the author of 
3Coffeehttps://github.com/divs1210/3Coffee, 
a 2D Game Engine (with custom inbuilt physics) that I wrote some 2 years 
back.
I stumbled across Clojure while trying to solve one of the *many* threading 
issues I seemed to have with swing.

I have been Lisping ever since. Check 
thishttp://pizzaforthought.blogspot.in/2014/02/on-art-of-programming.htmlout.

The point is: I like designing high-level APIs, and have a fairly good 
understanding of Clojure (and working on it). I have worked with 
graphics-processing before, and would like to work on the ClojureScript 
port for Quil as a project for GSoC 2014.

I have been busy with college all this while, but I'll start working on it 
ASAP.
Will keep you posted.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.