I'm a big believer in Clojure / Rich Hickey's principles regarding the
separation of Identity and State (http://www.infoq.com/presentations/
Are-We-There-Yet-Rich-Hickey) and how this is generally a good idea.
However I've recently been running into what seems to be a slight
conceptual challenge
Luc, what you're saying sounds to me like this is the way it is so
deal with it. Can you give me some concrete code snippets showing why
it's better to box ints as Longs? Do you really think the following is
at all intuitive?
user= (class (Integer/parseInt 1))
java.lang.Long
user= (class
On Fri, Oct 21, 2011 at 12:52 AM, nathanmarz nathan.m...@gmail.com wrote:
user= (class (Integer/parseInt 1))
java.lang.Long
(Integer/parseInt 1) returns an int - which Clojure promotes to long
(since it only has 64-bit primitives) and class takes an Object so
long is boxed to Long.
user=
c) Put actor identities inside the world state - nasty! now the world
state is mutable
Not necessarily (and I'd be interested in the replies)?
I mean, here's how I view it. If actors are part of the world, then
they are part of its state. Hence, when the state of an actor changes,
the
How about a potentially ugly workaround:
user (defn sum [ {:keys [x y]} ] (+ x y))
#'user/sum
user (sum :x 1 :y 2)
3
user (def inc-sum (partial sum :x 1))
#'user/inc-sum
user (inc-sum :y 1)
2
user (inc-sum :y 2)
3
user
I know this is a trivial example, but I do quite fancy named arguments
and
On Oct 21, 4:25 pm, Ulises ulises.cerv...@gmail.com wrote:
c) Put actor identities inside the world state - nasty! now the world
state is mutable
Not necessarily (and I'd be interested in the replies)?
I mean, here's how I view it. If actors are part of the world, then
they are
Are you arguing for my option b) then? In which case actors don't have
distinct identities, they are just part of the overall world?
Not necessarily as your option b) already gives implementation details
(using ids to find actors, etc.). I was mostly thinking out loud to
see if anything
Luc, what you're saying sounds to me like this is the way it is so
deal with it. Can you give me some concrete code snippets showing why
it's better to box ints as Longs? Do you really think the following is
at all intuitive?
user= (class (Integer/parseInt 1))
java.lang.Long
user= (class
Ok I watched the talk, and I picked up a few things. But I have questions,
which hopefully some kind member in the community can answer.
There are several instances of libraries Rich mentions that provide simple
constructs so what clojure libraries provide, set functions and rules (is it
Hello, in portuguese there are lots of special characters (such as *á*, *é*,
*ã...*), but when I need a file with slurp I don't get this characters in
the result.
For example, if I have this line in the file: Ferida perdida na imensidão.
When I execute (slurp file-name), I get:
Ferida perdida
when I read* a file
--
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,
You need to tell slurp how the file is encoded.
(slurp path-to-my-file :encoding UTF-8)
That means that you'll need to know what encoding your file is using.
If you've never dealt with encoding before, I recommend reading this:
http://www.joelonsoftware.com/articles/Unicode.html
// Ben
On Fri,
Thank's a lot, bsmith.occs, it worked
I haven't consider the encoding =P
--
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
Like Stu says, this conversation is going in circle.
Concrete code examples cannot be a replacement for consistent rules when
designing software and especially a prog. language.
Since the beginning of this thread, you have been exposed to two of these:
a) make collections consistent
b) make
Is the clojurescript REPL set up to allow access from remote machines?
My development box is all set up, and I'm able to connect to the REPL
from OSX Safari and Simulated Mobile Safari. Everything is localhost,
so it all works great.
I'm currently able to use my iPad and iPhone to access my
Me too! It's gonna be great!
On Wed, Oct 19, 2011 at 10:30 PM, Abbas abbas.r...@gmail.com wrote:
Look forward to your talk.
Cheers,
Abbas
On Oct 18, 5:19 pm, Aaron Bedra aaron.be...@gmail.com wrote:
I will be there and am giving a talk in the functional web track
Hi,
may I question the transitivity of state information?
Maybe the world's state is that player Trantor is at position [15 34]. Now
Trantor eats an appel. The appel is removed from his inventory and his
health is raised by 5 hit points. Did the state of the world change? No.
Trantor is still
I thought tail recursion was actually not possible on the JVM but saw
a talk on the Erlang VM yesterday and Robert Virding mentioned that
Erjang managed to do it.
I'm sure the core guys have seen it but just in case others thought
the same as me here are a few links:
And how would one structure something as stateful as a web app using these
techniques? Hopefully someone can point to a pre-existing example that
follows all or many of these ideas.
I currently work on a thick-client system. But our back-end is quite
stateless. One thing that irks me the most
Maybe the world's state is that player Trantor is at position [15 34]. Now
Trantor eats an appel. The appel is removed from his inventory and his
health is raised by 5 hit points. Did the state of the world change? No.
Trantor is still at position [15 34]. Does the world have to know about the
Perhaps I can clarify why the 1.3 behavior is confusing. For those who have
focused on issues like primitives need to be boxed, therefore you get a
long - I think you are missing Nathan's point. Here is what changed about
boxing in 1.3:
Clojure 1.2:
(class (Long/parseLong 1)) =
Wow. Easily the best conference talk I have seen... well, ever.
Executive summary: Mutability is bad for your complection. :)
- Chris
--
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
Clojure does tail-call elimination for simple cases with loop/recur. This is
by far the most common case. Most other tail-recursive situations can be
represented as lazy sequences, which are another way to handle recursive
functions without consuming stack space. For the final rare cases (e.g.
Great talk!
I got lost a bit in the Abstraction for Simplicity. Could anybody provide me
some concrete examples for Who When Where Why slides?
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Tom Hall thattommyh...@gmail.com writes:
I'm sure the core guys have seen it but just in case others thought
the same as me here are a few links:
http://www.javalimit.com/2009/12/tail-recursion-in-erjang.html
https://github.com/trifork/erjang/wiki/How-Erjang-compiles-tail-recursion
If
Hmm I get no errors. But it doesn't work. I agree that would be a *real*
killer app for ClojureScript. Debugging JS on mobile browsers is a big pain.
I will try looking into it if no one else gets to it first, ticket created
http://dev.clojure.org/jira/browse/CLJS-92
David
On Thu, Oct 20, 2011
Hi,
I'm trying to set the classes output path different from the default
src/main/classes by overriding :javac-options {:destdir
../../target/classes/} and that does not seem to work. is there a property
I can use to accomplish this?
Thanks,
Siyu
--
You received this message because you
Hey Timothy,
Thanks for the response, I currently perform some of these steps. My data is
taken out of mongodb and converted into straight clojure maps. I pass these
around in my application, calling validation functions on them etc. Having
said that, this talk will push me to take a good look
I've always felt that Clojure's treatment of nil was somehow inconsistent
with the elegance of many other features of Clojure. Now I can finally
articulate why: nil complects non-existence, false, and empty.
The choice to make nil represent so many concepts was an easy choice,
because it saves
I tried :compile-path and it worked, but it's not listed in
https://github.com/technomancy/leiningen/blob/stable/sample.project.clj
--
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
If I understand your post correctly you feel that nil should
ONLY represent the concept of a missing value. It should not
represent false and empty.
Having used lisp in many different forms over the last 40 years
I think that the complecting of nil to represent all three
concepts is one of the
On Fri, Oct 21, 2011 at 10:33 AM, siyu798 siyu...@gmail.com wrote:
I tried :compile-path and it worked, but it's not listed
in https://github.com/technomancy/leiningen/blob/stable/sample.project.clj
Good catch; I will add this.
-Phil
--
You received this message because you are subscribed to
On Fri, Oct 21, 2011 at 10:38 AM, daly d...@axiom-developer.org wrote:
If I understand your post correctly you feel that nil should
ONLY represent the concept of a missing value. It should not
represent false and empty.
Yes, you correctly interpreted my post. That is my opinion.
The context
On Fri, Oct 21, 2011 at 10:14 AM, Stuart Sierra
the.stuart.sie...@gmail.com wrote:
Clojure does tail-call elimination for simple cases with loop/recur. This is
by far the most common case. Most other tail-recursive situations can be
represented as lazy sequences, which are another way to handle
On 10/21/2011 06:50 PM, Mark Engelberg wrote:
Now I can finally articulate why: nil complects non-existence, false,
and empty.
How does nil represent empty? '() does not equal nil.
It is also easy in the sense that it is more similar to what Lisp users (as
opposed to Scheme) are used to
Collections often include false as a value. You will have to handle it by
using some other value like ::not-found.
David
On Fri, Oct 21, 2011 at 12:50 PM, Mark Engelberg
mark.engelb...@gmail.comwrote:
I've always felt that Clojure's treatment of nil was somehow inconsistent
with the elegance
nil complects non-existence, false, and empty.
Let's explore that a little further:
* Non-existence
- Accessing a local or var that has never been declared
* False
- (if nil :never-here :but-here)
* Empty
- (seq [])
And maybe there is another?
* Not set
- (def x)
- (:x {:a 1})
But
On Fri, Oct 21, 2011 at 11:08 AM, Thorsten Wilms t...@freenet.de wrote:
On 10/21/2011 06:50 PM, Mark Engelberg wrote:
Now I can finally articulate why: nil complects non-existence, false,
and empty.
How does nil represent empty? '() does not equal nil.
(cons 1 nil) is one obvious example.
On Fri, Oct 21, 2011 at 11:22 AM, David Nolen dnolen.li...@gmail.com wrote:
Collections often include false as a value. You will have to handle it by
using some other value like ::not-found.
David
True, but the multiple meanings of nil creates additional complexity.
Contrast, for example,
On Fri, Oct 21, 2011 at 11:43 AM, Mark Engelberg
mark.engelb...@gmail.com wrote:
How does nil represent empty? '() does not equal nil.
(cons 1 nil) is one obvious example.
The pattern of using first/next/nil? as a more efficient/compact
alternative to first/rest/empty? is arguably another.
Thanks for looking into it!
Regarding the issue: Cannot interact with Browser REPL running in iOS/
Webkit Mobile devices, I did try it locally on my development machine
with the iOS simulator and it works fine. For both iPhone and iPad,
and iOS version 4 and 5. Only on the actual devices,
Just because we have dynamic types does not give us the freedom to not
consider them.
(when s
...)
Does not communicate anything about collections - only nil, false or
something else.
(when (seq s)
...)
(when (empty? s)
...)
Clearly express a consideration about the types at play.
On Fri, Oct 21, 2011 at 12:41 PM, David Nolen dnolen.li...@gmail.com wrote:
Just because we have dynamic types does not give us the freedom to not
consider them.
Oh, I definitely considered the types when I wrote the function. It's
just that at the time I wrote it, I was confident the input
On Fri, 2011-10-21 at 12:36 -0700, Mark Engelberg wrote:
On Fri, Oct 21, 2011 at 11:43 AM, Mark Engelberg
mark.engelb...@gmail.com wrote:
How does nil represent empty? '() does not equal nil.
(cons 1 nil) is one obvious example.
The pattern of using first/next/nil? as a more
(because test cases are written by the coder who has a
specific intention in mind)
Good observation. When I see figures of tests coverage I wonder how
many flow paths aren't being covered simply because they don't exists
but they should.
--
You received this message because you are
On Fri, Oct 21, 2011 at 4:02 PM, Mark Engelberg mark.engelb...@gmail.comwrote:
On Fri, Oct 21, 2011 at 12:41 PM, David Nolen dnolen.li...@gmail.com
wrote:
Just because we have dynamic types does not give us the freedom to not
consider them.
Oh, I definitely considered the types when I
On Fri, 2011-10-21 at 15:41 -0400, David Nolen wrote:
Just because we have dynamic types does not give us the freedom to not
consider them.
If all of these dynamics types and all of the tests respected nil
in its many meanings then
(when s ...,
(when (seq s)...,
(when (empty? s)...,
Hi:
I found what I think might be considered a bug, but I'm not certain.
The doc-string for `pmap' just says that the passed-in function is
applied in parallel, but the code as-written is pretty clearly
intended to keep only (+ 2 #CPUS) future-wrapped function applications
realized at a time. It
Another annotation bug:
Annotations on gen-class in an ns form, like (ns foo (:gen-class
^{Singleton {}} foo.ClassName)) don't seem to work.
--
__
Herwig Hochleitner
--
You received this message because you are subscribed to the
This message is not specifically in reply to Tim, but to the thread in general.
It can be very difficult to enumerate (or even remember :) all of the
contending tradeoffs around something like Clojure's nil handling.
The is no doubt nil punning is a form of complecting. But you don't completely
Bravo, bravo! Great speech, I'm already looking for such esseys. I'm
already learning haskell and erlang for great good, because all things
told about lisp has been already read.
I'm also designing system. Because it has some well defined
functionality, my first tought was, hey man I will use
I'm a bit unsure as to the best way to solve this. Assuming I have the
following tree:
{:parent1
{:relationship1
{:child1 1}
{:child2 2}}
{:relationship2
{child3 3}}
{:_meta}}
I want to get:
[:parent1 :relationship1 :child1]
[:parent1 :relationship1 :child2]
Rich,
My apologies that what I have said about nil punning came across
as criticism directed at you. That was not intentional. I have
the highest respect for your design work. You're doing an amazing
job and I continue to learn from you.
I understand the lazy vs empty issue and I think you made
Turns out this works just fine. You need to make sure that you change:
(repl/connect http://localhost:9000/repl;)
In your source to be the correct IP.
David
On Fri, Oct 21, 2011 at 3:39 PM, stratospark pat...@gmail.com wrote:
Thanks for looking into it!
Regarding the issue: Cannot interact
The example tree was not accepted as a valid data structure, so I used this
instead. Hopefully it represents what you had in mind:
(def tree {:parent1
{:relationship1
{:child1 1
:child2 2}
:relationship2
{:child3 3}
:_meta
Hello Herwig,
I checked the patch you linked to in your original post, and it doesn't seem
that type hinting for native arrays of Objects is supported, that is the [L
type. Native arrays of native types work quite well.
(definterface Name (^[S method [])) ;;returns array of shorts
(def p (proxy
On Fri, 2011-10-21 at 09:19 +0530, Baishampayan Ghose wrote:
If you are going to upload your library to any Maven (or similar) repo
that's accessible through Leiningen, then you may choose to not
include a project.clj file; in any case, if you yourself are using
Leiningen, you should include
Yea let's chat on IRC. I'll ping you when I see you online.
-Nathan
On Oct 21, 4:24 am, Stuart Halloway stuart.hallo...@gmail.com wrote:
Luc, what you're saying sounds to me like this is the way it is so
deal with it. Can you give me some concrete code snippets showing why
it's better to
Why do you think, there is a bug?
You are referring to the /code/, i.e. the implementation, of things, which
is not a defined interface. At the same time, the /documentation/ describes
the actual behavior quite well.
Chunked seqs are supposed to realize more elements than you consume. That's
Thanks, it works with a hardcoded IP address. I had tried using our
Bonjour network hostnames, but that doesn't seem to work. The
important thing is now I have a REPL to my iPad!
-pat
On Oct 21, 2:53 pm, David Nolen dnolen.li...@gmail.com wrote:
Turns out this works just fine. You need to make
Hi
I wrote the following function to create a SQL IN clause from a list
of values. Essentially the function creates a single string which is a
comma separated quoted list of the values surrounded by parenthesis.
user= (def xs [1 2 3 4 5])
user=(str (' (first xs) (reduce #(str %1 ', ' %2) (rest
On Oct 21, 2011, at 5:37 PM, daly wrote:
Rich,
My apologies that what I have said about nil punning came across
as criticism directed at you.
It certainly didn't come across that way - no worries :-)
Rich
--
You received this message because you are subscribed to the Google
Groups
user= (str (' (apply str (interpose ', ' [1 2 3 4 5])) '))
('1', '2', '3', '4', '5')
Would be a way to do it. Interpose returns a lazy sequence so you need to apply
str to realize the sequence.
Luc P.
On Fri, 21 Oct 2011 17:54:41 -0700 (PDT)
Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote:
Augh don't do this, you are begging for SQL injection attacks. I'll
set one of the elements in your list to:
'); DROP TABLE users; --
On Oct 21, 5:54 pm, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com
wrote:
Hi
I wrote the following function to create a SQL IN clause from a list
of values.
Stefan Kamphausen ska2...@googlemail.com writes:
Chunked seqs are supposed to realize more elements than you
consume. That's for performance reasons. But since you will only ever
apply side-effect-free functions to seqs, that will make no
difference, no?
Sorry, yes, I'm talking about within
Just found another one:
You can't annotate constructors of gen-class.
2011/10/22 Ivan Koblik ivankob...@gmail.com:
Hello Herwig,
I checked the patch you linked to in your original post, and it doesn't seem
that type hinting for native arrays of Objects is supported, that is the [L
type.
It all depends if you sanitize the arguments yourself before building the SQL
string...
Luc
On Fri, 21 Oct 2011 19:23:22 -0700 (PDT)
Alan Malloy a...@malloys.org wrote:
Augh don't do this, you are begging for SQL injection attacks. I'll
set one of the elements in your list to:
'); DROP
Thanks. It is so much cleaner with interpose.
On Oct 21, 9:24 pm, Luc Prefontaine lprefonta...@softaddicts.ca
wrote:
user= (str (' (apply str (interpose ', ' [1 2 3 4 5])) '))
('1', '2', '3', '4', '5')
Would be a way to do it. Interpose returns a lazy sequence so you need to
apply str to
68 matches
Mail list logo