Re: Enhanced Primitive Support

2010-06-17 Thread Daniel Gagnon

 The problem is that it distinctly *not* easy to write fast numeric code in
 Clojure. It requires expert Clojure knowledge. On the other hand, the mental
 burden for someone who wants BigInts in the new system is very low - you'll
 get a trivial to track exception.



Also, when done, it doesn't look like clojure anymore.

+1 on the new behaviour.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Enhanced Primitive Support

2010-06-22 Thread Daniel Gagnon

 Lets just make things easy for the
 average guy..,


If we base the decision on the average guy not writing high performance
numeric apps, then we should also base it on the fact that he does not need
more than a long in 99% of cases either as Rich points out. And longs are a
much simpler concept to grok.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: I am unclear on how I can call an Ifn stored in a map usefully

2010-06-22 Thread Daniel Gagnon

user=(def current* (merge (uhoh* :event)(why* :event)))
#'user/current*

 here's my problem:

user= current*
{:stuff ELI, :date #user$fn__2507
user$fn__2...@4fa3551c, :name EOW}

 I was hoping this kind of a call would yield:

 {:stuff ELI, :date Tue 22 Jun 2010 17:45:32 MDT, :name
EOW}

 I need the date representing the time I assign the def (evaluated at
 call time) and I don't know which keys will have an Ifn or just a
 string etc.

 Is there existing falicilites to make this happen? An existing
 function call perhaps not obvious to me? Or do I need to write custom
 loops to cycle through and handle each item?

 Thanks,
 Tim


That would be completely un-idiomatic. The point of immutable structures is
that they don't mutate. You are thinking in javaesque object orientation
where you mix state and identity.

You might be interested in Rich's take on that question:
http://clojure.org/state

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: State of Clojure web development

2010-06-24 Thread Daniel Gagnon
I don't use Clojure for web development and I thought sharing why could be
useful too.

For web development, my favourite tool is
Djangohttp://www.djangoproject.com/.
It comes as a fullstack framework which means I have everything I need out
of the box. Templates, caching, ORM, a kick-ass autogenerated admin section,
cross-domain request forgery protection etc. and the documentation is really
top notch.

I'd rather have Clojure than Python but all the goodness that Django
provides is such a time saver that I feel I'd lose too much time with
Clojure.

If I had a full-stack, well-documented clojure framework, I'd jump to that.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Duplicate key bug in hash-maps

2010-06-25 Thread Daniel Gagnon


 Apparently, duplicate keys in sets are only disallowed in set
 literals. Arguably, that must be a mistake on the users part, but
 it sure seems to clash with the behavior of sets elsewhere.


Why would you ever want to write a duplicate in a set literal?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: the joys of lisp

2010-06-28 Thread Daniel Gagnon
On Sun, Jun 27, 2010 at 2:58 PM, cageface milese...@gmail.com wrote:

 When I read about new features in other languages that would be
 simple macros in Lisp I just have to smile:
 http://docs.python.org/dev/reference/compound_stmts.html#with


That feature would *not* be a simple macro. It isn't simply a call to .close
on whatever object, it's an arbitrary cleanup procedure on any object that
implements the feature. The whole standard library implements it and objects
know how to clean after themselves. So do most third objects like database
connexions and what not.

We can take care of 95% of cases with simply calling close and that's easily
macro-able but unless with implement cleanup procedures for all of the
mutable objects of the java library we don't have *that* feature.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: the joys of lisp

2010-06-28 Thread Daniel Gagnon

 So in order to make this work in Python the *entire* standard library
 had to be modified to support it? That's worse than I thought.


Only the objects that made sense with the use of with.



 The python approach is superior if you believe, as Guido apparently
 does, that the useful set of syntactic constructs is small and well-
 bounded. If you think, as most lispers do, that syntactic manipulation
 is the essence of expressive power then the work it takes to add *one*
 new keyword to a language like python seems farcical.


I didn't say it was better, I said it couldn't be replicated with a simple
macro.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure's n00b attraction problem

2010-06-28 Thread Daniel Gagnon
On Mon, Jun 28, 2010 at 2:26 PM, cageface milese...@gmail.com wrote:

 As I said in the HN thread, I think you're right that getting started
 with a productive clojure environment is harder than it has to be.

 However, as I also said in the thread, I think the *real* obstacles
 for a noobie are the concepts in the language itself. Clojure is very
 elegantly designed, but it builds on some very powerful and somewhat
 difficult concepts. Stuart's book is a big help here but I'm afraid
 that Clojure is simply over the heads of a lot of noobs anyway.

 So I wonder how much making the first few baby steps easier is really
 going to help the uptake of Clojure. I have to imagine that the kind
 of person that can't figure out  a CLASSPATH is going to have his head
 explode when he has to figure out how to restructure all his
 iterations in terms of loop/recur.


I had an easier time to pickup Haskell than clojure and I went with Haskell
first so I was already familiar with functional programming when I got to
clojure. I like clojure better but the first time I came to it, I couldn't
figure out how the part were fitting together, dropped and came back later
when I continued to hear good things about it on proggit.

And I don't think borrowing CL's smugness is doing anyone any good.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure's n00b attraction problem

2010-06-28 Thread Daniel Gagnon


 This is the question I had on the blog post- what is meant by a newbie?
 Specifically, what sort of newbie is Clojure wanting to attract?  One of the
 complaints the original poster had was that you had a choice of editors.
 Of the pool of potential Clojure users, how many of them are not already
 familiar with one (or more) of vi, emacs, or eclipse/other Java IDE?  If not
 0, then it surely must be very small.  That you can adopt Clojure without
 having to learn a new editor is a huge plus in my book (if I have to use
 your development environment to learn your language, I'm highly unlikely to
 learn your language).


How many? Most of the ones who come from a Ruby/Python background where
those editors are not very popular.



 One of Clojure's biggest strengths, IMHO, is the ease of adoption in
 situations where a Java tool chain already exists.  A lot of the complaints
 he has stand in opposition to this.  For example, the plethora of different
 build tools that can be used.  Or that Clojure is just a library, and all
 you need to do is deploy a couple of extra jars to deploy Clojure code.


Most of the newbies who come to clojure do not come from the pool of Java
programmers, they come to clojure from a programming language that is
already more flexible than Java. Only 32% come from Java according to a
recent survey (State of Clojure 2010) that number would most likely be lower
if we did a better job a retaining people who lack java knowledge.

Groking both java and clojure at once is not a simple task.


 Given a choice between Clojure being adopted by newbies who are so new they
 don't even have a familiar development environment, or existing Java
 development environments, I'd vote for the second.


 Agreed. Avoid success at all cost. Clojure should stay an academic
language. No wait, that's Haskell.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure's n00b attraction problem

2010-06-28 Thread Daniel Gagnon
What we need is this (but for clojure): http://learnyouahaskell.com/

I believe that the success of ruby is due in great part to *Why's Poignant
Guide to Ruby* and *Learn You a Haskell* is doing the same for Haskell. It's
fun to read, it holds your hand in setting up everything you have to and it
makes you want to learn more.

We need a great just follow the guide guide to introduce clojure to
people.

Maybe we could start a collective project to make that happen?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure's n00b attraction problem

2010-06-28 Thread Daniel Gagnon


 What editors do they use?


Komodo, TextMate, IDLE, Eric, Wing, etc.


 And is there a reason that the same editors can't be used for Clojure?



They don't have clojure language packs.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure's n00b attraction problem

2010-06-28 Thread Daniel Gagnon


 And that makes them impossible to use for Clojure?  Not as nice, I'll
 admit- but welcome to the bleeding edge.


They don't automatically deal with CLASSPATH and all that kind of issues
either.

Clojure lacks clear instructions that you can follow to the letter to get
you started. Once you are started, it's easier to swap things.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure's n00b attraction problem

2010-06-28 Thread Daniel Gagnon

 I'm not so sure. Certainly things like the poignant guide made getting
 started with Ruby easier, but I'd argue that the success of Ruby has a
 lot more to do with how simple the core language it is and how easy it
 makes it to get simple things done.


I'd argue it's both. Yes the language is elegant but you can't know until
you try it and if it's a pain in the ass to try, you'll try something else.
If you want to get started on Ruby and you ask people pointers, they'll tell
you to read the Poignant Guide and from there, it's a smooth ride.


 Conversely, despite increasingly
 beginner-friendly docs and one-shot installers I don't get the
 impression there's a bit upsurge of interest in Haskell outside of
 circles of elites or language afficionados.


It's doing very well for a language that attempts not to be popular.


 Again though, I'm all for making the beginner's experience no harder
 than it absolutely has to be. No point having people turned away by
 things extrinsic to the language.


Getting started in clojure seems to suffer from a lot of incidental
complexity. Quite ironic.


 I often find myself frustrated browsing through the docs that there
 aren't concrete examples for most of the functions in the API. I
 always have to google their usage or find an example in the clojure
 code. I'd be happy to help flesh out the docs with some usage examples
 if this kind of help is wanted.


 Hell yes! What about a clojure cookbook? We could link all the functions in
the API to examples where they are used.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: the joys of lisp

2010-06-28 Thread Daniel Gagnon


 I actually agree with you that the typical block of lisp code is less
 readable than the typical block of python. It bugs me when lisp
 advocates present s-expr syntax as the right way instead of the
 engineering tradeoff that it is.


This is mostly due to Python's There is only one obvious way to do it
which makes reading code much simpler. On the other hand it is possible but
harder to make lisp code as readable (my code became much more readable
after I discovered the threading macros for instance) and often lisp is
harder to read per line but does much more in that small amount of space
than another language would. Same principle as yet another Java class full
of getters and setters being trivial to read but not getting much done per
line.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure's n00b attraction problem

2010-06-28 Thread Daniel Gagnon

 Wrong/Misinformed ideas:
 - Clojure 1.1 is not out of date. While it may seem to an outsider that you
 need to be on 1.2 you would be very wrong. 1.2 certainly brings great things
 to the table but they are built upon having a good understanding of what
 currently exists in 1.1. Staying off the cutting edge really prevents a lot
 of headaches. If you want to be on the cutting edge you are probably
 expecting headaches and maybe even actively involved in fixing them.


Then why is labrepl relying on 1.2?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure's n00b attraction problem

2010-06-28 Thread Daniel Gagnon

 1. you don't have to worry about PYTHONPATH for a while with a
 standard install, although the day will come
 2. you have to understand the difference between class files and jars
 (PATH vs PATH/*)


No, you never have to.It's taken care of by virtualenv.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure's n00b attraction problem

2010-06-28 Thread Daniel Gagnon

 If folks find the Java stack intimidating, maybe Clojure isn't for
 them? Lots of language run on the JVM and they all require some basic
 knowledge of classpaths, build tools and existing IDEs such as
 Ecliper, NetBeans, IntelliJ etc. If folks are new to all that, I don't
 think it's Clojure's job to teach them - there's plenty of literature
 out there about the JVM environment and tools.


Groovy have an out of the box editor you just have to double-click to start.
Jython have an installer. Other JVM languages are ahead of clojure for
out-of-the-box ease of use. Lacking in that regard is *not* a feature. Also,
it's unreasonable to expect people to understand all the complex java ways
when they start out with the language. There is a lot of documentation about
Java, but how are newbs supposed to know where to start?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Java 7 is out!

2011-07-28 Thread Daniel Gagnon
So, what does it means for Clojure?

Faster execution? Some new interesting stuff in the standard Java library?

And I remember there was something about forkjoin that would be good for
Clojure, what about that?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Alright, fess up, who's unhappy with clojurescript?

2011-07-28 Thread Daniel Gagnon

 Javascript is simply painful to use functionally. The verbosity of
 anonymous functions, the lack of crucial HOFs like map/filter/reduce, the
 lack of functional data structures, the lack of macros (not strictly a
 functional feature, but especially useful with functional code)... You can
 fix these to varying degrees with libraries; but in any case the overall
 superiority of Clojure syntax and data structures must be obvious to anyone
 interested in ClojureScript, since those are the sole advantages it provides
 over Javascript.


The verbosity of anonymous function (and much more) is fixed by CoffeeScript
and Coco[1] and the lack of crucial HOFs is fixed by underscore.js

1: Coco is a CoffeeScript fork that fixes the main issues CoffeeScript have
(example: CoffeeScript's scope is broken).

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Alright, fess up, who's unhappy with clojurescript?

2011-07-28 Thread Daniel Gagnon

 I like CoffeeScript. But CoffeeScript is largely syntactic sugar. Hardly
 anything in the way of new semantics. And it encourages traditional stateful
 OOP and classical inheritance.

 Underscore.js does what it can, but it's goals are largely trumped by
 CoffeeScript.

 David

 CoffeeScript and Coco are largely Javascript. I'm just saying they are a
fairer comparison than naked Javascript. Especially when we speak about how
awkward it is to write Javascript.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: can I force the JIT to be called immediately for certain pieces of code after it starts executing with out waiting for the JVM realize it is necessary....

2011-01-01 Thread Daniel Gagnon


 Even if the JVM put the code through the compiler right away, the
 resulting code wouldn't be very good because it will have not had time
 to profile code to apply the more powerful optimizations. It would be
 throwing all of that code away once it has had time to profile the
 code, so any time spent JITing the code before then is most likely not
 worth it.


Exactly. You can't apply Just-In-Time techniques Ahead-Of-Time. Pretty much
by definition.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Google Refine

2011-05-19 Thread Daniel Gagnon
Google just launched and interesting power tool to clean up messy data which
you might want to look at:

http://code.google.com/p/google-refine/wiki/Screencasts

Sounds pretty nifty isn't it?

What they do not mention in the screencast (or anywhere else for that
matter), is that it comes with clojure bundled in.

Try to create a custom text facet in it and clojure will be offered as one
of the 3 languages you can transform your data with.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Silly algorithm

2011-06-17 Thread Daniel Gagnon
I found on Twitter the implementation of the latest stupid algorithm: sleep
sort. The idea behind sleep sort is that you sleep in parallel for a number
of second equal to the value of each cell and emit them as you finish
sleeping. The algorithm is said to run in O(lol^n)

The canonical implementation is:

#!/bin/bashfunction f() {
sleep $1
echo $1}while [ -n $1 ]do
f $1 
shiftdonewait



I found a clojure version on twitter:

(pmap #(do (Thread/sleep (* %1 1000)) (println %1)) '(5 1 3 6 2))

But I wasn't satisfied with it as it directly prints the list and doesn't
return a useful value.
So here's my version:

(defn sleep-sort [coll]
  (let [result (agent [])
coll-length (count coll)]
(dorun (pmap #(do
   (Thread/sleep (* % 1000))
   (send result conj %)) coll))
 (while (not= (count @result) coll-length) (Thread/sleep 1000))
@result))

How would you implement it?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Could be my favourite improvement in 1.4

2011-12-19 Thread Daniel Gagnon
Allow colon as whitespace in map
literalshttp://dev.clojure.org/jira/browse/CLJ-899

That's a very subtle subtle change but with this it will be easier to
experiment with JSON or Python data I want to just grab and paste.

That attention to little detail is very appreciated.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure in Python

2012-03-02 Thread Daniel Gagnon

 Well first of all, the real main drive, is that I don't know Java libs
 nearly as well as Python libs. Secondly, there's a lot of cruft (imo)
 in Clojure that doesn't need to exist in a dynamic VM. For instance,
 there's no reason to new up something with (Foo. 1 2). In python
 objects are functions, so (Foo 1 2) works just fine.


On a similar note, are you using Python's approach to characters (they are
simply a string of length 1)?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] clojure-py 0.1.0 Clojure on Python

2012-03-12 Thread Daniel Gagnon
On Thu, Mar 8, 2012 at 10:53 AM, Timothy Baldridge tbaldri...@gmail.comwrote:

  What's the plan for ratios and characters?  I assume they're still on
  the TODO list?  (Maybe Issue 17 covers the ratios?)

 Yeah, I need to run a few more tests, but I'm thinking of somehow
 layering libgmp ontop of Python in order to implement ratios.


Why wouldn't Python fractions work as ratios?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] clojure-py 0.1.0 Clojure on Python

2012-03-12 Thread Daniel Gagnon

 Actually Python fractions would work perfectly. And the decimal class
 in Python should be included as well.

 Thanks for pointing these libraries out to me!

 Timothy




No problem. I really like how symbiotic with Python you are making 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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] clojure-py 0.1.0 Clojure on Python

2012-03-12 Thread Daniel Gagnon
On Wed, Mar 7, 2012 at 10:42 PM, Timothy Baldridge tbaldri...@gmail.comwrote:

 The Clojure-Py team is happy to announce the release of Clojure-Py 0.1.0.

 https://github.com/halgari/clojure-py

 Clojure-Py is an implementation of Clojure running atop the Python VM.
 As it currently stands, we have translated over 235 functions from
 clojure.core. This is not a clojure interpreter in python; the
 Clojure-Py compiler compiles clojure code directly to python code.
 Clojure-py functions are python functions. Clojure-py types are python
 types, Clojure-py name spaces are python modules


I'm seeing a RPython test in the examples. Can Clojure-Py emit RPython code
from my Clojure code? If so, that'd be really great we could go Clojure -
RPython - C - Native

I guess it probably isn't since I imagine that laziness uses generators
which aren't well supported under RPython but if it did use make RPython
code, it'd be really awesome.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: A New Core.logic Primer

2012-03-14 Thread Daniel Gagnon
On Wed, Mar 14, 2012 at 3:00 PM, David Nolen dnolen.li...@gmail.com wrote:

 Thanks to Edmund Jackson we have a new primer for core.logic:
 https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer

 Feedback appreciated!

 David


It's pretty good and I think it's very accessible. If you compare to Learn
Prolog Now! http://www.learnprolognow.org/lpnpage.php?pageid=online it
lacks in the Pulp Fiction references department but it's still good.

I think you should say a word about prolog and mention that unlike it
core.logic isn't turing complete and can't have infinite loops (unless I'm
mistaken about core.logic).

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: A New Core.logic Primer

2012-03-14 Thread Daniel Gagnon


 Dan, you probably read that recently about Datalog, while you were
 reviewing Datomic. Ain't that right? :)


I didn't check out Datomic yet. I'll do that soon.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: A New Core.logic Primer

2012-03-15 Thread Daniel Gagnon
Could this tutorial explain the foremost question people have when seeing
core.logic: why is o appened to the names of all those functions?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: A New Core.logic Primer

2012-03-15 Thread Daniel Gagnon
On Thu, Mar 15, 2012 at 3:08 PM, Sean Corfield seancorfi...@gmail.comwrote:

 On Thu, Mar 15, 2012 at 10:49 AM, David Nolen dnolen.li...@gmail.com
 wrote:
   It's a convention from The Reasoned Schemer. It's just an easy way to
   differentiate goals from regular functions.

 What's the rationale in TRS for that? (and conde) Like Phil (and no
 doubt others) it seems an odd convention, without explanation.

  Wouldn't it be more idiomatic Clojure to use namespaces?

 That was my first reaction too.


I find it a jarring clash with the rest of Clojure because I'm used to see
things that are elegant or being given a good rationale of how it's a good
trade-off for practical purposes. Here, it seems arbitrary and it just
doesn't feel righto.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure code optimizer

2012-03-21 Thread Daniel Gagnon

 This isn't a big issue, as recursive functions aren't much advised in
 Clojure. However, ideal solution would be to detect tail calls and rewrite
 block in loop/recur combo. This would allow Clojure to fully reuse TCO
 without waiting for JVM to implement it (which will probably never happen).


Not all tail calls are self-recursion. If you call a different function in
tail position, there would be no TCO which if I remember correctly is why
Rich added recur instead of optimizing self-recursion. He doesn't want to
fool you into believing that Clojure supports TCO when it doesn't.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Has anyone solved the zebra/einstein puzzle using core.logic?

2012-03-23 Thread Daniel Gagnon


 p.s: If someone thinks that the zebra puzzle is too complicated as a first
 example please don't hesitate to say so...I recently purchased the
 reasoned schemer (hasn't arrived yet) which hopefully explains things at a
 good pace.


It's actually pretty simple. Take a look at the Prolog version:
http://en.literateprograms.org/Zebra_Puzzle_(Prolog)

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Using the Clojure Logo

2012-03-28 Thread Daniel Gagnon
On Wed, Mar 28, 2012 at 1:40 PM, Chip Collier pho...@gmail.com wrote:

 I was also intending on using the logo in such a way to communicate that
 a site I'm building is powered by clojure or something to that effect
 with a link to clojure.org. Is that frowned upon?

 Chip


Unfortunately, trademark laws are written in such a way that allowing this
risk making Rich lose his trademark. If he knows about it, he must put a
stop to it otherwise he can't claim to own the trademark. This is quite
different from copyrights where you are the author no matter what.

Most projects get around that with an officially endorsed powered by
graphic for such purposes.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Using the Clojure Logo

2012-03-29 Thread Daniel Gagnon

 First of all, one only has to police unauthorized use of the
 trademark. One can authorize its use under particular circumstances,
 and then those uses don't need to be policed to avoid losing the
 trademark.


That's at the heart of trademark law. A trademark is a form of Proof of
origin. If you see Mickey Mouse in a movie, you can assume it's Disney.
This is why you can lose trademarks. If you let people use it for whatever
they want then it's not a proof of origin any more.


 Second, trademark law only covers use in commerce. Use on a personal
 webpage would not be covered, and would not have to be policed or risk
 losing the mark. Use on a commercial site (which might be broadly
 inclusive of, for instance, pages with revenue-generating ads) might
 be another matter, if it's seen as implying an endorsement or a claim
 to be the product/service the mark names. But...


No you can't. That leads to trademark dilution.


 Third, use of the mark in a purely factual manner is not, to my
 knowledge, governed by law. So, a store needn't negotiate a license
 with Coca Cola Inc. to say they have Coca Cola for sale, at least as
 long as they aren't lying. Saying a site is powered by X, when it
 really is powered by X, may fall under the same rule, given that
 there's no implication that the site *is* X or is endorsed by X.


It is actually the purpose of the law. If you see the Coca Cola logo in a
store, you can expect genuine Coca Cola.

Powered by may or may not count, I don't think it has been tested in a
court of law.


 Identifying a noncommercial user group as a Clojure user group would
 be analogous to identifying a noncommercial Web site as powered by
 Clojure, to my mind. Trademark law would not apply, and Rich wouldn't
 risk losing the trademark by not sending a lawyer after the group.


It absolutely would. Not sure if it would be fine or not as mentioned
above.


 However, an earlier post claimed Rich had *copyrighted* the logo,
 which is another kettle of fish.


Copyright is automatic since 1976. All registration does is having the
copyright office they did see your work on a given date. It is by no mean a
requirement.


 On the one hand there's no need to
 police use or risk losing a copyright; on the other, a copyright
 covers noncommercial use as well as commercial. I'm not sure how
 copyrightable a fairly simple logo design really is, though. There are
 circumstances that exempt one from needing a copyright license, fair
 use, that tend to include noncommercial activities that don't harm
 the copyright holder's market. If Rich has copyrighted the logo, but
 isn't selling copies or cheap licenses to use it, a noncommercial use
 might well be found to be a fair use.


Using the logo seems fair use to me. However trademark and copyright laws
are independent. You can infringe one one while respecting the other.



 Personally, I think it would be silly to block uses of the logo to
 refer to Clojure in circumstances that don't imply an endorsement that
 doesn't exist, but obviously Rich is not obligated to share my opinion
 of what would be silly.


I think we would avoid lots of headaches and legal gray areas by having
official powered by logos.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Using the Clojure Logo

2012-03-29 Thread Daniel Gagnon

 As far as I know the Clojure logo is not currently trademarked.


You can have a trademark without registering anything (registration is
somewhere between $200 and $300 in the US, I forgot the exact amount), it's
just harder to demonstrate without a registration than copyright.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: how to get good at clojure?

2012-05-11 Thread Daniel Gagnon
On Mon, May 7, 2012 at 8:48 PM, toan kidn...@gmail.com wrote:

 Hi folks,

 I've been trying to learn clojure for a while. I've read the clojure
 section of seven languages... and currently trying to get through
 joy of clojure. I've been practicing with the prompt a bit and
 trying to learn emacs that came with clojurebox.


The clojure part of seven languages isn't very idiomatic.

Try Programming Clojure 2n Edition by Stuart Halloway, I think it's the
best learning book.

And clojurebox is quite outdated give a try to lein and the clooj editor.

I have 2 questions, 1. does anyone have advice on getting somewhat
 competent for a newb? (alternatively, how did you get good?)


Code until it clicks, then progress gets much faster.


 2. if i
 have no interest in java, should a learn at least some fundamentals?
 would that be helpful?


Try reading some javadoc and see if it makes sense to you. Learning Java
isn't critical to start but eventually, you'll want to use Java libraries
and then it's best to have some basics.


 --
 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 be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Record bug?

2010-06-29 Thread Daniel Gagnon
Under the latest snapshot of the equiv branch (07f05862c2), if I create a
record:

(defrecord MyRecord [foo bar baz])

and then create a record out of it:

(def x (MyRecord. 1 2 3))

I can use a keyword as a function to get the data:

(:foo x)
1

But if I use the record as a function like I would for a map, I get an
error:

(x :foo)
java.lang.ClassCastException: user.MyRecord cannot be cast to
clojure.lang.IFn

Is that a bug or is there something I don't get about records?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Record bug?

2010-06-29 Thread Daniel Gagnon
Is it by design or it just doesn't implement it yet?

On Tue, Jun 29, 2010 at 4:14 PM, Moritz Ulrich ulrich.mor...@googlemail.com
 wrote:

 I think record doen't implements all the stuff a PersistentMap
 implementes. It implementes the interface for map-lookup (with get and
 :foo) but doesn't implements IFn (for using an instance as a
 function).

 On Tue, Jun 29, 2010 at 9:16 PM, Daniel Gagnon redalas...@gmail.com
 wrote:
  Under the latest snapshot of the equiv branch (07f05862c2), if I create a
  record:
  (defrecord MyRecord [foo bar baz])
  and then create a record out of it:
  (def x (MyRecord. 1 2 3))
  I can use a keyword as a function to get the data:
  (:foo x)
  1
  But if I use the record as a function like I would for a map, I get an
  error:
  (x :foo)
  java.lang.ClassCastException: user.MyRecord cannot be cast to
  clojure.lang.IFn
  Is that a bug or is there something I don't get about records?
 
  --
  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 be patient with
 your
  first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en



 --
 Moritz Ulrich
 Programmer, Student, Almost normal Guy

 http://www.google.com/profiles/ulrich.moritz

 --
 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 be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Managing the classpath

2010-07-01 Thread Daniel Gagnon
That's really convenient to know! I just symlinked clojure.jar to
/usr/share/java where all the java jars are on k/ubuntu and now I just have
to have those two lines in my .bashrc file:

export CLASSPATH=.:/usr/share/java/*
alias clj=rlwrap java clojure.main

On Thu, Jul 1, 2010 at 10:29 AM, Laurent PETIT laurent.pe...@gmail.comwrote:

 Hello,

 note that with java 6 you can specify at once to add all the jars
 located in a directory:

 java -cp libs/* clojure.main



-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Link to API document in the cheat sheet

2010-07-04 Thread Daniel Gagnon
And uses '() for an empty list while () is more idiomatic.

On Sun, Jul 4, 2010 at 1:48 PM, ataggart alex.tagg...@gmail.com wrote:

 The cheatsheet is out of date (e.g., still has 'lazy-cons, old meaning
 of 'next).


 On Jul 2, 2:11 pm, ngocdaothanh ngocdaoth...@gmail.com wrote:
  Hi,
 
  This is my nth attempt to learn Clojure.
 
  I think it will be an improvement if there are links to API document
  for functions in the cheat sheet (http://clojure.org/cheatsheet).
  Clicking a function name will jump right to the description for the
  function is very convenient for newbies.

 --
 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 be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Daniel Gagnon


 Why would you ever type that more than once? Just use :as.


Because you use it in more than one file / project.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure noob: refactoring factorial code

2010-07-15 Thread Daniel Gagnon
There's no reason to recur at all:

(defn factorial [n] (reduce * (range 1 (inc n

On Thu, Jul 15, 2010 at 9:49 AM, Frederick Polgardy f...@polgardy.comwrote:

 You don't need to recur to another function, just recur to a loop:

 (defn factorial [n]
  (loop [x n acc 1]
(if (zero? x) acc (recur (dec x) (* acc x)

 (println (factorial 5))

 --
 Science answers questions; philosophy questions answers.

 On Jul 15, 2010, at 6:38 AM, Brisance wrote:

  Here's a factorial function as found in the WikiBook Learning
  Clojure http://en.wikibooks.org/wiki/Learning_Clojure:
 
  (defn factorial [n]
   (defn fac [n acc]
 (if (zero? n)
acc
   (recur (- n 1) (* acc n ; recursive call to fac, but reuses
  the stack; n will be (- n 1), and acc will be (* acc n)
   (fac n 1))
 
  Question: how would I go about writing idiomatic Clojure to return
  factorials of n, for large values of n. e.g. 1e6 or more? Preferably
  without having to create another function.
 
  Thanks in advance for any insight.
 
  --
  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 be patient with
 your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en

 --
 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 be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Leiningen 1.2.0 released!

2010-07-19 Thread Daniel Gagnon
Impressive list of new features!

By the way, what's left to do for the Windows support to stop being
experimental?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Leiningen 1.2.0 released!

2010-07-21 Thread Daniel Gagnon
On Tue, Jul 20, 2010 at 9:51 AM, Phil Hagelberg p...@hagelb.org wrote:

 On Mon, Jul 19, 2010 at 3:00 PM, Daniel Gagnon redalas...@gmail.com
 wrote:
  By the way, what's left to do for the Windows support to stop being
  experimental?

 Mostly we need volunteers to port the changes from the bash script to the
 batch file and test the changes. Also I don't think the self-install feature
 will ever work with lein.bat due to the lack of a way to download files. We
 may switch to a powershell script to work around this limitation; I don't
 know enough about Windows to say if that's a good idea.



Bummer, I know nothing about batch files...

As for the self install, what about writing the downloader in Java and
invoking it from the batch file?

Or using izPack which is the most popular next-next-finish installer for
Java? It would be very idiomatic for Windows.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Records can't be treated as functions anymore

2010-08-03 Thread Daniel Gagnon


 Hi BG,
 It is a common mistake to think that callability, corresponding to the
 clojure.lang.IFn interface, is part of the persistent map contract
 (I've done it myself, as did many others a Conj labs :). It is not. It
 is actually just a feature of clojure.lang.PersistentHashMap (and the
 other clojure map implementations).


While I get that part, I wonder why records do not implement IFn, it'd be
convenient if they did.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Keywords also have a literal syntax

2010-08-03 Thread Daniel Gagnon
On Wed, Aug 4, 2010 at 1:33 AM, vishy vishalsod...@gmail.com wrote:

 What does it mean? Does it mean that :hello itself is a value,so we
 call it literal syntax.Also,  this form of vector [1 2 3] is also
 literal syntax.



A vector evaluates all of its arguments. If I write [1 2 (+ 1 2)], I'll get
the same vector you got with [1 2 3]. Keywords always evaluate to
themselves.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Basic Lisp Compiler: How to tell which functions to compile?

2010-08-09 Thread Daniel Gagnon
As far as I know, the book Lisp In Small Pieces should be a tremendous
help for anyone who builds a Lisp interpreter or compiler. You might want to
check it out.

On Mon, Aug 9, 2010 at 2:21 PM, CuppoJava patrickli_2...@hotmail.comwrote:

 Thanks for the reply Jarkko. That helps quite a lot. I have some hacks
 in place that works most of the time, but was stuck trying to figure
 out a general solution. Knowing that there isn't one puts my mind at
 ease.
  -Patrick

 On Aug 9, 1:56 pm, Jarkko Oranen chous...@gmail.com wrote:
  On Aug 9, 7:54 pm, CuppoJava patrickli_2...@hotmail.com wrote:
 
   Hello everyone,
   Just for educational purposes, I'm writing a simple lisp compiler and
   am stuck on a small problem.
 
   I'm trying to write a function called (compile-function), which will
   take a function as input and compile it.
 
   If that function calls other functions, I would like (compile-
   function) to automatically compile the called functions as well.
 
   But I'm stuck on how to tell whether a function will be called or not.
   Particularly when functions are passed around as objects.
 
   So the question is this: Given a function f, how can I find all the
   functions that f depends on?
 
  I don't think that's feasible, if it's even possible in the first
  place.
 
  Functions that the parent function calls directly you can of course
  try to compile whatever you encounter in a function call form; just
  check if the operator is a known global function, and compile it.
  However, if the operator is a local variable (ie. a function passed as
  a parameter) there's no reliable way to find out what function it is.
  It might even be a runtime-generated function (by eval)
 
  Since you can't know what functions will be called, the generated code
  must somehow verify that it's calling a function in the first place,
  perhaps invoke the compiler (if all functions must be compiled), and
  then execute it.
 
  --
  Jarkko

 --
 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 be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: AOT compilation and calling Clojure from Java

2010-08-15 Thread Daniel Gagnon


 Any suggestions?


Can you run:
javap  YourClass.class

and give us the result?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: What is reference?

2010-08-16 Thread Daniel Gagnon
On Mon, Aug 16, 2010 at 11:54 AM, HB hubaghd...@gmail.com wrote:

 Excellent explanation, thanks Nicolas :)
 Are Refs unique to Clojure or they exist in all Lisps?


They are a big part of why Clojure was created in the first place.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Lisp/Scheme Style Guide

2010-09-05 Thread Daniel Gagnon

a) Python doesn't really have this problem


Python doesn't have this problem because the canonical style is define by
PEP 8 and Pythonistas love simplicity through conventions.

PEP 8: http://www.python.org/dev/peps/pep-0008/

I think it's actually a great feature of the language, I almost never got
code that didn't match or nearly matched PEP 8. Google's go goes even
further by having the canonical style define by gofmt. Once your code is
written, you run it through gofmt and it turns canonical. If your code
doesn't look nice after gofmt, you must file a bug against gofmt rather than
hand tweak the formatting.

I'd be all for having clojure-fmt that would format clojure code in the way
Rich prefers it so that when I get random code I could convert it to a nice
and predictable format. It should be even simpler to write for a lisp than
other languages.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Can Clojure compile a source-file? How does it do it?

2010-09-05 Thread Daniel Gagnon
On Sun, Sep 5, 2010 at 5:11 PM, Stuart Sierra
the.stuart.sie...@gmail.comwrote:

 Clojure compiles sources to Java .class files. To create a .class
 file that can be run at the command line, you need a namespace with a
 (:gen-class) directive and a function named -main.  Here's an
 example:


I think the question was about how clojure works under the hood and how it
can guarantee the same behaviour when compiled as when interactively typed.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Lisp/Scheme Style Guide

2010-09-05 Thread Daniel Gagnon

 I think it would be great if an official clojure-fmt tool existed.
 I have no interest in forcing people to use it who don't want to.  But
 I think it would set a great baseline for IDEs and would be helpful to
 the people and teams who like having coding standards.  I would be one
 of a number of people who would voluntarily use such a tool.


I would too because I prefer a good and predictable format to a perfect one
I'm the only one to use. Also if that tool is customizable, people could use
it format source to their own preferences out of git when they pull and
format it back when they push.

I don't think there's something special about Python that makes it more
suitable to something like PEP 8. If Python users were like Lisp users,
they'd bicker incessantly about how how much space in indentation but Guido
said it's 4 spaces and that's it.

I don't believe we can find *the* one style but I would like someone with
sufficient clout to suggest *a* style.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure ensure

2010-09-14 Thread Daniel Gagnon
The first one is correct.

On Tue, Sep 14, 2010 at 3:22 PM, peter veentjer alarmnum...@gmail.comwrote:

 I have got a question about the Clojure ensure and how it actually
 works and the documentation doesn't provide enough information.

 I see a few different solutions:

 1) An optimistic approach: Once a ref is 'ensured' it is included in
 the conflict detection set. This means that the approach is still
 completely optimistic because 2 concurrent transactions that have the
 same ensured ref, one of them is going to fail when the transaction
 wants to commit. This is a commit time ensure.

 2) The other approach is a more pessimistic approach where a ref can
 be protected against writes made by other transaction as soon as it is
 ensured. It still allows reads to happen, but a write/ensure is going
 to fail. It could be compared to a oracle 'select.. for update'. This
 is an encounter time ensure.



-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure ensure

2010-09-15 Thread Daniel Gagnon
On Wed, Sep 15, 2010 at 10:44 AM, Stuart Halloway stuart.hallo...@gmail.com
 wrote:

 Encounter time. I am sitting next to Rich as I write this.


Guaranteed or implementation detail?

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Being not Lisp is a feature?

2010-11-16 Thread Daniel Gagnon
I spoke to the guys on reddit. They said it is tongue-in-cheek. They have no
knowledge of functional programming but strongly feel it isn't suited to
their field.

-- 
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 be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en