Re: Small Problem: Which Strings Differ at One Location

2011-05-30 Thread joshua-choi
a compact functional > implementation:https://gist.github.com/828413 > > 2011/5/30 joshua-choi : > > > > > > > > > Let's say that I have a set of strings, each three English letters > > long. > > > How can I determine which strings differ only a

Small Problem: Which Strings Differ at One Location

2011-05-30 Thread joshua-choi
Let's say that I have a set of strings, each three English letters long. How can I determine which strings differ only at one location (e.g. "xxe" and "xbe")? Right now, I'm writing a loop that sequentially compares every string to every other string. I think that there's a better way, but I don'

JavaFX alternative languages talk at JavaOne

2010-09-12 Thread joshua-choi
I have no idea how many of you both care at all about JavaFX and are planning to go to the JavaOne conference tomorrow Monday in San Francisco, but there's apparently going to be a talk about using the JavaFX platform from alternative languages, particularly Clojure, at 4 PM. I myself can't go, but

Re: Macro problems with delay

2010-09-10 Thread joshua-choi
macro call, resulting in the error. The solution was to change (alter-var-root maker-var# named-rule-maker ~rule-type-kw) to (when (= '~def-form `defmacro) (alter-var-root maker-var# named-rule-maker ~rule-type-kw)) Thanks, everyone for your help. joshua-choi wrote: > Tha

Re: Macro problems with delay

2010-09-10 Thread joshua-choi
macro call, resulting in the error. The solution was to change (alter-var-root maker-var# named-rule-maker ~rule-type-kw) to (when (= '~def-form `defmacro) (alter-var-root maker-var# named-rule-maker ~rule-type-kw)) Thanks, everyone for your help. joshua-choi wrote: > Tha

Re: Macro problems with delay

2010-09-10 Thread joshua-choi
dding of a delay into macro code is somewhere else, but I don't know. Meikel Brandmeyer wrote: > Hi, > > On 10 Sep., 03:11, joshua-choi wrote: > > > I am running into a problem sometimes when I call a certain macro I > > defined. This problem macro (and an associated

Re: Macro problems with delay

2010-09-10 Thread joshua-choi
ou are correct, commenting out that function call in the macro does prevent the error. I don't understand it. Konrad Hinsen wrote: > On 10 Sep 2010, at 03:11, joshua-choi wrote: > > > And here is a full macro-expansion of the call at which the error > > happens: > >

Macro problems with delay

2010-09-09 Thread joshua-choi
I am running into a problem sometimes when I call a certain macro I defined. This problem macro (and an associated problem function) is: http://gist.github.com/572875 I run into this error (which is at a call to the macro, but *not* at the *first* time it's called for some reason!): http://gist.

Re: Another JavaFX and Clojure Demo

2010-08-23 Thread joshua-choi
This is fascinating—I too am interested in Clojure-JavaFX interaction. Thanks a lot for putting this up! On Aug 21, 8:43 pm, Sam Griffith wrote: > Hello group, > > I'd replied a long time ago to one of the posts about JavaFX and > Clojure working together... I've now finally gotten back to puttin

Re: DSL with a grammar

2010-07-08 Thread joshua-choi
Consider using FnParse (http://github.com/joshua-choi/fnparse/tree/ develop). It's a pure Clojure parser combiner that is flexible in what tokens it accepts. You can use it to parse the symbol/list/etc. structures given to your macros into other forms. FnParse 3, the latest version, is curr

Re: Language request: Passing metadata to a fn from its name (in a fn form)

2010-05-24 Thread joshua-choi
roxying AFn instead? > > On May 24, 3:24 pm, joshua-choi wrote: > > > > > > > I have a language request for the fn special form. > > > Functions can now have metadata. This is great, and very useful for > > me. > > > I'd like to request that

Language request: Passing metadata to a fn from its name (in a fn form)

2010-05-24 Thread joshua-choi
I have a language request for the fn special form. Functions can now have metadata. This is great, and very useful for me. I'd like to request that now the (fn name …) form pass on any metadata on the name symbol to the function itself: user=> (meta (fn ^{:a 3} name …)) {:a 3} This would ideall

Re: Splitting a string with the characters between each split?

2010-05-14 Thread joshua-choi
/partition #"\s+" "ab c  de") > ;; ("ab" " " "c" "  " "de") > > Justin > > On May 13, 12:24 pm, joshua-choi wrote: > > > I'd like to know if there's a standard function similar to > > clojure

Re: Splitting a string with the characters between each split?

2010-05-13 Thread joshua-choi
> You could do it by using the word boundary regexp operator. > > (ns foo.bar >   (:use [clojure.contrib.string :only [split]])) > > (defn split* [s] >   (drop 1 (split #"\b" s))) > > (split* "ab c  de") > > ;; ("ab" " " "c"

Splitting a string with the characters between each split?

2010-05-13 Thread joshua-choi
I'd like to know if there's a standard function similar to clojure.contrib.string/split that includes the characters between the spitted string, or if there isn't one, how I might write one. In other words, I'd like a function split* such that (split* #"\s+" "ab c de") returns ("ab" " " "c" " " "

Re: removing the need for refer-clojure ?

2010-05-05 Thread joshua-choi
I would love if this happened; it could probably be implemented in a backwardly compatible way, since you're currently not supposed to use or require clojure.core anyway, as far as I know. On May 5, 8:36 am, Laurent PETIT wrote: > Hello, > > After thinking twice about it, ns does 2 special things

Re: Trouble with Leiningen and Autodoc

2010-05-03 Thread joshua-choi
Actually, disregard the message above! You don't want the latest tree on the develop branch; it currently throws errors because defalias doesn't work with macros anymore. You want to use the tree at the tag 3.α.3! My apologies. On May 3, 5:15 pm, joshua-choi wrote: > Yes,http://gith

Re: Trouble with Leiningen and Autodoc

2010-05-03 Thread joshua-choi
Yes, http://github.com/joshua-choi/fnparse/tree/develop. You must use the latest tree in the develop branch (which is at the time of this writing commit "baf3b39f51fdd3893471f52d330336b5a794fa6d"). Thanks for the help, and I look forward to what you figure out. On May 3, 12:12 pm, Tom

Calling for advice on a parser's location data

2010-05-02 Thread joshua-choi
I'm making a parsing library that can keep track of its location in a stream of tokens, and the tokens can be of any type—character, map, and so forth. I need advice on this question: Can you think of an instance where the location would not be a line number and column number, such as {:line 3, :c

Trouble with Leiningen and Autodoc

2010-05-01 Thread joshua-choi
This is my project.clj: (defproject fnparse "3.α.3" :description "A library for creating functional parsers in Clojure." :dependencies [[org.clojure/clojure "1.2.0-master-SNAPSHOT"] [org.clojure/clojure-contrib "1.2.0-master- SNAPSHOT"]] :dev-dependencies [[autodoc "0.7.0"]]

Naming factory functions

2010-04-22 Thread joshua-choi
When it comes to naming factory functions—functions that create things— clojure.core gives four precedents: 1. Name it exactly what the new object is called. vector, hash-map, set. 2. Name it a shortened version of #1. vec. 3. Prefix #1 with "make-". make-hierarchy, make-array. 4. Prefix #1 with "

Are there any plans for more allowed symbol characters?

2010-03-01 Thread joshua-choi
According to http://clojure.org/reader, “Symbols begin with a non- numeric character and can contain alphanumeric characters and *, +, !, -, _, and ? (other characters will be allowed eventually, but not all macro characters have been determined).” Are there any plans of allowing any more symbol ch

Re: bug: clojure.contrib.json should not default to use keywords.

2010-02-28 Thread joshua-choi
As a small note, according to http://clojure.org/reader, Clojure keywords and symbols are allowed to contain only alphanumeric characters, *, +, !, -, _, and ?. Spaces aren’t allowed, but the keyword function allows them anyway because it doesn’t do any checking for validity for performance. I’m to

Re: Prefixed or suffixed symbols?

2010-02-25 Thread joshua-choi
of > taste I like suffixes).  If it's the behavior version, I think that a > special macro is in order (e.g. deftest) > > Sean > > On Feb 25, 10:22 pm, joshua-choi wrote: > > > > > Could you explain more what you mean? For instance, how are macros > > re

Re: Prefixed or suffixed symbols?

2010-02-25 Thread joshua-choi
-clojure-utils/blob/master/s... > > Hope this helps, > Sean > > On Feb 25, 8:59 pm, joshua-choi wrote: > > > > > Yeah, I don’t really like the underscores either. But I have to work > > with the set of currently allowed non-alphanumeric symbol characters > >

Re: Prefixed or suffixed symbols?

2010-02-25 Thread joshua-choi
sible. On Feb 25, 3:16 pm, Jarkko Oranen wrote: > On Feb 25, 12:17 am, joshua-choi wrote: > > > When it comes to distinguishing certain types of symbols from other > > things, should one use prefixes or suffixes? > > Whichever makes more sense, of course. :) > > >

Prefixed or suffixed symbols?

2010-02-24 Thread joshua-choi
When it comes to distinguishing certain types of symbols from other things, should one use prefixes or suffixes? Example: naming tests with clojure.test/deftest. If you distinguish your tests’ symbols at all, do you do “t-addition” or “addition-t”? (I need to know what the standard is, if there i

Re: idiomatic question about reader macro

2010-02-03 Thread joshua-choi
I see why you want to create your own reader macros—you want to set apart certain code visually. But ataggart has a good point when he keeps asking you for specific examples of your code. Do you want to use reader macros to change something like this: (make-data "red" "blue" "green") into somethi

Re: Clojure IRC help

2010-01-24 Thread joshua-choi
Ah! Never mind! I just got an email telling me that I had to verify the account! I did that, and I can now send messages to the room (I think). Thanks a lot! On Jan 24, 12:00 pm, joshua-choi wrote: > Thanks for the link; it's helpful. I've registered with Freenode as > jo

Re: Clojure IRC help

2010-01-24 Thread joshua-choi
Thanks for the link; it's helpful. I've registered with Freenode as joshua-choi with a password and nickname, and my IRC client informs me when I reconnect that the server has identified me as joshua-choi. However, when I try to send a message, I still get the same error. Could anything

Clojure IRC help

2010-01-24 Thread joshua-choi
Sorry for asking this here, but it's about the Clojure IRC room, which is kind of related to Clojure, being this group's sister help resource. I know nothing about IRC, but I've been using the Colloquy application for Mac OS X to connect to the Clojure IRC room on irc.freenode.net. It was working

Re: Small question: Best way to create a map with vector vals

2009-06-23 Thread joshua-choi
Come to think of it, this would also work for me: keeping the vector of pairs, and instead using filter to get the "values" of a key: (defn get-from-pairs [pairs key-to-fetch] (map #(get % 1) (filter #(= key-to-fetch (get % 0)) pairs))) (I wish the key and val functions were defined on vectors

Re: Was it decided to add these functions to core?

2009-06-23 Thread joshua-choi
On creating an infinite range, I think it'd be wonderful if Double/ POSITIVE_INFINITY or something like it would be bound to a core symbol, such as infinity or something. That'd way, one would be able to do things like (range 3 infinity) or (> infinity 5). CuppoJava, how long ago did those discus

Re: breaking early from a "tight loop"

2009-06-12 Thread joshua-choi
Oh! I see. Thanks for the explanation. On Jun 12, 9:56 am, "J. McConnell" wrote: > On Fri, Jun 12, 2009 at 12:35 PM, joshua-choi wrote: > > > Is the function of the "filter identity" call to make (map > > isInteresting pixels) a lazy sequence? I thought th

Re: breaking early from a "tight loop"

2009-06-12 Thread joshua-choi
Is the function of the "filter identity" call to make (map isInteresting pixels) a lazy sequence? I thought that the sequences map returned were already lazy, but I could be mistaken. On Jun 12, 8:56 am, CuppoJava wrote: > Hi Vlad, > I would approach it like this, and make full use of Clojure's

Re: In let: unpacking maps with accessors too

2009-06-08 Thread joshua-choi
Oh, I didn't know that. It makes me wonder, then, why integers were not implemented as functions of sequential collections: (3 [:a :b :c]). Ah, well. I guess since let can't be changed, it's then a choice between using accessors or being more elegant. Thanks for the reply. On Jun 8, 9:25 am, Kon

Re: error-kit + test-is

2009-05-18 Thread joshua-choi
I'd love for that to happen—either error-kit support in test-is or test-is support in error-kit. clojure.contrib libraries should be able to use each other with no worries, since they'll be installed together just about always. On May 17, 12:52 am, Dan Larkin wrote: > Sorry for the necro, but I