Re: [emacs over ssh limitations]

2012-08-28 Thread Alan Busby
On Tue, Aug 28, 2012 at 10:29 PM, Stuart Sierra wrote: > SSH in iTerm 2 from an OS X machine to a Linux server. $TERM is > "xterm-256color" at both ends. We use this for pair-programming, so X and > tramp are not helpful. To support what Tim said, after killing an afternoon I got iTerm2 from OSX

`format` behavior on Clojure vs CLJS

2012-08-28 Thread Shantanu Kumar
Hi, I noticed that on the Clojure REPL, `format` works fine: user=> (format "foo%s" :s) "foo:s" user=> (format "foo%s" 's) "foos" However, on the CLJS REPL (Rhino), I get this: ClojureScript:cljs.user> (format "foo%s" :s) "foo���'s" ClojureScript:cljs.user> (format "foo%s" 's) "foo���'s" Wante

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread larry google groups
Thanks, Arron. I have a lot to learn about discerning the meaning of the stack traces. It said line 27, but, as you point out, the real problem was on line 28. On Tuesday, August 28, 2012 10:36:15 PM UTC-4, Aaron Cohen wrote: > > Larry, > >You are missing a bit of important code from th

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread larry google groups
That seems to be right. I just tested it and that seem to fix the problem. I am confused about why Clojure appears to give the wrong line number? Is there often a difference between the line number Emacs gives and line number in the stack trace? On Tuesday, August 28, 2012 10:34:16 PM UTC-4

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread larry google groups
So, now I do this: (defn run-server [port] (let [server-socket (ServerSocket. port "localhost")] (while (not (. server-socket isClosed)) (listen-and-respond server-socket who-is-here-now (defn -main [& args] (let [port (Integer/parseInt (first args))] (println "Server is s

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread Aaron Cohen
Larry, You are missing a bit of important code from the example in the blog post. In his original example, "echo" is a function (note the code block that begins, (defn echo ...). His "listen-and-respond" function is what handles reading from the ServerSocket, and responding back on the s

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread Mark Rathwell
See [1]. Valid ServerSocket constructors: ServerSocket() ServerSocket(int) ServerSocket(int,int) ServerSocket(int,int,InetAddress) Your code is trying: ServerSocket(int,string) [1] http://docs.oracle.com/javase/1.4.2/docs/api/java/net/ServerSocket.html On Tue, Aug 28, 2012 at 8:25 PM, larry

Re: Deprecation of Swank Clojure, long live nrepl.el

2012-08-28 Thread Andy Fingerhut
The issue with an exception when trying to find the doc of a namespace is a known issue, and should be fixed in Clojure 1.5 when it is released: http://dev.clojure.org/jira/browse/CLJ-902 You could try out clojure-1.5.0-alpha4 to see if it fixes the problem for you, if that happens to be conven

Re: Is this a bug in core.match?

2012-08-28 Thread David Nolen
On Tue, Aug 28, 2012 at 7:01 PM, Brian Marick wrote: > Observe: > > user=> (defn count-sequence [& seq] > (match [seq] > ; [([so-far [x & xs]] :seq)] (str "1:" so-far x xs) >[([[& sequence]] :seq)] (str "2:" sequence))) > user=> (count-sequence [1 2 3]) > "2:[1 2 3]" > > Now uncomment the

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread larry google groups
I apologize about the beginner questions. I am new to Clojure. If I do this: (defn run-server [port what-to-do] (let [server-socket (ServerSocket. port "localhost")] (while (not (. server-socket isClosed)) (listen-and-respond server-socket what-to-do (defn -main [& args] (let

Re: Is this a bug in core.match?

2012-08-28 Thread Brian Marick
This may also be relevant. The following works: (defn factorial [& args] (match [args] [([n] :seq)](factorial 1 n) [([so-far 1] :seq)] so-far [([so-far n] :seq)] (factorial (* n so-far) (dec n user=> (factorial 5) 120 However, changing the order of clauses st

Is this a bug in core.match?

2012-08-28 Thread Brian Marick
Observe: user=> (defn count-sequence [& seq] (match [seq] ; [([so-far [x & xs]] :seq)] (str "1:" so-far x xs) [([[& sequence]] :seq)] (str "2:" sequence))) user=> (count-sequence [1 2 3]) "2:[1 2 3]" Now uncomment the commented line: user=> (defn count-sequence [& seq] (match [seq]

Re: How to avoid "Attempting to call unbound fn:..."

2012-08-28 Thread Armando Blancas
Nelson, that explained the case quite nicely. I appreciate it. On Tuesday, August 28, 2012 1:01:32 PM UTC-7, Nelson Morris wrote: > > On Tue, Aug 28, 2012 at 1:08 PM, Armando Blancas > > > wrote: > > I'm playing around with a parser combinator library from the paper > Monadic > > Parser Combi

Re: How to avoid "Attempting to call unbound fn:..."

2012-08-28 Thread Nelson Morris
On Tue, Aug 28, 2012 at 1:08 PM, Armando Blancas wrote: > I'm playing around with a parser combinator library from the paper Monadic > Parser Combinators by Hutton and Meijer [1] and came up with this: > > https://gist.github.com/3501273 > > That's just enough to show the error I'm getting when (e

Re: Clojure group in DFW area

2012-08-28 Thread Alex Robbins
Hey guys, sorry about the radio silence. Unofficially, it looks like the meetup will be: Third Wednesday of the month, 6:30-8:30 PM At Improving Enterprises in Addison, just off the Dallas North Tollway We are also working on getting a meetup group set up so that there will be a place to get info

Re: Clojure group in DFW area

2012-08-28 Thread gblack
Did you guys settle on having more meetings? The Farmers Branch location works for me. On Thursday, March 10, 2011 7:28:10 AM UTC-6, Alex Robbins wrote: > > Anyone else in the north Dallas area using/interested in Clojure? I'd > love to get together. > > Alex -- You received this message beca

How to avoid "Attempting to call unbound fn:..."

2012-08-28 Thread Armando Blancas
I'm playing around with a parser combinator library from the paper Monadic Parser Combinators by Hutton and Meijer [1] and came up with this: https://gist.github.com/3501273 That's just enough to show the error I'm getting when (expr) calls (factor): Clojure 1.4.0 user=> (load-file "expr.clj")

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread larry google groups
>Command line arguments that are not strings need to be converted > prior to use by your main function. That makes sense, I need to cast it to a symbol, yes? I have a problem with that though. At the REPL I tried something like this: (def hey (resolve (symbol what-to-do))) which worked grea

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread larry google groups
> > The ctor call for ServerSocket should be (ServerSocket. port "localhost"). Thanks, but the code doesn't get that far. It's the line before that throws the error: (defn run-server [port what-to-do] On Tuesday, August 28, 2012 7:49:54 AM UTC-4, Fogus wrote: > > The ctor call for S

Re: Parser combinators in parsatron

2012-08-28 Thread Alexsandro Soares
Armando, Nate and Panduranga Many thanks for the answers. Regards, Alex 2012/8/28 Nate Young > On Thu, Aug 23, 2012 at 11:22 AM, Alexsandro Soares > wrote: > > Can you provide the code for this? > Certainly. > > The parser's current source position is stored in the InputState > record's `p

Re: Deprecation of Swank Clojure, long live nrepl.el

2012-08-28 Thread Warren Lynn
With Tim's pointer, I worked around the completion exception on namespace by redefining the resolve-class. However, there is still another problem: If my cursor stops at the end of a namespace without any slash, like this "(clojure.set", I got an exception again. This time, the exception is t

Anyone going to PPSN?

2012-08-28 Thread Lee Spector
Maybe a long shot, but are any Clojurians going to the "Parallel Problem Solving from Nature" conference in Sicily later this week (http://www.dmi.unict.it/ppsn2012/)? I'll be giving a tutorial there that will cover genetic programming work currently being done in Clojure (https://github.com/l

Re: Destructuring can create structure..?

2012-08-28 Thread Justin Kramer
Vector-as-map destructuring makes sense when you consider that vectors are associative: they map index to value. (let [{a 1 b 3 :as c} [:a 1 :b 2]] [a b c]) => [1 2 [:a 1 :b 2]] Justin On Tuesday, August 28, 2012 8:30:58 AM UTC-4, Douglas Orr wrote: > > One possibly confusing titbit I came acro

Re: A Performance Comparison of SBCL & Clojure

2012-08-28 Thread Ben Mabey
Thanks Andy for the insightful report! I knew you and others have worked hard on the benchmarks so this kind of analysis is very helpful. Thanks for all your work on them, Ben On 8/28/12 12:07 AM, Andy Fingerhut wrote: I've written several of the Clojure programs on the site. I'm not omniscie

Re: Parser combinators in parsatron

2012-08-28 Thread Nate Young
On Thu, Aug 23, 2012 at 11:22 AM, Alexsandro Soares wrote: > Can you provide the code for this? Certainly. The parser's current source position is stored in the InputState record's `pos` field. That field is a SourcePos record consisting of the current line and column position. Most parsers, howe

Re: [emacs over ssh limitations]

2012-08-28 Thread Stuart Sierra
SSH in iTerm 2 from an OS X machine to a Linux server. $TERM is "xterm-256color" at both ends. We use this for pair-programming, so X and tramp are not helpful. -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Destructuring can create structure..?

2012-08-28 Thread Douglas Orr
One possibly confusing titbit I came across recently relates to how Clojure handles destructuring of variable-length argument lists. The essence is that the destructuring form can appear to influence the 'shape' of the collection of arguments. Here is what I mean: take nothing off the head of t

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread Meikel Brandmeyer (kotarak)
And service should not be a string. Am Dienstag, 28. August 2012 13:49:54 UTC+2 schrieb Fogus: > > The ctor call for ServerSocket should be (ServerSocket. port "localhost"). > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, se

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread Moritz Ulrich
Check the type of `port'. Seems like arguments from the command line gets passed as strings. You need to convert them to a number: (Integer. port-string) Cheers, Moritz larry google groups writes: > So, this started when I read Keith Swallow's article on a simple web server: > > http://keithce

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread Jon Boone
Command line arguments that are not strings need to be converted prior to use by your main function. Look at the code for the port number and do the same for the service. --jon On Aug 28, 2012, at 2:42, larry google groups wrote: So, this started when I read Keith Swallow's article on a simp

Re: function parameters were working, and now I suddenly get a cast error

2012-08-28 Thread Michael Fogus
The ctor call for ServerSocket should be (ServerSocket. port "localhost"). -- 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

Re: A Performance Comparison of SBCL & Clojure

2012-08-28 Thread David Nolen
Yes. Look at test.benchmark. Java is the baseline there. We don't accept Clojure versions that are not competitive. On Monday, August 27, 2012, Ben Mabey wrote: > Looking at clojure's benchmarks they seem to already be highly optimized > (in terms of employing all the standard tricks). Does any

Re: Clojure Sticker

2012-08-28 Thread dmirylenka
I've got my stickers! So happy... On Friday, July 6, 2012 11:09:29 AM UTC+2, dmirylenka wrote: > > +1 > > On Sunday, June 10, 2012 3:03:46 AM UTC+2, aboy021 wrote: >> >> Is there anywhere that I can get a Clojure sticker? > > -- You received this message because you are subscribed to the Google

Re: clj-http's json + enlive's selectors

2012-08-28 Thread Herwig Hochleitner
2012/8/27 Denis Labaye > Fetch JSON with clj-http AND extract informations from it with enlive. > > Does anyone know what's the most straightforward way to do that? > Enlive currently is tied to selecting and transforming XML. I have a branch of enlive on my computer, on which I've decoupled enl

Re: [emacs over ssh limitations]

2012-08-28 Thread Tim Cross
Hi Stuart, can I ask what platform are you sshing from and what terminal you are using? I use emacs over ssh a lot and while I have encountered some of the issues you mention, they are in a far more limited way. For example, I have found different behaviour between delete and sometimes, Alt d