Re: (type ...) vs (class ...)

2018-10-24 Thread Armando Blancas
Found this: https://groups.google.com/forum/#!searchin/clojure/%22type$20metadata%22%7Csort:date/clojure/LBGsPs2__pQ/oLgx_kgmQxgJ :tag is applied to source forms to communicate type hints to the compiler. :type can be used, by convention, to add 'type names' to runtime data structures that

Re: calling a clojure function within a quote/(')

2017-11-17 Thread Armando Blancas
user=> (cond-> query #_=> true #_=> (conj '[? :data/number ?number]) #_=> true #_=> (conj `[(~'> ~'?number ~(foo 2))])) [:find ?e :in $ :where [? :data/number ?number] [(> ?number 3)]] On Friday, November 17, 2017 at 6:15:18 AM UTC-8, Njab Soul wrote: > > Hi guys I

[ANN] Kern 1.1.0 A library of parser combinators

2016-12-17 Thread Armando Blancas
Kern is a text-parsing library: https://github.com/blancas/kern 1.1.0 has two fixes (times, <+>); operator <*> minimum arity is now 1 (formerly 2). -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

[ANN] Kern 1.0 parsing library

2016-04-18 Thread Armando Blancas
Release 1.0 updates dependencies and gets rid of a name collision with cat. These functions will let you write code that resembles the grammar you're parsing. I've found it useful for interpreters, translators and DSL's. repo: https://github.com/blancas/kern docs:

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Armando Blancas
Jorge, I tried this on 1.6 and seemed to work: (def primes (cons 2 (for [n (iterate inc 3) :when (prime? primes n)] n))) On Thursday, February 12, 2015 at 4:21:45 PM UTC-8, Jorge Marques Pelizzoni wrote: Neither did delay help: (defn primes [] (let [primes' (atom nil)]

Re: Modelling in Clojure

2014-10-16 Thread Armando Blancas
Sure, that's the theory behind encapsulation, but I'm not convinced there are many cases in practice where the API can remain consistent while the data changes. I'm not, either. Models that have little or no abstraction --basically aggregates of related items-- end up having APIs

Re: clojure/data.json parsing

2014-09-27 Thread Armando Blancas
Alan, what if you do (prn orders_query_result) If the json string is being parsed correctly you should get string values printed in double quotes, as Tobias's examples showed. On Saturday, September 27, 2014 1:25:27 PM UTC-7, Alan Moore wrote: Yes, I printed the type of body and as expected

Re: ClassCastExecption with conj on deftype

2014-09-03 Thread Armando Blancas
Your implementation of cons in your deftype is probably being associated to the ISeq type, not IPersistentCollection. user= (deftype Foo [a b] #_= clojure.lang.IPersistentCollection #_= (cons [_ c] [a b c])) user.Foo user= (conj (Foo. 1 2) 3) [1 2 3] I think Vector supports ISeq

Re: How to refactor data safely?

2014-05-23 Thread Armando Blancas
Jakub, I'll be interested to learn how you work this out. I also work with data whose structure is known to functions in various modules, thus its very shape is a contract. This is coming from the other end of encapsulating everything in Java classes and interfaces. Also, I write test cases at

Re: Leiningen just hangs

2014-05-15 Thread Armando Blancas
I've had this problem and I suspect is low memory. It happened often with an old box with 1G running Fedora 20, but I've also seen it with my laptop if I leave too many leftover jvm processes running (with 4G allocated for a virtual box instance); on my 16G mac it never happens. So freeing up

Re: Example of using ANTLR from Clojure?

2014-04-26 Thread Armando Blancas
I haven't touched this project in a while, but it might be useful. https://github.com/blancas/tinypost This file has the relevant interop code: src/main/clojure/blancas/tinypost/scan.clj On Saturday, April 26, 2014 3:04:50 AM UTC-7, Kranthi Rajoli wrote: Hi Paul, Do you mind outlining the

Re: creating a map

2014-03-27 Thread Armando Blancas
To add a little, into is generic and has no special treatment if the collection is a map, but works with maps if the elements are vectors because map associations of key-value pairs are a subclass of vector. The other way around: user= (for [elem {:foo :bar}] elem) ([:foo :bar]) ; extracts :foo

Re: What is the right way to create dynamic var in another namespace?

2014-03-01 Thread Armando Blancas
This came up a while back and it appeared that the metadata just reflected whether the var was created with the ^:dynamic annotation. But the meta attribute is an output, so to speak; the info flows from the var declaration to the meta but not the reverse. Maybe it'll remain like that as

Re: Can't start repl with Leiningen

2014-02-26 Thread Armando Blancas
I had the same problem with an old box I had around the house. Put Fedora 20 on it with a recent open jdk, but had just 1GB of memory total. I attributed the error to the lower memory since I never have that issue at work or other machines with at least 4GB. If you have more than 2GB,

Re: unconditional append to end

2014-02-07 Thread Armando Blancas
For efficient appends at the end you need a vector. Using the sequence library can be tricky while you're putting together your data structures because it's likely that you'll not done yet with type-specific functions. You'll need to re-create your vector after using map/filter/etc to be able

Re: bug in clojure.zip when calling next on empty list node?

2013-12-31 Thread Armando Blancas
The implementation of seq-zip uses seq? as its branching predicate. As a result the zipper goes down on () thinking it can have children: user= (seq? ()) true user= (seq? {}) false user= (seq? #{}) false user= (seq? []) false On Sunday, December 29, 2013 10:14:23 AM UTC-8, Lee wrote: I

Re: java.jdbc DSLs (java.jdbc.sql / java.jdbc.ddl)

2013-11-22 Thread Armando Blancas
We use select several times in one module; it wouldn't be hard to just copy and paste the function somewhere. Now, you could drop DSL and call it optional utility functions not to be used when deemed unhelpful, or whatever. Given your goals stated goals that code isn't bad at all. On

Re: java.jdbc DSLs (java.jdbc.sql / java.jdbc.ddl)

2013-11-22 Thread Armando Blancas
Didn't think of that. I can just rewrite those simple select calls with parameterized raw SQL, which is our preferred way of using the API. On Friday, November 22, 2013 2:09:19 PM UTC-8, Sean Corfield wrote: On Fri, Nov 22, 2013 at 1:04 PM, Armando Blancas abm2...@gmail.comjavascript

Re: ANN: Rush Hour - an example Clojure architecture

2013-10-28 Thread Armando Blancas
Good work. Thanks for putting this out. On Monday, October 28, 2013 6:03:54 AM UTC-7, Michael Drogalis wrote: Hi everyone, I'm happy to announce the Rush Hour platform - highly realistic traffic simulations done with a careful, exemplar architecture all in Clojure. GitHub platform page:

Re: much lower recursion depth with memoization

2013-09-22 Thread Armando Blancas
With memoize there are additional calls (the new function and apply) per recursion, so I guess that will produce the stack overflow to happen sooner. You can use memoization once you remove the stack issue with iteration: (defn gauss-iter [n] (letfn [(f [n acc] (if ( n 1)

Re: finding retained head

2013-09-10 Thread Armando Blancas
Can anyone explain to me what's happening here? Something about creating a anonymous function? The problem is not creating the anonymous function but that it closes over the matrix argument. The closure passed on to blah will keep a reference to matrix until blah returns. This won't

Re: finding retained head

2013-09-10 Thread Armando Blancas
I also suspected the closure over the matrix argument as being the root cause but was puzzled when using doseq instead made the problem go away... Right, it doesn't seem to be a hold in the closure, unless the compiler could tell when to release it, which is the case when the code is

Re: Handling name collisions with clojure.core

2013-09-05 Thread Armando Blancas
I just think the default behaviour should be super-friendly and not spit out warnings. If other libs also redefine any of those operators or names, now or in later versions, I'd be glad to know. With last-one-in-wins some will lose. Maybe this will help: mvn clojure:repl 2 /dev/null --

Re: evaluation order in loading file/project (with leiningen)

2013-09-02 Thread Armando Blancas
I assume that making a makro out of *define-all-properties* is not the way to go, because it depends on the reading of a file, which should not yet be done at compile time (this may be a false assumption;...). Seems to me this is the key to how you'd construct your program. The csv

Re: To read and write bytes via Socket

2013-08-28 Thread Armando Blancas
With UTF-8 characters are encoded in a variable number of bytes according to various ranges, as you can see here in section Description: http://en.wikipedia.org/wiki/UTF-8 Since you're sending your bytes as chars but read back as bytes, your last two bytes create chars that later produce two

Re: tools for minimizing forward declaration

2013-08-20 Thread Armando Blancas
That's what I was referring to. Was there something specific about it that you wanted to call out? :) Nope; just wanted to bring it up. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: tools for minimizing forward declaration

2013-08-19 Thread Armando Blancas
I'll point out as well that though I thought Yegge's criticisms of Clojure were a bit polemical (I guess that's his style), the single pass compiler issue was one of his biggest gripes, and I do think it still rings true. I feel like I have to babysit clojure in this regard, when I

Re: [ANN] Leiningen 2.3.0 released

2013-08-09 Thread Armando Blancas
[Mac OS X 10.8.4] I followed this same procedure as Sean and it worked for me last night. On Thursday, August 8, 2013 9:16:06 PM UTC-7, Sean Corfield wrote: It failed for me on Mac OS X 10.8.4 - this has also been a problem on Windows for me (which doesn't have curl / wget anyway). Can we

Re: Wrong documentation of contains?

2013-08-07 Thread Armando Blancas
The keys docstring says it returns a sequence, and that's all you get: it'll do first and next, nothing special about it. The contains? docstring says it won't do a linear search, so that rules out the result of keys. (KeySeq just wraps a seq of entries to return the key field.) What's

Re: Displaying objects in REPL: Clojure equivalent of Java's toString?

2013-08-01 Thread Armando Blancas
Adding to that... have a look at the implemented methods in core_print.clj. The print-method will get called on print and println with your instance as the first argument. In this example prints a pair type; since elements can be anything it just calls print on each. (deftype Pair [fst snd])

Re: Accessing Record Constructors

2013-07-31 Thread Armando Blancas
The constructor should be available, like in this contrived sample: Clojure 1.5.1 user= (deftype Foo [a] Object (toString [this] (Foo. 1))) user.Foo What error are you getting? On Wednesday, July 31, 2013 5:51:36 PM UTC-7, JvJ wrote: I tried to define this record, but the Vec2. constructor

Re: Does this abstraction have any existing name?

2013-07-27 Thread Armando Blancas
morph's incomplete because it extends Functor only for collections and function composition; I'll add String and boxed types, but for now Long's extension must be supplied: (use 'blancas.morph.core) (extend-type java.lang.Long Functor (fun [this f] (f this))) With this, it's like alto.generic

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-27 Thread Armando Blancas
There is no one who understands `(if (seq thing)` who wouldn't understand `(if (not (empty? thing))` or, better, `(if (not-empty? thing)`. The converse is not true. That suggests that the latter should be the idiom No, it doesn't. That simply illustrates that idioms must be learned, as in

Re: unusual question: how do you get morale?(or moral support)

2013-05-13 Thread Armando Blancas
Zack, you've probably come across this profile on Jeff Hammerbacher, but just in case. The best minds of my generation are thinking about how to make people click ads, he says. That sucks. http://www.businessweek.com/printer/articles/55578-this-tech-bubble-is-different On Monday, May 13, 2013

Re: More idiomatic way to use map like this?

2013-05-03 Thread Armando Blancas
Having failed many attempts, I asked Feng Shen and he kindly told me how: copy some formatted text off a browser and simply paste it on this editor box. So I made a gist and instead of putting this link https://gist.github.com/blancas/5507033 I just pasted the text. On Friday, May 3, 2013

Re: [OT] Re: More idiomatic way to use map like this?

2013-05-03 Thread Armando Blancas
On Friday, May 3, 2013 1:15:24 PM UTC-7, Robert Pitts wrote: Armando was a good citizen and sent along a plain-text version as well – https://groups.google.com/group/clojure/msg/6aae8287bc55d436?dmode=sourceoutput=gplainnoredirect That must have been Google Groups doing the right thing...

Re: More idiomatic way to use map like this?

2013-05-02 Thread Armando Blancas
This isn't idiomatic but can be useful for modeling mutable computations in pure functions: (use '[blancas.morph core monads]) (def cards [{:balance 30} {:balance 25}]) (def due 100) (run-state (mapm #(monad [due get-state app (state (min due (:balance %)))

Re: [ANN] Grojure, a Java/C# syntax atop Clojure using Kern

2013-04-29 Thread Armando Blancas
Nice work, Gavin. Grojure is a good example why Clojure is an excellent UNCOL for the JVM, so some of us will depend less on the ASM lib. Your parser illustrates how to use grammar actions for writing a very compact one-pass translator; pretty cool. On Sunday, April 28, 2013 9:41:00 PM UTC-7,

Re: [ANN] Grojure, a Java/C# syntax atop Clojure using Kern

2013-04-29 Thread Armando Blancas
for Kern over time. I haven't found any bugs in Kern so congratulations on that one. On Tuesday, April 30, 2013 1:42:06 AM UTC+8, Armando Blancas wrote: Nice work, Gavin. Grojure is a good example why Clojure is an excellent UNCOL for the JVM, so some of us will depend less on the ASM lib. Your

Re: ANN: Kern 0.7.0 text parsing lib has fixes, better performance

2013-04-16 Thread Armando Blancas
On Tuesday, April 16, 2013 4:06:51 AM UTC-7, Luca Antiga wrote: Great, I just updated clj-toml to 0.7.0 and all tests pass. Thanks Armando Very cool, Luca. I'll be looking for other ways to boost performance while keeping the purely functional design. -- -- You received this message

ANN: Morph 0.3.0, monads+functors lib gets perf boost

2013-04-16 Thread Armando Blancas
In this release the lib gets rid of reflective calls by adding type hints. https://github.com/blancas/morph I don't have any benchmarks, but in Ben's tree-numbering Morph's timing goes from ~13,700 msecs down to ~350. https://github.com/bwo/monads/wiki/Tree-numbering-benchmark Morph tries hard

ANN: Kern 0.7.0 text parsing lib has fixes, better performance

2013-04-15 Thread Armando Blancas
This is a much needed clean up and perf boost release. https://github.com/blancas/kern Function (parse-file) won't choke with big files, while new parsers (parse-data) and (parse-data-file) work much faster by relaxing their house-keeping for input that's expected to be alright (e.g.,

Re: ANN: Kern 0.7.0 text parsing lib has fixes, better performance

2013-04-15 Thread Armando Blancas
You're very welcome. Glad to know the lib is useful. On Monday, April 15, 2013 10:15:30 AM UTC-7, Omer Iqbal wrote: Thanks Armando! I've been using kern for a number of projects and I'm really grateful for the awesome documentation :) On Tue, Apr 16, 2013 at 12:38 AM, Armando Blancas

Re: Monads usage

2013-04-08 Thread Armando Blancas
Last week I released a project with a monadic translator that needed to: - work on sequences of expressions, arbitrarily nested - generate Clojure code or stop and report the first error - maintain a symbol table with easy access but not global state The relevant code is here:

ANN: Eisen, a language and API for programmable apps

2013-04-05 Thread Armando Blancas
The goal of this project is to help you write programs that users can change and extend. Besides its practical advantages, there's something really powerful about modifying a deployed program, especially when it's done interactively. As to what language users should write in, I've come to

Re: Attempt at rethrow macro

2013-04-01 Thread Armando Blancas
Define rethrow as a function; Alf's probably right. Also, change to: ~message. user= (defn rethrow [ex-class] `(catch ~ex-class x# (throw x#))) #'user/rethrow user= user= (defmacro handle-ex [message body] `(try ~@body ~(rethrow IllegalArgumentException) (catch Exception x# (throw

Re: doing a Google search from Clojure?

2013-03-22 Thread Armando Blancas
Rich, you may want to check out clojure-http-client. https://github.com/technomancy/clojure-http-client (require '[clj-http.client :as client]) (spit result.html (client/get http://www.google.com/search?q=clojure;)) On Friday, March 22, 2013 12:09:07 AM UTC-7, Rich Morin wrote: I've been

Re: doing a Google search from Clojure?

2013-03-22 Thread Armando Blancas
api, if that's helpful. No API key needed. https://github.com/flatland/lazybot/blob/develop/src/lazybot/plugins/google.clj On Friday, March 22, 2013 10:54:37 AM UTC-7, Armando Blancas wrote: Rich, you may want to check out clojure-http-client. https://github.com/technomancy/clojure-http

ANN: Morph 0.2.0, state+error-handling with pure functions

2013-03-20 Thread Armando Blancas
Release 0.2.0 of the Morph library comes with a couple of fixes and some enhancements: https://github.com/blancas/morph Safe error-handling with non-global, shared data is now even easier: https://github.com/blancas/morph/wiki/Simpler-State-with-Error-Handling Documentation and samples:

ANN: Kern 0.6.1, a text-parsing library

2013-03-19 Thread Armando Blancas
I've pushed to Clojars the release 0.6.1 of Kern, a text-parsing library, with some fixes and enhancements. https://github.com/blancas/kern There's updated Codox API docs and a change log. Documentation and samples: https://github.com/blancas/kern/wiki For feedback, bug reports, etc.:

Re: [ANN] clj-toml 0.2.0

2013-02-25 Thread Armando Blancas
is a TOMLhttps://github.com/mojombo/tomlparser for Clojure. It was written on top of the Kern https://github.com/blancas/kern library by Armando Blancas (kudos). TOML is a minimalistic, human-readable format that maps to a hash (like INI, but more evolved). Cheers, Luca -- -- You

Re: Easier imperative-style programming

2013-02-11 Thread Armando Blancas
Here's an example of using a state monad for updating a position. The state goes into a simple map and there's a function to add coordinates. (def init {:position [100 100] :st :st0 :keys-held #{:left}}) (defn v+ [v1 v2] (vec (map + v1 v2))) The state monad can compute a value and maintain some

Re: pr-str captures stdout- Is this intentional or a bug?

2013-02-09 Thread Armando Blancas
There's nothing wrong with pr-str. Debug output should go to stderr. user= (def k (pr-str (for [x (range 5)] (do (.println *err* x) (.println *err* nothing) x 0 nothing 1 nothing 2

Re: [ANN] Morph v0.1.0 Monads friends: pure functions, less boilerplate

2013-02-07 Thread Armando Blancas
, Armando Blancas wrote: Morph is a new implementation of monads based on protocols. It's intended to provide the common patterns of error-handling, short-circuit sequencing, and modeling of stateful computations in pure functions. I've tried to make this library idiomatic while keeping

Re: [ANN] Kern 0.5.0 -- A text-parsing library

2013-02-07 Thread Armando Blancas
On Monday, 21 January 2013 18:27:07 UTC, Armando Blancas wrote: Kern is a text-parsing library based on Parsec, the Haskell monadic combinators library. It is useful for parsing all kinds of text: data, program input, configuration files, DSLs, or a full-blown programming language. My main

[ANN] Morph v0.1.0 Monads friends: pure functions, less boilerplate

2013-02-06 Thread Armando Blancas
Morph is a new implementation of monads based on protocols. It's intended to provide the common patterns of error-handling, short-circuit sequencing, and modeling of stateful computations in pure functions. I've tried to make this library idiomatic while keeping it close to its Haskell roots.

Re: [ANN] Morph v0.1.0 Monads friends: pure functions, less boilerplate

2013-02-06 Thread Armando Blancas
to do that kind of thing at all? - I'm curious about the Monoid protocol---I have one in babbage, and it has two more methods than yours, mempty? and value (instead of monoid-specific accessors). Why not put the accessors in the protocol? On Wed, Feb 6, 2013 at 4:06 PM, Armando Blancas abm2

Re: Clojure - Python Style suggestion

2013-02-04 Thread Armando Blancas
What do you think? I think, go right ahead and give it to them. Worst that could happen is you gain insights into language design. I'd be interested in your users' comments; what worked, what didn't. If you really believe in that idea, don't give it up before you learn something from it.

[ANN] Kern 0.5.0 -- A text-parsing library

2013-01-21 Thread Armando Blancas
Kern is a text-parsing library based on Parsec, the Haskell monadic combinators library. It is useful for parsing all kinds of text: data, program input, configuration files, DSLs, or a full-blown programming language. My main goal is, like the Self folks, the power of simplicity. In the ideal

Re: [ANN] Kern 0.5.0 -- A text-parsing library

2013-01-21 Thread Armando Blancas
at Parsatron (another parsec-derived library)? https://github.com/youngnh/parsatron I wrote some combinators for parsatron for dealing with clojure datastructures: https://github.com/bwo/macroparser On Mon, Jan 21, 2013 at 10:27 AM, Armando Blancas abm2...@gmail.comjavascript: wrote: Kern

Re: [ANN] Kern 0.5.0 -- A text-parsing library

2013-01-21 Thread Armando Blancas
Any plans to decouple the parsing combinators (more importantly the error messages/position tracking) from parsing text? A seqable object as in the second argument to parse is not necessarily something for which lines and columns make sense. Not yet. I've decided that first the

Re: [ANN] Kern 0.5.0 -- A text-parsing library

2013-01-21 Thread Armando Blancas
I see---also fair enough. How do you implement things like return (for monads) or mempty (for monoids) with protocols? I assume it's the perceived desirability of not having to pass in a parameter corresponding to some concrete monad/monoid/whatever to be able to get the right function

Re: methods of a protocol

2012-12-27 Thread Armando Blancas
(defprotocol symbolicExpr (evalx [this args])) (deftype x [a]) (let [y #(+ 1 2)] (extend-type x symbolicExpr (evalx [this args] (y (evalx (x. 0) 0) On Wednesday, December 26, 2012 6:16:13 PM UTC-8, Sunil Nandihalli wrote: Hi Everybody, It looks like the following way of

Re: Running a clojure script

2012-12-16 Thread Armando Blancas
I'm not going out of my way to be pseudonymous, it just seems to be a feature of the group. I thought, Mark asking how to run a script? An usurper! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Confused about comp

2012-12-15 Thread Armando Blancas
(comp (partial apply str) (partial filter #{\a})) Or, (comp join (partial filter #{\a})) -- 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

Re: Running a clojure script

2012-12-15 Thread Armando Blancas
Why are you using puzzler's account and what did you did to him?! On Saturday, December 15, 2012 7:28:56 PM UTC-8, puzzler wrote: Thanks. I think that used to be on the Getting Started page, but now the page is just links to info about how to get up and running with IDEs, so I had trouble

Re: Can anyone point me to that library that supports quasiquoting without full namespace expansion?

2012-12-02 Thread Armando Blancas
You can do: user= `[~'foo 1] [foo 1] On Sunday, December 2, 2012 10:24:29 AM UTC-8, Conrad wrote: I remember seeing it somewhere recently but I can't find it now... As you probably know, if you quasiquote in clojure it automatically adds namespaces: `[foo ~1] [mylibrary.core/foo 1]

Re: monads

2012-10-27 Thread Armando Blancas
I found these articles very valuable in understanding the original motivation for monads and their use for practical development. Imperative Functional Programming Simon Peyton Jones, Philip Wadler http://research.microsoft.com/pubs/67066/imperative.ps.z Monadic Parser Combinators Graham Hutton

Re: Midje popularity?

2012-10-17 Thread Armando Blancas
Does anyone use Midje currently? I do; and expect to use more of its features. -- 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

Re: Rouge: Ruby + Clojure

2012-10-16 Thread Armando Blancas
Finally came around to install a recent Ruby build and ran a little test script just to get a feel for the startup time. Looks good, though the faster the merrier. ~ $ ruby --version ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin10.8.0] ~/dev/tools/rouge $ cat test.clj (defn square

Re: Rouge: Ruby + Clojure

2012-10-12 Thread Armando Blancas
Nice work. I'm getting this error: ~/dev/tools/rouge $ bin/rouge ./bin/../lib/rouge.rb:6: undefined method `define_singleton_method' for Rouge:Module (NoMethodError) ~/dev/tools/rouge $ ruby --version In case any of this is relevant: ruby 1.8.7 (2012-02-08 patchlevel 358)

Re: Rouge: Ruby + Clojure

2012-10-12 Thread Armando Blancas
into something of a dog's breakfast. Sorry for the hassle. — Arlen On Saturday, October 13, 2012 8:52:05 AM UTC+11, Armando Blancas wrote: Nice work. I'm getting this error: ~/dev/tools/rouge $ bin/rouge ./bin/../lib/rouge.rb:6: undefined method `define_singleton_method' for Rouge:Module

Re: Sort and Java 1.7

2012-09-12 Thread Armando Blancas
You must be referring to the detection of contract violations. It shouldn't be an issue; on the contrary, that seems useful info. And those who depend on legacy or third-party code can always stick to the old behavior. Area: API: Utilities Synopsis: Updated sort behavior for Arrays and

Re: edn

2012-09-08 Thread Armando Blancas
I'd say on the basis of convenience, since we get to serialize and deserialize for free (o with customizations), and for most cases the author on both ends is likely to be the same person or team. For other languages, producers don't work any harder either way, and consumers are free to

Re: Expanding the Community Through Online Courses

2012-09-07 Thread Armando Blancas
This is a story from the trenches of your every day developer: It's a story with a ridiculous sense of entitlement. Be sure to complete your Scala lessons. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: how to translate this snippet from Scheme to Clojure

2012-08-30 Thread Armando Blancas
That's the definition of a procedure named (A). Scheme48, for one, won't take that name, but Chicken will, even with parameters: #;1 (define ((A) n) n) #;2 ((A) 5) 5 And neither will, btw, bind a value to such a symbol in a (let). Clojure symbols can't start with an open paren, so that's just an

Re: how to translate this snippet from Scheme to Clojure

2012-08-30 Thread Armando Blancas
Let's take it case by case. (define A 1) is like (def A 1) in Clojure. (define (A) 1) is like (defn A [] 1) (define (A x y) (* x y)) as you'll expect, (defn A [x y] (* x y)) (define (A) 1) is the same as (define A (lambda () 1)) ;; defines procedure A (define ((A)) 1) is the same as

Re: how to translate this snippet from Scheme to Clojure

2012-08-30 Thread Armando Blancas
That statement of mine was confusing because if you type each you'll get different things. The equivalence of (define (foo) bar) === (define foo (lambda() bar)) won't hold there: you'd be defining procedure A in the second case. If the first argument is in parens, (define) will be a function

How to avoid Attempting to call unbound fn:...

2012-08-28 Thread Armando Blancas
I'm playing around with a parser combinator library from the paper Monadic Parser Combinators by Hutton and Meijer [1] and came up with this: https://gist.github.com/3501273 That's just enough to show the error I'm getting when (expr) calls (factor): Clojure 1.4.0 user= (load-file expr.clj)

Re: How to avoid Attempting to call unbound fn:...

2012-08-28 Thread Armando Blancas
Nelson, that explained the case quite nicely. I appreciate it. On Tuesday, August 28, 2012 1:01:32 PM UTC-7, Nelson Morris wrote: On Tue, Aug 28, 2012 at 1:08 PM, Armando Blancas abm2...@gmail.comjavascript: wrote: I'm playing around with a parser combinator library from the paper

Re: Parser combinators in parsatron

2012-08-22 Thread Armando Blancas
pL first tries anbn: many parses zero \a's; then times has to parse zero \b's; and the parser returns the concatenation of two empty lists. An empty list isn't a failure as far as the parser either is concerned, so it won't try xdny in that case. On Wednesday, August 22, 2012 5:38:56 PM UTC-7,

Re: Buggy FP behavior with Clojure 1.3

2012-06-26 Thread Armando Blancas
I don't get the exception on 1.4.0: ~ $ clj Clojure 1.4.0 user= 1e309 Infinity user= On Monday, June 25, 2012 11:09:14 PM UTC-7, Sean Corfield wrote: On Mon, Jun 25, 2012 at 10:30 PM, dennis zhuang killme2...@gmail.com wrote: Added a postfix M to make the number as BigDecimal or N as a

Re: Buggy FP behavior with Clojure 1.3

2012-06-26 Thread Armando Blancas
Tried it on my old XP laptop and got the same result with 32 bits. On Tuesday, June 26, 2012 2:46:07 PM UTC-7, tbc++ wrote: On Tue, Jun 26, 2012 at 11:25 AM, Armando Blancas abm221...@gmail.com wrote: I don't get the exception on 1.4.0: Is this a 64bit vs 32bit issue? Timothy

Re: Buggy FP behavior with Clojure 1.3

2012-06-26 Thread Armando Blancas
, is mostly running 32-bit software, including Java. On Tue, Jun 26, 2012 at 5:56 PM, Armando Blancas abm221...@gmail.com wrote: Tried it on my old XP laptop and got the same result with 32 bits. On Tuesday, June 26, 2012 2:46:07 PM UTC-7, tbc++ wrote: On Tue, Jun 26, 2012

Re: clojure.reflect annotations

2012-06-01 Thread Armando Blancas
That's the only way I've seen it done. Cool source box; how did you get it? On Friday, June 1, 2012 11:42:19 AM UTC-7, Jon Rose wrote: sorry, typo. My bluetooth keyboard is geeking out. I meant, is it possible to do this with out using the Jave Reflection classes through interop. On

Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.

2012-05-24 Thread Armando Blancas
23, 2012 10:53:15 PM UTC-7, Cedric Greevey wrote: On Wed, May 23, 2012 at 10:21 PM, Armando Blancas abm221...@gmail.com wrote: Is this any better? user= (defn f [^java.awt.image.BufferedImage bi x] (.setData (.getRaster bi) 0 0 0 ^double x)) #'user/f Didn't have a repl handy

Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.

2012-05-24 Thread Armando Blancas
I saw that you wrote it in the style of a repl interaction, which could have been pasted or could have been synthesized by hand. Aw! Dude, I'd never bullshit you like that. Honest. But I was sloppy and rude; sorry. -- You received this message because you are subscribed to the Google

Re: Different behavior at REPL vs compiled code

2012-05-19 Thread Armando Blancas
Why is there this difference in behavior between interactive and compiled code? In case you'd wonder why it works at the repl since what we type there are strings, too. The repl gets them through a call to (read) which parses strings into data structures that are Clojure code. This step

Re: NullPointerException

2012-05-17 Thread Armando Blancas
The redefinition of functions somehow is spooking the compiler. But if you're at the REPL you should be seeing these warnings (are you doing AOT compile?) WARNING: double already refers to: #'clojure.core/double in namespace: user, being replaced by: #'user/double WARNING: * already refers to:

Re: NullPointerException

2012-05-17 Thread Armando Blancas
There's nothing wrong is a pretty strong statement. LOL. Perhaps as strong as it is definitely the wrong way to do things? Jeez. Pedantry is the wrong way to welcome newbies to this board. -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: NullPointerException

2012-05-17 Thread Armando Blancas
-- it's also just plain wrong. Those are not local functions: def always operates at top-level. Big deal. You see what I mean? Pedantry is contagious. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Unable to replace static Java method with Clojure function

2012-05-16 Thread Armando Blancas
This repo and plugin tags should do it. repositories repository idclojure-releases/id urlhttp://build.clojure.org/releases/url /repository /repositories ... plugin groupIdcom.theoryinpractise/groupId artifactIdclojure-maven-plugin/artifactId

Re: Unable to replace static Java method with Clojure function

2012-05-16 Thread Armando Blancas
idtest-clojure/id phasetest/phase goals goaltest-with-junit/goal /goals /execution /executions On Wednesday, May 16, 2012 10:39:49 AM UTC-4, Armando Blancas wrote: This repo and plugin tags should do

Re: Unable to replace static Java method with Clojure function

2012-05-16 Thread Armando Blancas
I think the problem might also be that the failing tests are Java tests calling Java code, which is trying to call Clojure. Usually I'd have Clojure code consuming Java code; then Java and/or Clojure tests consuming compiled code, including classes from gen-class. But given the order

Re: Bootstrapping Clojure-in-Clojure

2012-05-14 Thread Armando Blancas
Much of the more recent code in Clojure is very cross platform. Stuff like reducers can simply be copied over, fixed up a bit, and it runs. I wonder how is the fork/join part carrier over for reducers. -- You received this message because you are subscribed to the Google Groups Clojure

Re: Using 'def' does not create an array-map for small, non-empty maps

2012-05-08 Thread Armando Blancas
You may want to check out the info for contributors and JIRA: http://www.clojure.org/contributing http://dev.clojure.org/jira/browse/CLJ On Tuesday, May 8, 2012 2:01:57 AM UTC-7, jaju wrote: Sent the following to clojure-dev - but then it turned out to be a closed group for posting. Posting

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Armando Blancas
Can someone please verify that it works on windows as well??? It works on XP. -- 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

Re: Arithmethic Evaluation

2012-05-02 Thread Armando Blancas
on the first and third elements of the list, which are the operands. On Tuesday, May 1, 2012 8:19:04 PM UTC-7, Asranz wrote: oh please if u can teach me! On 1 mayo, 21:29, Armando Blancas abm221...@gmail.com wrote: i just need to evaluate in infix a string (1 +2 (4 * 5) Check out

Re: Arithmethic Evaluation

2012-05-01 Thread Armando Blancas
i just need to evaluate in infix a string (1 +2 (4 * 5) Check out The Little Schemer. It'll teach you the techniques for doing this. -- 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

Re: Macros and deftype – usage question

2012-04-28 Thread Armando Blancas
Seems like the expansion is trying to put the function's value in there, and this has already been compiled. If the function' code is expanded in-place it works. user= (defmacro bar [a] (let [b (keyword a) f `(fn [ args#] ~b)] `(deftype ~a [] clojure.lang.ILookup

  1   2   3   >