suitability of Clojure for implementing new languages?

2009-04-03 Thread alex
have any comments about how appropriate Clojure would be for implementing new programming languages? thanks, Alex Mitchell --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gr

Re: Reminder: Bay Area Clojure User Group meeting in SF during JavaOne (6/3) with Rich Hickey

2009-06-10 Thread Alex
Just wanted to say I had a great time at the meetup. Really fun to see people using Clojure in earnest and hear Rich talk about stuff. I blogged it a bit here: http://tech.puredanger.com/2009/06/10/clojure-rich-hickey/ On Jun 4, 11:44 am, Paul Mooser wrote: > I wanted to say thank you to eve

Clojure contrib http-agent hangs when making a POST request

2009-10-30 Thread Alex
mething in the (string ... ) function is causing it to hang if the response has not yet completed. Anyone have any idea what might be causing this? Thanks, Alex Does anyone have any ideas why --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Clojure contrib http-agent hangs when making a POST request

2009-10-31 Thread Alex
Rob, that's perfect. Thanks very much for looking into that and supplying the patch. Hopefully we can get that applied to the source in git. On Oct 30, 9:58 pm, Rob Wolfe wrote: > Alex writes: > > Hi, > > > I'm getting some strange errors when trying to make

scope of binding

2010-02-08 Thread Alex
Hi, I have a question about the scope of "binding" of a var. Let's say I have the following var: (def *v* 1) And I define a function that uses it: (defn f [n] (+ *v* n)) "binding" behaves as expected, establishing a thread-local binding to a new value in its scope: user=> (bindin

Re: scope of binding

2010-02-09 Thread Alex
D'oh! Thanks. I fall for that trap yet again. Sounds so simple when explained. 2010/2/9 Sean Devlin : > The problem is that map returns a lazy seq, and the lazy seq is > evaluated outside of the binding by the REPL.  If you add a doall > inside the binding, it behaves as you expect. > > user=> (b

Re: Negation in core.logic

2013-08-09 Thread Alex
Hi, Norman Richards, In the example, "arg" and "goal" were not literal but were meant to be replaced with something appropriate to whatever you are trying to do. Yes, unless you use a projected value, it is equivalent to precomputing it outside the run*. The point was that, although very hacky, th

Sum up second elemsts of pairs in a sequence by grouping by the first item in pair

2015-03-19 Thread Alex
Hello everybody, How to transform sequence *[[1 0.5] [1 0.7] [2 1.0] [3 0.1] [3 0.1]]* to *[[1 1.2] [2 1.0] [3 0.2]]* ? Best regards, Alex -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Functional Programming Jobs across the globe! www.functionalworks.com

2016-09-13 Thread alex
Check out our new platform (built in Clojure/Clojurescript), the one stop shop for Functional Programming roles across the globe. Check it out .. www.functionalworks.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Functional Programming Job Board - Clojure

2017-10-20 Thread alex
Morning Everyone, For those of you that are looking for your next FP gig then check out the worlds leading Functional Programming job board! Functional Works <https://functional.works-hub.com/?utm_source=Clojure-google-group&utm_medium=Google-group&utm_campaign=alex> thanks,

Re: Best Book for Clojure

2018-03-16 Thread alex
That's very subjective, but I'd vote for "Joy of Clojure" for understanding ideas behind language design and some idiomatic use cases. I'd not recommend "Clojure Programming" for start, as it's very comprehensive and dives deep into detailes(which was a minus when I was starting with Clojure an

Re: [ANN] A complete draft of "Elements of Clojure" is available

2018-03-16 Thread alex
Thanks for your work Zach пятница, 16 марта 2018 г., 18:21:19 UTC+2 пользователь Zach Tellman написал: > > Almost exactly two years ago, I announced on this mailing list that I was > working on an intermediate-level book on Clojure [1], and released the > first chapter. I've confined updates si

[ANN] zakon 0.1.0

2018-07-06 Thread alex
Zakon is declarative authorization library which unleashes all the power of multimethods. Github: https://github.com/dawcs/zakon -- 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: (type ...) vs (class ...)

2018-10-24 Thread alex
Looks like pre defrecord stuff used in early days to add "type" to map. Can still be used if you need "type" on a map without using defrecord. среда, 24 октября 2018 г., 10:30:14 UTC+3 пользователь Didier написал: > > Reviving this thread, as I'd like to kmow if someone can explain the > purpose

[ANN] flow 0.3.1

2018-10-25 Thread alex
flow is a tiny library for declarative errors handling without monads https://github.com/dawcs/flow -- 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 mode

Re: An Error spec?

2018-11-07 Thread alex
How about using exception instances as errors? That plays pretty nicely with ex-info and (try ... (catch Exception e e)). I've built https://github.com/dawcs/flow on top of that approach and that seems like pretty good abstraction. Despite I'm not sure about CLJS. Anomalies are also great and y

Re: [ANN] 1.10.0-beta5

2018-11-08 Thread alex
ue, and you can return a plussed up version with new capabilities, > without having to return a wrapped value. Wrapped values are sometimes > problematic because they introduce new representations of existing types, > and this allows an API to return values to the caller that behave the same

Re: An Error spec?

2018-11-08 Thread alex
's View -- http://corfield.org/ > > "If you're not annoying somebody, you're not really alive." > -- Margaret Atwood > > > -- > *From:* clo...@googlegroups.com > on behalf of alex > > *Sent:* Wednesday, November 7, 2018

Re: An Error spec?

2018-11-09 Thread alex
s** should be called **catch-from* *to make its purpose more clear without reading docstring. пятница, 9 ноября 2018 г., 8:05:18 UTC+2 пользователь Sean Corfield написал: > > Alex, I’m curious, should this > https://github.com/dawcs/flow/blob/master/src/dawcs/flow.clj#L53 use * >

Re: Clojure 1.10 issue: thrown? no longer works on macros

2018-12-18 Thread alex
I'm not sure, but probably it behaves so because of throwing at macroexpand stage. вторник, 18 декабря 2018 г., 11:29:09 UTC+2 пользователь puzzler написал: > > Consider the following macro: > > (defmacro f [x] {:pre [(number? x)]} `(+ ~x 5)) > => (f 3) > 8 > => (f true) > Unexpected error (Asser

Scala/Clojure/F# - Functional Programming Advocates - New York/Chicago/San Fran

2016-02-01 Thread alex
...@functionalworks.com Paying up to $180,000 + Benefits + Bonus + Stock! Look forward to hearing from you. thanks, Alex Mesropians -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Clojure Engineer - Top Tech House - Chicago - $180,000 +

2016-02-15 Thread alex
finding out all the details drop me a line a...@functionalworks.com thanks, Alex -- 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 -

Contract - 3 Months - Clojure/Clojurescript/Reagent - London

2016-04-21 Thread alex
Morning, I have just had a 3 month contract come up for a Clojure/Clojurescript/Reagent engineer here in London. Working for a top Clojure house! Drop me a line for more info or if you are interested! a...@functionalworks.com thanks, Alex -- You received this message because you are

Possible bug in clojure.java.jdbc

2013-02-05 Thread alex
Hey all, I've been using clojure.java.jdbc to write a simple database app. When I use the `update-or-insert-values` function, I get an SQLException thrown whenever my column names have special characters in them (like a space or an ampersand). I think the solution is in line 908: the column-str

Re: Possible bug in clojure.java.jdbc

2013-02-05 Thread alex
@Andy: Sorry, I didn't know the proper channel, I'll post it there. I don't control the column names. They're imported from an excel spreadsheet or assigned by the client I'm writing the app for. From experience, it is certainly *possible*, at least to add these columns. Currently I just have a

lein > swank > Aquamacs > slime-connect test failed. Help!

2010-09-28 Thread Alex
o change on the slime-repl clojure side. I realize how little I understand about all this but would love to get started. Any advice much appreciated. Thanks Alex -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send em

Re: lein > swank > Aquamacs > slime-connect test failed. Help!

2010-09-28 Thread Alex
I wrote this immediately after writing the code and running the test. I should have waited a bit because in retrospect the test is bound to fail. Guessing I should have used a transaction. On Sep 28, 7:17 pm, Alex wrote: > I'm new at clojure+emacs+slime+swank+leiningen and I wanted

Re: lein > swank > Aquamacs > slime-connect test failed. Help!

2010-09-29 Thread Alex
On Sep 29, 1:08 pm, Phil Hagelberg wrote: > On Tue, Sep 28, 2010 at 4:17 AM, Alex wrote: > > $ lein swank > > user=> Connection opened on local port  4005 > > # > 127.0.0.1,port=0,localport=4005]> > > > First question: why no visible output? > > Runn

Clojure Community Values

2012-01-27 Thread alex
If you have trouble viewing or submitting this form, you can fill it out online: https://docs.google.com/spreadsheet/viewform?formkey=dFpleU1QbVRyLWVXVElRMmJpQlpoYWc6MQ Clojure Community Values For no particular reason I got to thinking about things the Clojure community values in the styl

Re: Learning Clojure

2008-12-11 Thread Alex Burka
t is, the first screen) it is off-putting for some reason. After all, it is a programming language. Alex On Dec 11, 2008, at 12:55 AM, Timothy Pratley wrote: > > Hi Brian, > > >> Rich talks about destructuring in the part about "let" on the >> "special &

Gorilla: key combinations

2008-12-15 Thread Alex Burka
before the "EOF" line in gorilla.vim, but I imagine that shouldn't be necesssary. Alex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Re: Method overloading & proxy method

2009-05-05 Thread Alex Osborne
On Mar 23, 9:55 am, ronen wrote: > [... what] I actually need is a way of overriding specific methods (like the > visit > (MethodDeclaration n, A arg) and not all of them. I keep running into this problem again and again myself, so I thought I might post some notes. The short of it: doing anyt

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-25 Thread Alex Combas
How about the name: jecl "jecl" breaks down: (j)ecl = (j)ava j(ec)l = (ec)lipse je(cl) = (cl)ojure jecl.net is not registered (yet) "develop clojure on eclipse with jecl" has a ring to it, I think ..and of course there is the story of Jekyll(clojure) and Hyde(java) where Jekyll is a good docto

Re: [OT] Convincing others about Clojure

2009-06-25 Thread Alex Combas
I'm no expert but I love to argue, so this is what I would say: On Wed, Jun 24, 2009 at 10:59 PM, Baishampayan Ghose wrote: > > > Their concerns are thus: > > 1. How do you get Clojure programmers? Lisp is not for the faint hearted. There has been a lot of re-newed interest in lisp over the past

Re: [OT] github (?) question

2009-06-26 Thread Alex Combas
need to either find the link on the clojure.org website or else make an educated guess. Best regards, Alex On Fri, Jun 26, 2009 at 12:48 AM, Laurent PETIT wrote: > Hi, this is an OT question, but since Rich encouraged git gurus here on the > ml to on help non gurus, then I ask :-) &

Re: [OT] Convincing others about Clojure

2009-06-26 Thread Alex Combas
Thats great to hear, hope everything goes well, let us know how it turns out! Best regards, agc On Fri, Jun 26, 2009 at 1:55 AM, Baishampayan Ghose wrote: > Laurent, > > > Out of curiosity, which (combination of) advice do you think 'closed the > > deal' ? > > Well, the guy is a real startup v

Re: java.ext.dirs problem

2009-06-27 Thread Alex Combas
Hello, Undoubtedly it is not the best solution, but all I do is export a variable called CLASSPATH pointing to whichever directories I want to require or load. # append to your .bashrc script # Start CLASSPATH=/home/user/aaa:/home/user/bbb:$CLASSPATH export CLASSPATH # End The only gotcha so far

Re: Troll in our midst - please ignore them

2009-06-28 Thread Alex Combas
Hi Rich, Does this mean you're going to be moderating every post, or just posts from new accounts? Either way, perhaps you could start looking around for a couple of people who would do this job of moderating for you because I'm sure I'm not alone in thinking that your time would be best used else

Re: Troll in our midst - please ignore them

2009-06-28 Thread Alex Combas
On Sun, Jun 28, 2009 at 10:21 PM, CuppoJava wrote: > > Thank you Denfer, > That's a very interesting trick. I'm sure it'll be handy to me in the > future. I really never considered trolls a possibility on this forum. > It seems if that sort of thing interests you, there's much easier and > satisfy

Clojure Workshop in London next Monday

2009-07-14 Thread Alex Scordellis
re or any Lisp to get involved, but more experienced hands will be very welcome to guide us through the learning experience. All the info, including sign up link, here http://londongeeknights.wetpaint.com/page/Clojure+Workshop Hope to see some of you there, Alex --~--~-~--~~~--

FYI Bug in "Programming Clojure" clojure download, wrt clojure.contrib.repl-utils/source

2009-07-21 Thread Alex Stoddard
eir source with that version of clojure.jar (apparently an old Clojure 1.1.0-alpha-SNAPSHOT). Used with either clojure.1.0.0.jar or an up to date clojure 1.1.0- alpha built from GitHub, the clojure.contrib.repl-utils/source function works fine. Kind re

London Clojurians

2009-07-22 Thread Alex Scordellis
t let me post a welcome message - does anyone know what I can do about this? Alex [1] http://londongeeknights.wetpaint.com/page/Clojure+Workshop --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" gro

Re: Clojure Workshop in London next Monday

2009-07-27 Thread Alex Scordellis
@Andrew, glad you enjoyed it :-) @Jim, sorry you missed it :-( There was quite a lot of interest in organising something to follow on from last Monday's event, so I've created a mailing list for London Clojure activity [1]. The next TW geek night is a pairing workshop [2] on September 8. [1] h

Re: Unable to use contrib

2009-10-06 Thread Alex Osborne
ot; to it. This means that you have to qualify lcm with the full namespace, like this: user=> (clojure.contrib.math/lcm 4 5) 20 You probably want "use" instead of "require", like this: user=> (use 'clojure.contrib.math) nil user=> (lcm 4 5) 20 Hope that

Re: Basic questions

2009-10-08 Thread Alex Osborne
s that are functions. So something like: (defn ns-functions [ns] (for [[n, v] (ns-publics ns) :when (and (.isBound v) (instance? clojure.lang.Fn @v))] n)) (ns-functions 'clojure.xml) => (star

Re: Duplicated keys in maps

2009-10-11 Thread Alex Osborne
On Oct 12, 11:55 am, Angel Java Lopez wrote: > I just discovered that maps support duplicated keys: > What is the rationale behind this behaviour? No, maps don't support duplicate keys. What you're seeing is due to an implementation detail in how array-maps are created from literals. You'll not

Re: Unable to resolve var

2009-10-11 Thread Alex Osborne
gt; more idiomatic way? (nth (lex-permutations [0 1 2 3 4 5 6 7 8 9]) 99) [Indexing starts at 0 so we use 99 instead of 100.] Cheers, Alex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure&quo

Re: JVM Language Summit talk on state, identity, time

2009-10-16 Thread Alex Osborne
Garth Sheldon-Coulson wrote: > In his blog post Rich mentioned his JVM Language Summit talk > on state, identity, value, time, etc. > > Does anyone know if audio or video was recorded, or (if Rich is reading > this) if there are more comprehensive notes to be gotten? The conclusion of it is her

Re: difference between into & concat

2009-10-18 Thread Alex Osborne
DemAS wrote: > I'm just wondering if there is any difference between 'into' and > 'concat' ? There are actually more differences than similarities in my opinion. For starters, 'concat' can take more than 2 arguments: (concat [1 2] [3 4] [5 6]) => (1 2 3 4 5 6) 'into' returns whatever col

Re: Best way to run multiple filters on the same [lazy] collection?

2009-10-18 Thread Alex Osborne
Meikel Brandmeyer wrote: > Maybe you can do: > > (reduce (fn [[sales upgrades demo :as v] data] >(cond > (is-sales? data) [(conj sales data) upgrades demo] > (is-upgrade? data) [sales (conj upgrades data) demo] > (is-demo? data)[sales upgra

Re: Best way to run multiple filters on the same [lazy] collection?

2009-10-18 Thread Alex Osborne
Alex Osborne wrote: > If the three output lists themselves are too large, I'd just explicitly > sum your units with reduce: > > (reduce > (fn [counts data] > (let [type (record-type data)] > (assoc counts type (+ (units data) >

Re: ANN: Clojure live-repl

2009-10-18 Thread Alex Osborne
David Powell wrote: > It uses the Java Attach API to let you connect a Clojure REPL to any running > Java or Clojure process, without them requiring any special startup. Exceedingly cool! > It probably requires a Sun 1.6 JDK. And currently the startup script is a > batch file, so if anyone ca

Re: Best way to run multiple filters on the same [lazy] collection?

2009-10-18 Thread Alex Osborne
Dmitry Kakurin wrote: > I actually like your "tag them then group them" approach. > But what if the same record can have multiple tags? > E.g. :sales and :upgrades? > Hmmm. the first way that occurred to me is just make your tagging function return a set: (defn record-types [x] (disj #{(w

Re: Using synchronized keyword

2009-10-18 Thread Alex Osborne
Gorsal wrote: > I was wondering how to used the java keyword synchronized in clojure? http://clojure.org/api#locking Java: synchronized(foo) { ... } Clojure: (locking foo ...) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Googl

Re: Printing to *out* in another thread

2009-10-18 Thread Alex Osborne
mbrodersen wrote: >> Using atoms is not a good idea. Unless you don't mind if the same >> message is sometimes printed more than once. Atoms are implemented >> using spin locks with automatic retry. > > Hmmm...unless add-watch => observer is called only once. Looking in clojure/lang/Atom.java:

Re: agents swallowing exceptions?

2009-10-19 Thread Alex Osborne
Raoul Duke wrote: > apparently one has to manually write ones agents to log the exceptions > out to stderr or stdout? i guess my personal principle of least > surprise implementation would have been to at least spit out the first > exception once. The problem is where do you throw the exceptions?

Re: data structures for efficient range queries

2009-10-19 Thread Alex Osborne
nchubrich wrote: > I need to make a data structure for a query such as "find everything > that is priced $3.27 - $6.12" (and perhaps sum up the total revenue > for all items in that price range). That's one of the things sorted maps are for: (let [objects-by-price (sorted-map 0.50 :cookie, 5.0

Re: data structures for efficient range queries

2009-10-19 Thread Alex Osborne
Alex Osborne wrote: > nchubrich wrote: >> I need to make a data structure for a query such as "find everything >> that is priced $3.27 - $6.12" (and perhaps sum up the total revenue >> for all items in that price range). > > > That's one of the thin

Re: Redirecting Output

2009-10-19 Thread Alex Osborne
Gorsal wrote: > I'm trying to redirect the input i receive from a BufferedInputStream > to the repl. I'm trying something like this: > > (defmacro with-thread [nm & body] > `(let [thread# (Thread. (fn [] (do ~...@body)))] > (if ~nm (.setName thread# ~nm)) > (.start thread#) > thread#

Re: sequence manipulation question

2009-10-19 Thread Alex Osborne
Dmitri wrote: > I notice that certain sequence operations such as concat and cons will > not retain the original type of sequence, for example if you combine > two vectors together a list will be returned: > > user=> (concat [1 2] [3 4]) > (1 2 3 4) > > is this intentional behavior, and wo

Re: sequence manipulation question

2009-10-19 Thread Alex Osborne
Oops, looks like the end of my message got cut off. Appended below. Alex Osborne wrote: > Dmitri wrote: > > I notice that certain sequence operations such as concat and cons will > > not retain the original type of sequence, for example if you combine > > two vectors to

Re: b:vimclojure_namespace does not exist

2009-10-19 Thread Alex Osborne
I'm not really a vim user, but I just tried this out as I was curious to see what vimclojure was like. It sounds like the nailgun server can't find clojure.jar, try checking the classpath you're using to launch the server. I get the exact same error if I set a bad classpath on purpose. eyeri

Re: Redirecting Output

2009-10-20 Thread Alex Osborne
John Harrop wrote: > On Tue, Oct 20, 2009 at 12:07 AM, Alex Osborne <mailto:a...@meshy.org>> wrote: > > Gorsal wrote: > > However, this raises the CPU to about 50 percent. This is due to the > > infinite recursion, I'm assuming? > >

Re: Best way to run multiple filters on the same [lazy] collection?

2009-10-20 Thread Alex Osborne
Dmitry Kakurin wrote: > Thanks Alex, this is a VERY elegant solution. Hehe. I think I got a bit carried away generalising mine, but I found it interesting. :-) I think your way or Meikal's juxt (which is really neat, I didn't know about juxt) is much better for this specific

Re: Best way to run multiple filters on the same [lazy] collection?

2009-10-20 Thread Alex Osborne
Dmitry Kakurin wrote: >> Stylistic: you should not put the closing parens on dedicated lines. >> They are normally collected on the last line. While this is only a >> style issue, you should get used to it, since 99.9% of all code at in >> the wild will use that style... > > I've read it many tim

Re: Private multimethods possible?

2009-10-22 Thread Alex Osborne
samppi wrote: > Are private multis possible? I notice that clojure.contrib.def does > not have a defmulti-, which doesn't bode well, but it's still worth a > question at the mailing list. Yes, you can make any symbol private. If you look at the definition of defn- you'll see all it does is set

Re: Private multimethods possible?

2009-10-22 Thread Alex Osborne
> So you could do the same when defining a multimethod, just give the > name (symbol) of the method the metadata ":private" with the value > "true": > > (defmulti #{:private true} my-multi my-dispatch) I'm having a bad day for typos, the example should of course be: (defmulti #^{:private true}

Re: Private multimethods possible?

2009-10-22 Thread Alex Osborne
John Harrop wrote: > I think we need some notion of semi-private as well. It would be ignored > by :use and by automation like tab-completion of symbols, doc > generation, and the like (except it would show in tab-completion inside > of its namespace) but would not actually be illegal to invoke

Re: invoking macros from Java

2009-10-27 Thread Alex Osborne
Jeff Brown wrote: > I can invoke a function using Java code that looks something like this... > > Reader reader = new FileReader("clj/demo.clj"); > Compiler.load(reader); > Var var = RT.var("demo", "add_numbers"); > Object result = var.invoke(4, 7); > System.out.println("Result: " + result); >

Re: Infinite sequences hang sets and maps

2009-10-28 Thread Alex Osborne
John Harrop wrote: > Probably the seq .hashCode should consider only the first N elements > for some maximum N and if two longer (or even infinite) sequences > collide so be it. I strongly disagree. Choosing some arbitrary magic cutoff point just seems cause for trouble and much confusion. Put

Re: Constructing Java Interop calls

2009-10-28 Thread Alex Osborne
Tiago Antão wrote: > Again, the point here is to be able to construct method names (full > call signatures, really) on runtime. > > I am lost. As in newbie clueless :( As others have suggested you need to use either Java's reflection or Clojure's eval. Here's some examples: Using reflection:

Re: cannot cast error java char-array to java string

2009-10-28 Thread Alex Osborne
Chick Corea wrote: > What is wrong with this code? I want to instantiate a Java String > from a Java character-array. > But I want it to be fast, hence the need to cast per the "warn on > reflection" message. > > user=> (set! *warn-on-reflection* true) > true > user=> (new String #^

Re: ANN: Clojure live-repl

2009-10-28 Thread Alex Osborne
David Powell wrote: > >> Under Linux I had to fix the paths in liverepl.sh to include the >> build folder: >> >> java -cp "$LIVEREPL_HOME/build/*:$JDK_HOME/lib/tools.jar" >> net.djpowell.liverepl.client.Main "$CLOJURE_JAR" >> "$LIVEREPL_HOME/build/liverepl-agent.jar" >> "$LIVEREPL_HOME/build/

Re: Java 7, nio, and createFile

2009-10-28 Thread Alex Osborne
youngblood.carl wrote: > When I try and call createFile from clojure: > (.createFile path) > > I get an exception that there is no field named createFile. If I remember correctly variable argument Java methods, which is what that "..." syntax means: abstract Path createFile(FileAttribute...

Re: Infinite sequences hang sets and maps

2009-10-29 Thread Alex Osborne
John Harrop wrote: > On Wed, Oct 28, 2009 at 9:35 PM, Alex Osborne wrote: > > Choosing some arbitrary magic cutoff point just > seems cause for trouble and much confusion. > > For the specific case of hashCode, no; identical values must have > identical hashes but

Re: Newcomer's question about Clojure's compatibility with common lisp

2009-10-29 Thread Alex Osborne
Daniel Simms wrote: > On Thu, Oct 29, 2009 at 4:34 PM, Rayne wrote: >> but I would highly recommend that you just pull it from the github >> repository. > > Especially if you're going to use clojure-contrib ...or is there some > "release" of contrib synch'd to clojure releases that I missed > so

Re: How to make lazy seq from socket input?

2009-10-30 Thread Alex Osborne
timc wrote: > I think I know how to do fileLines, but not socketLines. (Each > received packet should contain one line as it would have been written > to a file, I think). Something like this? (use 'clojure.contrib.duck-streams) (read-lines (.getInputStream socket)) > My problem is not how to

Re: Implementation of zipmap

2009-10-30 Thread Alex Osborne
John Harrop wrote: > Was something wrong with this?: > > (defn my-zipmap > "Returns a map with the keys mapped to the corresponding vals." > [keys vals] > (into {} (map vec (partition 2 (interleave keys vals) > > :) One reason might be that the original zipmap is 5-10 times faster for

Re: Implementation of zipmap

2009-10-30 Thread Alex Osborne
Chouser wrote: > On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne wrote: >> John Harrop wrote: >>> Was something wrong with this?: >>> >>> (defn my-zipmap >>> "Returns a map with the keys mapped to the corresponding vals." >>> [

Re: idiom questions

2009-10-30 Thread Alex Osborne
Chick Corea wrote: > Is everything in Clojure immutable? Most things. Clojure tries very hard to be thread-safe by default. > how does one modify the value of 'x' ? > > (let [x nil] (def x true)) One does not, at least not in a let-binding. If you really want a lexical variable you

Re: idiom questions

2009-10-30 Thread Alex Osborne
Alex Osborne wrote: > Chick Corea wrote: >> If I understand correctly, the "(binding ...)" macro specifically >> applies to >> "Variables", one of Clojure's STM types, thus has dynamic, thead-local >> scope. Is that right? In which case, it ma

Re: can I make this faster (and leaner) ?

2009-10-30 Thread Alex Osborne
Chick Corea wrote: > The corresponding Java code (w/ the hash-insert omitted in the clojure > version) > runs in 5.5sec and uses 290MB. > > This code runs (which omits the hash-insert) runs in 17.8sec and uses > 353MB. > > I thought that I added all of the casts and "warn-on-reflections" that >

Re: Infinite sequences hang sets and maps

2009-10-31 Thread Alex Osborne
Luke VanderHart wrote: > On Oct 29, 4:01 am, Mark Engelberg wrote: >> I see your point that hashCode could be made to work on infinite >> sequences, but since hashing is almost always a prelude to testing for >> equality, I'm hard pressed to think of an example of why you'd want to >> be able to

Re: update-proxy doc - what is "this" ?

2009-11-01 Thread Alex Osborne
msappler wrote: > user=> (doc update-proxy) > > It says:"the first arg corresponding to this" > > What is meant with "this"? "this" means the proxy object itself (like the "this" keyword in Java). --~--~-~--~~~---~--~~ You received this message because you are s

Re: clojure parser

2009-11-01 Thread Alex Osborne
nchubrich wrote: > Is there any way to access the clojure parser, i.e. something that > gives you all the elements contained in an expression? I.E. (parse (+ > 1 2)) would give you something like [:list [[:symbol +] [:literal 1] > [:literal 2]]]. Do you mean the reader? user=> (read-string "(+

Re: A couple questions about the language

2009-11-01 Thread Alex Osborne
Andrew wrote: > 1. Can I have compile time evaluation forms like in Lisp? For example, > I want to obtain current namespace during macro expansion, or make > Java imports in compile time. Is it possible? Unless I'm misunderstanding what you want, sure. Just access *ns* or (import 'whatever) in

Re: Generalizing -> & ->>

2009-11-02 Thread Alex Osborne
Sean Devlin wrote: > This is slightly unrealted, but how does one pronounce ->, ->> and the > like? Is this documented? The doc-strings usually give you a nice hint. I usually use "thread" for -> and "thread last" for ->>. The actual symbols I think of as "arrow" and "double arrow". Then -?

Re: Running out of memory when using loop/recur and destructuring

2009-11-02 Thread Alex Osborne
Paul Mooser wrote: > Good job tracking down that diff -- upon looking at it, unfortunately, > I obviously don't understand the underlying issue being fixed (the > inter-binding dependencies) because the "old code" basically matches > what I would think would be the way to avoid introducing this in

Re: Adding meta data to a function (from a macro)

2009-11-07 Thread Alex Osborne
Stefan Arentz wrote: > > I'm trying to do this: > > (defmacro my-defn [name & body] >`(defn- #^{ :foo-tag "blah" } ~name [] > ~...@body)) > > The idea is that foo will be defined and that {:foo-tag "blah"} is > added to its meta-data. > > But that does not seem to work: Try this:

Re: Functions and vars and meta-data

2009-11-07 Thread Alex Osborne
[fns ['greet 'groan]] (macroexpand (list 'get-xxx fns))) => [1 2] Or we can just quote the whole vector: (let [fns '[greet groan]] (macroexpand (list 'get-xxx fns))) => [1 2] But at this point get-xxx may just as well have been a function: (defn get-xxx-fn [syms]

Re: equivalent to Haskell's group function

2009-11-08 Thread Alex Osborne
Wilson MacGyver wrote: > Does Clojure have a function like Haskell's group? > > In Haskell, > Input: group [1,2,2,1,1,1,2,2,2,1] > Output: [[1],[2,2],[1,1,1],[2,2,2],[1]] (use 'clojure.contrib.seq-utils) (partition-by identity [1 2 2 1 1 1 2 2 2 1]) => ((1) (2 2) (1 1 1) (2 2 2) (1)) --~--~---

Re: Consistency of the API

2009-11-09 Thread Alex Osborne
Mark Engelberg wrote: > 2009/11/9 Tiago Antão : >> What is the rationale for even? and contains? having different >> behaviors for the exact same error (ie, one throws the other works >> fine and just returns false on a type error)? > I imagine the rationale is efficiency. Here's the function

Re: How to convert java Complex type to Clojure type?

2009-11-09 Thread Alex Osborne
Michael Jaaka wrote: > How to convert HashMap to Clojure map, sorted-map, > tree-map > > How far I'm able only to do it with > > (let [a (HashMap. { "abc" "def"}) ] >(zipmap (keys a) (vals a))) > > Note that HashMap. { ... } is here only as example, cause in fact it > is a result from J

Re: Understanding Clojure Closures

2009-11-11 Thread Alex Osborne
mbrodersen wrote: > In this simple recursive expression: > > (def t (fn [x] (if (zero? x) 0 (+ x (t (dec x)) > > The fn special form is evaluated within a context where t is not yet > bound. > > t is only bound AFTER fn has captured its environment. > > In other words, the closure captured

Re: How to print without spaces?

2009-11-11 Thread Alex Osborne
John Ky wrote: > How to I print without spaces? (println (str "a" "b" "c")) -- 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 patie

Re: How to write a macro

2009-11-11 Thread Alex Osborne
John Ky wrote: > Hi all, > > I'm looking for a way to write a defkw macro so that (defkw ABSENT) > expands to > (def ABSENT (kw "ABSENT" :ABSENT )). > Just use `(...) as a template and use ~ to unescape, like so: (defmacro defkw [sym] `(def ~sym (kw ~(str sym) ~(keyword sym (defkw ANSE

Re: How to write a macro

2009-11-11 Thread Alex Osborne
John Ky wrote: > I had to ~(keyword (str sym)) instead of ~(keyword sym), but now it > works well. Hmm, odd. Must have changed since Clojure 1.0. (keyword 'some-symbol) works for me on the "new" branch. -- You received this message because you are subscribed to the Google Groups "Clojure" gr

Re: clojure event handling

2009-11-11 Thread Alex Osborne
nchubrich wrote: > I'm curious what the best idiomatic way of handling events is (e.g. > receiving a series of messages and dispatching functions on the basis > of the messages). One could use the 'experimental' add-watch(er) > functions. But it might also be nice to do something stream-oriented,

Re: Datatypes and Protocols - early experience program

2009-11-13 Thread Alex Osborne
Mark Engelberg wrote: > Protocols: > > I don't understand whether there's any way to provide a partial > implementation or default implementation of a given > protocol/interface, and I believe this to be an important issue. > > For example, a protocol for < and > that provides a default > impleme

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread Alex Osborne
ajuc wrote: > I would like to somehow hide the global hilbert-map into my function, > but I can't see how to do that. > > Is this possible? I know that I can just inert literal into my let, > but that degrades performance, when function is called many times. > > I would like to have something lik

  1   2   3   4   5   6   7   8   9   10   >