Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-14 Thread Alan Malloy
On Dec 13, 8:37 pm, Cedric Greevey cgree...@gmail.com wrote:
 On Tue, Dec 13, 2011 at 11:25 PM, Alan Malloy a...@malloys.org wrote:
  On Dec 13, 7:56 pm, Stephen Compall stephen.comp...@gmail.com wrote:
  On Tue, 2011-12-13 at 16:28 -0800, Alan Malloy wrote:
   As you can see, only as many elements are realized as are needed to
   satisfy the user's request.

  Yes, in the expression (conr (conr (conr '( 1 2 3) 4) 6) 7), all the
  lazy-seqs implied by the conr calls must be forced immediately to yield
  (1 . more).  It is the same problem with repeatedly concatting to the
  end, and with left-fold in a top-down evaluation scheme like Haskell:
  you can run out of stack if you must travel deep to get to the first
  element.

  I see. You're making a subtler point than I realized, and you're right
  there. Repeated applications of conr need to be resolved all at once,
  but conr'ing one item onto an already-realized collection doesn't
  cause anything new to be realized until the element itself is needed.

 One way to mitigate it would be to use a datastructure with a seq and
 a vector: conr on a seq would produce one of these with the conr'd
 item the sole element of the vector, and conr on one of these
 datastructures would conj the item onto the vector. The datastructure
 would behave as a seq: first on the datastructure would return first
 on the seq part, and next would return a datastructure with the seq
 part nexted -- only, if the seq had only one element, instead with
 (seq the-vector-part) as the seq part and an empty vector part. An
 invariant would be maintained that the seq part is nil iff the whole
 thing is empty.

 Of course, such a datastructure is a queue, and it's not too much more
 work to turn it into a deque. Adding at both ends in O(1) and
 peeking/popping at the front is already in there. Peeking/popping at
 the rear is trickier, because a naive implementation is O(n) if the
 vector part happens to be empty. Any time the vector part would become
 empty you'd have to split the data in half between the seq part and
 the vector part, in a kind of reversal of how ArrayLists and vectors
 grow in amortized O(1). The invariant would now be that if there are
 at least two elements both parts are nonempty, if there's one element
 the vector part is empty, and if there's none the seq part is nil.

 (And nobody give me any guff about the vector operations actually
 being O(log_32 n); on present and near-future hardware I don't think
 log_32 n will get much above 6 or 7, so for all practical purposes it
 differs from O(1) by a constant factor of overhead. The work being
 done on finger trees might enable deques with true O(1) peeks at
 both ends, if the trees hold direct references to their end elements
 in their roots -- but then I'd expect O(log n) adds and pops at both
 ends, since the depth will need to be walked to do those.)

This queue already exists: clojure.lang.PersistentQueue.

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-14 Thread Cedric Greevey
On Wed, Dec 14, 2011 at 3:12 AM, Alan Malloy a...@malloys.org wrote:
 On Dec 13, 8:37 pm, Cedric Greevey cgree...@gmail.com wrote:
 On Tue, Dec 13, 2011 at 11:25 PM, Alan Malloy a...@malloys.org wrote:
  On Dec 13, 7:56 pm, Stephen Compall stephen.comp...@gmail.com wrote:
  On Tue, 2011-12-13 at 16:28 -0800, Alan Malloy wrote:
   As you can see, only as many elements are realized as are needed to
   satisfy the user's request.

  Yes, in the expression (conr (conr (conr '( 1 2 3) 4) 6) 7), all the
  lazy-seqs implied by the conr calls must be forced immediately to yield
  (1 . more).  It is the same problem with repeatedly concatting to the
  end, and with left-fold in a top-down evaluation scheme like Haskell:
  you can run out of stack if you must travel deep to get to the first
  element.

  I see. You're making a subtler point than I realized, and you're right
  there. Repeated applications of conr need to be resolved all at once,
  but conr'ing one item onto an already-realized collection doesn't
  cause anything new to be realized until the element itself is needed.

 One way to mitigate it would be to use a datastructure with a seq and
 a vector: conr on a seq would produce one of these with the conr'd
 item the sole element of the vector, and conr on one of these
 datastructures would conj the item onto the vector. The datastructure
 would behave as a seq: first on the datastructure would return first
 on the seq part, and next would return a datastructure with the seq
 part nexted -- only, if the seq had only one element, instead with
 (seq the-vector-part) as the seq part and an empty vector part. An
 invariant would be maintained that the seq part is nil iff the whole
 thing is empty.

 Of course, such a datastructure is a queue, and it's not too much more
 work to turn it into a deque. Adding at both ends in O(1) and
 peeking/popping at the front is already in there. Peeking/popping at
 the rear is trickier, because a naive implementation is O(n) if the
 vector part happens to be empty. Any time the vector part would become
 empty you'd have to split the data in half between the seq part and
 the vector part, in a kind of reversal of how ArrayLists and vectors
 grow in amortized O(1). The invariant would now be that if there are
 at least two elements both parts are nonempty, if there's one element
 the vector part is empty, and if there's none the seq part is nil.

 (And nobody give me any guff about the vector operations actually
 being O(log_32 n); on present and near-future hardware I don't think
 log_32 n will get much above 6 or 7, so for all practical purposes it
 differs from O(1) by a constant factor of overhead. The work being
 done on finger trees might enable deques with true O(1) peeks at
 both ends, if the trees hold direct references to their end elements
 in their roots -- but then I'd expect O(log n) adds and pops at both
 ends, since the depth will need to be walked to do those.)

 This queue already exists: clojure.lang.PersistentQueue.

Should be better documented.

Is it a fully fledged deque?

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Lazy-seq of a binary file

2011-12-14 Thread Cedric Greevey
On Wed, Dec 14, 2011 at 12:04 AM, Simone Mosciatti mweb@gmail.com wrote:
 Thank you so much, just one last thing, why you use a char-array ?

Reader returns chars.

 If I want use a byte-array, and no map all the whole sequence ?

Use an InputStream rather than a reader if you're reading binary files
(or text files as binary). If you're not consuming the whole sequence,
again, have the part of the code that consumes some and then stops
also create the stream and be responsible for closing it, passing it
to the lazy sequence maker; use with-open, and if that part of the
code still emits a sequence (e.g. (take some-number (remove icky?
(..., rather than a single object (extracted, reduced, or
whatever), wrap that sequence in (doall ...) inside the with-open so
all the needed stream I/O actually is performed before the stream gets
closed.

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-14 Thread Alan Malloy
On Dec 14, 1:18 am, Cedric Greevey cgree...@gmail.com wrote:
 On Wed, Dec 14, 2011 at 3:12 AM, Alan Malloy a...@malloys.org wrote:
  On Dec 13, 8:37 pm, Cedric Greevey cgree...@gmail.com wrote:
  On Tue, Dec 13, 2011 at 11:25 PM, Alan Malloy a...@malloys.org wrote:
   On Dec 13, 7:56 pm, Stephen Compall stephen.comp...@gmail.com wrote:
   On Tue, 2011-12-13 at 16:28 -0800, Alan Malloy wrote:
As you can see, only as many elements are realized as are needed to
satisfy the user's request.

   Yes, in the expression (conr (conr (conr '( 1 2 3) 4) 6) 7), all the
   lazy-seqs implied by the conr calls must be forced immediately to yield
   (1 . more).  It is the same problem with repeatedly concatting to the
   end, and with left-fold in a top-down evaluation scheme like Haskell:
   you can run out of stack if you must travel deep to get to the first
   element.

   I see. You're making a subtler point than I realized, and you're right
   there. Repeated applications of conr need to be resolved all at once,
   but conr'ing one item onto an already-realized collection doesn't
   cause anything new to be realized until the element itself is needed.

  One way to mitigate it would be to use a datastructure with a seq and
  a vector: conr on a seq would produce one of these with the conr'd
  item the sole element of the vector, and conr on one of these
  datastructures would conj the item onto the vector. The datastructure
  would behave as a seq: first on the datastructure would return first
  on the seq part, and next would return a datastructure with the seq
  part nexted -- only, if the seq had only one element, instead with
  (seq the-vector-part) as the seq part and an empty vector part. An
  invariant would be maintained that the seq part is nil iff the whole
  thing is empty.

  Of course, such a datastructure is a queue, and it's not too much more
  work to turn it into a deque. Adding at both ends in O(1) and
  peeking/popping at the front is already in there. Peeking/popping at
  the rear is trickier, because a naive implementation is O(n) if the
  vector part happens to be empty. Any time the vector part would become
  empty you'd have to split the data in half between the seq part and
  the vector part, in a kind of reversal of how ArrayLists and vectors
  grow in amortized O(1). The invariant would now be that if there are
  at least two elements both parts are nonempty, if there's one element
  the vector part is empty, and if there's none the seq part is nil.

  (And nobody give me any guff about the vector operations actually
  being O(log_32 n); on present and near-future hardware I don't think
  log_32 n will get much above 6 or 7, so for all practical purposes it
  differs from O(1) by a constant factor of overhead. The work being
  done on finger trees might enable deques with true O(1) peeks at
  both ends, if the trees hold direct references to their end elements
  in their roots -- but then I'd expect O(log n) adds and pops at both
  ends, since the depth will need to be walked to do those.)

  This queue already exists: clojure.lang.PersistentQueue.

 Should be better documented.

 Is it a fully fledged deque?

Yes and yes.

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-14 Thread Alan Malloy
On Dec 14, 2:22 am, Alan Malloy a...@malloys.org wrote:
 On Dec 14, 1:18 am, Cedric Greevey cgree...@gmail.com wrote:









  On Wed, Dec 14, 2011 at 3:12 AM, Alan Malloy a...@malloys.org wrote:
   On Dec 13, 8:37 pm, Cedric Greevey cgree...@gmail.com wrote:
   On Tue, Dec 13, 2011 at 11:25 PM, Alan Malloy a...@malloys.org wrote:
On Dec 13, 7:56 pm, Stephen Compall stephen.comp...@gmail.com wrote:
On Tue, 2011-12-13 at 16:28 -0800, Alan Malloy wrote:
 As you can see, only as many elements are realized as are needed to
 satisfy the user's request.

Yes, in the expression (conr (conr (conr '( 1 2 3) 4) 6) 7), all the
lazy-seqs implied by the conr calls must be forced immediately to 
yield
(1 . more).  It is the same problem with repeatedly concatting to the
end, and with left-fold in a top-down evaluation scheme like Haskell:
you can run out of stack if you must travel deep to get to the first
element.

I see. You're making a subtler point than I realized, and you're right
there. Repeated applications of conr need to be resolved all at once,
but conr'ing one item onto an already-realized collection doesn't
cause anything new to be realized until the element itself is needed.

   One way to mitigate it would be to use a datastructure with a seq and
   a vector: conr on a seq would produce one of these with the conr'd
   item the sole element of the vector, and conr on one of these
   datastructures would conj the item onto the vector. The datastructure
   would behave as a seq: first on the datastructure would return first
   on the seq part, and next would return a datastructure with the seq
   part nexted -- only, if the seq had only one element, instead with
   (seq the-vector-part) as the seq part and an empty vector part. An
   invariant would be maintained that the seq part is nil iff the whole
   thing is empty.

   Of course, such a datastructure is a queue, and it's not too much more
   work to turn it into a deque. Adding at both ends in O(1) and
   peeking/popping at the front is already in there. Peeking/popping at
   the rear is trickier, because a naive implementation is O(n) if the
   vector part happens to be empty. Any time the vector part would become
   empty you'd have to split the data in half between the seq part and
   the vector part, in a kind of reversal of how ArrayLists and vectors
   grow in amortized O(1). The invariant would now be that if there are
   at least two elements both parts are nonempty, if there's one element
   the vector part is empty, and if there's none the seq part is nil.

   (And nobody give me any guff about the vector operations actually
   being O(log_32 n); on present and near-future hardware I don't think
   log_32 n will get much above 6 or 7, so for all practical purposes it
   differs from O(1) by a constant factor of overhead. The work being
   done on finger trees might enable deques with true O(1) peeks at
   both ends, if the trees hold direct references to their end elements
   in their roots -- but then I'd expect O(log n) adds and pops at both
   ends, since the depth will need to be walked to do those.)

   This queue already exists: clojure.lang.PersistentQueue.

  Should be better documented.

  Is it a fully fledged deque?

 Yes and yes.

Edit: yes and probably no. It *could* support those operations using
the design you outline, but I guess doesn't. So you can only conj to
one end and pop from the other.

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ANN: core.memoize v0.5.1

2011-12-14 Thread Fogus
core.memoize v0.5.1 Release Notes
=

core.memoize is a new Clojure contrib library providing the following
features:

* An underlying `PluggableMemoization` protocol that allows the use of
customizable and swappable memoization caches that adhere to the
synchronous `CacheProtocol` found in [core.cache](http://github.com/
clojure/core.cache)

* Memoization builders for implementations of common caching
strategies, including:
  - First-in-first-out (`memo-fifo`)
  - Least-recently-used (`memo-lru`)
  - Least-used (`memo-lu`)
  - Time-to-live (`memo-ttl`)
  - Naive cache (`memo`) that duplicates the functionality of
Clojure's `memoize` function

* Functions for manipulating the memoization cache of `core.memoize`
backed functions

core.memoize is based on a library named Unk, found at http://
github.com/fogus/unk that is planned for deprecation.

* [Source code](https://github.com/clojure/core.memoize)
* [Ticket system](http://dev.clojure.org/jira/browse/CMEMOIZE)

Changes from Unk
---

The v0.5.1 version of core.memoize is based almost wholly on the final
version of Unk, with the following changes:

* All cache factory functions have been moved to core.cache
* The `SoftCache` backed implementation was buggy and removed for now

Plans
-

The following capabilities are under design, development, or
consideration for future versions of core.memoize:

* LIRS backed memoization
* A [defn-memo](https://github.com/richhickey/clojure-contrib/blob/
1c805bd0e515ea57028721ea54e6db4b0c791e20/src/main/clojure/clojure/
contrib/def.clj#L143) macro
* A [MapMaker](http://google-collections.googlecode.com/svn/trunk/
javadoc/com/google/common/collect/MapMaker.html) style ctor interface
* Reimplementation of a cache based on soft references
* test.generative usage
* Deprecation of Unk
* Documentation and examples

More planning is needed around capabilities not listed nor thought of.

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: core.memoize v0.5.1

2011-12-14 Thread Linus Ericsson
Wov!

There have been some great and very educational blog posts on how to
improve the memoization functionality for various use-cases but this makes
it even more effort free to use the techniques.

This is brilliant! Thank you!

/Linus

2011/12/14 Fogus mefo...@gmail.com

 core.memoize v0.5.1 Release Notes
 =

 core.memoize is a new Clojure contrib library providing the following
 features:

 * An underlying `PluggableMemoization` protocol that allows the use of
 customizable and swappable memoization caches that adhere to the
 synchronous `CacheProtocol` found in [core.cache](http://github.com/
 clojure/core.cache)

 * Memoization builders for implementations of common caching
 strategies, including:
  - First-in-first-out (`memo-fifo`)
  - Least-recently-used (`memo-lru`)
  - Least-used (`memo-lu`)
  - Time-to-live (`memo-ttl`)
  - Naive cache (`memo`) that duplicates the functionality of
 Clojure's `memoize` function

 * Functions for manipulating the memoization cache of `core.memoize`
 backed functions

 core.memoize is based on a library named Unk, found at http://
 github.com/fogus/unk that is planned for deprecation.

 * [Source code](https://github.com/clojure/core.memoize)
 * [Ticket system](http://dev.clojure.org/jira/browse/CMEMOIZE)

 Changes from Unk
 ---

 The v0.5.1 version of core.memoize is based almost wholly on the final
 version of Unk, with the following changes:

 * All cache factory functions have been moved to core.cache
 * The `SoftCache` backed implementation was buggy and removed for now

 Plans
 -

 The following capabilities are under design, development, or
 consideration for future versions of core.memoize:

 * LIRS backed memoization
 * A [defn-memo](https://github.com/richhickey/clojure-contrib/blob/
 1c805bd0e515ea57028721ea54e6db4b0c791e20/src/main/clojure/clojure/
 contrib/def.clj#L143) macro
 * A [MapMaker](http://google-collections.googlecode.com/svn/trunk/
 javadoc/com/google/common/collect/MapMaker.html) style ctor interface
 * Reimplementation of a cache based on soft references
 * test.generative usage
 * Deprecation of Unk
 * Documentation and examples

 More planning is needed around capabilities not listed nor thought of.

 --
 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 with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Baltimore Functional Programming

2011-12-14 Thread Gary Trakhman
We've scheduled a beer night at Max's in Fells point tonight at 7:30.
If you haven't already, check out the mailing list:
http://groups.google.com/group/baltimorefp

Here's the announcement: 
http://baltimorefp.wordpress.com/2011/12/09/first-beer-night/

On Nov 28, 6:38 pm, Gary Trakhman gary.trakh...@gmail.com wrote:
 Any Baltimore guys around?  I'm interested in starting a FP meetup where we
 can give talks and learn together and such.

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: multiple return values

2011-12-14 Thread Tom Faulhaber
Razvan,

I believe that proxy actually only creates a new class per call site,
not per instance. However, I can't completely swear to this.

Anyone with more detailed knowledge than I have want to comment?

Assuming I'm right,, you should be fine to have lots of instances.

HTH,

Tom

On Dec 13, 10:47 am, Razvan Rotaru razvan.rot...@gmail.com wrote:
 Thanks Tom. Using proxy like this could work. But i'm worried about
 one thing.What happens if I have many instances? With proxy there's a
 new class with each instance. Could I run out of permgen space?

 On Dec 13, 9:38 am, Tom Faulhaber tomfaulha...@gmail.com wrote:







  Razvan,

  I think that you can implement your idea of extending the class with
  proxy in the following way (originally suggested to me by Rich Hickey
   Chris Houser for use with the pretty printer):

  (let [extra-fields (ref {:field1 extra-value1, :field2 extra-value2}]
    (proxy [Writer IDeref]
      (deref [] extra-fields)
      (write [x] ...)
      other funcs))

  You don't need to make the extra-values item a ref if you will set the
  values immutably at create time.

  You can see the full example of this 
  athttps://github.com/clojure/clojure/blob/1f11ca3ef9cd0585abfbe4a9e7609...

  The rest of that module is an abomination that was written when I was
  still under the influence of CLOS  O-O.

  Hope that helps,

  Tom

  On Dec 12, 5:10 pm, Stephen Compall stephen.comp...@gmail.com wrote:

   On Mon, 2011-12-12 at 10:54 -0800, Razvan Rotaru wrote:
- function returns a value which is a java instance (not possible to
change here, or at least not from what I see - it needs to be a java
instance)
- i need to be able to call some function which gets some values that
are not part of the java class

   You should approach such a need with great trepidation:

   [org.jboss.netty/netty 3.2.7.Final]

   (import 'org.jboss.netty.util.internal.ConcurrentIdentityWeakKeyHashMap)

   (def ^:private asides (ConcurrentIdentityWeakKeyHashMap.))

   (defn function-with-two-return-values [...]
     (let [retval ...]
       (.put asides retval extra-data)
       retval))

   (let [x (function-with-two-return-values ...)]
     (prn x)
     (prn (.get asides x)))

   --
   Stephen Compall
   ^aCollection allSatisfy: [:each|aCondition]: less is better

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Leiningen and Cake

2011-12-14 Thread Timothy Washington
Hey there,


I see there's been progress made on Leiningen, and wanted to chime in wrt
overall features. I've been recording a few small things that would make
life easier.


1) The first is being able to pass many tasks to lein. So I would prefer A.
instead of B.

   - A) lein clean deps
   - B) lein clean  lein deps


2) Also, It'd be nice to have a way of listing installed leiningen plugins,
instead of ls on ~/.lein/plugins

3) I'd love to fire up a *lein repl src/my-code.clj*, and have passed in
code execute before I get to the repl. A) I know there's a location in
~/.lein to place custom scripts. But that's global , and runs each time *lein
repl* is invoked. And B) I know there's *lein run* and *lein exec* ,
but they execute code, then exit the repl.


HTH
Tim


On Mon, Nov 14, 2011 at 7:35 PM, Phil Hagelberg p...@hagelb.org wrote:

 Hello folks.

 You may have heard some rumours and/or tweetage about Cake and
 Leiningen. During the Conj I met with Justin Balthrop and some of the
 other Cake developers. They were interested in joining forces to
 develop a single unified build tool for Clojure. We talked it through
 and I think Leiningen could definitely benefit on the one hand from
 having a few of Cake's features ported over and on the other hand from
 gaining a bunch of new developers. This will mean Cake may see another
 few releases but will have its development efforts directed to
 Leiningen.[1]

 In particular I'm thinking of two or three things that make sense to
 take from Cake for Leiningen 2.0. Firstly there's the use of
 in-process classloaders for project execution. I've wanted this for a
 while, and they've got a nice well-tested implementation they're
 offering to have ported right over. This should speed things up and
 offer fairly significant memory savings. The other definite win would
 be taking the SCP implementation for Clojars uploads. There is a
 lein-clojars plugin, but it has some issues with keys that have
 prevented it from being considered for inclusion.

 Another thing we may take is the notion of profiles or environments
 in which tasks execute. Right now Leiningen has a notion of dev time
 vs production, which is just a single bit that determines whether
 dev-dependencies, tests, and test resources are on the classpath. Cake
 (and Maven IIUC) expand on this and allow various config options to be
 grouped and activated on a per-profile basis. I'll start a separate
 thread discussing this since there's still a fair bit more I'd like to
 understand about how people are using this in Cake and how simply it
 could be implemented.

 We're still thinking through whether it makes sense for Leiningen to
 offer persistent/daemonized JVMs to reduce execution time; it may be
 simpler to delegate this to Jark[2] instead since it could be
 considered fairly orthogonal. If you use Cake and Leiningen and have
 some other features you would miss, please mention them.

 So I'm excited to welcome them to the team.

 Happy Hacking.

 -Phil

 [1] -
 https://groups.google.com/group/clojure-cake/browse_thread/thread/186ec36c2426996e
 [2] - http://icylisper.in/jark

 --
 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 with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

help with web server

2011-12-14 Thread labwork07
I have the following web server that I pieced together from code snippets  
so I'm not sure how everything works really but most of it works. Now, I  
want to put a file for download in download.html. I tried all kinds of href  
specs but nothing works. Where should I put my file for download?


Here's the code below. Any constructive criticism welcome!

melipone

(ns fileupload.core
(:use [net.cgrand.enlive-html
:only [deftemplate defsnippet content clone-for
nth-of-type first-child do- set-attr sniptest at emit*]]
[compojure.core]
[ring.adapter.jetty])
(:require (compojure [route :as route])
(ring.util [response :as response])
(ring.middleware [multipart-params :as mp])
(clojure.contrib [duck-streams :as ds]))
)

(defn render [t]
(apply str t))

(deftemplate index fileupload/resources/index.html [])

(deftemplate download fileupload/resources/download.html [])

(deftemplate upload-success fileupload/resources/success.html [])

(defn upload-file
[file]
; (ds/copy (file :tempfile) (ds/file-str file.out))
(ds/copy (file :tempfile) (ds/file-str (file :filename)))
(render (upload-success)))

(defn(ns fileupload.core
(:use [net.cgrand.enlive-html
:only [deftemplate defsnippet content clone-for
nth-of-type first-child do- set-attr sniptest at emit*]]
[compojure.core]
[ring.adapter.jetty])
(:require (compojure [route :as route])
(ring.util [response :as response])
(ring.middleware [multipart-params :as mp])
(clojure.contrib [duck-streams :as ds]))
)

(defn render [t]
(apply str t))

(deftemplate index fileupload/resources/index.html [])

(deftemplate download fileupload/resources/download.html [])

(deftemplate upload-success fileupload/resources/success.html [])

(defn upload-file
[file]
; (ds/copy (file :tempfile) (ds/file-str file.out))
(ds/copy (file :tempfile) (ds/file-str (file :filename)))
(render (upload-success)))

(defn pload [params]
(println params)
(upload-file (get params file)))

(defroutes public-routes
(GET /upload [] (render (index)))
(GET /download [] (render (download)))
(mp/wrap-multipart-params
;(POST /file {params :params} (upload-file (get params file)))
(POST /file {params :params} (pload params))
)
)

(defn start-app []
(future (run-jetty (var public-routes) {:port 8000})))

--
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Leiningen and Cake

2011-12-14 Thread Timo Mihaljov

On 12/14/2011 06:37 PM, Timothy Washington wrote:

1) The first is being able to pass many tasks to lein. So I would prefer
A. instead of B.

  * A) lein clean deps
  * B) lein clean  lein deps



You can chain commands by separating them with a comma:

lein clean, deps

--
Timo

--
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Leiningen and Cake

2011-12-14 Thread Phil Hagelberg
On Wed, Dec 14, 2011 at 8:37 AM, Timothy Washington twash...@gmail.com wrote:
 2) Also, It'd be nice to have a way of listing installed leiningen plugins,
 instead of ls on ~/.lein/plugins

 3) I'd love to fire up a lein repl src/my-code.clj, and have passed in
 code execute before I get to the repl. A) I know there's a location in
 ~/.lein to place custom scripts. But that's global , and runs each time
 lein repl is invoked. And B) I know there's lein run and lein exec ,
 but they execute code, then exit the repl.

As Timo mentioned, 1 already exists. 2 and 3 sound pretty reasonable.
Feel free to open issues for them. They should be very easy to
implement as well, so I'd encourage you to try your hand at
implementing them. Features always have a better chance of making it
into a release if they're implemented by someone who would use them.
=) Feel free to ask in the #leiningen channel on freenode if you have
any questions.

-Phil

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: multiple return values

2011-12-14 Thread Alan Malloy
Correct, just like closures and reifies.

On Dec 14, 7:33 am, Tom Faulhaber tomfaulha...@gmail.com wrote:
 Razvan,

 I believe that proxy actually only creates a new class per call site,
 not per instance. However, I can't completely swear to this.

 Anyone with more detailed knowledge than I have want to comment?

 Assuming I'm right,, you should be fine to have lots of instances.

 HTH,

 Tom

 On Dec 13, 10:47 am, Razvan Rotaru razvan.rot...@gmail.com wrote:







  Thanks Tom. Using proxy like this could work. But i'm worried about
  one thing.What happens if I have many instances? With proxy there's a
  new class with each instance. Could I run out of permgen space?

  On Dec 13, 9:38 am, Tom Faulhaber tomfaulha...@gmail.com wrote:

   Razvan,

   I think that you can implement your idea of extending the class with
   proxy in the following way (originally suggested to me by Rich Hickey
Chris Houser for use with the pretty printer):

   (let [extra-fields (ref {:field1 extra-value1, :field2 extra-value2}]
     (proxy [Writer IDeref]
       (deref [] extra-fields)
       (write [x] ...)
       other funcs))

   You don't need to make the extra-values item a ref if you will set the
   values immutably at create time.

   You can see the full example of this 
   athttps://github.com/clojure/clojure/blob/1f11ca3ef9cd0585abfbe4a9e7609...

   The rest of that module is an abomination that was written when I was
   still under the influence of CLOS  O-O.

   Hope that helps,

   Tom

   On Dec 12, 5:10 pm, Stephen Compall stephen.comp...@gmail.com wrote:

On Mon, 2011-12-12 at 10:54 -0800, Razvan Rotaru wrote:
 - function returns a value which is a java instance (not possible to
 change here, or at least not from what I see - it needs to be a java
 instance)
 - i need to be able to call some function which gets some values that
 are not part of the java class

You should approach such a need with great trepidation:

[org.jboss.netty/netty 3.2.7.Final]

(import 'org.jboss.netty.util.internal.ConcurrentIdentityWeakKeyHashMap)

(def ^:private asides (ConcurrentIdentityWeakKeyHashMap.))

(defn function-with-two-return-values [...]
  (let [retval ...]
    (.put asides retval extra-data)
    retval))

(let [x (function-with-two-return-values ...)]
  (prn x)
  (prn (.get asides x)))

--
Stephen Compall
^aCollection allSatisfy: [:each|aCondition]: less is better

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Leiningen and Cake

2011-12-14 Thread Timothy Washington
Oh nice, I hadn't realised 1) was already in there.

And I've created the issues. I'll certainly begin to dig into leiningen
code, and see in what ways I can push these forward.

   - https://github.com/technomancy/leiningen/issues/351
   - https://github.com/technomancy/leiningen/issues/352


Thanks
Tim


On Wed, Dec 14, 2011 at 1:00 PM, Phil Hagelberg p...@hagelb.org wrote:

 On Wed, Dec 14, 2011 at 8:37 AM, Timothy Washington twash...@gmail.com
 wrote:
  2) Also, It'd be nice to have a way of listing installed leiningen
 plugins,
  instead of ls on ~/.lein/plugins
 
  3) I'd love to fire up a lein repl src/my-code.clj, and have passed in
  code execute before I get to the repl. A) I know there's a location in
  ~/.lein to place custom scripts. But that's global , and runs each time
  lein repl is invoked. And B) I know there's lein run and lein exec
 ,
  but they execute code, then exit the repl.

 As Timo mentioned, 1 already exists. 2 and 3 sound pretty reasonable.
 Feel free to open issues for them. They should be very easy to
 implement as well, so I'd encourage you to try your hand at
 implementing them. Features always have a better chance of making it
 into a release if they're implemented by someone who would use them.
 =) Feel free to ask in the #leiningen channel on freenode if you have
 any questions.

 -Phil

 --
 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 with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

letrec

2011-12-14 Thread Razvan Rotaru
Hi,

Is there a reliable implementation of letrec in clojure? Anybody using
it?
I have found a post from 2008, with an implementation which I don't
understand (and it's said to be slow), and which I don't know whether
to trust.(It's also supposed to be slow).

Thanks,
Razvan

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: letrec

2011-12-14 Thread Kevin Downey
lazy-seq and letfn should cover anything you would need letrec for

On Wed, Dec 14, 2011 at 11:09 AM, Razvan Rotaru razvan.rot...@gmail.com wrote:
 Hi,

 Is there a reliable implementation of letrec in clojure? Anybody using
 it?
 I have found a post from 2008, with an implementation which I don't
 understand (and it's said to be slow), and which I don't know whether
 to trust.(It's also supposed to be slow).

 Thanks,
 Razvan

 --
 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 with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: letrec

2011-12-14 Thread Razvan Rotaru
I don't quite understand why people are saying this. Anyway, It's not
enough for me.

On Dec 14, 9:13 pm, Kevin Downey redc...@gmail.com wrote:
 lazy-seq and letfn should cover anything you would need letrec for









 On Wed, Dec 14, 2011 at 11:09 AM, Razvan Rotaru razvan.rot...@gmail.com 
 wrote:
  Hi,

  Is there a reliable implementation of letrec in clojure? Anybody using
  it?
  I have found a post from 2008, with an implementation which I don't
  understand (and it's said to be slow), and which I don't know whether
  to trust.(It's also supposed to be slow).

  Thanks,
  Razvan

  --
  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 with 
  your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

 --
 And what is good, Phaedrus,
 And what is not good—
 Need we ask anyone to tell us these things?

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: letrec

2011-12-14 Thread David Nolen
On Wed, Dec 14, 2011 at 2:53 PM, Razvan Rotaru razvan.rot...@gmail.comwrote:

 I don't quite understand why people are saying this. Anyway, It's not
 enough for me.


What can't you solve your problem with what was suggested?

David

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

help with webserver

2011-12-14 Thread labwork07
I'm using a combination of clojure, enlive and jetty. I want to be able to  
serve arbitrary files. Can somebody show me an example?


--
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: help with webserver

2011-12-14 Thread Chris Granger
If you used Noir (www.webnoir.org), anything you put into the
resources/public/ directory would be accessible from a url. So for
example, if I had resources/public/hey.mp4  and accessed http://my-site/hey.mp4
I would get it.

Cheers,
Chris.

On Dec 14, 12:46 pm, labwor...@gmail.com wrote:
 I'm using a combination of clojure, enlive and jetty. I want to be able to
 serve arbitrary files. Can somebody show me an example?

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: letrec

2011-12-14 Thread Razvan Rotaru
letfn defines functions. I'm just defining some values. The values
contain anonymous functions which need to refer to other values.I know
there are workarounds for this, but this means I must change the
interface.

Razvan

On Dec 14, 9:56 pm, David Nolen dnolen.li...@gmail.com wrote:
 On Wed, Dec 14, 2011 at 2:53 PM, Razvan Rotaru razvan.rot...@gmail.comwrote:

  I don't quite understand why people are saying this. Anyway, It's not
  enough for me.

 What can't you solve your problem with what was suggested?

 David

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: help with webserver

2011-12-14 Thread Mark Rathwell
Generally, in production, jetty or tomcat would be fronted by a web
server like nginx or apache httpd, and those would be setup to serve
your static files.  In development, or if you just don't want to set
that up, with Compojure you can use compojure.route/files to serve
static files [1].

Or, as Chris said, Noir might make your life easier.

[1] http://weavejester.github.com/compojure/compojure.route-api.html

On Wed, Dec 14, 2011 at 3:46 PM,  labwor...@gmail.com wrote:
 I'm using a combination of clojure, enlive and jetty. I want to be able to
 serve arbitrary files. Can somebody show me an example?

 --
 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 with your
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: letrec

2011-12-14 Thread David Nolen
Do you have a minimal example of what you are trying to do?

On Wed, Dec 14, 2011 at 3:53 PM, Razvan Rotaru razvan.rot...@gmail.comwrote:

 letfn defines functions. I'm just defining some values. The values
 contain anonymous functions which need to refer to other values.I know
 there are workarounds for this, but this means I must change the
 interface.

 Razvan

 On Dec 14, 9:56 pm, David Nolen dnolen.li...@gmail.com wrote:
  On Wed, Dec 14, 2011 at 2:53 PM, Razvan Rotaru razvan.rot...@gmail.com
 wrote:
 
   I don't quite understand why people are saying this. Anyway, It's not
   enough for me.
 
  What can't you solve your problem with what was suggested?
 
  David

 --
 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 with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: letrec

2011-12-14 Thread Razvan Rotaru
Yes. Assuming I have following macros:

(button :id b1 :listener #(...)) = (let [b1 (new JButton)] ...)
(panel [:id p1] (button :id b1 ...) (button :id b2 ...)) = (let [p1
(new JPanel) b1 (button :id b1 ...) b2 (button :id b2 ...)] ...)

How to make the listener in b1 refer to b2?

Razvan

On Dec 14, 11:09 pm, David Nolen dnolen.li...@gmail.com wrote:
 Do you have a minimal example of what you are trying to do?

 On Wed, Dec 14, 2011 at 3:53 PM, Razvan Rotaru razvan.rot...@gmail.comwrote:







  letfn defines functions. I'm just defining some values. The values
  contain anonymous functions which need to refer to other values.I know
  there are workarounds for this, but this means I must change the
  interface.

  Razvan

  On Dec 14, 9:56 pm, David Nolen dnolen.li...@gmail.com wrote:
   On Wed, Dec 14, 2011 at 2:53 PM, Razvan Rotaru razvan.rot...@gmail.com
  wrote:

I don't quite understand why people are saying this. Anyway, It's not
enough for me.

   What can't you solve your problem with what was suggested?

   David

  --
  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 with
  your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Re: help with webserver

2011-12-14 Thread labwork07
Thanks everybody. Adding a resources route did work. The link below was  
helpful:

http://stackoverflow.com/questions/7816465/serving-static-files-with-ring-compojure-from-a-war

On , Mark Rathwell mark.rathw...@gmail.com wrote:

Generally, in production, jetty or tomcat would be fronted by a web



server like nginx or apache httpd, and those would be setup to serve



your static files. In development, or if you just don't want to set



that up, with Compojure you can use compojure.route/files to serve



static files [1].





Or, as Chris said, Noir might make your life easier.





[1] http://weavejester.github.com/compojure/compojure.route-api.html





On Wed, Dec 14, 2011 at 3:46 PM, labwor...@gmail.com wrote:


 I'm using a combination of clojure, enlive and jetty. I want to be able  
to



 serve arbitrary files. Can somebody show me an example?







 --



 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 with  
your



 first post.



 To unsubscribe from this group, send email to



 clojure+unsubscr...@googlegroups.com



 For more options, visit this group at



 http://groups.google.com/group/clojure?hl=en





--



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 with  
your first post.



To unsubscribe from this group, send email to



clojure+unsubscr...@googlegroups.com



For more options, visit this group at



http://groups.google.com/group/clojure?hl=en


--
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Re: help with webserver

2011-12-14 Thread labwork07
Thanks everybody. Adding a resources route did work. The link below was  
helpful:

http://stackoverflow.com/questions/7816465/serving-static-files-with-ring-compojure-from-a-war

On , Mark Rathwell mark.rathw...@gmail.com wrote:

Generally, in production, jetty or tomcat would be fronted by a web



server like nginx or apache httpd, and those would be setup to serve



your static files. In development, or if you just don't want to set



that up, with Compojure you can use compojure.route/files to serve



static files [1].





Or, as Chris said, Noir might make your life easier.





[1] http://weavejester.github.com/compojure/compojure.route-api.html





On Wed, Dec 14, 2011 at 3:46 PM, labwor...@gmail.com wrote:


 I'm using a combination of clojure, enlive and jetty. I want to be able  
to



 serve arbitrary files. Can somebody show me an example?







 --



 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 with  
your



 first post.



 To unsubscribe from this group, send email to



 clojure+unsubscr...@googlegroups.com



 For more options, visit this group at



 http://groups.google.com/group/clojure?hl=en





--



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 with  
your first post.



To unsubscribe from this group, send email to



clojure+unsubscr...@googlegroups.com



For more options, visit this group at



http://groups.google.com/group/clojure?hl=en


--
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Clojure videos no longer downloadable

2011-12-14 Thread Phil Hagelberg
So I recently went to clojure.blip.tv to download a video, and I
noticed my account had been deleted. Apparently they are requiring all
logins to go through facebook.

Is there a way we could provide video downloads to people who don't
have facebook accounts?

-Phil

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure videos no longer downloadable

2011-12-14 Thread Sean Corfield
I don't know if it helps but I subscribe to the Clojure podcast in
iTunes and it has downloaded all the episodes:

http://itunes.apple.com/us/podcast/clojure/id275488598

I don't know how/if that relates to the blip.tv access point.

Sean

On Wed, Dec 14, 2011 at 3:30 PM, Phil Hagelberg p...@hagelb.org wrote:
 So I recently went to clojure.blip.tv to download a video, and I
 noticed my account had been deleted. Apparently they are requiring all
 logins to go through facebook.

 Is there a way we could provide video downloads to people who don't
 have facebook accounts?

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure videos no longer downloadable

2011-12-14 Thread Phil Hagelberg
On Wed, Dec 14, 2011 at 4:07 PM, Sean Corfield seancorfi...@gmail.com wrote:
 I don't know if it helps but I subscribe to the Clojure podcast in
 iTunes and it has downloaded all the episodes:

 http://itunes.apple.com/us/podcast/clojure/id275488598

Is there a way to get at them with a browser?

-Phil

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Obscure bug (?) in clojurescript, probably related to lazy seqs

2011-12-14 Thread Dave Sann
Hi all,

I came across an obscure behaviour in clojurescript.

The original function is used to tabulate, as a list of lists, non 
overlapping sub-sequences.
I stripped out the unessential parts from my code to get the following.
It doesn't do anything specific - but exhibits similar behaviour

uncommenting the comment below causes the correct behaviour to be produced.
when commented the result is different
when commented, and if you count it, the length of 'held' increases 
indefinitely and the function does not terminate

(defn obscure-bug
  ([a-seq held iresult fresult]
(if (empty? a-seq)
  (if (empty? held)
(conj fresult iresult)
(recur held [] [] (conj fresult iresult)))
  (let [[item  remainder] a-seq
[n-held new-seq] (split-with (fn [i] ( item i)) remainder)
   
 _x (doall n-held) ; -- uncommenting this produces 
different results in clojurescript, it does not in clojure

]
(recur new-seq (concat held n-held) (conj iresult item) fresult)



(obscure-bug [1  7  8 9  6 2 3 4 5 6] [] [] [])

; in clojure - whether commented or not

[[1 7 8 9] [6 6] [2 3 4 5]]

; in clojurescript

; uncommented
[[1 7 8 9] [6 6] [2 3 4 5]]

; commented
[[1 7 8 9] [7] [6] [2]]


Regards

Dave

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure videos no longer downloadable

2011-12-14 Thread Baishampayan Ghose
Every video has an RSS feed which can be mechanically constructed given the URL.

So for http://blip.tv/clojure/rich-hickey-unveils-clojurescript-5399498,
the RSS feed is at http://blip.tv/rss/flash/5399498

IIRC, the RSS feed has the URL to the actual video.

Regards,
BG

On Thu, Dec 15, 2011 at 5:00 AM, Phil Hagelberg p...@hagelb.org wrote:
 So I recently went to clojure.blip.tv to download a video, and I
 noticed my account had been deleted. Apparently they are requiring all
 logins to go through facebook.

 Is there a way we could provide video downloads to people who don't
 have facebook accounts?

 -Phil

 --
 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 with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en



-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Lazy-seq of a binary file

2011-12-14 Thread Simone Mosciatti
Ok thank you so much, i got it.

Thanks again ;-)

Simone

On Dec 14, 3:22 am, Cedric Greevey cgree...@gmail.com wrote:
 On Wed, Dec 14, 2011 at 12:04 AM, Simone Mosciatti mweb@gmail.com wrote:
  Thank you so much, just one last thing, why you use a char-array ?

 Reader returns chars.

  If I want use a byte-array, and no map all the whole sequence ?

 Use an InputStream rather than a reader if you're reading binary files
 (or text files as binary). If you're not consuming the whole sequence,
 again, have the part of the code that consumes some and then stops
 also create the stream and be responsible for closing it, passing it
 to the lazy sequence maker; use with-open, and if that part of the
 code still emits a sequence (e.g. (take some-number (remove icky?
 (..., rather than a single object (extracted, reduced, or
 whatever), wrap that sequence in (doall ...) inside the with-open so
 all the needed stream I/O actually is performed before the stream gets
 closed.

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


want to make a 'debug' function, how to get current source and line number?

2011-12-14 Thread jaime
Hello there,

I want to write a function named debug which will print out date-
time msg + current source-line + etc. info, but I don't know how to
get the current source and line number of the running point (just like
what REPL does when encounter any exceptions) ...

Got any ideas?

Thanks!

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: namespace what?

2011-12-14 Thread David Brunell
Do you have a complete program that you are trying to get working, along
with errors?  The examples.core namespace was chosen at random; you could
call it whatever you want.  It refers to the namespace in which your main
program runs.  In order to have clarity.component recognized, you need to
manage your classpath and dependencies.  The easiest way would be to create
a project with lein, edit the project.clj, then run lein deps.  Clarity is
in the clojars repository, so it will pull it in automatically for you and
place it in the classpath.

On Tue, Dec 13, 2011 at 4:50 PM, jayvandal s...@ida.net wrote:

 I think I understand namespace and then I don't!
 I try to run this example
 (ns examples.core
  (use [clarity.component :as c]))

  (make :button The Button)
  I have programs stored in c:\projects\klarity.clj
 I have clojure stored in c:\clojure-1.2.1\clojure-1.21.
 I am running c:\cljr\clj-installer-jar

 I tried running
 (ns clojure-1.2.1.clojure-1.2.1.src.clojure.core
  (use [clarity.component :as c]))

  (make :button The Button)

 What is namespace suposed to point to or access???

 --
 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 with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: namespace what?

2011-12-14 Thread Tassilo Horn
jayvandal s...@ida.net writes:

Hi,

I don't understand your question, but...

 I think I understand namespace and then I don't!
 I try to run this example

 (ns examples.core
   (use [clarity.component :as c]))

The syntax of ns is

  (ns examples.core
(:use [clarity.component :as c]))

Notice the colon preceeding the use.

Bye,
Tassilo

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en