Re: Generating functions from data

2013-11-18 Thread Michael-Keith Bernard (SegFaultAX)
Hi Jeremy, There are a number of existing implementations of what you're describing, the most well known of which is the Web Services Description Language (WSDL)http://en.wikipedia.org/wiki/Web_Services_Description_Languagecommonly used with SOAP http://en.wikipedia.org/wiki/SOAP. A WSDL file

Re: Lazy group-by for sorted maps?

2013-08-12 Thread Michael-Keith Bernard (SegFaultAX)
For the partition-by solution to work, you have to ensure that the result set from the query is sorted by the foreign key: (partition-by identity aaabbbcccaaabbbcc) ;;= ((\a \a \a) (\b \b \b) (\c \c \c) (\a \a \a) (\b \b \b) (\c \c)) (partition-by identity (sort aaabbbcccaaabbbcc)) ;;= ((\a \a

Re: Adding implicit indexing to Clojure lists and arrays?

2013-06-26 Thread Michael-Keith Bernard (SegFaultAX)
Vectors and maps are already functions of their indices and keys, respectively. I don't really think it makes sense for other sequence types (seqs, lists, etc.) because they aren't naturally associative in the same way. Finally, there isn't a Clojure form I'm aware of that allows negative

Re: putting 2-element colls into a map: works with vectors, but not with lists?

2013-06-25 Thread Michael-Keith Bernard (SegFaultAX)
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentMap.java#L24 The implementation assumes you're attempting to conj one of the following 3 things into the hash map: 1. A MapEntry object 2. A vector of the format [key value] 3. A seq of MapEntry objects

Re: what directs the program in my-website progream to execute the various files, welcome, users?

2013-06-11 Thread Michael-Keith Bernard
Without some code it would be impossible for us to speculate about how your program operates. Please provide the relevant source code and we can easily help you trace the flow of execution. On Tuesday, June 11, 2013 5:32:46 AM UTC-7, jayvandal wrote: what statements makes the program execute.

Re: what directs the program in my-website progream to execute the various files, welcome, users?

2013-06-11 Thread Michael-Keith Bernard
Re-paste for formatting: ;; project.clj (defproject my-website 0.1.0-SNAPSHOT :description my Noir website :dependencies [[org.clojure/clojure 1.3.0] [noir 1.3.0-beta3] [org.clojure/java.jdbc 0.2.3] [mysql/mysql-connector-java 5.1.6]]

Re: Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-11 Thread Michael-Keith Bernard
Ok fair enough. Check out the updated gist, I think it more exactly fits your guidelines. https://gist.github.com/SegFaultAX/5754209 (defn crypt-range [low high] (let [chars (map char (range low high))] (zipmap chars (shuffle chars (defn make-crypto [] (let [ranges [[97 123] [65

Re: Is there an approved way for testing if something is a zipper?

2013-06-11 Thread Michael-Keith Bernard
If you're using clojure.zip then a zipper is merely a vector with 3 specific keys (:zip/make-node, :zip/children, and :zip/branch?) in the metadata which the zipper algorithms use to manipulate and traverse the data structure. You can trivially check using something like (and (vector? z)

Re: swap keys / values in hash map

2013-06-10 Thread Michael-Keith Bernard
An alternative implementation that shuffles all printable characters. This version returns the encryption map and generalizes the encrypt/decrypt functionality. https://gist.github.com/SegFaultAX/5754209 On Tuesday, August 12, 2008 10:25:00 PM UTC-7, Joubert Nel wrote: Hello, I have a

Re: Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-10 Thread Michael-Keith Bernard
Here is an alternative implementation that generalizes the encrypt/decrypt functionality. It also uses all printable characters for the source dictionary. https://gist.github.com/SegFaultAX/5754209 P.S. I accidentally posted this as a reply to an older question I happened to have open. On