Parth,
I was thinking about this a little more today and I came up with a way
to extend the pretty printer easily to support *print-radix* with a
little wrapper. I'll try to get a chance to write it up for you
tomorrow.
Tom
On Jul 2, 6:29 pm, Parth wrote:
> On Jul 3, 6:15 am, Parth wrote:
>
>
mmwaikar wrote:
> Thanks Michael, and you are spot on about your observation on
> parentheses :) but when I wasn't putting (def name-wo-extn
> "something") in another (), I was getting some error like - too many
> arguments to def, hence I put one more. I am still getting used to
> this syntax.
Us
On Jul 3, 6:15 am, Parth wrote:
> Tom, Chouser, Thanks for your responses.
>
> As of now I am doing the same thing as suggested.
> However, this tends be become painful the moment structures
> start to nest. For e.g. I am using Clojure to decode a bit
> of assembly and below is what I end up do
On Jul 2, 9:44 pm, Tom Faulhaber wrote:
> Hi Parth,
>
> It is on the agenda to support this for pprint, but I don't know
> exactly when.
>
Thanks Tom.
I look forward to this addition to the wonderful pprint function :)
Regards,
Parth
> In the meantime, arbitrary bases *are* supported in the
Tom, Chouser, Thanks for your responses.
As of now I am doing the same thing as suggested.
However, this tends be become painful the moment structures
start to nest. For e.g. I am using Clojure to decode a bit
of assembly and below is what I end up doing to see the
values of interest in hex:
use
Hey, how come we did not see this even more concise version sooner ? :-):
;; using just clojure 1.0.0 without any additional library :-)
;; from command line:
;; java -cp clojure.jar /path/to/challenge2.clj "()" "((([[]])))" ... ...
(ns challenge2)
(defn balanced? [s]
(and
(every? #{ \( \)
This is a solution in Qi+Qi-YACC
(define test-brackets
X -> (not (= (compile (COERCE X LIST)) fail!)))
(defcc
#\[ #\] ;
#\( #\) ;
;
:= [];)
(defcc
-*- := (if (element? -*- [#\[ #\] #\( #\)]) #\Escape -*-);)
Testing
(5-) (test-brackets "()")
true
(6-) (test-brackets "())")
Here is a solution in Qi+Qi YACC.
(define test-brackets
X -> (not (= (compile (COERCE X LIST)) fail!)))
(defcc
#\[ #\] ;
#\( #\) ;
;
:= [];)
(defcc
-*- := (if (element? -*- [#\[ #\] #\( #\)]) #\Escape -*-);)
Mark
--~--~-~--~~~---~--~~
You rec
Thanks Kai.
FYI, concerning your question about EPL, generally a slightly modified
version of this (the modification being putting your own name) is put
on top of clojure source code files :
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are
Hey Laurent,
I went ahead and finished the modifications I wanted to make. The
source code will now correctly highlight any function that begins with
def and underline any code that follows that was defined by that
function. It looks much better :)
I looked into Google Code but it seems like too
Hi,
It's amusing, because I just though a few days ago that "Troy" (in
reference to the city and the story of the trojan horse) was a
candidate name I had in mind for the new name of clojuredev ! :-)
2009/7/2 Sean Devlin :
>
> Hey all,
> I found this blog entry on how C++ replaced C, and it made
OK I understand now. I didn't have something like that in mind.
Regards,
--
Laurent
2009/7/2 Kai :
>
> Hey Laurent,
>
> I had stack overflows because I had functions set up like this:
>
> (defn parse-code [original-code formatted-code main-loop?] ... )
> (defn format-list [original-code format
Hi,
OK, so here's my attempt at doing this the most higher order but also
the most understandable I could do.
Hope you enjoy reading it as much as I enjoyed polishing it :-) :
;; from command line:
;; java -cp clojure.jar /path/to/challenge.clj "()" "((([[]])))" ... ...
(ns challenge)
(def pus
Hey Laurent,
I had stack overflows because I had functions set up like this:
(defn parse-code [original-code formatted-code main-loop?] ... )
(defn format-list [original-code formatted-code] ... )
(defn format-string [original-code formatted-code] ... )
Now, whenever parse-code sees an opening
BUILD SUCCESSFUL
Total time: 6 seconds
Awesome, thanks for the quick fix!
--~--~-~--~~~---~--~~
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
Hi,
ok. Fixed it. Was a stupid typo in the classname. Obviously it was no
Schrödingbug, since I didn't compile the changes
Fix is up on github.
Sincerely
Meikel
smime.p7s
Description: S/MIME cryptographic signature
Hi,
geez. A Schrödingbug I know I compiled it before, but
after a clean it broke. :( I'll see how to fix it.
Sincerely
Meikel
smime.p7s
Description: S/MIME cryptographic signature
On Thu, Jul 2, 2009 at 21:11, Daniel Lyons wrote:
> On Jul 2, 2009, at 1:00 PM, B Smith-Mannschott wrote:
>> What was confusing me is that slime/swank seem to be using
>> iso-latin-1-unix and so trip over greek letters. I've not yet found
>> the knobs to twiddle in emacs to get it to use UTF-8 her
On Thu, Jul 2, 2009 at 2:46 PM, Stephen C. Gilardi wrote:
>
> On Jul 2, 2009, at 3:21 PM, Mark Volkmann wrote:
>
>> Now it is using a vector instead of a list. Too
>> bad there is no push function in core. I'm using conj.
>
> conj is the correct thing to use for the push operation.
Right, but the
Hey all,
I found this blog entry on how C++ replaced C, and it made me think of
how Clojure interacts with Java. Not a direct comparison, but I
figure I'm not the only on who'll like it.
http://ejohnson.blogs.com/software/2004/11/i_find_c_intere.html
Hope someone enjoys it.
--~--~-~--~-
On Jul 2, 2009, at 3:21 PM, Mark Volkmann wrote:
Now it is using a vector instead of a list. Too
bad there is no push function in core. I'm using conj.
conj is the correct thing to use for the push operation.
Here's my take on it based on yours. This bails early as soon as there
is a misma
On Thu, 2 Jul 2009 08:15:32 -0700 (PDT)
Kai wrote:
> I haven't placed the code anywhere other than on my server. It was
> just an experiment in Clojure but I'm glad it's useful to others. I'll
> go ahead and make it open source and let you know when I do. It should
> be relatively robust as it i
On Thu, Jul 2, 2009 at 2:13 PM, Laurent PETIT wrote:
>
> There are also peek and pop functions in core that you could you to
> convey the semantics of using the cons list as a stack.
Yes, that's a nice improvement! Here's the new code without the tests
which didn't change. Now it is using a vect
There are also peek and pop functions in core that you could you to
convey the semantics of using the cons list as a stack.
As far as performance is on the table, I'm not sure whether of
cons'ing over lists or conj'ing over vectors would have the better
performance (maybe it's just comparable ! :
Hi Ben,
This is sitting in my .emacs file:
(set-language-environment "UTF-8")
(setq slime-net-coding-system 'utf-8-unix)
(I don't know whether it'll work for you, just as I don't know whether
all the things sitting in my fridge are edible... Good luck. ;)
Tayssir
On Jul 2, 9:00 pm, B Sm
On Jul 2, 2009, at 1:00 PM, B Smith-Mannschott wrote:
>
> On Thu, Jul 2, 2009 at 18:39, Stuart Sierra > wrote:
>>
>> Hi Ben,
>> Clojure assumes UTF-8 when loading code. If you want to load source
>> code in a different encoding, you can open a java.io.Reader with the
>> appropriate encoding; th
On Thu, Jul 2, 2009 at 1:59 PM, Raoul Duke wrote:
>
>> clojure functions should return a value. This is good advice, but I
>> have code that sometimes return nil. Is it better to return 'nil' or
>> an object with no data. I guess a simple example, if you have a
>
> imho, null/nil/etc. are more
On Thu, Jul 2, 2009 at 2:04 PM, Laurent PETIT wrote:
>
> Hi,
>
> I think you could use recur instead of the direct recursive call,
Great idea! Simply changing "helper" to "recur" works.
> 2009/7/2 Mark Volkmann :
>>
>> There is a challenge on the blog of Tony Morris at
>> http://dibblego.wordpre
On Thu, Jul 2, 2009 at 1:59 PM, Stuart
Halloway wrote:
>
> Hi Mark,
>
> The balanced-test would be a great place to use "are" instead of "is".
Excellent suggestion! The new version of that function follows:
(deftest balanced-test
(are [text result]
(= (balanced? text) result)
"()" tru
Hi,
I think you could use recur instead of the direct recursive call,
Regards,
--
Laurent
2009/7/2 Mark Volkmann :
>
> There is a challenge on the blog of Tony Morris at
> http://dibblego.wordpress.com/2008/09/05/haskell-scala-java-7-functional-java-java/#comment-2460.
> It's a parsing proble
On Thu, Jul 2, 2009 at 18:39, Stuart Sierra wrote:
>
> Hi Ben,
> Clojure assumes UTF-8 when loading code. If you want to load source
> code in a different encoding, you can open a java.io.Reader with the
> appropriate encoding; the easiest way to do that is probably to use
> clojure.contrib.duck-
Hi Mark,
The balanced-test would be a great place to use "are" instead of "is".
Cheers,
Stu
>
> There is a challenge on the blog of Tony Morris at
> http://dibblego.wordpress.com/2008/09/05/haskell-scala-java-7-functional-java-java/#comment-2460
>
> .
> It's a parsing problem for which he com
On Jul 2, 2:17 pm, Chouser wrote:
> Also, is there any reason not to call this contrib-1.0? It seems to me that
> it
> would be most useful to have major contrib versions simply map to major
> clojure
> versions: contrib-1.a.x for clojure-1.a.y
The consensus on the dev list seemed to be that
It looks like ant is using ivy to get these dependencies, unless I'm
reading it wrong.
Is this what I need?
http://dev.mysql.com/downloads/connector/j/3.1.html
$ ant
Buildfile: build.xml
init:
download-ivy:
[get] Getting:
http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.1.0-rc1/ivy-2
There is a challenge on the blog of Tony Morris at
http://dibblego.wordpress.com/2008/09/05/haskell-scala-java-7-functional-java-java/#comment-2460.
It's a parsing problem for which he compares solutions in Haskell,
Scala and Java. I added a Clojure solution. I don't know if this is
the "best" way
Hi Kai,
2009/7/2 Kai :
>
> Hi all,
>
> @Laurent
>
> I haven't placed the code anywhere other than on my server. It was
> just an experiment in Clojure but I'm glad it's useful to others. I'll
> go ahead and make it open source and let you know when I do. It should
> be relatively robust as it is
On Jul 2, 2009, at 1:48 PM, Mark Volkmann wrote:
(defn match [prev-char next-char]
(cond = prev-char
\( (= next-char \))
\[ (= next-char \])
true false))
It looks like you intended condp here instead of cond.
Your test works as expected if you make that change. However, there's
a
On Thu, Jul 2, 2009 at 12:58 PM, Stuart
Sierra wrote:
>
> Hi folks,
> I have created a branch of clojure-contrib that should be fully
> compatible with Clojure 1.0:
> http://github.com/richhickey/clojure-contrib/tree/clojure-1.0-compatible
>
> This includes c.c.test-is with the older syntax for "a
On Jul 2, 2009, at 2:00 PM, Mark Volkmann wrote:
I run it with "clj demo.clj foo bar baz" and get this output:
clojure.lang.ArraySeq
2
I get the same output with "clj demo.clj -- foo bar baz".
Why doesn't it output 3?
That depends on your definition of clj.
Here's what I get without using
On Jul 2, 2009, at 11:48 AM, BerlinBrown wrote:
>
> I posted a thread about side-effects. Some one replied that your
> clojure functions should return a value. This is good advice, but I
> have code that sometimes return nil. Is it better to return 'nil' or
> an object with no data. I guess
Hi again,
Am 02.07.2009 um 19:52 schrieb Meikel Brandmeyer:
(defn match [prev-char next-char]
(cond = prev-char
Typo: you mean cond*p* instead of cond.
\( (= next-char \))
\[ (= next-char \])
true false))
And BTW: the true shouldn't be there. If there
is an odd number of clauses, th
I'm confused about *command-line-args*.
I have a file demo.clj containing only this:
(println (class *command-line-args*))
(println (count *command-line-args*))
I run it with "clj demo.clj foo bar baz" and get this output:
clojure.lang.ArraySeq
2
I get the same output with "clj demo.clj -- fo
> clojure functions should return a value. This is good advice, but I
> have code that sometimes return nil. Is it better to return 'nil' or
> an object with no data. I guess a simple example, if you have a
imho, null/nil/etc. are more often than not pretty evil.
random related links:
http://
On Thu, Jul 2, 2009 at 4:51 AM, Parth
Malwankar wrote:
>
> I frequently deal with hex and binary numbers.
> As of now when I need to view a list of numbers
> I just map a little hex function to it to translate it
> into a list of hex strings at the repl.
>
>
> Having something like *print-base* /
Hi,
Am 02.07.2009 um 19:48 schrieb Mark Volkmann:
(defn match [prev-char next-char]
(cond = prev-char
Typo: you mean cond*p* instead of cond.
\( (= next-char \))
\[ (= next-char \])
true false))
Sincerely
Meikel
smime.p7s
Description: S/MIME cryptographic signature
The following short code snippet compares character literals.
The match function is suppose to return true when given the characters
( and ) or [ and ]. It should return false for everything else.
Why is the output of this code "(" instead of "true"?
(defn match [prev-char next-char]
(cond = pr
I posted a thread about side-effects. Some one replied that your
clojure functions should return a value. This is good advice, but I
have code that sometimes return nil. Is it better to return 'nil' or
an object with no data. I guess a simple example, if you have a
function that returns a stri
Signed-off-by: Takeshi Banse
---
Hi all,
I Takeshi Banse live in Japan, have been teaching myself Clojure and in the
process have a patch to the swank-clojure I'd like to make.
With this patch, I can happily `M-x slime-apropos' within Emacs/SLIME.
Hope this helps. Thanks.
swank/commands/basi
On Jul 2, 1:01 am, Daniel Lyons wrote:
> On Jul 2, 2009, at 12:58 AM, fft1976 wrote:
>
> > On Jun 30, 3:02 pm, igorrumiha wrote:
>
> >> Some people claim
> >> that the JVM can give you C-like performance, but I would be more
> >> than
> >> happy if I got my VM to be 10x slower than the C one
Hello,
I just have a look at your code. I was wondering why reflect.Array/getDouble
was faster than aget?
And I realized than you create arrays of objects and not array of doubles.
Have you tried to replace make-array by double-array?
I am not a Java specialist but if I understand well the API ot
Hi folks,
I have created a branch of clojure-contrib that should be fully
compatible with Clojure 1.0:
http://github.com/richhickey/clojure-contrib/tree/clojure-1.0-compatible
This includes c.c.test-is with the older syntax for "are". Maybe this
should be updated to use the newer syntax.
Contri
Hi Parth,
It is on the agenda to support this for pprint, but I don't know
exactly when.
In the meantime, arbitrary bases *are* supported in the common lisp
compatible format function (cl-format) which is also part of
clojure.contrib.pprint.
The interesting directives are ~X, ~B, and ~bR, where
We need to hire some more devs full time to work on a clojure project
(distributed backend hardcore clojure - not web dev).
I would prefer to have someone in Seattle to work with Philip
Hagelberg (technomancy on IRC). This would be work from home salary
employment w/ mac laptop provided (or if y
Hi Ben,
Clojure assumes UTF-8 when loading code. If you want to load source
code in a different encoding, you can open a java.io.Reader with the
appropriate encoding; the easiest way to do that is probably to use
clojure.contrib.duck-streams and bind *default-encoding*.
-SS
On Jul 2, 2:20 am,
Ram Krishnan writes:
> I'd sent this to jochu earlier, but perhaps you can help commit this
> minor patch to clojure-mode.
>
> I found a small bug in the regexp used in `swank-clojure-find-
> package'. The head version incorrectly parses `ns' forms of the
> following kind:
Thanks; I've pushed
Hi,
Am 02.07.2009 um 17:16 schrieb Ozzi Lee:
I get an error when compiling from head with ant. It dies with:
java.lang.ClassNotFoundException: org.mysql.jdbc.Connection
(mysql.clj:
18)
You'll need the JDBC drivers for MySQL and Derby. Otherwise
the corresponding backends won't compile. If
Hi all,
@Laurent
I haven't placed the code anywhere other than on my server. It was
just an experiment in Clojure but I'm glad it's useful to others. I'll
go ahead and make it open source and let you know when I do. It should
be relatively robust as it is -- I ran it through some of the src
Cloj
I get an error when compiling from head with ant. It dies with:
java.lang.ClassNotFoundException: org.mysql.jdbc.Connection (mysql.clj:
18)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to t
Hi Phil,
I'd sent this to jochu earlier, but perhaps you can help commit this
minor patch to clojure-mode.
I found a small bug in the regexp used in `swank-clojure-find-
package'. The head version incorrectly parses `ns' forms of the
following kind:
(ns compojure.server.jetty
"Clojure interfac
There are a number of aspects of the CLR dissimilar to the JVM that
the current implementation of ClojureCLR does not properly account
for. Some of these will require extensions to Clojure, e.g. in symbol
syntax if we are to allow CLR-specific type references.
A short and by no means complete li
On Jul 2, 2009, at 10:36, Daniel Lyons wrote:
> This is one reason I am not a big fan of
> comparing the speed of languages; another is that it often changes out
> from under you. Java itself is a great example of this: by the time
> everyone had gotten the message that it was slow, it had alread
2009/6/26 Kai :
>
> Hi all,
>
> I'm new to this discussion group and Clojure. I'm sharing the first
> "bigger-than-REPL" script that I've written because I haven't seen
> anything else like it for Clojure. It's a script that takes Clojure
> code as input and generates a pretty HTML version. You ca
I frequently deal with hex and binary numbers.
As of now when I need to view a list of numbers
I just map a little hex function to it to translate it
into a list of hex strings at the repl.
Having something like *print-base* / *print-radix* [1] may be
valuable in such a scenario
Or maybe an enh
Mark,
On Jul 1, 2009, at 3:16 PM, Mark Engelberg wrote:
> But each language encourages a certain style of design and algorithm,
> so it IS fair to compare the way that the language encourages a
> certain approach. For example, Clojure encourages you to use a more
> functional approach and persis
On Jul 2, 2009, at 12:58 AM, fft1976 wrote:
> On Jun 30, 3:02 pm, igorrumiha wrote:
>
>> Some people claim
>> that the JVM can give you C-like performance, but I would be more
>> than
>> happy if I got my VM to be 10x slower than the C ones :)
>
> I like your honesty! You can come to my house
65 matches
Mail list logo