Unable to resolve symbol in third-party jarfile

2010-03-03 Thread Michael Gardner
As part of a project to help me learn Clojure, I'm trying to send an email using code like http://nakkaya.com/2009/11/10/using-java-mail-api-from-clojure/. For the JavaMail API I'm using GNU JavaMail, which in turn requires GNU JAF (activation.jar). When I try to run my program, I get:

Binary byte reader closure

2010-03-03 Thread TimDaly
I would like to have a function that returns the next binary byte of a file. I tried (defn reader (file) (let [in (new java.io.FileInputStream file] #(. in (read The idea is that I could call this function once and it would return a closure over the 'in' object. Then I could simply

Some basic guidance to designing functional vs. state parts of app

2010-03-03 Thread Sophie
As a bit of a newbie to the functional + identity/state design space, I'm struggling a bit with where to use identity constructs (refs) and where to stay with pure functions, and could use some guidance. Pardon me if some of my terms are a bit off. Here is a simple hypothetical app for matching

Using deftype to define mutually recursive data inside agent

2010-03-03 Thread zahardzhan
Sorry my english I use in my small clojure program one complicated mutually-recursive data structure that represents an agent-in-environment. This structure is clojure agent which have self-reference inside himself and reference to environment, where environment is set of agents: (let [a (agent

Protocols and Types

2010-03-03 Thread Andrea Tortorella
Hi everyone, if I run this code: (defprotocol P (foo [x])) (deftype T [] P (foo [] dummy)) (extends? P T) ;== nil (satisfies? P T) ;== nil (extenders P) ;==nil are they not yet implemented? anyway when I run (type P) ;== clojure.lang.PersistentArrayMap So the protocol is simply a

Re: Unable to resolve symbol in third-party jarfile

2010-03-03 Thread Michael Wood
On 2 March 2010 17:40, Michael Gardner gardne...@gmail.com wrote: As part of a project to help me learn Clojure, I'm trying to send an email using code like http://nakkaya.com/2009/11/10/using-java-mail-api-from-clojure/. For the JavaMail API I'm using GNU JavaMail, which in turn requires

Re: Binary byte reader closure

2010-03-03 Thread Meikel Brandmeyer
Hi, On Mar 2, 10:57 pm, TimDaly d...@axiom-developer.org wrote: (defn reader (file)   (let [in (new java.io.FileInputStream file]     #(. in (read The arguments a written in a vector not a list: (defn reader [file] ; - note vectpr (...)) Sincerely Meikel -- You received this

Re: Protocols and Types

2010-03-03 Thread Shawn Hoover
On Wed, Mar 3, 2010 at 8:43 AM, Andrea Tortorella elian...@gmail.comwrote: Hi everyone, if I run this code: (defprotocol P (foo [x])) (deftype T [] P (foo [] dummy)) (extends? P T) ;== nil (satisfies? P T) ;== nil (extenders P) ;==nil are they not yet implemented? Nil

Re: Protocols and Types

2010-03-03 Thread Konrad Hinsen
On 03.03.2010, at 14:43, Andrea Tortorella wrote: (extends? P T) ;== nil (satisfies? P T) ;== nil (extenders P) ;==nil The doc string of both extends? and extenders refers to types explicitly extending a protocol. My understanding is that this excludes protocols implemented via their

Re: Protocols and Types

2010-03-03 Thread Stuart Halloway
Hi Andrea, You need to make two little changes: (1) satisfies? is a predicate about instances, not types, and (2) the extend predicates check for explicit extension: (defprotocol P (foo [x])) (deftype T []) (extend ::T P {:foo (fn [] dummy)}) (extends? P T) = true (satisfies? P

Re: Protocols and Types

2010-03-03 Thread Meikel Brandmeyer
Hi, On Mar 3, 2:43 pm, Andrea Tortorella elian...@gmail.com wrote: You have to use some instance of T. (extends? P T) ;== nil (extends? P some-t) will return false, because you don't call extend explicitly. (satisfies? P T) ;== nil (satisfies? P some-t) will return true. (extenders P)

Re: Protocols and Types

2010-03-03 Thread Andrea Tortorella
I'm not on my machine so i'cant experiment, i tried on #clojure with clojurebot but it's not 1.2, so i ask here, given that a protocol is represented as a simple map, which is the way to know if something is infact a protocol. Or suppose i want to add a function that works on protocols how can i

Re: Binary byte reader closure

2010-03-03 Thread TimDaly
Sorry, that was a transcription error. My common-lisp is showing. The original source has square brackets. The issue seems to be that something internal to Clojure does not implement the ISeq interface. Why it wants to find an ISeq interface on Symbol is unclear. The symbol in should be part of

Re: Some basic guidance to designing functional vs. state parts of app

2010-03-03 Thread eyeris
One aspect of your question that makes it difficult to answer is that you don't explain what the repercussions should be (in terms of synchronization) when a new applicant or job enters the pool or a new skill is attributed to an applicant. Should the job-applicant matching function be restarted?

Re: Binary byte reader closure

2010-03-03 Thread Michael Wood
On 2 March 2010 23:57, TimDaly d...@axiom-developer.org wrote: I would like to have a function that returns the next binary byte of a file. I tried (defn reader (file)  (let [in (new java.io.FileInputStream file]    #(. in (read The idea is that I could call this function once and it

Re: Protocols and Types

2010-03-03 Thread Konrad Hinsen
On 03.03.2010, at 16:05, Andrea Tortorella wrote: given that a protocol is represented as a simple map, which is the way to know if something is infact a protocol. I don't think that is possible without relying on undocumented characteristics that are likely to change. What do you need this

objects, interfaces and library design

2010-03-03 Thread cageface
I've been reading through the examples of OO in clojure using multi- methods and they certainly seem very flexible and powerful. I'm wondering, however, how people handle interface library design. If people can implement objects as maps, structs, or just about anything else you can discriminate

Re: Unable to resolve symbol in third-party jarfile

2010-03-03 Thread Michael Gardner
On Mar 3, 2010, at 8:42 AM, Michael Wood wrote: On 2 March 2010 17:40, Michael Gardner gardne...@gmail.com wrote: As part of a project to help me learn Clojure, I'm trying to send an email using code like http://nakkaya.com/2009/11/10/using-java-mail-api-from-clojure/. For the JavaMail API

Re: Binary byte reader closure

2010-03-03 Thread TimDaly
Works for me now. No idea what changed. Different day. Sigh. On Mar 3, 12:07 pm, Michael Wood esiot...@gmail.com wrote: On 2 March 2010 23:57, TimDaly d...@axiom-developer.org wrote: I would like to have a function that returns the next binary byte of a file. I tried (defn reader

Re: objects, interfaces and library design

2010-03-03 Thread Jarkko Oranen
On Mar 3, 7:47 pm, cageface milese...@gmail.com wrote: I've been reading through the examples of OO in clojure using multi- methods and they certainly seem very flexible and powerful. I'm wondering, however, how people handle interface library design. If people can implement objects as maps,

Re: Some basic guidance to designing functional vs. state parts of app

2010-03-03 Thread Armando Blancas
On Mar 2, 8:34 pm, Sophie itsme...@hotmail.com wrote: Do I design a single World ref whose state changes with time to different worlds, so adding a new Applicant or even adding a new Skill to an existing Applicant results in a new World value? Or is it better to have an Applicants ref and a

Re: objects, interfaces and library design

2010-03-03 Thread cageface
On Mar 3, 2:05 pm, Jarkko Oranen chous...@gmail.com wrote: Well, it seems to me that the universal interface is the sequence. Turns out many things can be represented as sequences. :) And since maps are just collections of key/value pairs, very generic code can be written to process them, too.

Seajure meeting tomorrow night (Seattle Clojure group)

2010-03-03 Thread Phil Hagelberg
Just a reminder: tomorrow night we're having a meeting of Seajure, the Seattle Clojure group. 7:00 pm at University Zoka

Re: objects, interfaces and library design

2010-03-03 Thread Mike Meyer
On Wed, 3 Mar 2010 09:47:09 -0800 (PST) cageface milese...@gmail.com wrote: I've been reading through the examples of OO in clojure using multi- methods and they certainly seem very flexible and powerful. I'm wondering, however, how people handle interface library design. If people can

Re: Some basic guidance to designing functional vs. state parts of app

2010-03-03 Thread Mike Meyer
On Wed, 3 Mar 2010 14:20:56 -0800 (PST) Armando Blancas armando_blan...@yahoo.com wrote: On Mar 2, 8:34 pm, Sophie itsme...@hotmail.com wrote: Do I design a single World ref whose state changes with time to different worlds, so adding a new Applicant or even adding a new Skill to an

Re: Some basic guidance to designing functional vs. state parts of app

2010-03-03 Thread Rick Moynihan
On 3 March 2010 04:34, Sophie itsme...@hotmail.com wrote: As a bit of a newbie to the functional + identity/state design space, I'm struggling a bit with where to use identity constructs (refs) and where to stay with pure functions, and could use some guidance. Pardon me if some of my terms

Re: Some basic guidance to designing functional vs. state parts of app

2010-03-03 Thread Richard Newman
For a single value there seems to be little reason to adopt refs, though I've often wondered why Stuart Halloway's book gives an example updating a single ref of messages for a chat application. I seem to recall atoms being the last reference type to be introduced. They might not have existed

doto doc fix

2010-03-03 Thread MarkSwanson
- value of x supplied at the from of the given arguments. The forms + value of x supplied at the front of the given arguments. The forms -- 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

clojure slides

2010-03-03 Thread Wilson MacGyver
Looks like I'll be doing a talk on clojure next week at the local java user group. Any recommendations on slides I can steal? :) -- Omnem crede diem tibi diluxisse supremum. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: clojure slides

2010-03-03 Thread Mike Mazur
Hi, On Thu, Mar 4, 2010 at 11:58, Wilson MacGyver wmacgy...@gmail.com wrote: Looks like I'll be doing a talk on clojure next week at the local java user group. Any recommendations on slides I can steal? :) There are some presentations in our google group file section[1]. Look for PDF files.

Re: Some basic guidance to designing functional vs. state parts of app

2010-03-03 Thread rzeze...@gmail.com
On Mar 2, 11:34 pm, Sophie itsme...@hotmail.com wrote: How do I choose? What are the trade-offs? Any and all guidance, insights, advice etc. welcome! Thanks! To me, it seems like you have two orthogonal pieces of data, and a function that builds a report from that data. You have a set of

name clash/problem with refer

2010-03-03 Thread cageface
In trying to build compojure with the git MASTER versions of clojure contrib I ran into this error: Clojure 1.2.0-master-SNAPSHOT user= (use 'clojure.contrib.string) java.lang.IllegalStateException: repeat already refers to: #'clojure.core/repeat in namespace: user (NO_SOURCE_FILE:0) So I

Re: name clash/problem with refer

2010-03-03 Thread Meikel Brandmeyer
Hi, On Mar 4, 7:36 am, cageface milese...@gmail.com wrote: So I figured I'd try to use the :exclude option but got this: user= (use 'clojure.contrib.string :exclude [repeat]) java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean (NO_SOURCE_FILE:0) Almost

Need help for the macro with defn and defmacro inside

2010-03-03 Thread sailormoo...@gmail.com
Hi : I would try to make a macro to simplify the database methods as follows, but it doesn't work, is there any way to fix it, or any easier solution? Thanks.. (defmacro with-db [ body] `(with-connection *db* ~...@body)) (defmacro with-transaction [ body] `(with-db (transaction