Sean Corfield seancorfi...@gmail.com writes:
user (map #(let [{x 0 y 1 :or {0 -1, 1 -2}} %1]
[x y])
[[] [10] [10 11]])
([nil nil] [10 nil] [10 11])
I had expected it to return ([-1 -2] [10 -2] [10 11]).
It needs to be this:
user= (map #(let [{x 0 y 1 :or {x -1 y
Great!
On Tuesday, June 12, 2012 11:32:11 PM UTC+2, Jim foo.bar wrote:
Nevermind...I found the namespace with these non-relational operators and
the code works like a charm!!! I am so happy... :-)
Jim
On 12/06/12 22:18, Jim - FooBar(); wrote:
Hi Marek,
I did what you said and I
Jay Fields j...@jayfields.com writes:
right, I know it's possible to do what you guys are describing. What I
meant to ask is, should :or be allowed in destructuring vectors? I
can't see any reason for it not to be allowed.
Hm, yes, I could think of these semantics, i.e., fill missing indices
HI all,
I am trying to read a InputStream that is coming from S3
I am using clj-aws-s3 library
When I get the object I get a #S3ObjectInputStream
com.amazonaws.services.s3.model.S3ObjectInputStream@40d88d2d
How can I get the content inside this InputStream, any ideas, unfortunately
I do not
Jim - FooBar(); jimpil1...@gmail.com writes:
What's update-position? Shouldn't that be (updatePosition p coords),
as you say IPieces have an updatePosition method? And since you use
that for side effects (you don't use the return value), are your
IPiece implementors actually deftypes with
I am trying to read a InputStream that is coming from S3
I am using clj-aws-s3 library
When I get the object I get a #S3ObjectInputStream
com.amazonaws.services.s3.model.S3ObjectInputStream@40d88d2d
How can I get the content inside this InputStream, any ideas, unfortunately
I do not know
Why do the clojure.core.reducers defcurried operators define the kv cases?
Is there a way to use these? Since reducers and folders only implement
{Coll,I}Reduce, I don't see why they are there.
Are there changes coming that make this make sense?
--
You received this message because you are
I do use pre-conditions where the test condition is simple, ie is this a
string? does the map have a :field-type? however I get a lot of my input
data from http requests as json which have similar structures but different
semantics, so I often do not have preconditions where type is not
First of all, thanks all of you for your helpful and often enlightening
comments
On 13/06/12 08:13, Tassilo Horn wrote:
But probably that's not a good approach. When mutating the positions in
a move, there's no way back. If everything was immutable, i.e.,
updatePosition would return a
Hi forum,
I found that (empty? my-brain) - true.
'seq' suffices.
user= (def sm (sorted-map 0 {:name Alice} 1 {:name Bob} 2 {:name
Charlie}))
#'user/sm
user= (loop [[k v :as x] xs] (seq sm) acc []]
(if x
(recur xs (conj acc (assoc v :id k)))
that mutation inside piece is
the only non-functional detail...everything else I am indeed returning new
boards, new pieces (promotion, death etc)...
If I were you, I would look into a way to make Pieces pure too.
Because their mutability cascades into the whole state and makes the
On Jun 12, 2012, at 7:12 PM, Phil Hagelberg wrote:
On Mon, Jun 11, 2012 at 1:48 PM, Phil Hagelberg p...@hagelb.org wrote:
On Mon, Jun 11, 2012 at 9:36 AM, Phil Hagelberg p...@hagelb.org wrote:
These will be removed once Central gets back to working order, but
they should help stem the flow of
On Wed, Jun 13, 2012 at 10:46 AM, nicolas.o...@gmail.com
nicolas.o...@gmail.com wrote:
that mutation inside piece is
the only non-functional detail...everything else I am indeed returning new
boards, new pieces (promotion, death etc)...
And from what I understand of your design, I disagree
On 13/06/12 10:58, nicolas.o...@gmail.com wrote:
And from what I understand of your design, I disagree on a point: I
think it is not true a move is a command apply to
a piece. A lot of moves involve multiple pieces.
So I would try to represent a move as something like:
(defprotocol
Move
Jim - FooBar(); jimpil1...@gmail.com writes:
Hi Jim,
In other words, moves are also records that satisfy the Command
protocol which says there should exist an execute and an undo
method in all implementors...that way, each move knows how to execute
itself but also how to undo itself and
different positions now or some are nil (dead))... if i make the pieces pure
what comes to mind is resetting or swapping possibly 32 atoms instead..
No, you will have an atom containing a new board with new pieces in
their new position.
(By the way, you can go a long way writing what you want
On Wed, Jun 13, 2012 at 5:47 AM, Chas Emerick c...@cemerick.com wrote:
On Jun 12, 2012, at 7:12 PM, Phil Hagelberg wrote:
On Mon, Jun 11, 2012 at 1:48 PM, Phil Hagelberg p...@hagelb.org wrote:
On Mon, Jun 11, 2012 at 9:36 AM, Phil Hagelberg p...@hagelb.org wrote:
These will be removed once
On 13/06/12 11:21, Tassilo Horn wrote:
I don't get this. If you have your current-board as an atom containing
a collection of pieces, and every piece's location can be mutated by
(updatePosition piece ...), then doing that does change the world, i.e.,
the location of piece changed without
My solution:
(defn lis [s]
(- s
(partition 2 1)
(partition-by (partial apply =))
(filter (fn [[[a b]]] ( a b)))
(reduce (fn [m s] (if ( (count s) (count m)) s m)) [])
(#(cons (ffirst %) (map second %)
The strategy is (given the vector [3 2 1 2 4 2]
- I
On Wed, Jun 13, 2012 at 1:38 AM, Warren Lynn wrn.l...@gmail.com wrote:
If you don't need AOT then you can include the common lib in
Could :uberjar-exclusions help in any way? It's a vector of regexps to
exclude files from the uberjar. It could be a starting point to try
out.
Jacek
--
Jacek
So far I can only confirm the following.
It does not occur if I revert to
commit 7b6678bead5a0733d0388ddaa4e78e714b9d6187 but does
from e959e0205a4b42a099c120a77427314d288c965b (Merge branch
'cljs-305-proto-inline') onward.
I have been unable to get a stacktrace with the exception - So at the
Jim - FooBar(); jimpil1...@gmail.com writes:
If the things you store in atoms or refs aren't immutable, then the
guarantees made by those reference types simply don't apply.
hmmm...I see what you mean. I'll try to rethink my design... In fact,
I was wondering in the beggining of this project
Does this problem only occur on a specific project? Can you create a
minimal reproducible case?
Thanks,
David
On Wed, Jun 13, 2012 at 7:54 AM, Dave Sann daves...@gmail.com wrote:
So far I can only confirm the following.
It does not occur if I revert to
commit
On Wed, Jun 13, 2012 at 4:05 AM, JuanManuel Gimeno Illa
jmgim...@gmail.com wrote:
My solution:
(defn lis [s]
(- s
(partition 2 1)
(partition-by (partial apply =))
(filter (fn [[[a b]]] ( a b)))
(reduce (fn [m s] (if ( (count s) (count m)) s m)) [])
you mean making 32 new pieces after each move regardless of whether they
moved or not? how can I identify the ones that are different from the ones
that remain unchanged so i can conj them in a new list? move will eventually
call 'build-board' which has to look somewhere for the current
On Wed, Jun 13, 2012 at 1:52 AM, Vinzent ru.vinz...@gmail.com wrote:
Why do you care about computational expensiveness of pre and post
conditions? They'll be turned off in production anyway.
I think that's a philosophical question :)
In clojure, structure of your map is a part of the
On 13/06/12 17:22, nicolas.o...@gmail.com wrote:
For example, if your state were a vector [:x :o :x nil :x]
(for a board of tic-tac-toe), calling (assoc board 3 :x) will return a
new board
with the position 3 set to :x.
Yes but in tic-tac-toe you are inserting pieces while in
On Wednesday, June 13, 2012 5:47:55 PM UTC+2, Andy C wrote:
On Wed, Jun 13, 2012 at 4:05 AM, JuanManuel Gimeno Illa wrote:
My solution:
(defn lis [s]
(- s
(partition 2 1)
(partition-by (partial apply =))
(filter (fn [[[a b]]] ( a b)))
2012/6/12 Andy Coolware andy.coolw...@gmail.com
Hi,
First a quick disclaimer. Those are my first steps in Clojure so I am
not be super accustomed to the language entire landscape and might
miss some basics here. However I was able to solve my first 4clojure
hard problem
Ok after a cup of tea I'm starting to realize i can easily do something
like:
(let [moved (update-position p coords)] ;no mutation - returns a new piece
(filter (complement dead?)
(- board
(dissoc (getListPosition p)) ;get rid of
the old piece
(assoc
useful https://github.com/flatland/useful has a partition
functionhttps://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L222powerful
enough to make the find increasing subsequences part pretty easy:
(defn lis [coll]
(or (- coll
(partition-between (partial apply =))
I'm speaking from ignorance but this kind of error smacks of a version
mismatch between the Java runtime library and what Clojure is expecting.
What version of Java runtime are you using? Also, is the Azul Java library
the same as Sun's? What's the entire stacktrace?
On Wednesday, June 13,
Unfortunately, the full stacktrace is getting swallowed up by all of the other
moving parts, so it's not easily accessible.
Here is the Azul Java version:
-bash-4.1$ java -version
java version 1.6.0_29
Java(TM) SE Runtime Environment (build 1.6.0_29-13)
Java HotSpot(TM) 64-Bit Tiered VM (build
Hi All,
I am running the following
(defn json-response [data [status]]
{:status (or status 200)
:headers {Content-Type application/json}
:body (json/generate-string data)})
(GET /events/s3 []
(let [response (s3files/fetch-data-aws)]
(println response)
(json-response response)))
https://github.com/ftravers/PublicDocumentation/blob/master/clojure-development-setup.md
An index to other clojure tutorials:
https://github.com/ftravers/PublicDocumentation/blob/master/clojure-index.md
--
You received this message because you are subscribed to the Google
Groups Clojure group.
For some reason I cannot create an XML node. Sample code
here.https://gist.github.com/ce66585542f4b426381c Any
assistance much appreciated.
--
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
(defn lis [coll]
(or (- coll
(partition-between (partial apply =))
(sort-by (comp - count))
(filter next)
(first))
[]))
Totally agree on decomposing the problem into a single independent
steps. This is what I did not like about the trick
On Wed, Jun 13, 2012 at 12:33 PM, fenton fenton.trav...@gmail.com wrote:
https://github.com/ftravers/PublicDocumentation/blob/master/clojure-development-setup.md
Have you considered evaluating the official documentation and
improving it so that effort goes to a place in which it can be updated
On Wed, Jun 13, 2012 at 12:55 AM, Phil Hagelberg p...@hagelb.org wrote:
If you don't need AOT then you can include the common lib in
dependencies in the :dev profile.
Hi Phil,
Thanks for the idea - I blogged about the solution and it worked great!
On Wed, Jun 13, 2012 at 1:42 PM, Jacek Laskowski ja...@laskowski.net.pl wrote:
That's the part I didn't understand. Could you elaborate what wouldn't work?
If you try to create an uberjar with AOT using a profile that excludes
the dependencies you don't want in your uberjar then the AOT will
Here is the full stack trace:
Caused by: clojure.lang.Compiler$CompilerException:
java.lang.NoSuchFieldException: close, compiling:(clojure/core.clj:6139)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at
On Wed, Jun 13, 2012 at 10:47 PM, Phil Hagelberg p...@hagelb.org wrote:
If you try to create an uberjar with AOT using a profile that excludes
the dependencies you don't want in your uberjar then the AOT will fail
because it tries to references classes that don't exist.
Why does AOT happen
Sure would love to. Could you point me to the right location?
Here:
http://clojuredocs.org/ ?
or here:
http://en.wikibooks.org/wiki/Clojure_Programming ?
or somewhere else?
On Wednesday, June 13, 2012 1:13:20 PM UTC-7, Phil Hagelberg wrote:
On Wed, Jun 13, 2012 at 12:33 PM, fenton
Or likely you mean here:
http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
I'm not sure I can edit this page??? Seems to only leave comments there.
On Wednesday, June 13, 2012 12:33:38 PM UTC-7, fenton wrote:
Right,
so I followed every ones' suggestions and went fully immutable! points
are now regular vectors and updating position returns a brand new piece
(as does killing a piece, it changes its meta-data). On the upside I did
not have to change much and now at least it reads nicer...however, on
On Wed, Jun 13, 2012 at 1:52 PM, Jacek Laskowski ja...@laskowski.net.pl wrote:
If you try to create an uberjar with AOT using a profile that excludes
the dependencies you don't want in your uberjar then the AOT will fail
because it tries to references classes that don't exist.
Why does AOT
On Wed, Jun 13, 2012 at 1:58 PM, fenton fenton.trav...@gmail.com wrote:
Or likely you mean here:
http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
I'm not sure I can edit this page??? Seems to only leave comments there.
I think that's the best place for an overview.
Hi,
I have a use case where I'd like to load small forms in String format from
a database and wrap them in functions. This is to support some basic
runtime customisation.
I'm having problems getting read-string and macros to play nicely, a
problem which can be distilled as below:
; a simple
Hi all,
I've always developed desktop apps with the typical C/C++/C# stack and I
was willing to delve into web development. I really don't like Javascript
so I thought to give CoffeScript with node.js a chance, but as I love
functional programming the idea of using Clojure/Clojurescript for
Thanks for all the help, guys.
Because Laurent's suggesting of calling sample/bar.clj instead of
sample.bar.clj in loadResourceScript() seemed the easiest, I tried
that first and it worked. So it looks like in that method you have to
specify the path the file, relative to the src directory,
Hi Craig,
I can't reproduce the problem you're seeing. Right now, when I visit
http://repo1.maven.org/maven2/org/clojure/clojure/maven-metadata.xml I get
the the same list as Article A in your original post.
Is it possible that the maven-metadata-central.xml file in your local Maven
cache is
I see you have found that you can override Object.toString in defrecord by
including Object in your defrecord. However, Object is a special case,
since every Java class extends Object.
You *can* have two protocols with the same method name, but they must be in
*different* namespaces.
Every
Sorry, I thought it was something simple but obviously not. I don't think
I can help
On Wednesday, June 13, 2012 1:52:41 PM UTC-7, Edward Z. Yang wrote:
Here is the full stack trace:
Caused by: clojure.lang.Compiler$CompilerException:
java.lang.NoSuchFieldException: close,
Why does AOT happen after exclusion? Shouldn't exclusion be the last
step in the process which would hardly break anything and would
eventually fix the issue?
Oh, I meant this would be a problem if you used profiles for
separating dependencies. If you use :uberjar-exclusions you'll
It is very common for all elements in a vector to be always of the same
type. Is there any way to hint the type to Clojure? Does such hint can even
improve performance? Thank you.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group,
I cannot help notice that leinengen seems quite slow. Even lein help
takes 8 seconds to finish printing all the information. I am using version
2 on Windows 7(that .bat file). Can anyone explain what is going on? Or is
it just me? Thank you.
--
You received this message because you are
1. I suppose you can't call any Java library from ClojureScript if you
want it to compile to JS. Can you call any Clojure library and have it
translated?
If you want to use existing Java libraries then run those on the server.
Clojure code will run either on the client or the server if
On Wed, Jun 13, 2012 at 5:27 PM, Warren Lynn wrn.l...@gmail.com wrote:
I cannot help notice that leinengen seems quite slow. Even lein help takes
8 seconds to finish printing all the information. I am using version 2 on
Windows 7(that .bat file). Can anyone explain what is going on? Or is it
Jacobo,
Using JavaScript from ClojureScript is very straightforward.
There are a few points where interop is awkward, but that wasn't the main
reason I wrote a new library (in Clojure).
There were two primary motivations for that.
1) We needed a visualization library that would work on the
I totally understand the value of having a single source of truth (DRY
principle). My main problem was that to get from 0-60 for doing clojure
development is quite challenging.
Say you want to do what my document describes, that is setup Leiningen,
setup emacs, etc..., it took me weeks to get
Doesn't this produce something like:
(fn []
(read-string (println \hello\)))
which would return the list '(println hello)?
On Wednesday, June 13, 2012 7:29:54 PM UTC-4, Rob Harrop wrote:
Hi,
I have a use case where I'd like to load small forms in String format from
a database and wrap
how about add something about auto completion, it's pretty useful for
working around large project or java interop.
On Thu, Jun 14, 2012 at 9:27 AM, fenton fenton.trav...@gmail.com wrote:
I totally understand the value of having a single source of truth (DRY
principle). My main problem was
On Wed, Jun 13, 2012 at 4:29 PM, Rob Harrop rob.har...@gmail.com wrote:
I'm having problems getting read-string and macros to play nicely, a problem
which can be distilled as below:
Try this:
user= (defmacro xr [f] (list 'fn [] (read-string f)))
#'user/xr
user= (apply (xr (println \hello\))
On Wed, Jun 13, 2012 at 5:27 PM, Warren Lynn wrn.l...@gmail.com wrote:
I cannot help notice that leinengen seems quite slow. Even lein help takes
8 seconds to finish printing all the information. I am using version 2 on
Windows 7(that .bat file). Can anyone explain what is going on? Or is it
On Wed, Jun 13, 2012 at 4:57 PM, Stuart Sierra
the.stuart.sie...@gmail.com wrote:
I can't reproduce the problem you're seeing. Right now, when I visit
http://repo1.maven.org/maven2/org/clojure/clojure/maven-metadata.xml I get
the the same list as Article A in your original post.
This was fixed
On Wed, Jun 13, 2012 at 7:06 PM, Sean Corfield seancorfi...@gmail.com wrote:
user= (defmacro xr [f] (list 'fn [] (read-string f)))
Or, if you prefer: (defmacro xr [f] `(fn [] ~(read-string f)))
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC.
On Wed, Jun 13, 2012 at 6:27 PM, fenton fenton.trav...@gmail.com wrote:
Then I head over to
lein: https://github.com/technomancy/leiningen, well this one is better than
most install instructions, but still IMO, isn't as simple to follow as my
instructions. Which I'd agree I should update to
On Wed, Jun 13, 2012 at 6:27 PM, fenton fenton.trav...@gmail.com wrote:
I totally understand the value of having a single source of truth (DRY
principle). My main problem was that to get from 0-60 for doing clojure
development is quite challenging.
Which is why the official documentations
On Wed, Jun 13, 2012 at 7:45 PM, Sean Corfield seancorfi...@gmail.com wrote:
We definitely need improvements in the official getting started
documentation. Starting here -
http://dev.clojure.org/display/doc/Getting+Started - any specific
problems / improvements that folks identify will
This can't work as a macro - Sean's suggestion is just as broken as yours,
in that it needs the form supplied to be a compile-time literal, because
macros are expanded at compile-time. You can do this at runtime with eval:
something like (defn xr [s] (eval `(fn [] ~(read-string s, though of
Ok, I hit a wall and really did not see this coming.
Based on what I have read, its really easy for Clojure and Java to
work together. So I wrote some test Clojure code with a very simple
defrecord (say named as testrec) and AOT compile it, create a jar
file, and add it to a HelloWorld java
On Wed, Jun 13, 2012 at 8:23 PM, Alan Malloy a...@malloys.org wrote:
This can't work as a macro - Sean's suggestion is just as broken as yours,
Ah yes... I got too focused on the original code (with the literal)
instead of trying something more real world...
--
Sean A Corfield -- (904) 302-SEAN
On Jun 12, 2012 7:41 PM, Alan Malloy a...@malloys.org wrote:
On Jun 12, 5:56 am, Jim - FooBar(); jimpil1...@gmail.com wrote:
On 12/06/12 13:53, Jim - FooBar(); wrote:
On 12/06/12 13:47, Meikel Brandmeyer (kotarak) wrote:
If update-position is a protocol function just call it without
El jueves, 14 de junio de 2012 02:28:23 UTC+2,
thenwithexpandedwingshesteershisflight escribió:
1. I suppose you can't call any Java library from ClojureScript if you
want it to compile to JS. Can you call any Clojure library and have it
translated?
If you want to use existing Java
74 matches
Mail list logo