Re: Jesus, how the heck to do anything?

2011-03-25 Thread Michael Wood
On 25 March 2011 07:15, Ken Wesson wrote: > On Fri, Mar 25, 2011 at 12:36 AM, ultranewb wrote: [...] >> One other difference with APL is that they removed the old complaint >> of "special characters and keyboards" by changing it to pure standard >> ascii characters.  Thing is, I don't particularl

Re: Jesus, how the heck to do anything?

2011-03-25 Thread ultranewb
I'm sure you are right, but I see asians using American keyboards with English alphabets to write Chinese, Japanese, and everything else every day. And with a few keystrokes, they switch between writing in English and writing in (insert asian language). In theory, I don't know why it would be any

Re: Jesus, how the heck to do anything?

2011-03-25 Thread Ken Wesson
On Fri, Mar 25, 2011 at 4:40 AM, ultranewb wrote: > I'm sure you are right, but I see asians using American keyboards with > English alphabets to write Chinese, Japanese, and everything else > every day.  And with a few keystrokes, they switch between writing in > English and writing in (insert as

Re: Jesus, how the heck to do anything?

2011-03-25 Thread Ken Wesson
On Fri, Mar 25, 2011 at 4:08 AM, Michael Wood wrote: > On 25 March 2011 07:15, Ken Wesson wrote: >> On Fri, Mar 25, 2011 at 12:36 AM, ultranewb wrote: > [...] >>> One other difference with APL is that they removed the old complaint >>> of "special characters and keyboards" by changing it to pure

Re: Implicit unpacking of a map

2011-03-25 Thread Thorsten Wilms
On 03/25/2011 01:34 AM, Ken Wesson wrote: What about this? First, use :title and :body keywords instead of "title" and "body" strings as keys in form-params. Then define this utility function: (defn get-seq [m& kws] ((apply juxt kws) m)) which takes a map and one or more keywords (cannot be

Re: gen-class and state...

2011-03-25 Thread Jules
yes and that's great where the resource usage is scoped on a per-thread basis, but not a per-object basis - but then, I am thinking in OO terms again :-) Jules -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo

Re: Implicit unpacking of a map

2011-03-25 Thread Meikel Brandmeyer
Hi, On 25 Mrz., 10:09, Thorsten Wilms wrote: > Interesting, but you just listed title and body twice, where the goal > was to not list them at all (except in the definition of Article and in > the html form, of course, though theoretically, the form could be > generated from a a bit richer singl

Re: Implicit unpacking of a map

2011-03-25 Thread Ken Wesson
On Fri, Mar 25, 2011 at 5:09 AM, Thorsten Wilms wrote: > On 03/25/2011 01:34 AM, Ken Wesson wrote: >> >> What about this? First, use :title and :body keywords instead of >> "title" and "body" strings as keys in form-params. Then define this >> utility function: >> >> (defn get-seq [m & kws] >>   (

Re: Jesus, how the heck to do anything?

2011-03-25 Thread ultranewb
I mean, how is what you are describing any different than what these asians I am referring to do? On another note, I have unfortunately decided that I just can't do Clojure right now. I was never able to get anything to work except for using the command line to "java -cp" a file that way. No edi

Namespace and file structuring

2011-03-25 Thread Terje Dahl
I would love to know how better to organize my code: I understand the basics of namespaces and how to use them. But when and why I should use different namespaces eludes me. In Java, the language forces you to have more or less one class pr class-file, and you are encouraged to group class-files i

bindings & lazy-seq

2011-03-25 Thread Carlos-K
Hi, Why when you create a lazy sequence, you need to do the bindings inside the definition?, e.g., (lazy-seq (binding [*in* in#] <-- some code -->)) As opposed to make the bindings first and call the lazy-seq later, e.g., (binding [*in* in#] (lazy-seq <-- some code -->)) Thanks -

Your favorite utility function or macro.

2011-03-25 Thread Takahiro Hozumi
Hi, I'm interested in useful utility which you create. Please show me your favorite utility. For example, _-> is that for me. _-> is like ->, but it can insert expression in arbitrary place by marking underscore. (_-> :a (assoc {} _ 1)) ;=> {:a 1} Therefore It can unify -> and ->> behavior. https:

Re: bindings & lazy-seq

2011-03-25 Thread Meikel Brandmeyer
Hi, This might help: http://kotka.de/blog/2009/11/Taming_the_Bound_Seq.html Sincerely Meikel -- 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

Re: Your favorite utility function or macro.

2011-03-25 Thread Meikel Brandmeyer
Ah. There it is again: the classic. http://groups.google.com/group/clojure/browse_thread/thread/66ff0b89229be894/c3d4a6dae45d4852 -- 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 p

Re: Your favorite utility function or macro.

2011-03-25 Thread Michael Gardner
This comes in handy for me when I'm dealing with side-effects but can't use doto: (defmacro do-with [[binding-form init-expr] & body] "Evaluates body with binding-form bound to the value of init-expr, then yields that same value." `(let [~binding-form ~init-expr] ~@body ~

Re: Your favorite utility function or macro.

2011-03-25 Thread Chouser
On Fri, Mar 25, 2011 at 8:21 AM, Meikel Brandmeyer wrote: > Ah. There it is again: the classic. > http://groups.google.com/group/clojure/browse_thread/thread/66ff0b89229be894/c3d4a6dae45d4852 It goes back further: http://clojure-log.n01se.net/date/2008-04-14.html#22:10- 23:07 In fact, I would gu

Re: Implicit unpacking of a map

2011-03-25 Thread Thorsten Wilms
On 03/25/2011 11:37 AM, Ken Wesson wrote: Interesting, but you just listed title and body twice, where the goal was to not list them at all (except in the definition of Article and in the html form, of course, though theoretically, the form could be generated from a a bit richer single definitio

Re: Implicit unpacking of a map

2011-03-25 Thread Ken Wesson
On Fri, Mar 25, 2011 at 9:03 AM, Thorsten Wilms wrote: > On 03/25/2011 11:37 AM, Ken Wesson wrote: > >>> By now I'm rather sure this would trigger an error, as nothing but an >>> immediate call of Article. seems acceptable for ds/save!. >> >> Why do you say that? Either your ds-save! is a function

I understand metadata now!

2011-03-25 Thread msappler
Never used metadata until now. I had an insight yesterday that I want to share with you: http://resatori.com/metadata-insight -- 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 pos

Re: Jesus, how the heck to do anything?

2011-03-25 Thread Tim Webster
On Mar 25, 6:54 am, ultranewb wrote: > On another note, I have unfortunately decided that I just can't do > Clojure right now.   I have been reading usenet for 20+ years, and this whole thread just became one of the most epic trolls I have ever seen. -- You received this message because you ar

Re: I understand metadata now!

2011-03-25 Thread James Reeves
On 25 March 2011 10:41, msappler wrote: > Never used metadata until now. > > I had an insight yesterday that I want to share with you: > > http://resatori.com/metadata-insight In my view, it depends whether your :id key is a surrogate key or a natural key. Object metadata should not affect objec

Re: Jesus, how the heck to do anything?

2011-03-25 Thread Shantanu Kumar
> On another note, I have unfortunately decided that I just can't do > Clojure right now.  I was never able to get anything to work except > for using the command line to "java -cp" a file that way.  No editor > or IDE ever worked (also ended up installing that IntelliJ thing - it > didn't work for

Re: I understand metadata now!

2011-03-25 Thread Ambrose B
On Fri, Mar 25, 2011 at 11:48 PM, James Reeves wrote: > > (defprotocol Identifiable >(id [self] "Return an object's unique id")) > > (deftype DBRef [db-id data] >Identifiable >(id [_] db-id) >clojure.lang.IDeref >(deref [_] data)) > > (defn db-ref [id data] >(DBRef. id d

Re: I understand metadata now!

2011-03-25 Thread Joop Kiefte
Would it be possible to create something like CL's multiple values this way? 2011/3/25 James Reeves : > On 25 March 2011 10:41, msappler wrote: >> Never used metadata until now. >> >> I had an insight yesterday that I want to share with you: >> >> http://resatori.com/metadata-insight > > In my vi

Re: Jesus, how the heck to do anything?

2011-03-25 Thread Alessio Stalla
On Thursday, March 24, 2011 2:34:02 PM UTC+1, tbc++ wrote: > > > I didn't have much trouble getting things running. Is > > the CLASSPATH really so much different to the PYTHONPATH, > > LD_LIBRARY_PATH or even the plain old PATH itself? > > No, it's not that much different, except python is a bit mo

Re: Jesus, how the heck to do anything?

2011-03-25 Thread ultranewb
On Mar 25, 11:05 pm, Shantanu Kumar wrote: > Are you using Mac, Linux or Windows? > > Okay, let me list few things out for you (assuming you are on > Windows): Yes, on Windows. Okay, I can give these things a try late tomorrow and post my results back. Thanks for helping. -- You received this

Re: I understand metadata now!

2011-03-25 Thread Alan
It's already possible, but metadata is the wrong tool. Wrap all return values that "might" have multiple values in a vector, and return/bind as many elements as you want. Add macros to make it less ugly, stir awhile, and you have multiple values. Using metadata for this purpose would have real pro

Re: Clojure in Small Pieces -- Literate Clojure

2011-03-25 Thread Christian Schuhegger
Hello, I only had time now to look at this. I am running Ubuntu 10.04 LTS "Lucid Lynx" and on my machine running the tangle program had always the effect that the clojure.pamphlet file was reduced to file size 0. Looking ad the man page for the open system call (man 2 open) says that there

open o_RDONLY patch applied

2011-03-25 Thread daly
Fixed. Thanks. --Tim On Fri, 2011-03-25 at 19:46 +0100, Christian Schuhegger wrote: > Hello, > > I only had time now to look at this. > > I am running Ubuntu 10.04 LTS "Lucid Lynx" and on my machine running the > tangle program had always the effect that the clojure.pamphlet file was > reduced

Re: Jesus, how the heck to do anything?

2011-03-25 Thread Mike Meyer
On Thu, 24 Mar 2011 06:22:49 -0700 (PDT) Meikel Brandmeyer wrote: > On 24 Mrz., 13:09, Baishampayan Ghose wrote: > IMHO the Java bashing is overrated. Coming from a polyglot-but-non- > java background, I didn't have much trouble getting things running. Is > the CLASSPATH really so much different

Re: Noob Question - Clojure number rounding

2011-03-25 Thread JDuPreez
Thanks so much for your answers. OK. So from the solutions above I understand that Clojure does not have C#'s equivalent of Math.round(7.127298, 2), and requires either using some custom method or Java's rounding? I think I'll rather go with the Java-interop approach. On Mar 23, 11:13 pm, Joost

Re: Namespace and file structuring

2011-03-25 Thread Stuart Sierra
I try to use namespaces in layers. Each namespace defines an "interface" as a set of functions, and only calls functions of the layer(s) "below" it. I build from small utilities and Java interop at the "bottom" layer, to application-level logic in the "middle" layers, with the external API in

Re: Namespace and file structuring

2011-03-25 Thread James Reeves
On 25 March 2011 01:05, Terje Dahl wrote: > In Java, the language forces you to have more or less one class pr > class-file, and you are encouraged to group class-files in packages. > So, is it as simple as saying that that namespaces are analogous to > class-files, and clj-files are analogous to

Re: Namespace and file structuring

2011-03-25 Thread Ken Wesson
On Fri, Mar 25, 2011 at 6:00 PM, Stuart Sierra wrote: > I try to use namespaces in layers.  Each namespace defines an "interface" as > a set of functions, and only calls functions of the layer(s) "below" it.  I > build from small utilities and Java interop at the "bottom" layer, to > application-l

Re: Jesus, how the heck to do anything?

2011-03-25 Thread Kasim
Hi, I actually created ClojureW for exact reason. No need to know jar files, lein, bash, maven.. nothing. It does not matter if you use Window, Linux, Mac, or Cygwin. Here is how easy it is: 1. download this file: https://bitbucket.org/kasim/clojurew/get/tip.zip 2. Unzip it to wherever you want.

Random "IllegalArgumentException: No distinct mapping found" after replacing defmultis with protocols

2011-03-25 Thread Tassilo Horn
Hi all, in my graph querying library, I had several defmultis that simply dispatched on the class of the first argument. The guys on #clojure suggested using protocols instead to get a better performance. So I did, and basically it works fine and seems to be a bit faster than before. However, w

Re: Random "IllegalArgumentException: No distinct mapping found" after replacing defmultis with protocols

2011-03-25 Thread Alan
That error message is coming from some use of (case), usually in your code but conceivably from somewhere in Clojure. It tries to do some clever bit-fiddling to generate a constant-time-dispatch on the hashcodes of its clauses, and if that fails it throws a compiler error (arguably it could degrade

Re: Random "IllegalArgumentException: No distinct mapping found" after replacing defmultis with protocols

2011-03-25 Thread Tassilo Horn
Alan writes: Hi Alan, > That error message is coming from some use of (case), usually in your > code but conceivably from somewhere in Clojure. It tries to do some > clever bit-fiddling to generate a constant-time-dispatch on the > hashcodes of its clauses, and if that fails it throws a compile

int or long as map key

2011-03-25 Thread daigo
I have just started learning Clojure. Thank you for developing a wonderful language. Is this behavior by design? If so, how can I loosely use numerical values as keys? Clojure 1.2.0 user=> (def m {1 10 2 20}) #'user/m user=> (m 2) 20 user=> (m (long 2)) nil Regards, Daigo -- You received this

Re: ClojureCLR in production ?

2011-03-25 Thread Timothy Pratley
Hi Jules On Wed, Mar 23, 2011 at 12:34 AM, Jules wrote: > I was wondering whether anyone else had ClojureCLR in production and > how they felt about it ? Whether it will be mature enough in say 3 > months to support a production app ? I've been using it for a small project and haven't run into a

Re: int or long as map key

2011-03-25 Thread David Nolen
On Fri, Mar 25, 2011 at 9:18 PM, daigo wrote: > I have just started learning Clojure. > Thank you for developing a wonderful language. > > Is this behavior by design? > If so, how can I loosely use numerical values as keys? > > Clojure 1.2.0 > user=> (def m {1 10 2 20}) > #'user/m > user=> (m 2)