Re: Simple Neural Network DSL -- request for feedback

2010-11-10 Thread Saul Hazledine
On Nov 10, 11:20 pm, "Eric Schulte" wrote: > Hi, > > Inspired by cgrand's regexp example [1], I've implemented a simple DSL > for specifying neural networks using Clojure data types.   This is really clear. The web page documentation is awesome. > Construction of this simple language involved a

Re: clojure.core function decision tree

2010-11-10 Thread David Nolen
On Wed, Nov 10, 2010 at 11:12 PM, Miki wrote: > > How many methods, total, are in the java.lang classes, I wonder? Or > > functions in the C standard library, or the C++ STL. > It doesn't mean it's a good thing :) > > IMO there's another problem with many function in the core namespace - > it bec

Re: clojure.core function decision tree

2010-11-10 Thread Miki
> How many methods, total, are in the java.lang classes, I wonder? Or > functions in the C standard library, or the C++ STL. It doesn't mean it's a good thing :) IMO there's another problem with many function in the core namespace - it becomes harder and harder to find good names for user function

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Sean Corfield
On Wed, Nov 10, 2010 at 11:37 AM, Gary Poster wrote: > In my opinion, its promise is that it reverses anything that supports the > minimal seq interface.  Its implementation can be pluggable via protocols Hmm, don't protocols have some overhead? Switching an implementation from a direct, possibl

Re: Find all ties in a sorted list

2010-11-10 Thread David Jacobs
Thanks for all of the options, and Ken, thanks for the detailed comparison. This will be extremely useful. (I'm trying to port some statistical tests to Clojure for work.) Best, David On 10 Nov 2010, at 5:13 pm, Alan wrote: > Juha's is my favorite by a mile. And if you're content with a list o

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Michael Gardner
On Nov 10, 2010, at 5:48 PM, Alan wrote: > I guess you stay backwards-compatible by putting it in the docstring, > but isn't it more general, clean, and programmatic to put these useful > bits of information into new entries in (meta f)? That's pretty much what I was trying to get at with "struct

Mobile Clojure

2010-11-10 Thread Glen Rubin
Are there any mobile platforms that clojure runs well on? I saw that clojure is available for Android, but runs very slowly. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Alan
I guess you stay backwards-compatible by putting it in the docstring, but isn't it more general, clean, and programmatic to put these useful bits of information into new entries in (meta f)? On Nov 10, 3:14 pm, Carson wrote: > > But perhaps it should be more clear. What if there were some additio

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Carson
> But perhaps it should be more clear. What if there were some additional > structured fields for each doc entry, like "performance guarantees" and "see > also"? That's a good idea. I've found "See Also" sections useful in man pages, for example. And if performance guarantees are part of the s

Re: Simple Neural Network DSL -- request for feedback

2010-11-10 Thread Greg
Awesome! Thanks for sharing! :-) On Nov 10, 2010, at 2:20 PM, Eric Schulte wrote: > Hi, > > Inspired by cgrand's regexp example [1], I've implemented a simple DSL > for specifying neural networks using Clojure data types. The code is > available in this gist [2], and a brief introduction with s

Re: Simple Neural Network DSL -- request for feedback

2010-11-10 Thread Sean Grove
Very elegant. From the example, it looks like it takes away a great deal of the tedium of neural networks. Do you have any more significant code examples than those listed on [3]? Sean On Nov 10, 2010, at 2:20 PM, Eric Schulte wrote: > Hi, > > Inspired by cgrand's regexp example [1], I've imp

Simple Neural Network DSL -- request for feedback

2010-11-10 Thread Eric Schulte
Hi, Inspired by cgrand's regexp example [1], I've implemented a simple DSL for specifying neural networks using Clojure data types. The code is available in this gist [2], and a brief introduction with some usage examples is up at [3]. Construction of this simple language involved a number of ch

Re: Find all ties in a sorted list

2010-11-10 Thread Alan
Juha's is my favorite by a mile. And if you're content with a list of [element, count] pairs, you could do this: (defn seq-ties [coll] (->> coll (partition-by identity) (filter next) (map (juxt first count))) (seq-ties [1 1 1 1 2 3 3 4 5 7 7]) ;==>([1 4] [3 2] [7 2]) On Nov 10, 1:27 pm, Juha A

Re: Find all ties in a sorted list

2010-11-10 Thread Juha Arpiainen
On Nov 10, 10:28 pm, David Jacobs wrote: > I have a sorted list, and I'd like to derive from that a list > containing all "ties" in the original. One more solution assuming input is sorted: (defn seq-ties [coll] (mapcat #(cons (first %) %) (keep next (partition-by identity coll -- Juha Ar

Re: Find all ties in a sorted list

2010-11-10 Thread Ken Wesson
On Wed, Nov 10, 2010 at 4:01 PM, Ken Wesson wrote: > Oh, and another difference: the frequencies implementation handles nil > in the input. The fully-lazy one also does. The loop/recur will screw > up if the input starts with nil. Changing the literal nil in the loop > initial bindings to (Object.

Re: Find all ties in a sorted list

2010-11-10 Thread Ken Wesson
Oh, and another difference: the frequencies implementation handles nil in the input. The fully-lazy one also does. The loop/recur will screw up if the input starts with nil. Changing the literal nil in the loop initial bindings to (Object.) will fix it though. -- You received this message because

Re: Find all ties in a sorted list

2010-11-10 Thread David Jacobs
Wow, thanks for the quick replies, guys :) I can't decide which one I like best. On Nov 10, 3:40 pm, Ken Wesson wrote: > And > > (let [x (map #(if (= %1 %2) [%1]) s (rest s))] >   (mapcat #(if (nil? %1) %2 %1) x (concat (rest x) [nil]))) > > does it lazily. :) -- You received this message becau

Re: Find all ties in a sorted list

2010-11-10 Thread Ken Wesson
user=> (defn foo [the-input-seq] (loop [s the-input-seq o [] last nil] (if (empty? s) o (let [n (first s)] (if (or (= n (second s)) (= n last)) (recur (rest s) (conj o n) n) (recur (rest s) o n)) #'user/foo user=> (defn bar [coll] (let [freqs (frequencies coll)] (f

Re: Find all ties in a sorted list

2010-11-10 Thread Meikel Brandmeyer
HI, Am 10.11.2010 um 21:28 schrieb David Jacobs: > That is, if I have (1 2 3 4 4 5 5 5 5 5 6 9 12 12), I want to get back > the sequence (4 4 5 5 5 5 5 12 12). Low-level solution using lazy-seq. As lazy as possible: (defn ties [coll] (let [step (fn step [seen s] (lazy-seq

Re: "Parameterized" SQL queries?

2010-11-10 Thread Daniel Bell
This is awesome, guys. Clear and helpful. Thanks a ton. And Sean, I actually already know how with-query-results worked...from studying the example on your blog. Thanks again! ---Daniel On Nov 10, 11:07 am, Saul Hazledine wrote: > On Nov 10, 6:35 pm, Daniel Bell wrote: > > > I'm a newb to b

Re: Find all ties in a sorted list

2010-11-10 Thread Ken Wesson
And (let [x (map #(if (= %1 %2) [%1]) s (rest s))] (mapcat #(if (nil? %1) %2 %1) x (concat (rest x) [nil]))) does it lazily. :) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that

Re: Find all ties in a sorted list

2010-11-10 Thread Benny Tsai
I don't know about a standard solution, but my take is that you can use the built-in 'frequencies' function to build up a frequency table for the list, then filter on anything that occurs more than once: (defn get-ties [coll] (let [freqs (frequencies coll)] (filter #(> (freqs %) 1) coll)))

Re: Find all ties in a sorted list

2010-11-10 Thread Ken Wesson
On Wed, Nov 10, 2010 at 3:28 PM, David Jacobs wrote: > I have a sorted list, and I'd like to derive from that a list > containing all "ties" in the original. > > That is, if I have (1 2 3 4 4 5 5 5 5 5 6 9 12 12), I want to get back > the sequence (4 4 5 5 5 5 5 12 12). > > My first thought was to

Re: Being "not Lisp" is a feature?

2010-11-10 Thread lprefontaine
Sometimes a bit of acid in a joke improves it... I`ll be there next year certainly :)) Baishampayan Ghose wrote .. > Luc, > > > Gosu -> standard athlete on performance enhancing drugs (EPO, steroids, ...) > > Clojure -> genetically modified athlete > > > > A big generation gap, comparison stops

Find all ties in a sorted list

2010-11-10 Thread David Jacobs
I have a sorted list, and I'd like to derive from that a list containing all "ties" in the original. That is, if I have (1 2 3 4 4 5 5 5 5 5 6 9 12 12), I want to get back the sequence (4 4 5 5 5 5 5 12 12). My first thought was to try to filter down the list, but filter takes each element of a l

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Gary Poster
On Nov 10, 2010, at 1:38 PM, Meikel Brandmeyer wrote: > Hi, > > Am 10.11.2010 um 17:37 schrieb Gary Poster: > >> But that's exactly my point. Why should developers have to remember to use >> rseq on a vector, as the first example? Why can't reverse simply be part of >> a protocol, so that i

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Michael Gardner
On Nov 10, 2010, at 12:40 PM, Michael Gardner wrote: > The docstring for reverse does say "not lazy", which implies at least O(n). In the general case, that is. As Meikel mentioned, reverse works on any seq, so this is the best guarantee it can provide in general. -- You received this message

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Michael Gardner
On Nov 10, 2010, at 11:36 AM, Carson wrote: >> rseq O(1), reverse O(n). >> peek O(1), last O(n). >> pop O(1), butlast O(n). >> get O(1), nth O(n). > > I don't see that in the documentation... If these functions aren't > "collapsed", then it's better if at least (doc reverse) says something > abo

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Meikel Brandmeyer
Hi, Am 10.11.2010 um 17:37 schrieb Gary Poster: > But that's exactly my point. Why should developers have to remember to use > rseq on a vector, as the first example? Why can't reverse simply be part of > a protocol, so that it gives O(1) when it can? Is there *any* practical > value to hav

Re: "Parameterized" SQL queries?

2010-11-10 Thread Saul Hazledine
On Nov 10, 6:35 pm, Daniel Bell wrote: > I'm a newb to both SQL and Clojure, and after reading this post > (http://groups.google.com/group/clojure/browse_thread/thread/718fa1b72... > ) I was curious as to exactly it means to parameterize a query. Is it > a way to automatically insert arguments int

Re: "Parameterized" SQL queries?

2010-11-10 Thread Sean Corfield
On Wed, Nov 10, 2010 at 9:35 AM, Daniel Bell wrote: > > I'm a newb to both SQL and Clojure, and after reading this post > ( > http://groups.google.com/group/clojure/browse_thread/thread/718fa1b725389639/4c4d7ed1492e082b?lnk=gst&q=sql+parameterized#4c4d7ed1492e082b > ) I was curious as to exactly

Re: "Parameterized" SQL queries?

2010-11-10 Thread Dave Newton
On Wed, Nov 10, 2010 at 12:35 PM, Daniel Bell wrote: > I was curious as to exactly it means to parameterize a query. Is it > a way to automatically insert arguments into the query, a way to > destructure the results, or what? The first of those, including SQL-quoting etc. Most JDBC tutorials will

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Carson
> rseq O(1), reverse O(n). > peek O(1), last O(n). > pop O(1), butlast O(n). > get O(1), nth O(n). I don't see that in the documentation... If these functions aren't "collapsed", then it's better if at least (doc reverse) says something about O(n) and "see rseq". Carson On Nov 10, 8:16 am, Meik

"Parameterized" SQL queries?

2010-11-10 Thread Daniel Bell
I'm a newb to both SQL and Clojure, and after reading this post ( http://groups.google.com/group/clojure/browse_thread/thread/718fa1b725389639/4c4d7ed1492e082b?lnk=gst&q=sql+parameterized#4c4d7ed1492e082b ) I was curious as to exactly it means to parameterize a query. Is it a way to automatically

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Ryan Waters
Not to veer a hijack, but a 'popular' or common functions group could be useful for people learning clojure. It could be assembled by taking the number of occurrences in a set of code or by being hand-picked by people-who-should-know. Everyone who uses clojure should have an idea of everything tha

Re: Python is way faster than Clojure on this task

2010-11-10 Thread Leif Walsh
I am reminded of an arcane implementation... http://lists.freebsd.org/pipermail/freebsd-current/2010-August/019310.html On Wed, Nov 10, 2010 at 8:06 AM, pepijn (aka fliebel) wrote: > I almost forgot about this. I talked to mfex on IRC, and he came up > with the winning solution. > http://clojure-

Re: Python is way faster than Clojure on this task

2010-11-10 Thread pepijn (aka fliebel)
ouch didn't noticed the second page. On Nov 10, 2:06 pm, "pepijn (aka fliebel)" wrote: > I almost forgot about this. I talked to mfex on IRC, and he came up > with the winning > solution.http://clojure-log.n01se.net/date/2010-11-07.html#11:32 > > https://gist.github.com/666228 > > Basically it c

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Gary Poster
On Nov 10, 2010, at 11:16 AM, Meikel Brandmeyer wrote: > Hi, > > On 10 Nov., 17:09, Gary Poster wrote: > >> I believe that the cost of having developers remember both rseq and reverse >> (why can't reverse just DTRT if it is given a vector?), last and peek >> (same), butlast and pop (same),

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Meikel Brandmeyer
Hi, On 10 Nov., 17:09, Gary Poster wrote: > I believe that the cost of having developers remember both rseq and reverse > (why can't reverse just DTRT if it is given a vector?), last and peek (same), > butlast and pop (same), and nth and get (same) is unnecessarily high. Ehm. No. rseq O(1),

Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Gary Poster
On Nov 10, 2010, at 6:59 AM, Pepijn de Vos wrote: > Hi all, > > It occurred to me that Clojure has a huge core namespace. While OO languages > like Python and Java stuff functions into modules and objects and have a core > of a few dozen functions, Clojure's core contains everything you might

Re: refactoring

2010-11-10 Thread Laurent PETIT
2010/11/10 Zmitro Lapcjonak > On Nov 9, 10:46 pm, Laurent PETIT wrote: > > Yes, tcrayford's clojure-refactoring project: > https://github.com/tcrayford/clojure-refactoring > > How about using this in your CCW? :) > Mind you, it's already on the todo list :-) -- You received this message becau

Re: refactoring

2010-11-10 Thread Zmitro Lapcjonak
On Nov 9, 10:46 pm, Laurent PETIT wrote: > Yes, tcrayford's clojure-refactoring > project:https://github.com/tcrayford/clojure-refactoring How about using this in your CCW? :) -- Zmi La -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to th

Re: clojure.core function decision tree

2010-11-10 Thread Benny Tsai
On Nov 10, 7:59 am, Ken Wesson wrote: > > An interesting idea, though I'm not sure it buys much over apropos, > doc, and the "cheat sheet" at the main website. In addition to those, I find the ClojureDocs quick reference really useful too: http://clojuredocs.org/quickref/Clojure%20Core -- You

Re: clojure.core function decision tree

2010-11-10 Thread Ken Wesson
On Wed, Nov 10, 2010 at 6:59 AM, Pepijn de Vos wrote: > Hi all, > > It occurred to me that Clojure has a huge core namespace. While OO languages > like Python and Java stuff functions into modules and objects and have a core > of a few dozen functions, Clojure's core contains everything you migh

clojure.core function decision tree

2010-11-10 Thread Pepijn de Vos
Hi all, It occurred to me that Clojure has a huge core namespace. While OO languages like Python and Java stuff functions into modules and objects and have a core of a few dozen functions, Clojure's core contains everything you might need for most tasks, but has over 400 functions in core, with

Re: Python is way faster than Clojure on this task

2010-11-10 Thread pepijn (aka fliebel)
I almost forgot about this. I talked to mfex on IRC, and he came up with the winning solution. http://clojure-log.n01se.net/date/2010-11-07.html#11:32 https://gist.github.com/666228 Basically it comes down to *not* doing work, rather than doing it fast. What the Python version does - and this ve

Re: parrot vm

2010-11-10 Thread Shantanu Kumar
Seems it was lost among other posts. I would also like to know if there's any effort by somebody to port Clojure to the Parrot VM. Looks like Parrot 3.x is going to be quite interesting with Lorito: http://whiteknight.github.com/2010/11/04/parrot_of_the_future.html http://reparrot.blogspot.com/ R