Re: I'm trying to make proper urls, but I seem to be failing at it.

2014-03-10 Thread David Toomey
Thanks for the repiles -- and sorry for the delayed reply. I guess I'm 
doing something obnoxiously stupid.

The code I'm working with looks like this: 

  (GET  "/:profile-page" [profile-page]
   . ;;; check if user is in database, if so, show the profile 
page: ))

I've tried several variations on the theme, but the only thing that doesn't 
throw an error is this: 

(:require [ring.util.codec :as codec)

  (GET (codec/url-encode "/:profile-page") [profile-page]

Which does not give the desired result and throws a 404. 

I tried adding it in middleware, converting the arguments to a map, stuff 
like this: 

  (GET (str "/:profile-page" (codec/url-encode [profile-page]))

At this point, I'm clearly guessing and I fear I did something wrong 
somewhere else. I'm still confused as to why, even after using this, the 
urls do not replace any of the spaces with %20 or anything else. 

It's probably not the least bit surprising that this works without throwing 
a 404, but of course, does not replace the blank spaces:

  (GET (codec/url-decode "/:profile-page") [profile-page]

Thanks;
David

-- 
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: Working with big datasets, merging two ordered lists by key

2014-03-10 Thread Frank Behrens
Thanks for your suggestions. 
a for loop has to do  100.000 * 300.000 compares
Storing the database table into a 300.000 element hash, would be a memory 
penalty I want to avoid.

I'm quite shure that assential part of the solution is a function to 
iterate through both list at once,
spitting out pairs of values according to compare

(merge-sortedlists 
  '(1 2 3)
  '(   24))
=> ([1 nil] [2 2] [3 nil] [nil 4])

Seems quite doable.
Try to implement now.

Frank


Am Montag, 10. März 2014 01:23:57 UTC+1 schrieb frye:
>
> Hmm, the *for* comprehension yields a lazy sequence of results. So the 
> penalty should only occur when one starts to use / evaluate the result. 
> Using maps is a good idea. But I think you'll have to use another algorithm 
> (not *for*) to get the random access you seek. 
>
> Frank could try a *clojure.set/intersection* to find common keys between 
> the lists. then *order* and *map* / *merge* the 2 lists. 
>
> Beyond that, I can't see a scenario where some iteration won't have to 
> search the space for matching keys (which I think 
> *clojure.set/intersection* does). A fair point all the same. 
>
>
> Tim Washington 
> Interruptsoftware.com  
>
>
> On Sun, Mar 9, 2014 at 12:13 PM, Moritz Ulrich 
> 
> > wrote:
>
>> I think it would be more efficient to read one of the inputs into a
>> map for random access instead of iterating it every time.
>>
>> On Sun, Mar 9, 2014 at 4:48 PM, Timothy Washington 
>> > 
>> wrote:
>> > Hey Frank,
>> >
>> > Try opening up a repl, and running this for comprehension.
>> >
>> > (def user_textfile [[:id1 {:name 'Frank'}] [:id3 {:name 'Tim'}]])
>> > (def user_database [[:id1 {:age 38}] [:id2 {:age 27}] [:id3 {:age 18}] 
>> [:id4
>> > {:age 60}]])
>> >
>> > (for [i user_textfile
>> > j user_database
>> > :when (= (first i) (first j))]
>> > {(first i) (merge (second i) (second j))})
>> >
>> > ({:id1 {:age 38, :name Frank'}} {:id3 {:age 18, :name Tim'}})  ;; result
>> > from repl
>> >
>> >
>> >
>> > Hth
>> >
>> > Tim Washington
>> > Interruptsoftware.com
>> >
>> >
>> > On Sun, Mar 9, 2014 at 5:33 AM, Frank Behrens 
>> > > 
>> wrote:
>> >>
>> >> Hi,
>> >>
>> >> i'm investigating if clojure can be used to solve the challenges and
>> >> problems we have at my day job better than ruby or powershell. A very 
>> common
>> >> use case is validating data from different  systems against some 
>> criteria. i
>> >> believe clojure can be our silver bullet, but before that, it seems to 
>> be
>> >> required to wrap my head around it.
>> >>
>> >> So I am starting in the first level with the challenge to validate some
>> >> data from the user database against our active directory.
>> >>
>> >> I already have all the parts to make it work: Which is to make a hash 
>> by
>> >> user_id from the database table, export a textfile from AD, each line
>> >> representing a user, parse it, merge the information from the
>> >> user_table_hash, and voila.
>> >>
>> >> I did not finish to implement this. So I don't know if this naive 
>> approach
>> >> will work with 400.000 records in the user database and 100.000 in the
>> >> textfile.
>> >> But I already think about how I could implement this in a more memory
>> >> efficient way.
>> >>
>> >> So my simple question:
>> >>
>> >> I have user_textfile (100.000 records) which can be parsed into a
>> >> unordered list of user-maps.
>> >> I have user_table in the database(400.000 record) which I can query 
>> with
>> >> order and gives me an ordered list of user-maps.
>> >>
>> >> So I would first order the user_textfile and then conj the user_table
>> >> ordered list into it, while doing the database query.
>> >> Is that approach right ? How would I then merge the two ordered lists 
>> like
>> >> in the example below?
>> >>
>> >> (defn user_textfile
>> >>   ([:id1 {:name 'Frank'}]
>> >>[:id3 {:name 'Tim'}]))
>> >>
>> >> (defn user_database
>> >>   ([:id1 {:age 38}]
>> >>[:id2 {:age 27}]
>> >>[:id3 {:age 18}]
>> >>[:id4 {:age 60}]))
>> >>
>> >> (merge-sorted-lists user_database user_textfile)
>> >> =>
>> >>   ([:id1 {:name 'Frank' :age 38}]
>> >>[:id3 {:name 'Tim'   :age 18}]))
>> >>
>> >> Any feedback is appreciated.
>> >> Have a nice day,
>> >> Frank
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups "Clojure" group.
>> >> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com .
>> >> For more optio

Re: Working with big datasets, merging two ordered lists by key

2014-03-10 Thread Frank Behrens
Hey, just to share, I came up with this code, which seem quite ok to me,
Feels like I already understand something, do i,
Have a nice day, Frank

(loop
  [a '(1 2 3 4)
   b '(1 3)
   out ()]
  (cond 
(and (empty? a)(empty? b)) out
(empty? a) (recur a (rest b) (conj out [nil (first 
b)]))   
(empty? b) (recur (rest a)  b (conj out [(first a) 
nil]))
:else (let
[fa   (first a)
 fb   (first b)
 cmp  (compare fa fb)]
(cond 
(= 0 cmp) (recur (rest a) (rest b) (conj out [fa fb]))
(> 0 cmp) (recur (rest a)  b   (conj out [fa nil]))
:else (recur  a   (rest b) (conj out [nil fb]))


Am Montag, 10. März 2014 09:26:14 UTC+1 schrieb Frank Behrens:
>
> Thanks for your suggestions. 
> a for loop has to do  100.000 * 300.000 compares
> Storing the database table into a 300.000 element hash, would be a memory 
> penalty I want to avoid.
>
> I'm quite shure that assential part of the solution is a function to 
> iterate through both list at once,
> spitting out pairs of values according to compare
>
> (merge-sortedlists 
>   '(1 2 3)
>   '(   24))
> => ([1 nil] [2 2] [3 nil] [nil 4])
>
> Seems quite doable.
> Try to implement now.
>
> Frank
>
>
> Am Montag, 10. März 2014 01:23:57 UTC+1 schrieb frye:
>>
>> Hmm, the *for* comprehension yields a lazy sequence of results. So the 
>> penalty should only occur when one starts to use / evaluate the result. 
>> Using maps is a good idea. But I think you'll have to use another algorithm 
>> (not *for*) to get the random access you seek. 
>>
>> Frank could try a *clojure.set/intersection* to find common keys between 
>> the lists. then *order* and *map* / *merge* the 2 lists. 
>>
>> Beyond that, I can't see a scenario where some iteration won't have to 
>> search the space for matching keys (which I think 
>> *clojure.set/intersection* does). A fair point all the same. 
>>
>>
>> Tim Washington 
>> Interruptsoftware.com  
>>
>>
>> On Sun, Mar 9, 2014 at 12:13 PM, Moritz Ulrich wrote:
>>
>>> I think it would be more efficient to read one of the inputs into a
>>> map for random access instead of iterating it every time.
>>>
>>> On Sun, Mar 9, 2014 at 4:48 PM, Timothy Washington  
>>> wrote:
>>> > Hey Frank,
>>> >
>>> > Try opening up a repl, and running this for comprehension.
>>> >
>>> > (def user_textfile [[:id1 {:name 'Frank'}] [:id3 {:name 'Tim'}]])
>>> > (def user_database [[:id1 {:age 38}] [:id2 {:age 27}] [:id3 {:age 18}] 
>>> [:id4
>>> > {:age 60}]])
>>> >
>>> > (for [i user_textfile
>>> > j user_database
>>> > :when (= (first i) (first j))]
>>> > {(first i) (merge (second i) (second j))})
>>> >
>>> > ({:id1 {:age 38, :name Frank'}} {:id3 {:age 18, :name Tim'}})  ;; 
>>> result
>>> > from repl
>>> >
>>> >
>>> >
>>> > Hth
>>> >
>>> > Tim Washington
>>> > Interruptsoftware.com
>>> >
>>> >
>>> > On Sun, Mar 9, 2014 at 5:33 AM, Frank Behrens  
>>> wrote:
>>> >>
>>> >> Hi,
>>> >>
>>> >> i'm investigating if clojure can be used to solve the challenges and
>>> >> problems we have at my day job better than ruby or powershell. A very 
>>> common
>>> >> use case is validating data from different  systems against some 
>>> criteria. i
>>> >> believe clojure can be our silver bullet, but before that, it seems 
>>> to be
>>> >> required to wrap my head around it.
>>> >>
>>> >> So I am starting in the first level with the challenge to validate 
>>> some
>>> >> data from the user database against our active directory.
>>> >>
>>> >> I already have all the parts to make it work: Which is to make a hash 
>>> by
>>> >> user_id from the database table, export a textfile from AD, each line
>>> >> representing a user, parse it, merge the information from the
>>> >> user_table_hash, and voila.
>>> >>
>>> >> I did not finish to implement this. So I don't know if this naive 
>>> approach
>>> >> will work with 400.000 records in the user database and 100.000 in the
>>> >> textfile.
>>> >> But I already think about how I could implement this in a more memory
>>> >> efficient way.
>>> >>
>>> >> So my simple question:
>>> >>
>>> >> I have user_textfile (100.000 records) which can be parsed into a
>>> >> unordered list of user-maps.
>>> >> I have user_table in the database(400.000 record) which I can query 
>>> with
>>> >> order and gives me an ordered list of user-maps.
>>> >>
>>> >> So I would first order the user_textfile and then conj the user_table
>>> >> ordered list into it, while doing the database query.
>>> >> Is that approach right ? How would I then merge the two ordered lists 
>>> like
>>> >> in the example below?
>>> >>
>>> >> (defn user_textfile
>>> >>   ([:id1 {:name 'Frank'}]
>>> >>[:id3 {:name 'Tim'}]))
>>> >>
>>> >> (defn user_database
>>> >>   ([:id1 {:age 38}]
>>> >>[:id2 {:age 27}]
>>> >>[:id3 {:age 18}]
>>> >>[:id4 {:age 60}]))
>>> >>
>>> >> (merge-sorted-lis

Re: Need help understanding a lazy sequence function

2014-03-10 Thread Asfand Yar Qazi
Hi,

On Sunday, 9 March 2014 14:58:47 UTC, Atamert Ölçgen wrote:
>
> Hello,
>
> (take 1 fib-seq) => (1)
>
>
> Which can also be seen as[*] (map + (0) (1))
>
> (map + '(0) '(1)) => (1)
>
>
> Makes sense?
>
>
I'm afraid it still doesn't make sense; I still don't understand how (cons 
0 (cons 0 fib-seq)) evaluates to '(0) the first time; it should evaluate to 
'(0 0) since there are 2 cons statements.  That's the point I'm stuck on; 
any help would be gratefully received.





On Sun, Mar 9, 2014 at 12:54 PM, Asfand Yar Qazi 
> > wrote:
>
>> Hi,
>>
>> I'm trying to understand the following function (from 
>> http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Lazy_Fibonacci#Self-Referential_Version
>> ):
>>
>> (def fib-seq
>>   (lazy-seq
>> (map +
>>   (cons 0 (cons 0 fib-seq))
>>   (cons 1 fib-seq
>>
>> I'm trying to understand how this works.  In particular, I do not 
>> understand what the recursive call to fib-seq will return when the sequence 
>> is lazily evaluated.
>>
>> Here's my understanding so far:
>>
>> The first time fib-seq is invoked, it has no head, and the function is 
>> the tail.  So we go into the first collection, where we append 0 and 0 to 
>> fib-seq, which then '(0 0) .  This is then mapped with the second 
>> collection, which (because fib-seq has not returned anything yet) is '(1) . 
>>  Shouldn't map then raise an error because it is effectively being called 
>> as (map + (0 0) (1)) ?
>>
>> I would be very grateful for any insights.
>>
>> Thanks
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Kind Regards,
> Atamert Ölçgen
>
> -+-
> --+
> +++
>
> www.muhuk.com
>  

-- 
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: I'm trying to make proper urls, but I seem to be failing at it.

2014-03-10 Thread James Reeves
You should be able to write:

(GET "/:profile-page" [profile-page] ...)

Compojure (via Clout) automatically decodes parameters in the URL, so there
shouldn't be any need to decode the data any further.

However, for future reference, routes in Compojure have a syntax very
similar to functions. So writing:

(GET "/:profile-page" (codec/url-encode [profile-page]))

Is similar to writing:

(fn (codec/url-encode [profile-page]))

You'll just get a syntax error. Instead, you need to write something like:

(GET "/:profile-page" [profile-page]
  (let [profile-page (codex/url-encode profile-page)]
...))

- James

On 10 March 2014 07:07, David Toomey  wrote:

> Thanks for the repiles -- and sorry for the delayed reply. I guess I'm
> doing something obnoxiously stupid.
>
> The code I'm working with looks like this:
>
>   (GET  "/:profile-page" [profile-page]
>. ;;; check if user is in database, if so, show the profile
> page: ))
>
> I've tried several variations on the theme, but the only thing that
> doesn't throw an error is this:
>
> (:require [ring.util.codec :as codec)
>
>   (GET (codec/url-encode "/:profile-page") [profile-page]
>
> Which does not give the desired result and throws a 404.
>
> I tried adding it in middleware, converting the arguments to a map, stuff
> like this:
>
>   (GET (str "/:profile-page" (codec/url-encode [profile-page]))
>
> At this point, I'm clearly guessing and I fear I did something wrong
> somewhere else. I'm still confused as to why, even after using this, the
> urls do not replace any of the spaces with %20 or anything else.
>
> It's probably not the least bit surprising that this works without
> throwing a 404, but of course, does not replace the blank spaces:
>
>   (GET (codec/url-decode "/:profile-page") [profile-page]
>
> Thanks;
> David
>
> --
> 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.
>

-- 
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: Need help understanding a lazy sequence function

2014-03-10 Thread Alan Forrester
On 10 March 2014 10:26, Asfand Yar Qazi  wrote:
> Hi,
>
> On Sunday, 9 March 2014 14:58:47 UTC, Atamert Ölçgen wrote:
>>
>> Hello,
>>
>> (take 1 fib-seq) => (1)
>>
>>
>> Which can also be seen as[*] (map + (0) (1))
>>
>> (map + '(0) '(1)) => (1)
>>
>>
>> Makes sense?
>>
>
> I'm afraid it still doesn't make sense; I still don't understand how (cons 0
> (cons 0 fib-seq)) evaluates to '(0) the first time; it should evaluate to
> '(0 0) since there are 2 cons statements.  That's the point I'm stuck on;
> any help would be gratefully received.

The code is this:

(def fib-seq
  (lazy-seq
(map +
  (cons 0 (cons 0 fib-seq))
  (cons 1 fib-seq

According to the documentation for map
http://clojuredocs.org/clojure_core/clojure.core/map
(map + x y)

where x and y are two collections adds the first element of x to the
first element of y, the second element of x to the second element of y
and so on until either x or y is exhausted.

The documentation for cons states that (cons x seq) returns a new
collection with x as the first element and seq as the rest so (cons 0
[1 2 3 4]) is '(0 1 2 3 4) and  (cons 0 (cons 0 [1 2 3 4])) is the
same as (cons 0 [0 1 2 3 4]) which gives '(0 0 1 2 3 4).

So the expression

(cons 0 (cons 0 fib-seq))

is the same as fib-seq with two zeros in front. It is not the same as
fib-seq with '(0 0) in front.

When the map maps over (cons 0 (cons 0 fib-seq)) and takes its first
element, it finds that the first element is 0, not '(0 0).

You seem to be trying to imagine how lazy-seqs work rather than
reading the documentation, which tells you how they behave when you
run a program or type an expression into the REPL. This is a bad idea
since it conflates the implementation with the behaviour. The
behaviour is in the documentation. If you want to know how functional
data structures work there are books about this kind of thing like
"Purely Functional Data Structures" by Okasaki.

Alan

-- 
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: Need help understanding a lazy sequence function

2014-03-10 Thread Asfand Yar Qazi
On Monday, 10 March 2014 11:35:30 UTC, Alan Forrester wrote:
>
> According to the documentation for map 
> http://clojuredocs.org/clojure_core/clojure.core/map 
> (map + x y) 
>
> where x and y are two collections adds the first element of x to the 
> first element of y, the second element of x to the second element of y 
> and so on until either x or y is exhausted. 
>

OK I feel like an idiot - I was going by what I picked up from Clojure 
Programming, and didn't read the official API docs, sorry.  The "until 
either x or y is exhausted" bit is what was the missing piece of the puzzle.
 

> You seem to be trying to imagine how lazy-seqs work rather than 
> reading the documentation, which tells you how they behave when you 
> run a program or type an expression into the REPL.
>

I will take your advice on-board.

Many 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: [soft/philosophical] event handers in cljs

2014-03-10 Thread juan.facorro
Hi Sam,

On Sunday, March 9, 2014 11:16:13 PM UTC-3, Sam Ritchie wrote:
>
> Well, I typically have multiple channels. No need to have a single global 
> event bus for everything. With multiple channels, you can have a bunch of 
> local event loops.
>
 
I have taken this approach as well, but I can can't seem to find a good 
answer to this question: When you create a bunch of elements with their 
corresponding channels to handle certain events, how do you handle the 
closing of those channels and the termination of the related *go* blocks 
once you remove the elements?

Thanks!

Juan


 

-- 
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.


Do I have to have knowlegde about Lisp

2014-03-10 Thread Roelof Wobben
Hello, 

I like the idea of Clojure but I wonder if I have to know a lot of Lisp to 
work with Clojure.

What is the best way to go from a absolute beginner to someone who can work 
with Clojure. 

Roelof

-- 
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: Do I have to have knowlegde about Lisp

2014-03-10 Thread Dennis Haupt
you can learn clojure without learning lisp first :)


2014-03-10 15:41 GMT+01:00 Roelof Wobben :

> Hello,
>
> I like the idea of Clojure but I wonder if I have to know a lot of Lisp to
> work with Clojure.
>
> What is the best way to go from a absolute beginner to someone who can
> work with Clojure.
>
> Roelof
>
>  --
> 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.
>

-- 
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: Do I have to have knowlegde about Lisp

2014-03-10 Thread Moritz Ulrich
It might actually be counter-productive to learn Common Lisp before
Clojure, as Clojure is so much simpler easier to learn/understand than
Common Lisp.

On Mon, Mar 10, 2014 at 4:52 PM, Dennis Haupt  wrote:
> you can learn clojure without learning lisp first :)
>
>
> 2014-03-10 15:41 GMT+01:00 Roelof Wobben :
>
>> Hello,
>>
>> I like the idea of Clojure but I wonder if I have to know a lot of Lisp to
>> work with Clojure.
>>
>> What is the best way to go from a absolute beginner to someone who can
>> work with Clojure.
>>
>> Roelof
>>
>> --
>> 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.
>
>
> --
> 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.

-- 
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: Do I have to have knowlegde about Lisp

2014-03-10 Thread Gary Trakhman
1. Read a good book. 'Clojure Programming' has a good reputation.  'Joy of
Clojure' is a good second book.
2. Do some small examples, 4clojure is great for this.
3. Build up larger programs from smaller chunks.

Learning another lisp at the same time is going to distract more than help,
clojure docs don't assume prior knowledge, and you might get caught up in
minor differences.  That said, the 'Little Schemer' is a great intro to
basic lisp and recursive thought, and the language features needed to get
through the book are very very small.


On Mon, Mar 10, 2014 at 11:52 AM, Dennis Haupt  wrote:

> you can learn clojure without learning lisp first :)
>
>
> 2014-03-10 15:41 GMT+01:00 Roelof Wobben :
>
> Hello,
>>
>> I like the idea of Clojure but I wonder if I have to know a lot of Lisp
>> to work with Clojure.
>>
>> What is the best way to go from a absolute beginner to someone who can
>> work with Clojure.
>>
>> Roelof
>>
>>  --
>> 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.
>>
>
>  --
> 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.
>

-- 
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: Do I have to have knowlegde about Lisp

2014-03-10 Thread Thomas
Roelof,

I wanted to learn Lisp for a lng time (maybe even 10 year +) tried 
common Lips once or twice, but failed miserably. But it was Clojure that 
really got me going. Watch the various video's that Rich Hickey did that 
are on youtube (https://www.youtube.com/user/ClojureTV) if you don't want 
to spend any money (yet)

Good luck and let us know how you get on.

Thomas

On Monday, March 10, 2014 2:41:12 PM UTC, Roelof Wobben wrote:
>
> Hello, 
>
> I like the idea of Clojure but I wonder if I have to know a lot of Lisp to 
> work with Clojure.
>
> What is the best way to go from a absolute beginner to someone who can 
> work with Clojure. 
>
> Roelof
>
>

-- 
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: Do I have to have knowlegde about Lisp

2014-03-10 Thread Jacob Goodson
Let me rephrase your question to show you something...

Should I learn LISP in order to learn LISP...

Clojure is a dialect of LISP as is common lisp; when you learn Clojure you 
are learning LISP.  Clojure "has its opinions" about how to do its list 
processing, however, all other list processing dialects have theirs as 
well.  Clojure will bend you strongly toward functional programming 
paradigms while common lisp would not really suggest any one paradigm.  
Common Lisp is more of a multi-paradigm language than Clojure is.  Many 
people have thought of common lisp as a functional language but that is not 
true.  One can do functional programming in CL but one can be as imperative 
as they like as well.  Clojure "tries" to steer one away from the 
imperative way of doing things but since Clojure is a LISP it can be bent 
to imperative "nirvana" as well.  The fact is, learning any one dialect 
will teach you LISP, so dive in!

On Monday, March 10, 2014 10:41:12 AM UTC-4, Roelof Wobben wrote:
>
> Hello, 
>
> I like the idea of Clojure but I wonder if I have to know a lot of Lisp to 
> work with Clojure.
>
> What is the best way to go from a absolute beginner to someone who can 
> work with Clojure. 
>
> Roelof
>
>

-- 
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: Do I have to have knowlegde about Lisp

2014-03-10 Thread Roelof Wobben


Op maandag 10 maart 2014 15:41:12 UTC+1 schreef Roelof Wobben:
>
> Hello, 
>
> I like the idea of Clojure but I wonder if I have to know a lot of Lisp to 
> work with Clojure.
>
> What is the best way to go from a absolute beginner to someone who can 
> work with Clojure. 
>
> Roelof
>
>

-- 
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: Do I have to have knowlegde about Lisp

2014-03-10 Thread Shantanu Kumar


On Monday, 10 March 2014 20:11:12 UTC+5:30, Roelof Wobben wrote:
>
> Hello, 
>
> I like the idea of Clojure but I wonder if I have to know a lot of Lisp to 
> work with Clojure.
>
> What is the best way to go from a absolute beginner to someone who can 
> work with Clojure.
>

To have a quick feel of Clojure, install Leiningen from leiningen.org, run 
`lein repl` and check this 
out: http://adambard.com/blog/clojure-in-15-minutes/

Then, move onto Clojure books, 4clojure etc. using Nightcode from 
https://nightcode.info/ or any editor you like.

Shantanu

-- 
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: More functional Quil

2014-03-10 Thread Nikita Beloglazov
Lee,

I think question about managing/updating state in quil pop ups pretty
frequently and many people expect quil to have built-in tools to do it in
functional style. And using atoms to update state may feel hacky. I think
this tools should exist and quil 2.0 is a good time to address the issue.
Yes, Pablo's and mine changes are cosmetic but still they will help to feel
functional nature of quil and I think it is a win.
As for translating Processing code to Quil - I think it's already not very
easy for people who has little experience with functional programming and
therefore I don't think these cosmetic changes will add much complexity.

The only issue I see, which is you mentioned, is having two similar but
still separate modes. It may create confusion for newcomers.

Though I will be glad to hear other opinions on the question and see if
people generally like the idea or would rather keep old good quil as it is.


Gary,
Thank you. It might be useful in future if we decide to implement similar
thing.


Thank you,
Nikita


On Mon, Mar 10, 2014 at 4:27 AM, Gary Trakhman wrote:

> FWIW, I've got an example of a decoupled update/draw loop here:
> https://github.com/gtrak/quilltest/blob/master/src/quilltest/balls.clj
>
>
> On Sun, Mar 9, 2014 at 10:16 PM, Lee Spector wrote:
>
>>
>> FWIW I'm not crazy about these suggestions because they seem to me to be
>> mostly cosmetic, and actually negative if they end up leading to multiple
>> incompatible modes of operation. The Processing model seems to me to be
>> intrinsically imperative, and it's also well-known by lots of people and
>> easy to understand. The current Quil scheme, which provides fairly direct
>> access to Processing's existing model from Clojure, still allows us to
>> write functional-style code for all of the interesting stuff that we do
>> within/between calls to the imperative Processing calls. And it allows one
>> to translate Processing ideas into Quil relatively easily. So I like it
>> like it is :-).
>>
>>  -Lee
>>
>> On Mar 9, 2014, at 8:29 PM, Nikita Beloglazov wrote:
>>
>> > Hi Pablo
>> >
>> > You can find similar old thread on Quil github repo:
>> https://github.com/quil/quil/pull/19 It may serve as good background
>> what other people considered to make Quil more "functional-style".
>> >
>> > I like your suggestion though I would split your :draw function to 2
>> fns: an :update function, which only purpose is to update state and :draw
>> which draws state and doesn't change the world at all. If this approach is
>> implemented - other handler functions like :mouse-move, :key-pressed are
>> also need to become update-like functions - they should take state as
>> argument and return new state.
>> >
>> > The only problem is that it is not backward compatible at all. But
>> probably we still can do it... We can add option :fun-mode? true (stands
>> for functional-mode) which enables all these changes - :draw takes state as
>> argument, new :update function is added for modifying state, all handlers
>> behave like :update. This option is enabled per-sketch. It requires
>> additional work on Quil internals, but I think it is doable. This option
>> can be implemented in coming quil 2.0 and it would be great feature to have.
>> >
>> > One more thing we could do to make it more functional-like - pass
>> "changed" values to handlers directly. Currently when :key-pressed handler
>> is called - no argument is passed to the function and you need to use
>> (key-code) or (raw-key) functions to identify which key was pressed. I
>> think this parameters should be explicitly passed to the function.
>> >
>> > What do you think?
>> >
>> > Nikita
>>
>> --
>> 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.
>>
>
>  --
> 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 a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> http

Re: More functional Quil

2014-03-10 Thread Gary Trakhman
The complicated-looking semaphore code was adapted from
http://stackoverflow.com/a/5275254/2559313 . I think some issues with other
alternatives are in there.


On Mon, Mar 10, 2014 at 1:27 PM, Nikita Beloglazov
wrote:

> Lee,
>
> I think question about managing/updating state in quil pop ups pretty
> frequently and many people expect quil to have built-in tools to do it in
> functional style. And using atoms to update state may feel hacky. I think
> this tools should exist and quil 2.0 is a good time to address the issue.
> Yes, Pablo's and mine changes are cosmetic but still they will help to feel
> functional nature of quil and I think it is a win.
> As for translating Processing code to Quil - I think it's already not very
> easy for people who has little experience with functional programming and
> therefore I don't think these cosmetic changes will add much complexity.
>
> The only issue I see, which is you mentioned, is having two similar but
> still separate modes. It may create confusion for newcomers.
>
> Though I will be glad to hear other opinions on the question and see if
> people generally like the idea or would rather keep old good quil as it is.
>
>
> Gary,
> Thank you. It might be useful in future if we decide to implement similar
> thing.
>
>
> Thank you,
> Nikita
>
>
> On Mon, Mar 10, 2014 at 4:27 AM, Gary Trakhman wrote:
>
>> FWIW, I've got an example of a decoupled update/draw loop here:
>> https://github.com/gtrak/quilltest/blob/master/src/quilltest/balls.clj
>>
>>
>> On Sun, Mar 9, 2014 at 10:16 PM, Lee Spector wrote:
>>
>>>
>>> FWIW I'm not crazy about these suggestions because they seem to me to be
>>> mostly cosmetic, and actually negative if they end up leading to multiple
>>> incompatible modes of operation. The Processing model seems to me to be
>>> intrinsically imperative, and it's also well-known by lots of people and
>>> easy to understand. The current Quil scheme, which provides fairly direct
>>> access to Processing's existing model from Clojure, still allows us to
>>> write functional-style code for all of the interesting stuff that we do
>>> within/between calls to the imperative Processing calls. And it allows one
>>> to translate Processing ideas into Quil relatively easily. So I like it
>>> like it is :-).
>>>
>>>  -Lee
>>>
>>> On Mar 9, 2014, at 8:29 PM, Nikita Beloglazov wrote:
>>>
>>> > Hi Pablo
>>> >
>>> > You can find similar old thread on Quil github repo:
>>> https://github.com/quil/quil/pull/19 It may serve as good background
>>> what other people considered to make Quil more "functional-style".
>>> >
>>> > I like your suggestion though I would split your :draw function to 2
>>> fns: an :update function, which only purpose is to update state and :draw
>>> which draws state and doesn't change the world at all. If this approach is
>>> implemented - other handler functions like :mouse-move, :key-pressed are
>>> also need to become update-like functions - they should take state as
>>> argument and return new state.
>>> >
>>> > The only problem is that it is not backward compatible at all. But
>>> probably we still can do it... We can add option :fun-mode? true (stands
>>> for functional-mode) which enables all these changes - :draw takes state as
>>> argument, new :update function is added for modifying state, all handlers
>>> behave like :update. This option is enabled per-sketch. It requires
>>> additional work on Quil internals, but I think it is doable. This option
>>> can be implemented in coming quil 2.0 and it would be great feature to have.
>>> >
>>> > One more thing we could do to make it more functional-like - pass
>>> "changed" values to handlers directly. Currently when :key-pressed handler
>>> is called - no argument is passed to the function and you need to use
>>> (key-code) or (raw-key) functions to identify which key was pressed. I
>>> think this parameters should be explicitly passed to the function.
>>> >
>>> > What do you think?
>>> >
>>> > Nikita
>>>
>>> --
>>> 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.
>>>
>>
>>  --
>> 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
>> y

Re: Do I have to have knowlegde about Lisp

2014-03-10 Thread Benedict Apuna
I'm still a beginner with Clojure so I can't give any definite answers. For 
what it's worth, I've been working through both Clojure from the ground 
upand Clojure 
for the Brave and True , and I'm finding them 
to be quite enjoyable.

Also LightTable  seems to be a great tool for 
learning Clojure with it's inline live eval feature. The Light Table 
Discussion Google 
Groupis
 a good place to learn more about 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.


[ANN] 1st public release of thi.ng geometry toolkit (CLJ & CLJS)

2014-03-10 Thread Karsten Schmidt
It is my absolute pleasure to finally announce the first public
release of the 2d/3d geometry library/toolkit: thi.ng/geom

Having worked on this regularly since late 2011 as successor of my
Java-based toxiclibs.org project, the new project has already
undergone three complete overhauls as I've been improving my grasp of
Clojure. The project currently consists of 26 namespaces and 6500+
lines of code.

You can find all existing details, sources & initial examples at:
https://github.com/thi-ng/geom/blob/master/src/index.org

Leiningen coords: [thi.ng/geom "0.2.0"] (available from Clojars)

This project is part of a bigger & rapidly growing collection of
Clojure libraries targeted at the wider computational/generative
design context. All libraries in the thi.ng collection are (will be)
developed in a literal programming format to also encourage their use
in teaching contexts and generally try to improve the state of
documentation & managing source code. Clojure with its focus on
isolated functionality is particular nice to work with in this sense
and Org-mode has completely transformed my way of working.

Since this is only the 1st release and I've planned a few more
(potentially) breaking API changes I cannot currently accept major
pull requests until the API is more solid (and once I'm less up
against deadlines). In general though, I hope this project has a wide
enough scope & license to encourage further communal development.

Lastly, if you're not too allergic to strong German accents, you can
also watch (and follow along) a little live coding session I've done
with Paul Kinlan @ Google Developers Live last month:

http://youtu.be/tKIVJ2TaS2k?t=20m9s

Happy coding! :)

-- 
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: [ANN] 1st public release of thi.ng geometry toolkit (CLJ & CLJS)

2014-03-10 Thread Mimmo Cosenza
This stuff should be great. Thanks so much for sharing it.

mimmo

On 10 Mar 2014, at 22:32, Karsten Schmidt  wrote:

> It is my absolute pleasure to finally announce the first public
> release of the 2d/3d geometry library/toolkit: thi.ng/geom
> 
> Having worked on this regularly since late 2011 as successor of my
> Java-based toxiclibs.org project, the new project has already
> undergone three complete overhauls as I've been improving my grasp of
> Clojure. The project currently consists of 26 namespaces and 6500+
> lines of code.
> 
> You can find all existing details, sources & initial examples at:
> https://github.com/thi-ng/geom/blob/master/src/index.org
> 
> Leiningen coords: [thi.ng/geom "0.2.0"] (available from Clojars)
> 
> This project is part of a bigger & rapidly growing collection of
> Clojure libraries targeted at the wider computational/generative
> design context. All libraries in the thi.ng collection are (will be)
> developed in a literal programming format to also encourage their use
> in teaching contexts and generally try to improve the state of
> documentation & managing source code. Clojure with its focus on
> isolated functionality is particular nice to work with in this sense
> and Org-mode has completely transformed my way of working.
> 
> Since this is only the 1st release and I've planned a few more
> (potentially) breaking API changes I cannot currently accept major
> pull requests until the API is more solid (and once I'm less up
> against deadlines). In general though, I hope this project has a wide
> enough scope & license to encourage further communal development.
> 
> Lastly, if you're not too allergic to strong German accents, you can
> also watch (and follow along) a little live coding session I've done
> with Paul Kinlan @ Google Developers Live last month:
> 
> http://youtu.be/tKIVJ2TaS2k?t=20m9s
> 
> Happy coding! :)
> 
> -- 
> 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.



signature.asc
Description: Message signed with OpenPGP using GPGMail


[ANN] 1st public release of luxor - 3d scene compiler for Luxrender

2014-03-10 Thread Karsten Schmidt
Following up on the announcement of thi.ng/geom, I've also just pushed
the first release of a related support library: thi.ng/luxor, a 3d
scene compiler & mesh exporter for creating high definition & high
resolution renders with Luxrender.

Luxrender.net is an open source, physically based, unbiased rendering
engine with OpenCL & network rendering support and can be easily
deployed in the cloud to form ad-hoc render farms.

Description, source, usage & example render:
https://github.com/thi-ng/luxor

Leiningen coords:
[thi.ng/luxor "0.2.0"] (available from Clojars)

Luxor currently only supports the most common Luxrender scene entities
and is still missing features like procedural textures and various
material types. Adding support for these is on the TODO list though
and I'd be happy about contributions from other interested people.

-- 
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.


[ANN] thi.ng/validate - purely functional validation & correction

2014-03-10 Thread Karsten Schmidt
Last release of today, I promise... :)

thi.ng/validate is (by now) yet-another-validation library, but
actually is almost a year old and AFAIK has some unique features I
dearly missed in other contenders and maybe you've (missed them) too:

- pure functions, no macros
- composable validator fns
- wildcard support (apply constraints to all values in a coll)
- support for auto-correction attempts before failing
- support for nested maps & vectors
- optional value constraints
- no hardcoded validation errors (i.e. can be be overridden for I18N purposes)
- errors returned in similar structure as offending fied in original collection
  (for easy destructuring and mapping errors to form fields)

The library comes with 22 ready-made validators, but of course
supports custom ones too.

https://github.com/thi-ng/validate

Leiningen coords:
[thi.ng/validate "0.1.0-SNAPSHOT"] (available from Clojars)

-- 
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: Need help understanding a lazy sequence function

2014-03-10 Thread Frank Behrens
Hello,

I'm trying to understand the lazyness, how they work, how to create them, 
how to avoid pre-realisation.

Can someone point me to which documentation would be helpful, where do I 
find it ?

Frank

Am Montag, 10. März 2014 13:16:00 UTC+1 schrieb Asfand Yar Qazi:
>
> On Monday, 10 March 2014 11:35:30 UTC, Alan Forrester wrote:
>>
>> According to the documentation for map 
>> http://clojuredocs.org/clojure_core/clojure.core/map 
>> (map + x y) 
>>
>> where x and y are two collections adds the first element of x to the 
>> first element of y, the second element of x to the second element of y 
>> and so on until either x or y is exhausted. 
>>
>
> OK I feel like an idiot - I was going by what I picked up from Clojure 
> Programming, and didn't read the official API docs, sorry.  The "until 
> either x or y is exhausted" bit is what was the missing piece of the puzzle.
>  
>
>> You seem to be trying to imagine how lazy-seqs work rather than 
>> reading the documentation, which tells you how they behave when you 
>> run a program or type an expression into the REPL.
>>
>
> I will take your advice on-board.
>
> Many 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: Need help understanding a lazy sequence function

2014-03-10 Thread Gary Trakhman
If you haven't seen the impl yet, it's relatively small and simple:
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L642
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java

Chunked seqs are more complex, but they're basically a performance
optimization.


On Mon, Mar 10, 2014 at 6:43 PM, Frank Behrens  wrote:

> Hello,
>
> I'm trying to understand the lazyness, how they work, how to create them,
> how to avoid pre-realisation.
>
> Can someone point me to which documentation would be helpful, where do I
> find it ?
>
> Frank
>
> Am Montag, 10. März 2014 13:16:00 UTC+1 schrieb Asfand Yar Qazi:
>
>> On Monday, 10 March 2014 11:35:30 UTC, Alan Forrester wrote:
>>>
>>> According to the documentation for map
>>> http://clojuredocs.org/clojure_core/clojure.core/map
>>> (map + x y)
>>>
>>> where x and y are two collections adds the first element of x to the
>>> first element of y, the second element of x to the second element of y
>>> and so on until either x or y is exhausted.
>>>
>>
>> OK I feel like an idiot - I was going by what I picked up from Clojure
>> Programming, and didn't read the official API docs, sorry.  The "until
>> either x or y is exhausted" bit is what was the missing piece of the puzzle.
>>
>>
>>> You seem to be trying to imagine how lazy-seqs work rather than
>>> reading the documentation, which tells you how they behave when you
>>> run a program or type an expression into the REPL.
>>>
>>
>> I will take your advice on-board.
>>
>> Many 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.
>

-- 
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: Do I have to have knowlegde about Lisp

2014-03-10 Thread Karsten Schmidt
May I also chip in with a 15k word intro tutorial I've co-written (and
whose upcoming part 2 is focused on Quil):

http://www.creativeapplications.net/tutorials/introduction-to-clojure-part-1/


On 10 March 2014 20:19, Benedict Apuna  wrote:
> I'm still a beginner with Clojure so I can't give any definite answers. For
> what it's worth, I've been working through both Clojure from the ground up
> and Clojure for the Brave and True, and I'm finding them to be quite
> enjoyable.
>
> Also LightTable seems to be a great tool for learning Clojure with it's
> inline live eval feature. The Light Table Discussion Google Group is a good
> place to learn more about 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.



-- 
Karsten Schmidt
http://postspectacular.com | http://toxiclibs.org | http://toxi.co.uk

-- 
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: [ANN] durable-queue: an in-process disk-backed queue

2014-03-10 Thread Zach Tellman
Hey Leif,

When using :fsync-interval, the actual calls to .force() on the underlying 
ByteBuffers occur on another thread, making it effectively a background 
process.  This is contrasted with :fsync-threshold, which will 
synchronously call fsync when the write threshold is hit.  Note that if the 
fsync-interval is less than the time it takes to actually fsync, it will 
simply continuously fsync at whatever pace it can.

If you'd like to verify, I suggest using strace.

Zach

On Sunday, March 9, 2014 6:54:50 PM UTC-7, Leif wrote:
>
> Hi, Zach.
>
> I was trying to benchmark at different values of the :fysnc-* parameters, 
> and I noticed that it didn't matter what value of :fsync-interval I set, 
> the performance was constant, and about what it is with both :fsync-put? 
> and :fsync-take? disabled.
>
> Any suggestions on how to test if data is actually being synced to disk at 
> my specified interval?
>
> Please forgive my suspicious nature,
> Leif
>
> On Friday, March 7, 2014 4:21:44 PM UTC-5, Zach Tellman wrote:
>>
>> I added the above-described features a few weeks back, but only got 
>> around to marking 0.1.1 today.  Fsync batching is described at the end of 
>> the README, let me know if you have any questions.
>>
>> On Friday, February 7, 2014 11:52:11 AM UTC-8, Zach Tellman wrote:
>>>
>>> Hi Bob,
>>>
>>> Right now the API only allows for single puts, and fsyncing is 
>>> all-or-nothing.  However, this is just an artifact of my major use case for 
>>> the library, which relies on upstream batching of tasks.  I'm planning an 
>>> 0.1.1 release which has an explicit `sync` method, and support for 
>>> sync-intervals (i.e. sync twice a second) and sync-thresholds (i.e. sync 
>>> every ten puts or takes).  The use case you describe could be achieved by 
>>> disabling automatic syncing, and doing a series of puts and takes followed 
>>> by a call to `sync`.
>>>
>>> If you have thoughts or suggestions on how this can be more useful for 
>>> you, please let me know.
>>>
>>> Zach
>>>
>>>
>>> On Fri, Feb 7, 2014 at 5:26 AM, Bob Hutchison wrote:
>>>

 On Feb 6, 2014, at 6:45 PM, Zach Tellman  wrote:

 At Factual we get a lot of data thrown at us, and often don't have 
 control over the rate at which it comes in.  As such, it's preferable that 
 our buffer isn't bounded by the process' memory, since a temporary blip in 
 throughput may cause GC pauses, OOM exceptions, and other things that will 
 only exacerbate the problem.  It's also preferable that if the process 
 dies, we won't lose any data which hasn't yet escaped the process.  A 
 disk-backed queue satisfies both of these requirements.

 As such, I'm happy to announce that we're open sourcing 
 'durable-queue': https://github.com/Factual/durable-queue.  It's a 
 small, fast, pure-Clojure implementation that in our production systems is 
 responsible for processing billions of entries daily.  We believe it has 
 broad applications, and are excited to see how others will use it.


 What excellent timing! I’ve been looking at ZeroMQ, RabbitMQ, and Kafka 
 for the last week or so. ZMQ is awfully attractive for what I’m trying to 
 do, but there are a few things it doesn’t do that I need done. I had begun 
 thinking of building something similar on top of Redis.

 You mention the idea of batching to reduce the impact of fsync. Is 
 there an API for batching puts? Is there a way to batch a complete! and 
 put! new tasks to the queue?

 One pattern that keeps coming up is:
- take a single task from the queue
- execute the task, which might generate a set of new tasks to be 
 queued on the same queue (and likely on other queues too)
- signal completion, and put the new tasks

 Cheers,
 Bob


 Zach

 P.S. If this sort of work is interesting to you, Factual is hiring: 
 https://groups.google.com/forum/#!searchin/clojure/factual/clojure/8bPIEnNpfyQ/lvv-9gkVozAJ

 -- 
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.


  -- 
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clo...@go

Re: [ANN] 1st public release of thi.ng geometry toolkit (CLJ & CLJS)

2014-03-10 Thread Malcolm Sparks
Karsten, 

This is amazing. Watching you work with your geom library in this fantastic 
video has really inspired me :- 
http://www.youtube.com/watch?v=tKIVJ2TaS2k&feature=youtu.be&t=20m9s

I've been looking for some geom library to build animated data 
visualizations, so I'm looking forward to exploring this more. Thanks for 
making this available to everyone - it's obviously been a huge amount of 
work.

Regards,

Malcolm

On Monday, 10 March 2014 21:32:02 UTC, Karsten Schmidt wrote:
>
> It is my absolute pleasure to finally announce the first public 
> release of the 2d/3d geometry library/toolkit: thi.ng/geom 
>
> Having worked on this regularly since late 2011 as successor of my 
> Java-based toxiclibs.org project, the new project has already 
> undergone three complete overhauls as I've been improving my grasp of 
> Clojure. The project currently consists of 26 namespaces and 6500+ 
> lines of code. 
>
> You can find all existing details, sources & initial examples at: 
> https://github.com/thi-ng/geom/blob/master/src/index.org 
>
> Leiningen coords: [thi.ng/geom "0.2.0"] (available from Clojars) 
>
> This project is part of a bigger & rapidly growing collection of 
> Clojure libraries targeted at the wider computational/generative 
> design context. All libraries in the thi.ng collection are (will be) 
> developed in a literal programming format to also encourage their use 
> in teaching contexts and generally try to improve the state of 
> documentation & managing source code. Clojure with its focus on 
> isolated functionality is particular nice to work with in this sense 
> and Org-mode has completely transformed my way of working. 
>
> Since this is only the 1st release and I've planned a few more 
> (potentially) breaking API changes I cannot currently accept major 
> pull requests until the API is more solid (and once I'm less up 
> against deadlines). In general though, I hope this project has a wide 
> enough scope & license to encourage further communal development. 
>
> Lastly, if you're not too allergic to strong German accents, you can 
> also watch (and follow along) a little live coding session I've done 
> with Paul Kinlan @ Google Developers Live last month: 
>
> http://youtu.be/tKIVJ2TaS2k?t=20m9s 
>
> Happy coding! :) 
>

-- 
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.


[ANN] ClojureCLR mailing list

2014-03-10 Thread dmiller
ClojureCLR now has its own Google group for discussions.

https://groups.google.com/forum/#!forum/clojure-clr

Please use this new forum for ClojureCLR-specific questions, suggestions, 
requests related to usage, development, tooling etc.

ClojureCLR-specific announcements will be the new list.




ClojureJVM and general Clojure questions/discussions still go on his group. 
 

-- 
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: Working with big datasets, merging two ordered lists by key

2014-03-10 Thread Timothy Washington
Hey Frank,

Right. So I tried this loop / recur, and it runs, giving a result of *([4
nil] [3 3] [2 nil] [1 1])*. But I'm not sure how that's going to help you
(although not discounting the possibility).

You can simultaneously iterate through pairs of lists, to compare values.
However you cannot guarantee that those lists will be *i)* ordered, and
*ii)* the same length. Both those conditions are required for your
algorithm to work. Plus, what you suggest still means that you'll have to
scan through the entire space of both results. So we're not going to avoid
that.

Based on your requirements, I still see my original *for* comprehension as
the most straightforward way to solve the problem. My second suggested
algorithm could also work. But I could be wrong and am always learning too.
So trying different solutions is a good habit to keep.


Hth

Tim Washington
Interruptsoftware.com 


On Mon, Mar 10, 2014 at 4:53 AM, Frank Behrens  wrote:

> Hey, just to share, I came up with this code, which seem quite ok to me,
> Feels like I already understand something, do i,
> Have a nice day, Frank
>
> (loop
>   [a '(1 2 3 4)
>b '(1 3)
>out ()]
>   (cond
> (and (empty? a)(empty? b)) out
> (empty? a) (recur a (rest b) (conj out [nil (first
> b)]))
> (empty? b) (recur (rest a)  b (conj out [(first a)
> nil]))
> :else (let
> [fa   (first a)
>  fb   (first b)
>  cmp  (compare fa fb)]
> (cond
> (= 0 cmp) (recur (rest a) (rest b) (conj out [fa fb]))
> (> 0 cmp) (recur (rest a)  b   (conj out [fa nil]))
> :else (recur  a   (rest b) (conj out [nil fb]))
>
>
> Am Montag, 10. März 2014 09:26:14 UTC+1 schrieb Frank Behrens:
>
>> Thanks for your suggestions.
>> a for loop has to do  100.000 * 300.000 compares
>> Storing the database table into a 300.000 element hash, would be a memory
>> penalty I want to avoid.
>>
>> I'm quite shure that assential part of the solution is a function to
>> iterate through both list at once,
>> spitting out pairs of values according to compare
>>
>> (merge-sortedlists
>>   '(1 2 3)
>>   '(   24))
>> => ([1 nil] [2 2] [3 nil] [nil 4])
>>
>> Seems quite doable.
>> Try to implement now.
>>
>> Frank
>>
>>

-- 
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: I'm trying to make proper urls, but I seem to be failing at it.

2014-03-10 Thread David Toomey
You should be able to write:

(GET "/:profile-page" [profile-page] ...)

Compojure (via Clout) automatically decodes parameters in the URL, so there 
shouldn't be any need to decode the data any further.

Heh, I would have thought something was baked in, but I still get urls with 
nothing filling in the blank-space. 

I'm concerned about XXS, but I'm also irritated because the urls look like 
a drooling idiot created my project. I guess the only option is to disallow 
blank spaces in the user names, but this is pretty disappointing. 

Thanks;
David

-- 
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: 1.6.0-beta2 / sumatra / graal / okra / hsa / gpgpu

2014-03-10 Thread kovas boguta
This is pretty cool. Keep us updated!

On Sun, Mar 9, 2014 at 5:42 PM, Jules  wrote:
> Well - not sure about interest levels :-) but I am soldiering on.
>
> I've tidied up and checked in the code I mentioned and some more stuff that
> I am playing with.
>
> If you are running Fedora 20 x86_64 then you are only a few lines of
> cut-n-paste away from being able to build yourself a working graal-enabled
> jdk8.
>
> Here is the project - Clumatra !
>
> https://github.com/JulesGosnell/clumatra
>
> please get in touch if you're interested.
>
>
> Jules
>
> --
> 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.

-- 
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: I'm trying to make proper urls, but I seem to be failing at it.

2014-03-10 Thread Jarrod Swart
This has become super confusing to follow, possibly because you have the 
wrong expectation of compojure?

Compojure is not specificy how your routes will look, it is responding to 
whatever URLs you put in place.

In the case of:

(GET "/:profile-page" [profile-page] ...)

:profile-page in the route string, becomes profile-page the variable.

So if you make the link: "http://myapp.com/some user" then profile-page 
will be "some user".

If you make the link: "http://myapp.com/SomeUser"; then profile-page will be 
"SomeUser".  The route is simply capturing whatever is sent, not specifying 
or creating anything.  Once you have profile-page you can then modify it as 
you see fit.

When you create the links in your app's template you will specify what URL 
is called, that is when you decide how to display the user's profile name 
in the URL.  

I recommend not having a space, take a look at google+ where my username is 
"Jarrod Swart" but my profile url is: plus.google.com/+JarrodSwart

Hopefully this helps, or perhaps I misread the thread.

-- 
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: Working with big datasets, merging two ordered lists by key

2014-03-10 Thread Leif

Re. Tim's points below:

*i)* The seqs have to be ordered, or one of them has to be loaded fully 
into memory; I don't think there's any way around that.

*ii)* Frank's solution does *not* require the seqs to be the same length, 
and it gives you the complete 'diff' of the seqs (aka outer join), which 
could be handy.  The one snag I see is that it is eager, not lazy, so it's 
going to put the answer completely in memory.  So unless you are projecting 
out a small subset of the fields from each record, you will probably end up 
using as much memory as the other solutions.  I wrote a lazy version using 
'iterate', but I'm not sure it doesn't keep both entire seqs in memory, too.

My two cents:

1. If you have enough memory, go with Moritz' suggestion to read the 
smaller seq into a map.  Then you can do a simple for comprehension and 
arrange it so that the second, larger seq will never be completely in 
memory.
2. Another possible solution is to load the textfile into a temp table in 
your database.  Then the solution is one simple SQL query, backed by 
hyper-optimized code designed to deal with this exact problem.
3. You may want to try the naive approach: 400k records sounds like it 
could very well fit into memory, as long as each record doesn't have a huge 
amount of data.
4. A library that has tools to deal with big files: 
https://github.com/kyleburton/clj-etl-utils

--Leif

On Monday, March 10, 2014 11:01:07 PM UTC-4, frye wrote:
>
> Hey Frank, 
>
> Right. So I tried this loop / recur, and it runs, giving a result of *([4 
> nil] [3 3] [2 nil] [1 1])*. But I'm not sure how that's going to help you 
> (although not discounting the possibility). 
>
> You can simultaneously iterate through pairs of lists, to compare values. 
> However you cannot guarantee that those lists will be *i)* ordered, and 
> *ii)* the same length. Both those conditions are required for your 
> algorithm to work. Plus, what you suggest still means that you'll have to 
> scan through the entire space of both results. So we're not going to avoid 
> that. 
>
> Based on your requirements, I still see my original *for* comprehension 
> as the most straightforward way to solve the problem. My second suggested 
> algorithm could also work. But I could be wrong and am always learning too. 
> So trying different solutions is a good habit to keep. 
>
>
> Hth 
>
> Tim Washington 
> Interruptsoftware.com  
>
>  
> On Mon, Mar 10, 2014 at 4:53 AM, Frank Behrens 
> > wrote:
>
>> Hey, just to share, I came up with this code, which seem quite ok to me,
>> Feels like I already understand something, do i,
>> Have a nice day, Frank
>>
>> (loop
>>   [a '(1 2 3 4)
>>b '(1 3)
>>out ()]
>>   (cond 
>> (and (empty? a)(empty? b)) out
>> (empty? a) (recur a (rest b) (conj out [nil (first 
>> b)]))   
>> (empty? b) (recur (rest a)  b (conj out [(first a) 
>> nil]))
>> :else (let
>> [fa   (first a)
>>  fb   (first b)
>>  cmp  (compare fa fb)]
>> (cond 
>> (= 0 cmp) (recur (rest a) (rest b) (conj out [fa fb]))
>> (> 0 cmp) (recur (rest a)  b   (conj out [fa nil]))
>> :else (recur  a   (rest b) (conj out [nil 
>> fb]))
>>
>>
>> Am Montag, 10. März 2014 09:26:14 UTC+1 schrieb Frank Behrens:
>>
>>> Thanks for your suggestions. 
>>> a for loop has to do  100.000 * 300.000 compares
>>> Storing the database table into a 300.000 element hash, would be a 
>>> memory penalty I want to avoid.
>>>
>>> I'm quite shure that assential part of the solution is a function to 
>>> iterate through both list at once,
>>> spitting out pairs of values according to compare
>>>
>>> (merge-sortedlists 
>>>   '(1 2 3)
>>>   '(   24))
>>> => ([1 nil] [2 2] [3 nil] [nil 4])
>>>
>>> Seems quite doable.
>>> Try to implement now.
>>>
>>> Frank
>>>
>>> 

-- 
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: I'm trying to make proper urls, but I seem to be failing at it.

2014-03-10 Thread David Toomey


Fair enough. So if I want pretty urls, I have to have an extra column in my 
database then. This is one compromise, but I was hoping for something a 
little more programmatic. 

As a counter to G+, StackOverflow alters the name to lower-case and add a 
'-', so that M User becomes www./m-user.



On Monday, March 10, 2014 9:21:13 PM UTC-7, Jarrod Swart wrote:
>
> This has become super confusing to follow, possibly because you have the 
> wrong expectation of compojure?
>
> Compojure is not specificy how your routes will look, it is responding to 
> whatever URLs you put in place.
>
> In the case of:
>
> (GET "/:profile-page" [profile-page] ...)
>
> :profile-page in the route string, becomes profile-page the variable.
>
> So if you make the link: "http://myapp.com/some user" then profile-page 
> will be "some user".
>
> If you make the link: "http://myapp.com/SomeUser"; then profile-page will 
> be "SomeUser".  The route is simply capturing whatever is sent, not 
> specifying or creating anything.  Once you have profile-page you can then 
> modify it as you see fit.
>
> When you create the links in your app's template you will specify what URL 
> is called, that is when you decide how to display the user's profile name 
> in the URL.  
>
> I recommend not having a space, take a look at google+ where my username 
> is "Jarrod Swart" but my profile url is: plus.google.com/+JarrodSwart
>
> Hopefully this helps, or perhaps I misread the thread.
>

-- 
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: I'm trying to make proper urls, but I seem to be failing at it.

2014-03-10 Thread Jarrod Swart
Right, either way the compojure route would be the same.  (GET 
"/:profile-name" [profile-name] ...).  

You don't need an extra column in your DB unless you want to do so.

The route/compojure is simply responding to the URL you write out in your 
template, or that is requested by some other mechanism.

The change would be in your template, where you decide how to write out 
those URLs.

(defn make-profile-url [username]
  (let [safe-name (clojure.string/replace username #" " "-")]
(str "/" safe-name)))
;; (make-profile-url "John Smith") => "John-Smith"

or

(defn make-profile-url [username]
  (let [safe-name (clojure.string/replace username #" " "")]
(str "/" safe-name)))
;; (make-profile-url "John Smith") => "/JohnSmith"

You can do whatever you like best.

Compojure is at the end, receiving the request.  In order for anything to 
happen you need to actually put an anchor on your template any way you 
want, then write the compojure routes to receive 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: I'm trying to make proper urls, but I seem to be failing at it.

2014-03-10 Thread Jarrod Swart
No edit button so I have to post again, that first example should end with 
";; (make-profile-url "John Smith") => "/John-Smith"

And to reiterate you decide what your url will look like in your template:

http://myapp.com/JohnSmith";>View John Smith's Profile
or
http://myapp.com/John-Smith";>View John Smith's Profile
or
http://myapp.com/john-smith";>View John Smith's Profile

Then compojure + your route handler respond to the browser requesting the 
link:

;; obviously this is ALL just psedo code of the important elements to give 
you an idea
(GET "/:username" [username] (view-profile-page username)) ;; this route 
definition will handle any of the above links

;; assume you chose the last link type, in stack-overflow style. this means 
username from the route is "john-smith"
(defn view-profile-page [username]
  (let [user (db/get-user-by-username username)]
(render-template user)))

(defn get-user-by-username [username]
  (let [no-dash (clojure.string/replace username #"-" " ") ;; munge 
username to match what is in DB
 capitalized (capitalize-words no-dash)]
(select-user-by-name capitalized)))

So as you can see whatever link or browser request is called, compojure 
grabs that url param and passes it in.  You then modify that param to fit 
what you expect and look it up in your DB.  You were essentially working 
backwards I think.

Hope that helps!

-- 
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.


Good quick reference screencasts

2014-03-10 Thread The Dude (Abides)
Found a good set of screencasts as quick references for functions, 
namespaces, collections, destructuring, sequences and conditional flow. 
Quick 1 to 2 min screencasts on each:

http://www.pluralsight.com/training/Courses/TableOfContents/clojure-fundamentals-part-one

And the more advanced for concurrency:

http://www.pluralsight.com/training/Courses/TableOfContents/clojure-concurrency-tutorial

The other really good resource I found so far as a beginner is:

http://www.braveclojure.com/

And of course clojure-docs, the clojure cheat sheet and the doc function in 
the repl. 

-- 
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.


ANN Langohr 2.7.1 is released

2014-03-10 Thread Michael Klishin
Langohr [1] is a small, feature complete Clojure client for RabbitMQ.

Release notes:
http://blog.clojurewerkz.org/blog/2014/03/11/langohr-2-dot-7-1-is-released/

1. http://clojurerabbitmq.info
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
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: [ANN] 1st public release of thi.ng geometry toolkit (CLJ & CLJS)

2014-03-10 Thread Kuba Roth
Hey, Karsten great stuff and congrats! 

I haven't been following toxic closely for quite some time, sadly but does that 
mean it's been discontinued completely and you are working in clojure full 
time? :)

What's your impression on working with big code base as above library in 
clojure vs java? Does clojure scales well? I'm particularly interested in 
functional vs OO approach and If any performance critical stuff was done in 
java? If you could share some thoughts would be great. 

Thanks,
Kuba

-- 
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.