mysql record field formats

2012-01-10 Thread jayvandal
I 'm having trouble with adding to this table I cand drop the table, create table but can't add this data What is the format error? Thanks for help! (defn create-fruit [] (sql/with-connection db (sql/create-table :fruit [:name "varchar(25)"] [:appearance "varchar(25)"] [:cost "integer

Re: 4Clojure exersice question

2012-01-10 Thread Baishampayan Ghose
Try using map instead - (fn [s] (reduce + (map (fn [_] 1) s))) Or even better - (fn [s] (reduce (fn [x _] (inc x)) 0 s)) Regards, BG On Tue, Jan 10, 2012 at 11:33 PM, Erlis Vidal wrote: > Hi, > > I'm solving the following exercise and when I'm trying to use the answer: > > #(reduce + (for [x

Re: Good database for local storage in Clojure

2012-01-10 Thread Shantanu Kumar
> Which database would be easiest to work with in Clojure for local > storage? There are several local storage databases that you can choose from: Derby, HSQL, H2, SQLite, Axion, Mckoi, Firebird etc. I tend to prefer H2 in general personally. Some of these databases support both in- memory (volati

Re: Good database for local storage in Clojure

2012-01-10 Thread Sean Corfield
On Tue, Jan 10, 2012 at 7:24 PM, jk wrote: > HSQLDB (http://hsqldb.org/) and Derby (http://db.apache.org/derby/) > are both fairly popular databases that are small enough to embed right > in your program. Your data is tiny. You might not even need a database > at all but in any case, these are sma

Re: Good database for local storage in Clojure

2012-01-10 Thread jk
HSQLDB (http://hsqldb.org/) and Derby (http://db.apache.org/derby/) are both fairly popular databases that are small enough to embed right in your program. Your data is tiny. You might not even need a database at all but in any case, these are small and easy to use with Java or Clojure. On Jan 10,

Re: Use You a Spaced Repetition System for Great Good!

2012-01-10 Thread daly
On Tue, 2012-01-10 at 10:24 -0800, Kai wrote: > Hi Tim, > > > I found your post very compelling in the questions, analogies, and > possibilities raised - something like a "Clojure Etudes" is really > needed to move beyond learning just the syntax and general concepts, > and into the next level of

Re: Disequality

2012-01-10 Thread David Nolen
On Sat, Jan 7, 2012 at 11:20 PM, jim wrote: > Hey David, > > From the readme the failing disequality example: > > (run* [q] > (fresh [x y] >(!= [x 2] [1 y]) >(== x 1) >(== y 2) >(== q [x y]))) > > gives me ([1 2]) > I just checked this. This fails for me. David -- You receive

Re: core.logic constraint satisfaction

2012-01-10 Thread David Nolen
On Tue, Jan 10, 2012 at 10:51 AM, GHZ wrote: > I have the following problem to solve, and before I try and tackle it > the long way around, I wondered this was a problem that fits inside > the domain of problems to be handled by core.logic (of which I hear a > lot about recently) > Seems ideally

Re: 4Clojure exersice question

2012-01-10 Thread Jack Moffitt
> > I'm solving the following exercise and when I'm trying to use the answer: >> >> #(reduce + (for [x coll] 1)) >> >> I get the error saying that I was using "count" which I'm not. Someone >> knows why is that? Is this a bug in 4Clojure or something in the language >> that I cannot see? >> >> If o

Re: string to S-value

2012-01-10 Thread Armando Blancas
user=> (first (read-string x)) a On Jan 10, 12:36 pm, Bartek wrote: > hello everyone, > > It's true that: > > (first '(a b)) > is: > a > > And now I have: > > (def x "(a b)") > > How can I use 'x' as S-expression like in the example above? > > (first (>>some-functions<< x)) > and should give: > a

Re: Struggling in making a sub-process work in an interactive way

2012-01-10 Thread jaime
I didn't read your code carefully yet but I think you're meaning to copy streams between my Clojure code and the sub-process, actually I've tried this but this is probably not what I want. I might not make myself clear. So here I go again: 1. I writing a program which will open an OS shell (that

Re: Invoking varargs Java methods

2012-01-10 Thread Aaron Cohen
On Tue, Jan 10, 2012 at 5:46 PM, Norman Gray wrote: > > Greetings. > > I've run into a situation which (I think) is the Clojure analogue of > , > and I'm not sure how to apply the solution there to Clojure (I'm

Re: string to S-value

2012-01-10 Thread Jay Fields
read-string+eval or load-string should do the trick. http://blog.jayfields.com/2011/03/clojure-eval-ing-string-in-clojure.html Cheers, Jay Sent from my iPad On Jan 10, 2012, at 3:36 PM, Bartek wrote: > hello everyone, > > It's true that: > > (first '(a b)) > is: > a > > And now I have: >

Re: Threading macro with support for conditionals

2012-01-10 Thread Miikka Miettinen
Thanks, I'll take a look at pallet. And thanks also to Tassilo for the suggestion to use anonymous functions. --Miikka On Jan 10, 2012, at 4:36 PM, Sam Ritchie wrote: > Mikka, > > The pallet/thread-expr library has the macros you're looking for: > > https://github.com/pallet/thread-expr > >

Re: 4Clojure exersice question

2012-01-10 Thread Erlis Vidal
I did an small mistake in the previous email but it's irrelevant I get the same result. the function should be #(reduce + (for [x %] 1)) Thanks, Erlis On Tue, Jan 10, 2012 at 1:03 PM, Erlis Vidal wrote: > Hi, > > I'm solving the following exercise and when I'm trying to use the answer: > > #(

Re: Need help to translate a simple java program into Clojure program

2012-01-10 Thread Nicolas Garcin
Hi, Finally I managed to write my program, see below. It is probably not optimized at all (I had some issues with vector concatenation..) but at least it does the same as my java program. Thanks again! Regards, Nicolas (defrecord Pos [name value]   Object   (toString [this]         (str ""))) (d

4Clojure exersice question

2012-01-10 Thread Erlis Vidal
Hi, I'm solving the following exercise and when I'm trying to use the answer: #(reduce + (for [x coll] 1)) I get the error saying that I was using "count" which I'm not. Someone knows why is that? Is this a bug in 4Clojure or something in the language that I cannot see? Thanks Erlis [image: im

core.logic constraint satisfaction

2012-01-10 Thread GHZ
I have the following problem to solve, and before I try and tackle it the long way around, I wondered this was a problem that fits inside the domain of problems to be handled by core.logic (of which I hear a lot about recently) Take a shop selling ice cream of the following flavors: Vanilla, Stra

Re: Use You a Spaced Repetition System for Great Good!

2012-01-10 Thread Kai
Hi Tim, I found your post very compelling in the questions, analogies, and possibilities raised - something like a "Clojure Etudes" is really needed to move beyond learning just the syntax and general concepts, and into the next level of skill with Clojure - or any other language. Perhaps that

string to S-value

2012-01-10 Thread Bartek
hello everyone, It's true that: (first '(a b)) is: a And now I have: (def x "(a b)") How can I use 'x' as S-expression like in the example above? (first (>>some-functions<< x)) and should give: a again. What should I put in 'some-functions' place? regards, Bartek -- You received this mess

Invoking varargs Java methods

2012-01-10 Thread Norman Gray
Greetings. I've run into a situation which (I think) is the Clojure analogue of , and I'm not sure how to apply the solution there to Clojure (I'm a Clojure beginner, though familiar with Java and with variou

Good database for local storage in Clojure

2012-01-10 Thread Adam Markham
I am looking for a database which I can use to store data about certain stock over a number of years. There will probably be a few thousand records to store. I am writing an application in Clojure and Java, but mostly Clojure, which will pull out data from this local database when required to displ

Re: I don't understand how to instantiate a closure library object

2012-01-10 Thread Alan Malloy
On Jan 10, 3:07 pm, Praki Prakash wrote: > On Tue, Jan 10, 2012 at 2:22 PM, billh2233 wrote: > > I'm trying to instantiate a new goog.fx/Animate object, but the > > constructor doesn't return anything: > > >  (:require [goog.fx :as fx]) > >  (let [anim (fx/Animation (array 22 33) (array 44 55) 10

Re: I don't understand how to instantiate a closure library object

2012-01-10 Thread Praki Prakash
On Tue, Jan 10, 2012 at 2:22 PM, billh2233 wrote: > I'm trying to instantiate a new goog.fx/Animate object, but the > constructor doesn't return anything: > >  (:require [goog.fx :as fx]) >  (let [anim (fx/Animation (array 22 33) (array 44 55) 1000 nil)] >    "anim:>" # "    ... (let [anim (fx/An

I don't understand how to instantiate a closure library object

2012-01-10 Thread billh2233
I'm trying to instantiate a new goog.fx/Animate object, but the constructor doesn't return anything: (:require [goog.fx :as fx]) (let [anim (fx/Animation (array 22 33) (array 44 55) 1000 nil)] "anim:>" # "" # "http://groups.google.com/group/clojure?hl=en

Re: does symbol completion work after 2nd slime-compile-and-load-file ?

2012-01-10 Thread Andrew
or is M-x slime-compile-and-load-file the wrong command to use? -- 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

does symbol completion work after 2nd slime-compile-and-load-file ?

2012-01-10 Thread Andrew
If you do these steps, do you get a better result for #5? If so, what might be wrong with my setup? 1. in emacs shell, lein swank & 2. M-x slime-connect (I have to do these as two separate steps vs M-x clojure-jack-in because of my broken environment) 3. M-x slime-compile-and-load-fi

Re: array literal syntax

2012-01-10 Thread David Nolen
There is no array literal syntax yet, but (array 22 33) should work for you. On Tue, Jan 10, 2012 at 2:46 PM, billh2233 wrote: > How do I code an array literal in clojurescript that translates to an > array literal in javascript? What's the syntax? > > If I code in clojurescript: > ... [22 3

array literal syntax

2012-01-10 Thread billh2233
How do I code an array literal in clojurescript that translates to an array literal in javascript? What's the syntax? If I code in clojurescript: ... [22 33] ... it translates to a javascript vector: cljs.core.Vector.fromArray([22,33]) Javascript (fx/Animation) needs an array defining a

Re: Struggling in making a sub-process work in an interactive way

2012-01-10 Thread Ryan Waters
On Mon, Jan 9, 2012 at 11:20 PM, jaime wrote: > > now it works fine for NON-interactive command such as "dir" or "help", > but it will hang when I send the shell commands that require user > input, such as "time". I think the reason is that my code doesn't > detect any input requirement so the she

read support for defrecord instances in clojurescript

2012-01-10 Thread Praki
Is cljs/reader going to support reading defrecords? Also, is there a clojurescript library that can serialize and deserialize defrecord/ deftype? Thanks -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goog

Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-10 Thread Phil Hagelberg
Tassilo Horn writes: > I fixed the definition directly in the swank-clojure-1.3.4.jar and then > wanted to write a patch against clj-stacktrace's git master branch. As > it turns out, it's already fixed in there. Funnily, it was Phil himself > who committed that patch written by Michael van Ack

goog.debug.Logger from clojurescript or how to hide mutability with a functional approach

2012-01-10 Thread Ryan Waters
I'd like to use clojurescript to set up a gclosure logger (goog.debug.Logger) similar to the closure demo [1]. The slightly modified javascript for this is below. How should clojurescript insulate the programmer from the mutability issues? 1) log level mutates a LogManager object 2) a logconsole

Re: Struggling in making a sub-process work in an interactive way

2012-01-10 Thread Phil Hagelberg
Alan Malloy writes: > On Jan 9, 9:24 pm, Phil Hagelberg wrote: >> As far as I know this is impossible to do without bringing in >> third-party libraries; this is just a (rather serious) shortcoming of >> the JDK. I haven't looked into it enough to know which libraries would >> offer it though. >

Re: Enlive reborn in ClojureScript - Enfocus (Dom Manipulation Lib)

2012-01-10 Thread Sean Corfield
On Tue, Jan 10, 2012 at 4:35 AM, ckirkendall wrote: > Sean, you sort of help launched this idea.  It was while looking at > framework1's use of Enlive, at ClojureConj, that I began thinking > about how to use this on the client side. Thanx. For anyone interested, FW/1 is a minimal convention-over

Re: Threading macro with support for conditionals

2012-01-10 Thread Sam Ritchie
Mikka, The pallet/thread-expr library has the macros you're looking for: https://github.com/pallet/thread-expr These would allow you to write: (use 'pallet.thread-expr) (-> {} (status code) (content-type "application/json;charset=utf-8") (when-> (= error-type :unauthorized) (head

Re: Threading macro with support for conditionals

2012-01-10 Thread Tassilo Horn
Miikka Miettinen writes: Hi Miikka, > I sometimes find myself wanting to write simple conditional > expressions inside -> and ->>. For example, it would be nice to create > Ring responses like this: > > (-> {} > (status code) > (content-type "application/json;charset=utf-8") > (when

Re: java interop 'optional vararg' issue?

2012-01-10 Thread Tassilo Horn
bjconlan writes: > Thanks for your quick responses. I guess having clojure behave this > way is obvious and consistent (with having to explicitly fill in the > vararg). Java varargs parameters are only syntax sugar. class SomeClass { static int foo(String... x) {...} } becomes foo(String[

Re: ClojureScript – inter-namespace usage

2012-01-10 Thread Shantanu Kumar
On Jan 10, 2:16 am, David Nolen wrote: > binding works just fine in CLJS. That it doesn't work with required "vars" > sounds like a bug. I filed CLJS-121 for this: http://dev.clojure.org/jira/browse/CLJS-121 Shantanu -- You received this message because you are subscribed to the Google Group

Re: Trying to understand variable capture

2012-01-10 Thread TOMITA Hiroshi
(macroexpand) will help you. (macroexpand '(assert-true (< 4 3))) => (let* [lhsv__1__auto__ 4 rhsv__2__auto__ 3 ret__3__auto__ (< 4 3)] (clojure.core/if-not ret__3__auto__ (throw (java.lang.RuntimeException. (clojure.core/str (quote 4) " is not " (quote <) " " rhsv__2__auto__))) true)) This is wh

Re: Need help to translate a simple java program into Clojure program

2012-01-10 Thread Nicolas Garcin
Thanks a lot to all of you. Regards, Nicolas On 10 jan, 08:14, Brian Mosley wrote: > Oops. > A possible solution might look something like that... -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googleg

Threading macro with support for conditionals

2012-01-10 Thread Miikka Miettinen
Hi, I sometimes find myself wanting to write simple conditional expressions inside -> and ->>. For example, it would be nice to create Ring responses like this: (-> {} (status code) (content-type "application/json;charset=utf-8") (when (= error-type :unauthorized) (header "WWW-A

Re: java interop 'optional vararg' issue?

2012-01-10 Thread bjconlan
Thanks for your quick responses. I guess having clojure behave this way is obvious and consistent (with having to explicitly fill in the vararg). Sometimes I forget that Java does things that are syntactically 'nice' but otherwise unexpected which often isn't ideal to emulate in other languages...

Re: java interop 'optional vararg' issue?

2012-01-10 Thread Tassilo Horn
bjconlan writes: Hi, > Just writing that feels confusing (let alone the quasi techno babble) > so here is the example: > > http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html > > there are 2 static methods in the class "Path". > > Path.get(String first, String... more): usage examp

Re: Enlive reborn in ClojureScript - Enfocus (Dom Manipulation Lib)

2012-01-10 Thread ckirkendall
Peter, Sean, Thanks for the encouraging words. Sean, you sort of help launched this idea. It was while looking at framework1's use of Enlive, at ClojureConj, that I began thinking about how to use this on the client side. Creighton Kirkendall On Jan 9, 11:36 am, Sean Corfield wrote: > On Sun,

Re: java interop 'optional vararg' issue?

2012-01-10 Thread Baishampayan Ghose
On Tue, Jan 10, 2012 at 5:56 PM, bjconlan wrote: > Now when trying to use the first function in clojure such as > (Path/get "foo") > the Path.get(URI) method will be resolved. > > Now my question(s): > Is there a clean way to call this function (beside my current work > around "(Path/get "foo" (ma

Re: java interop 'optional vararg' issue?

2012-01-10 Thread bjconlan
Please read every reference to "Path" as "Paths" in regards to the class that I'm referring to (as is referenced by the anchor) On Jan 10, 10:26 pm, bjconlan wrote: > I'm just playing around with the the nio2 package in jdk7 and have > found clojure doesn't interop "nicely" when resolving a metho

java interop 'optional vararg' issue?

2012-01-10 Thread bjconlan
I'm just playing around with the the nio2 package in jdk7 and have found clojure doesn't interop "nicely" when resolving a method signature if the signature conflicts the polymorphic equivalent with appended variable argument. Just writing that feels confusing (let alone the quasi techno babble) s

Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-10 Thread Baishampayan Ghose
> I fixed the definition directly in the swank-clojure-1.3.4.jar and then > wanted to write a patch against clj-stacktrace's git master branch.  As > it turns out, it's already fixed in there.  Funnily, it was Phil himself > who committed that patch written by Michael van Acken. > > Phil, maybe you

Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-10 Thread Tassilo Horn
Tassilo Horn writes: Hi again, > Maybe the problem is that clj-stacktrace stumbles upon those names? > > But on the other hand: since *e contains the last exception and that > is the divide by zero exception and not some exception from > clj-stacktrace, this doesn't seem very likely... Debuggin

Re: My implementation of ISeqable for NodeList doesn't work on Opera.

2012-01-10 Thread Takahiro Hozumi
I've created an issue about this. http://dev.clojure.org/jira/browse/CLJS-120 Thanks. On Jan 10, 5:31 am, Stuart Sierra wrote: > I would like to have NodeList be seqable. Please file a ticket with a > patch. Perhaps someone else can shed light on why Opera doesn't work. > -S -- You received th

Re: Struggling in making a sub-process work in an interactive way

2012-01-10 Thread Alan Malloy
On Jan 9, 9:24 pm, Phil Hagelberg wrote: > jaime writes: > > Later on I tried to add code that can make this possible but I found > > there's no way to detect if a command requires user's input and thus I > > have to find another way to make it work - but I didn't success and > > have been strugg

Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-10 Thread Tassilo Horn
David Nolen writes: Hi David, > Do you see the same issue when working with lazy sequences? We > definitely don't eat exceptions. No, exceptions in lazy sequences show up fine. (defn blow-up [i] (map #(/ 1 %) (iterate inc i))) (take 200 (blow-up -100)) ;Divide by zero ; [Thrown c