Re: How to hide data representation with keywords for deftype accessor?

2010-04-11 Thread Konrad Hinsen
Sophie a écrit : (deftype A [x]) gives me an accessor (:x anA) Then I decide to change data representation of A without impacting client code, but I don't seem able to define a function (defn :x [anA] ...) Should I be doing something different? (:x anA) is not a special accessor function,

Re: How to hide data representation with keywords for deftype accessor?

2010-04-11 Thread B Smith-Mannschott
On Sun, Apr 11, 2010 at 06:39, Sophie itsme...@hotmail.com wrote: (deftype A [x]) gives me an accessor (:x anA) Then I decide to change data representation of A without impacting client code, but I don't seem able to define a function (defn :x [anA] ...) Should I be doing something

Re: How do I call Foo.class?

2010-04-11 Thread Lars Nilsson
On Fri, Apr 9, 2010 at 11:31 AM, dknesek doug.kne...@gmail.com wrote: How do I invoke Foo.class in Clojure? Specifically, I'm trying to convert this (working) Java to Clojure. service.getEntry(new URL(entryUrl), PortfolioEntry.class); When I do this: (def entry-url-str (str base-url

Haskell-style list functions

2010-04-11 Thread Yuto Hayamizu
Hi, all I want some list functions in Haskell like mapAccumL in clojure.contrib, because some sequence operations are difficult with only functions in clojure.core and contrib. Think about writing a function 'accum-seq', which takes a sequence of numbers, and returns a sequence of numbers. Each

How to separate code into different files

2010-04-11 Thread -r
Hi all, I am a total newbie to Clojure. This is just my second day. I was wondering how you split code into different files and use them in clojure. For example if i have 2 folders dir1 and dir2 and dir1 has file1.clj and dir 2 has file2.clj, how to call a function in file2 from file1. How to

Re: How do I call Foo.class?

2010-04-11 Thread Nurullah Akkaya
For analytics code which expects a call in Java like the following, AccountFeed accountFeed = analyticsService.getFeed(queryUrl, AccountFeed.class); I had to do this, (defn get-class [class] (Class/forName (str com.google.gdata.data.analytics. class))) Class/forName will return a

Re: How to separate code into different files

2010-04-11 Thread Nurullah Akkaya
Assuming you have the following file structure, src/ src/tubes/ src/tubes/core.clj src/tubes/download.clj src/tubes/plugins/a.clj Now to use plugin a from core, (ns tubes.core (:use :reload-all tubes.plugins.a)) or to use download module from within plugin a, (ns tubes.plugin.a (:use

Re: Haskell-style list functions

2010-04-11 Thread Steve Purcell
On 10 Apr 2010, at 08:46, Yuto Hayamizu wrote: Hi, all I want some list functions in Haskell like mapAccumL in clojure.contrib, because some sequence operations are difficult with only functions in clojure.core and contrib. Think about writing a function 'accum-seq', which takes a

(apply partition coll1 coll2 ...)

2010-04-11 Thread Glen Rubin
I am working with a collection of sequences ...(e.g. coll: ((/f /b /c /4 /5 /6 /3 /6 /f /4 /3 /2 /4 /5 /7 /3 /6) (/2 /b /c /4 /2 / 6 /3 /7 /f /4 /3 /2 /4 /5 /7 /3 /6)...) I want to partition the sequences into groups of 4, but when I try the following or something similar it fails saying either

Re: (apply partition coll1 coll2 ...)

2010-04-11 Thread Douglas Philips
On 2010 Apr 11, at 1:28 PM, Glen Rubin wrote: I am working with a collection of sequences ...(e.g. coll: ((/f /b /c /4 /5 /6 /3 /6 /f /4 /3 /2 /4 /5 /7 /3 /6) (/2 /b /c /4 / 2 / 6 /3 /7 /f /4 /3 /2 /4 /5 /7 /3 /6)...) I want to partition the sequences into groups of 4, but when I try the

Re: Introduction to Monads in Clojure tech talk

2010-04-11 Thread alux
Thank you! Nice step by step intro. Regards, alux On 9 Apr., 06:04, Mike T. Miller jini...@gmail.com wrote: Adam Smyczek's Introduction to Monads video is now available. http://www.youtube.com/user/LinkedInTechTalks?feature=mhw5#p/u/0/ObR3... I'll work on getting an HD version up Friday.

Re: How to hide data representation with keywords for deftype accessor?

2010-04-11 Thread Laurent PETIT
I would like to add another idea right out of my head: When you say you want to hide from client code, juxtaposed to the notion of (def)type, a little warning manifests itself in my head, because as far as I understand them, types are there to provide polymorphic implementations for protocols. So

Re: My non-ELPA Emacs swank-clojure setup

2010-04-11 Thread Constantine Vetoshev
On Apr 8, 12:45 pm, Ævar Arnfjörð Bjarmason ava...@gmail.com wrote: If I have 10 Clojure projects I'm going to have 10 src/clojure.jar files. Do they really need to be there or could I just use the clojure that comes with my operating system (Debian)? When I hack Common Lisp I don't copy sbcl

re-arranging sub-partitions

2010-04-11 Thread Glen Rubin
I am working with a collection of sequences ...(e.g. coll: ((/f /b /c /4 /5 /6 /3 /6 /f /4 /3 /2 /4 /5 /7 /3 /6...) (/2 /b /c /4 / 2 / 6 /3 /7 /f /4 /3 /2 /4 /5 /7 /3 /6...)...) I want to rearange the sequence into groups of 4 where the later 2 elements are moved to the front for example: (/f /b

Re: My non-ELPA Emacs swank-clojure setup

2010-04-11 Thread Constantine Vetoshev
This thread encouraged me to post what I did to make swank-clojure 1.1.0 work with the the latest SLIME. It does not use any of swank- clojure's automatic .jar downloading features (as of version 1.1.0). These instructions won't work on Windows, but may work if you have Cygwin. Note that this

Re: re-arranging sub-partitions

2010-04-11 Thread ataggart
How about: (defn foo [coll] (apply concat (map (fn [[a b c d]] [c d a b]) (partition 4 coll On Apr 11, 3:25 pm, Glen Rubin rubing...@gmail.com wrote: I am working with a collection of sequences ...(e.g. coll: ((/f /b /c /4 /5 /6 /3 /6 /f /4 /3 /2 /4 /5 /7 /3 /6...) (/2 /b /c

Re: re-arranging sub-partitions

2010-04-11 Thread ataggart
Or a more generic way: (defn bar [n m coll] (when-let [s (seq coll)] (let [a (take n s) b (take m (drop n s))] (concat b a (bar n m (drop (+ n m) s)) On Apr 11, 4:23 pm, ataggart alex.tagg...@gmail.com wrote: How about: (defn foo [coll]   (apply concat     (map (fn [[a b c