Re: "let" a variable number of bindings

2009-07-17 Thread Meikel Brandmeyer
Hi, Am 18.07.2009 um 05:52 schrieb Rowdy Rednose: How can I lexically bind names like "let" does in a macro, when names and values for those bindings are passed in? You can't. A macro cannot depend on runtime information (for some suitable definition of "runtime information", I know). In a c

Text log viewer in clojure updates

2009-07-17 Thread BerlinBrown
Here is an update to my log viewer in clojure. It mostly works on win32 and I hope to get it past an alpha release., but if you are interested in gui applications in clojure, all source is provided. http://code.google.com/p/lighttexteditor/wiki/LightLogViewer If you run it, I will be happy. --~

"let" a variable number of bindings

2009-07-17 Thread Rowdy Rednose
How can I lexically bind names like "let" does in a macro, when names and values for those bindings are passed in? This here works fine when I pass a literal collection: (defmacro let-coll [coll & body] `(let ~(vec coll) ~...@body)) user=> (let-coll [a 11 b 22] (list b a)) (22 11) Doing th

Loop, Recur, and Binding

2009-07-17 Thread Tim Snyder
I was experimenting with how binding behaves within a loop and found some inconsistent results: (def y 0) (loop [x 0] (println "x " x) (binding [y (inc y)] (println "y " y) (if (< x 10) (recur (inc x) The printed lines are what you'd expect: x 0 y 1 x 1 ... x 10 y 11 But if

Re: binding issue

2009-07-17 Thread Jonathan Smith
On Jul 14, 5:12 pm, Stuart Sierra wrote: > On Jul 14, 3:01 pm, bgray wrote: > > > Ok, so *if* this is intended behavior, what have people been doing to > > bind variables dependant on other bindings?  I can't be the first to > > run into this. > > Just nest multiple binding forms: > (binding [

Re: Is there a standard function testing if a sequence starts with a sequence

2009-07-17 Thread John Harrop
On Fri, Jul 17, 2009 at 4:41 PM, Mark Engelberg wrote: > > On Fri, Jul 17, 2009 at 1:32 PM, samppi wrote: > > > > Is there a function in clojure.core or clojure.contrib so that: > > (and (mystery-fn '(a b c d) '(a b)) > >(not (mystery-fn '(a b c d) '(a b d > > > how about something li

Re: comment macro not ignoring contents

2009-07-17 Thread philip.hazel...@gmail.com
On Jul 17, 1:52 pm, Rich Hickey wrote: > #_ does what you want: > > user=> (list 1 2 #_42 3) > (1 2 3) Thanks for pointing that out. I notice this is actually on the reader page - apologies for not looking properly. --~--~-~--~~~---~--~~ You received this message

Re: How to use vimClojure?

2009-07-17 Thread Dragan Djuric
Thanks! :) On Jul 17, 5:08 pm, Meikel Brandmeyer wrote: > Hi, > > On Jul 17, 3:51 pm, Dragan Djuric wrote: > > > I have installed vimClojure and it seems to work, but... how to push > > the code to the REPL? > > Ok. Let's see. Step by step... > > 0. Start ng-server > 1. Start a fresh vim. > 2.

Re: Experiment with named args

2009-07-17 Thread Mark Addleman
Chouser - Can you describe definline and how that differs from defmacro? I'm not sure I understand it from reading the docs. On Jul 17, 10:06 am, Chouser wrote: > On Fri, Jul 17, 2009 at 12:17 PM, Laurent PETIT > wrote: > > > 2009/7/17 Chouser > > >> On Fri, Jul 17, 2009 at 11:21 AM, Mark >

Re: Is there a standard function testing if a sequence starts with a sequence

2009-07-17 Thread samppi
Awesome, thanks for the quick answer. I think that it'd be a useful thing to add to seq-utils or something. :) On Jul 17, 1:41 pm, Mark Engelberg wrote: > On Fri, Jul 17, 2009 at 1:32 PM, samppi wrote: > > > Is there a function in clojure.core or clojure.contrib so that: > >  (and (mystery-fn '(

Re: Is there a standard function testing if a sequence starts with a sequence

2009-07-17 Thread Mark Engelberg
On Fri, Jul 17, 2009 at 1:32 PM, samppi wrote: > > Is there a function in clojure.core or clojure.contrib so that: >  (and (mystery-fn '(a b c d) '(a b)) >        (not (mystery-fn '(a b c d) '(a b d how about something like: (defn mystery-fn [l1 l2] (every? identity (map = l1 l2))) --~--~--

Is there a standard function testing if a sequence starts with a sequence

2009-07-17 Thread samppi
Is there a function in clojure.core or clojure.contrib so that: (and (mystery-fn '(a b c d) '(a b)) (not (mystery-fn '(a b c d) '(a b d --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. T

Re: Very minor problem in the REPL

2009-07-17 Thread John Harrop
On Fri, Jul 17, 2009 at 11:31 AM, Stephen C. Gilardi wrote: > It looks like somehow you're seeing a very old REPL or it's not the default > REPL you get from launching Clojure via clojure.main. > I can confirm the described behavior for the enclojure REPL. --~--~-~--~~~--

Re: How to achieve indirection?

2009-07-17 Thread Adam Smyczek
A maybe related newbie question. How common is it for Clojure to separate the two implementations into different libraries? For example, in an application I create one lib that contains just the data for the app (app.data) and two other libraries that provide the functions on the data (app.d

Re: Experiment with named args

2009-07-17 Thread Chouser
On Fri, Jul 17, 2009 at 12:17 PM, Laurent PETIT wrote: > > 2009/7/17 Chouser >> >> On Fri, Jul 17, 2009 at 11:21 AM, Mark >> Addleman wrote: >> > >> > On Jul 17, 2:35 am, Nicolas Oury wrote: >> >> Hello, >> >> >> >> Can this construct handle higher-order functions? >> > >> > Nope :) >> > >> > Ch

Re: comment macro not ignoring contents

2009-07-17 Thread Richard Newman
> (I once tried to write a reader macro for CL which would do this, but > the best I got was one which would read two forms and ignore the > first.) The usual technique in Common Lisp is cl-user(1): (list 1 2 #+(or) 3 4) (1 2 4) You can improve readability by using #+:never or somesuch, but tha

Re: Experiment with named args

2009-07-17 Thread Laurent PETIT
2009/7/17 Chouser > > On Fri, Jul 17, 2009 at 11:21 AM, Mark > Addleman wrote: > > > > On Jul 17, 2:35 am, Nicolas Oury wrote: > >> Hello, > >> > >> Can this construct handle higher-order functions? > > > > Nope :) > > > > Chouser brought up this point in IRC. It's not even clear what the > > s

Re: Experiment with named args

2009-07-17 Thread Laurent PETIT
Hi, 2009/7/17 Mark Addleman > > > > On Jul 16, 11:50 pm, Laurent PETIT wrote: > > 2009/7/17 Mark Addleman > > > > > > > > > "The "sufficiently smart compiler" argument > > > comes to mind: if the arglist of a function is known, then surely > > > the > > > compiler should be able to automatic

Re: Examining performance on the JVM

2009-07-17 Thread Bradbev
On Jul 16, 12:58 am, Christian Vest Hansen wrote: > I haven't tried to look beyond the JIT to see what it does, so I > wouldn't know which tools to use, but if you do not already know about > it, you might find the HotSpot Internals wiki to be an interesting > source of info:http://wikis.sun.com/

Re: Experiment with named args

2009-07-17 Thread Chouser
On Fri, Jul 17, 2009 at 11:21 AM, Mark Addleman wrote: > > On Jul 17, 2:35 am, Nicolas Oury wrote: >> Hello, >> >> Can this construct handle higher-order functions? > > Nope :) > > Chouser brought up this point in IRC.  It's not even clear what the > syntax would look like. I suppose you could p

Re: Very minor problem in the REPL

2009-07-17 Thread Stephen C. Gilardi
On Jul 17, 2009, at 9:05 AM, AlamedaMike wrote: As I say, technically very trivial, but it violates the principal of least surprise (for me). I bring it up only because of reasons of broader acceptance by the business community. I know how some of them think, and even trivial stuff like this wi

Re: Experiment with named args

2009-07-17 Thread Mark Addleman
On Jul 17, 2:35 am, Nicolas Oury wrote: > Hello, > > Can this construct handle higher-order functions? Nope :) Chouser brought up this point in IRC. It's not even clear what the syntax would look like. > (I mean a function with named arguments as an argument to another > function). > It see

Re: Experiment with named args

2009-07-17 Thread Mark Addleman
On Jul 16, 11:50 pm, Laurent PETIT wrote: > 2009/7/17 Mark Addleman > > > > > "The "sufficiently smart compiler" argument > >  comes to mind: if the arglist of a function is known, then surely > > the > >  compiler should be able to automatically translate named/keyword > >  arguments into an

Re: How to use vimClojure?

2009-07-17 Thread Meikel Brandmeyer
Hi, On Jul 17, 3:51 pm, Dragan Djuric wrote: > I have installed vimClojure and it seems to work, but... how to push > the code to the REPL? Ok. Let's see. Step by step... 0. Start ng-server 1. Start a fresh vim. 2. :setfiletype clojure (a colon command like :w or :q) 3. \sr (should open a new

Re: easiest JMX API ever, in Clojure...

2009-07-17 Thread Daniel
On Fri, Jul 17, 2009 at 7:59 PM, Michael Wood wrote: > > 2009/7/16 Daniel : >> >> On Thu, Jul 16, 2009 at 10:20 PM, Michael Wood wrote: > [...] >>> What I am wondering now is whether it's possible to use JBoss' RMI >>> connector/object server (on port 1099) with Stuart's JMX library.  If >>> I jus

How to use vimClojure?

2009-07-17 Thread Dragan Djuric
Hi, I have installed vimClojure and it seems to work, but... how to push the code to the REPL? I have defined a function, typed \sr -> REPL started... the fn is not accessible... tried typinf \ef '\el and their cousins to the vim command but nothing happens. I am a notal novice to vim, so the so

Re: Very minor problem in the REPL

2009-07-17 Thread Andrew Wagner
Sounds like a good application of the broken window principle to me. On Fri, Jul 17, 2009 at 9:05 AM, AlamedaMike wrote: > > This is so trivial from a technical standpoint I'm embarrassed to > mention it. The REPL is accepting more than one sexp on a line and > then generating output for all of

Very minor problem in the REPL

2009-07-17 Thread AlamedaMike
This is so trivial from a technical standpoint I'm embarrassed to mention it. The REPL is accepting more than one sexp on a line and then generating output for all of them in an unusual fashion. In the following, all text after the first line is generated by clojure (except for the comment, of co

Re: easiest JMX API ever, in Clojure...

2009-07-17 Thread Michael Wood
2009/7/16 Daniel : > > On Thu, Jul 16, 2009 at 10:20 PM, Michael Wood wrote: [...] >> What I am wondering now is whether it's possible to use JBoss' RMI >> connector/object server (on port 1099) with Stuart's JMX library.  If >> I just try pointing it at port 1099 I get: >> >> java.io.IOException:

Re: comment macro not ignoring contents

2009-07-17 Thread Rich Hickey
On Fri, Jul 17, 2009 at 8:13 AM, philip.hazel...@gmail.com wrote: > > On Jul 17, 4:56 am, Richard Newman wrote: >> If you want unsyntactic input in your file, comment it out with >> semicolons. >> >> Adding true block comments -- #| |# -- is on the to-do list. > While we're on the subject, are th

Re: comment macro not ignoring contents

2009-07-17 Thread philip.hazel...@gmail.com
On Jul 17, 4:56 am, Richard Newman wrote: > If you want unsyntactic input in your file, comment it out with   > semicolons. > > Adding true block comments -- #| |# -- is on the to-do list. While we're on the subject, are there any plans for a sexp-comment? Essentially I'm looking for reader synta

Re: Algorithm help

2009-07-17 Thread Mark Triggs
Heheh, three times slower but gives the wrong answer--maybe not a great trade-off :o) I'd misread the way the last if statements work in the Python version. I modified mine to read: (defn backtrack-all [c x y i j] (cond (or (zero? i) (zero? j)) #{""} (= (get x (dec i)) (get y

Re: Experiment with named args

2009-07-17 Thread Nicolas Oury
Hello, Can this construct handle higher-order functions? (I mean a function with named arguments as an argument to another function). It seems quite difficult to do a function dependent transformation on the call site when the function is unknown. Best regards, Nicolas. On Thu, 2009-07-16 at 1

Re: Algorithm help

2009-07-17 Thread martin_clausen
Thanks. Your code is definitely much more idiomatic Clojure - and 3X faster. The lcs function does exactly what it is suppose to, but the backtrack-all function only returns the first LCS found(for the strings "AATCC" "ACACG" => ("ACC"), whereas the Python version returns all the LCSes found (for