Is there a function to determine if code is run as script or library ?

2014-02-26 Thread macdevign mac
Hi, is there a function to determine if the clojure code is running as library or as script ? In ruby, there is if __FILE__==$0 # this will only run if the script was the main, not load'd or require'dend In Java, we could include main method in class, and choose to run it, How about cloju

Re: Error throw when defining function with return type hint

2014-02-10 Thread macdevign mac
I get it. Thank :} On Monday, February 10, 2014 11:19:06 PM UTC+8, Jim foo.bar wrote: > > On 10/02/14 15:08, macdevign mac wrote: > > (defn testing > > (^String []) > > (.toUpperCase "hello world")) > > > ;;syntax for overloading > (defn

Error throw when defining function with return type hint

2014-02-10 Thread macdevign mac
Hi, I'm new to the clojure and try to learn this language. Referring to this at http://clojure.org/java_interop#Java%20Interop-Type%20Hints when trying this code (defn testing (^String []) (.toUpperCase "hello world")) clojure throws "java.lang.IllegalArgumentException: Parameter decla

ANN: clj-vorbis

2011-10-10 Thread mac
Hello all. I have made a small clojure wrapper around the jorbis library from jcraft (for decoding ogg vorbis compressed audio). I'm planning to maybe use it as a component in a small game library but I made it as a stand alone library because it could really be useful in any app dealing with audio

Re: using swig in clojure

2010-11-26 Thread mac
On Nov 19, 3:44 pm, Seth wrote: > unfortunately doesnt work. The library loads succesfully but i still > get the error when calling add. Note that compiling on the top is a > workaround to get it working on the repl. > > i added the loadlibrary to an init function which is good and i > decided to

Re: using swig in clojure

2010-11-05 Thread mac
System/loadLibrary uses the paths set in the System property java.library.path to look for dynamic libraries so you need to make sure it contains the directory where your .so is. I think it also gets cached at first read or something stupid like that so it's very important to get java.library.path

Re: Generating "special" classes

2010-10-06 Thread mac
shoot me a mail if you have problems, requests or suggestions. /Markus > > > > > On Wed, Oct 6, 2010 at 07:21, mac wrote: > > There is always clojure.asm if you don't mind getting your hands dirty > > with bytecode generation. That's what I did when I needed e

Re: Generating "special" classes

2010-10-05 Thread mac
There is always clojure.asm if you don't mind getting your hands dirty with bytecode generation. That's what I did when I needed exactly what you describe for clj-native. It wasn't that much work, the JVM bytecode is uncomplicated to begin with and since JNI method stubs require no code all you hav

Re: clojure Image/video processing?

2010-09-08 Thread mac
> Thank you Mark Downie for recommending OpenCL, I'll start playing > around with it.  As for accessing the c libraries directly, I'm afraid > I don't know much about JNI to do it from clojure.  Do you or anyone > know of a good way to start with JNI in clojure? If you are going to use a straight

Re: RFC: New Clojure launcher

2010-08-16 Thread mac
Correction: you will need the jdk on windows when using the 32 bit build because the server jvm does not come with the 32 bit jre. Perhaps I should just make it prefer the server jvm, not require it. On Aug 15, 6:12 pm, mac wrote: > On Aug 15, 6:02 pm, Wilson MacGyver wrote:> This

Re: RFC: New Clojure launcher

2010-08-15 Thread mac
On Aug 15, 6:02 pm, Wilson MacGyver wrote: > This still requires JDK installed right? On the OSX version, does it > create DMG file? > Since for an end user OSX app, that's what people expect. > It requires JRE installed, not JDK. It comes with the OS on everything but windows but should be easy t

RFC: New Clojure launcher

2010-08-15 Thread mac
readme and code is over here: http://github.com/bagucode/Carnival If you don't want to compile C++ or can't get the projects working (I may have used some machine-specific paths) I have made some prebuilt binaries for your testing pleasure. Mac OS X version requires jre 1.6, Windows vers

Re: Game development in Clojure

2010-08-13 Thread Mac
On Aug 13, 9:51 am, Mike Anderson wrote: > 2. It would be great to reduce the amount of memory allocations. Yes, > I know memory is plentiful and GC is very cheap, but it's still not as > cheap as stack allocation and any noticeable GC pauses are not good > for the player experience in interacti

Re: jna Java Native Acess and clojure ....

2010-08-11 Thread mac
On Aug 11, 4:26 pm, Chouser wrote: > On Wed, Aug 11, 2010 at 5:18 AM, mac wrote: > > > It is certainly theoretically possible to call C++ from Clojure/Java > > but it requires deep knowledge and lots of code for each C++ compiler > > one would like to support. > > I

Re: jna Java Native Acess and clojure ....

2010-08-11 Thread mac
cience answers questions; philosophy questions answers. > > On Aug 10, 2010, at 6:29 AM, Sunil S Nandihalli wrote: > > > > > Thanks Mac for your clarification .. I am using clojure 1.2 .. so should be > > fine. And I was wondering if I can acess c++ stuff via clj-native .. Wha

Re: jna Java Native Acess and clojure ....

2010-08-10 Thread mac
I'm the author of clj-native. Currently it only works with Clojure 1.2. In retrospect I should have made a separate branch when dropping 1.1 support. If you need 1.1 support, just tell me and I could make a branch for it since the changes required should be small. /Markus On Aug 9, 5:31 pm, Chous

Re: ANN: CDT - The Clojure Debugging Toolkit

2010-07-06 Thread mac
I agree with Laurent, this looks very cool. It's great that you are making it a text/repl interface because that means it's decoupled from any particular editor and can easily be used as a base for gui debuggers in different editors and IDEs. /Markus On Jul 7, 7:39 am, George Jahad wrote: > Than

Re: Version of netbeans with extra Clojure and Polyglot Maven/Leiningen support ...

2010-04-11 Thread mac
Yes, this is very interesting and I would love to try it. Since I do most of my programming on a mac, a .dmg file would work fine for me. On 9 Apr, 16:18, Antony Blakey wrote: > I have a private build of Netbeans that adds the following features to the > maven support: > > 1. In

Re: concurrency and rand-int

2010-03-26 Thread mac
l) > > 0.5558267606843464 > > user=> (next-random-val) > > 0.32353157456467474 > > > Cheers, > > Andrzej > > > On Fri, Mar 26, 2010 at 11:35 AM, Lee Spector   > > wrote: > > >> I'm trying to track down the reason that I sometimes se

Re: Clojure/LLVM

2010-03-24 Thread mac
save you millions of method calls. On the native side you should be able to get a direct pointer to the memory in the buffer so you can just go crazy and do whatever you like (hello segfault) ;) On Mar 24, 3:17 pm, Konrad Hinsen wrote: > On 24.03.2010, at 11:22, mac wrote: > > > With

Re: Clojure/LLVM

2010-03-24 Thread mac
C will never move it. JNA also has facilities to create ByteBuffers from pointers which means you can gain access to large blobs of memory that reside in native code. On 24 mar, 08:56, Konrad Hinsen wrote: > On 24 Mar 2010, at 07:40, mac wrote: > > > If you just want to use LLVM f

Re: Clojure/LLVM

2010-03-23 Thread mac
Like Per says, if you want to compile Clojure to LLVM code that's probably a huge project, have you looked at VMKit? I think that's a JVM/CLR implementation based on LLVM, perhaps it could run Clojure? If you just want to use LLVM from Clojure however, you can use my C FFI clj-native with the C in

Name suggestions

2010-03-17 Thread mac
h anything, could just be something that sounds funny, like sasquatch, that's a funny word. Please help! /Markus On 13 mar, 19:14, mac wrote: > Hello all. > I have had some time lately to work on my C FFI for Clojure and I > think it's pretty much feature complete now. > It has

[ANN] clj-native 0.8.1

2010-03-13 Thread mac
Hello all. I have had some time lately to work on my C FFI for Clojure and I think it's pretty much feature complete now. It has support for functions, callbacks, structures, unions and globals. For structures there is support for different alignments. The library has two main namespaces: clj-nati

Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-04 Thread mac
The .m2 folder is a Maven 2 convention. Leiningen uses Maven internally. .m2 contains your "local repository" - the single standard place where stuff gets downloaded to. When doing lein deps in a project folder any dependencies are downloaded to your local repo first (unless you already had the lib

Re: How to Initiate Clojure Application

2010-02-01 Thread mac
> Is "-main" special in any way, or is this just a convention that some > environments select? In the past I think I've used a manifest to > specify the main entry point... is that really necessary or does -main > map to the default main entry point regardless of build tool? Just > curious really!

Re: C interop lib (JNA wrapper)

2010-01-25 Thread mac
oblem I describe > here:https://jna.dev.java.net/servlets/ReadMsg?list=dev&msgNo=808 > > (I realize that this would basically be the "generate callback classes > OTF solution" that I said I'd rather not do, but if the code for this > already exists I could be persu

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread mac
On 25 Jan, 12:18, Joonas Pulakka wrote: > I would be interested in native / C interoperability; perhaps either > (or both) of these libraries: > > http://github.com/bagucode/clj-native > http://github.com/Chouser/clojure-jna > > And others, if there are similar ones. In general, "the Clojure way o

Re: Full Disclojure - I Need Topics!

2010-01-24 Thread mac
On 25 Jan, 06:50, Mark Engelberg wrote: > Debugging techniques, including: > * How to make sense of Clojure's stack traces. > * How to use Java debugging and profiling tools with Clojure. +1 for this. I haven't had the energy to try any debugging or profiling tools yet. Would be nice with demo o

Re: C interop lib (JNA wrapper)

2010-01-24 Thread mac
A little progress update. I havent had much time to work on this since my initial effort. But this weekend I have gotten structures to work. The reason that special support for structures is needed is to support C api's that pass them by value. Most of the effort to make this work went into how I

Re: Question about Responsiveness of Garbage Collection

2010-01-20 Thread mac
If you are talking about gui's written in swing you might have more luck with AWT since that is supposed to be using native gui components rather than doing it's rendering in java. I suspect that the sluggishness of swing is due to the fact that it has to copy a lot of data between the java heap an

Re: ANN: dgraph 1.0, a dependency graph library for Clojure

2010-01-17 Thread mac
Using the clojars repo from leiningen works fine for me, just using [dgraph "1.0.0"]. I've done most of my little swing app I needed to get done and dgraph has been very pleasant. However I found myself wanting to put a map in the graph because I had a function for updating the gui that depended on

Re: I'm going to teach Clojure at university - suggestions/comments?

2010-01-13 Thread mac
> The issue that is > particularly interesting to me to explore is how alien Clojure is to > Java programmers, what are subjective and objective causes, and how > hard is to overcome each of the identified issues. This sounds very interesting. I try to explain the point of lisp to java programmers

Re: C interop lib (JNA wrapper)

2010-01-12 Thread mac
I had apparently forgotten to commit and push the last changes. Sorry for any trouble if anyone is trying to use the library. The callbacks should work now. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@go

Re: C interop lib (JNA wrapper)

2010-01-10 Thread mac
> This is great. I think it'll be very valuable to call out to a bunch > of useful C library functions. Thank you > Can this approach also provide a bridge > to Objective-C? > > I'm very interested in using Cocoa to design GUIs for the Mac.  I'd > really like

Re: C interop lib (JNA wrapper)

2010-01-09 Thread mac
I've gotten rid of the automatic loading of the library and replacement of stub functions upon their first call. While this seemed convenient I didn't like that the stub versions of the functions could be passed around as objects without the user knowing that it was not the "real" version being use

Re: C interop lib (JNA wrapper)

2010-01-08 Thread mac
On Jan 8, 8:53 pm, Rob Wolfe wrote: > mac writes: > > Hello all. > > I've started work on a clojure library for interoperating with C. It's > > always been a pain to do in Java but recently JNA (java native access) > > has taken away most of that pain. >

C interop lib (JNA wrapper)

2010-01-08 Thread mac
Hello all. I've started work on a clojure library for interoperating with C. It's always been a pain to do in Java but recently JNA (java native access) has taken away most of that pain. When using clojure however, it's nice to be able to stay in clojure and not drop to java (or C *shudder*). It's

Re: Clojure and c++ and a bit more

2009-12-25 Thread mac
On Dec 24, 6:14 pm, atucker wrote: > I am also curious about this.  Apologies, possibly naive question > ahead :) > > My background is in C++.  By choosing to work with immutable values > (i.e. with a lot of consts), I found that I was able to avoid most of > explicit memory management, pointers

Re: Clojure and c++ and a bit more

2009-12-22 Thread mac
andidates are D and the new Google Go. Go in particular seems interesting because one of their goals is to make a very efficient GC and the language is somewhat multicore aware. /mac -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: Help recreating OS X Leiningen 1.0 +Swank bug

2009-12-18 Thread mac
I think I have solved the arguments issue but I had a strange bug with clojure.test which worries me a little bit. If you can try this out and see if it works for you that would be great: http://github.com/bagucode/leiningen/tree/setfork /mac On Dec 17, 7:02 pm, Steve Purcell wrote: > I c

Re: Help recreating OS X Leiningen 1.0 +Swank bug

2009-12-17 Thread mac
I've looked into it a little and this is probably a solvable problem. Since my native code patch needs fork as well I will try an idea I have later today. /mac On Dec 17, 7:02 pm, Steve Purcell wrote: > I came across this problem too, and David's patch helps, to a c

Re: Binary compatibility and a culture of AOT abuse

2009-12-13 Thread mac
need to start and stop a lot more than server apps, which makes such things important. Also from a developer point of view working with server software it's nice if you can restart things quickly when the system has gotten into a bad state because you carelessly deployed something broken on yo

Re: Leiningen Run ?

2009-12-13 Thread mac
viewed here: http://github.com/bagucode/leiningen However, when trying to build penumbra with it, it still fails with an UnsatisfiedLinkError. It seems like setting the java.library.path property in the ant task in eval-in-project is ignored..? /Mac -- You received this message because you are su

Re: ClojureCLR questions

2009-12-03 Thread mac
Apologies if this has been answered, did a quick search but found only pieces of info. Is it possible to run ClojureCLR on Mono yet? There was an issue with the BigDecimal dependency from J#? /Markus On Dec 3, 5:21 am, dmiller wrote: > 1. CLR Interop:  Interop is the focus of development at the

Re: leiningen - a Clojure build tool

2009-11-19 Thread mac
On Nov 19, 8:50 am, Martin DeMello wrote: > On Thu, Nov 19, 2009 at 10:52 AM, Phil Hagelberg wrote: > > > I must confess I don't understand the "avoid the command-line" mindset > > at all, so I need a little extra explanation. > > It's a matter of context switching. If I'm working in an IDE, I wa

Re: I got to use Clojure at work today !!!

2009-03-17 Thread mac
On Mar 17, 4:54 am, Paul Mooser wrote: > I've been using clojure in a similar way at work. I run a swank server > in a separate thread inside of a running application instance, and I > can connect to it remotely using SLIME. It works pretty well! Me too, I put a swank server in a webapp and dep

Re: How can I make the smallest structure possible?

2009-03-10 Thread mac
Arrays also have some overhead though so if your "objects" are all of equal size you could use just one array (of ints?) for all of them and create functions for indexing correctly in your array. A bit brittle but very space efficient. Of course this throws all of the benefits of Clojure or even J

Re: Internal structure of evaluation results

2009-03-02 Thread mac
There is meta data on var's which you need to use (meta (var sym)) to get at, but I'm under the impression that the var metadata is mostly for the benefit of the language runtime and a few core functions (like doc). The regular use of metadata I think is when you add it yourself to symbols or coll

Re: Clojure indentation conventions

2008-12-03 Thread mac
On 4 Dec, 02:14, "Mark Volkmann" <[EMAIL PROTECTED]> wrote: > On Wed, Dec 3, 2008 at 4:49 PM, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > > Hi, > > > Am 03.12.2008 um 22:06 schrieb levand: > > >> I am coming to Clojure from the Java side, and am completely ignorant > >> about lisp indentation &

Re: Clojure for LISP programmers....

2008-11-17 Thread mac
On Nov 17, 4:52 am, Luc Prefontaine <[EMAIL PROTECTED]> wrote: > I never read anywhere in the documentation or in the user group that > Clojure is a Common LISP implementation. > > Since it's existence, LISP has not gained a large acceptance in the > commercial market compared to other "conventi

Re: Patch: standalone compiler (almost)

2008-11-16 Thread mac
On Nov 17, 4:34 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Nov 16, 9:47 pm, "Stuart Sierra" <[EMAIL PROTECTED]> > wrote: > > > Hi Rich, and all, > > > I took a stab at writing a static compiler class, i.e. a main() that > > just compiles all the .clj files on the command line and saves the

Re: Why are symbols resolved when a function is defined?

2008-11-11 Thread mac
On 11 Nov, 06:24, Paul Barry <[EMAIL PROTECTED]> wrote: > In Common Lisp and Scheme, if you have an expression that evaluates a > symbol, it doesn't evaluate it until you call the function, not when > you define it.  So you can do this: > > Common Lisp: > [1]> (defun b () a) > B > [2]> (defvar a

Re: A trivial question about type and class

2008-11-05 Thread mac
tity comparison. For a discussion about dispatching based on type see this old thread: http://groups.google.com/group/clojure/browse_thread/thread/74d430f8e4353725/d16b548d4d46aab0 /mac --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Modified doto

2008-10-27 Thread mac
methods) ~x)) Here you go. sdoto for "static doto". /mac --~--~-~--~~~---~--~~ 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 To u

Re: Modified doto

2008-10-24 Thread mac
ld have to become > (doto x (.foo 42)). > > Any thoughts on this as part of the upcoming bit of breaking changes? > > Rich +1, would be a very nice change. /mac --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Clojure Eclipse plugin progress (clojure-dev)

2008-10-14 Thread mac
I use eclipse daily at work so I'm pretty used to it, would be very nice with a clojure plugin. Are you taking feature requests? If you are, here is mine: I like a good IDE as much as anyone but so far I have been using emacs with Jeffrey Chu's clojure-mode (http://clojure.codestuffs.com/). Comin

Re: Cells in Clojure

2008-09-23 Thread mac
retarded thing to point out :) /mac On 23 Sep, 04:55, "Stuart Sierra" <[EMAIL PROTECTED]> wrote: > Ok, here's another version of Cells, attached.  This one uses Agents, > like MikeM wrote.  It works even on a 1-link chain of dependencies > -- see examples in the c

Re: Talk at Boston Lisp in September

2008-09-07 Thread mac
I can't make it so I have a question: Will it be recorded? Would be great, even if the talk itself will be similar to what is in the podcasts that exist already, because it can be interesting to hear you answer questions. On 8 Sep, 02:05, Rich Hickey <[EMAIL PROTECTED]> wrote: > I will be speakin