Re: small project to learn clojure
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 i DID care about my robot :) Am 17.09.2011 04:57, schrieb Alan Malloy: Notice something you do often, and try to automate it. Or find an open- source project you use, and you wish were better in some way, and improve it. Learning a language by means of I need to learn something, what should I do is not as effective, or as fun, as learning it by doing something you care about. On Sep 16, 2:50 pm, Dennis Haupt d.haup...@googlemail.com wrote: hi community, i feel compelled to do something more complex in clojure. not too big, but bigger than what fits in 100 lines and offers some chances to use macros. it should also be fun, maybe something like robocode. - -- -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.14 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJOdEvzAAoJENRtux+h35aGN8MQAI3lnLB31L1C2brCh4jgWWdo AOW+nhiF5X47ab3WPnaIrcVOkE89OBQE4/7hXlSqeJD8W6zh4uCIhkFzIKk/p9xN ISgUBues9qxh8SIhpujCgnhyp44ms8ifHzHlZIiBuR2O2+LBeYKyZIepyZCdjpcf zZ/4er3lpKB5DTwQ3X+TRAHK4zHC3eEhtSwaLki9AShw2f5abFT5H8Mo/ptSogOt lkYZHEWNHr2xShBtvJZtXfXTecRisT3Ra3ukkeAldgfRst1LXmy2G44HN1B3Cn+K 9yQJoja4aySqtEKilzADkG2+8AyNK5y2UoGjehca9omGha30KkreyNiyLws/njNn I6YGBLgzIAgcu+gXTPXqV8j0gE1YBrgTcQvzMTKlOKnA/DG0mJwJTLdfE5q6FNP5 92lAntea0fNBb5RMFpcNa4/c8lGvwgiNAJtAYeX2G1v6MFMavd1nbN/HR3fS3rLQ wpR6ssPSqjQxQZ5a0MzM/vXJX2qn8/rNqo7RkgLRMv0abOPMCA2FEtxxxsrHetkz lY/O/B+F6ByKxp5W9xdHE9f2QxfSYf9lXr0eEuHWOeJK10Jj2tYR4WmxB/s/cFNI KUGTrAeh666TTyzAq93OHLHh7y7lLXY4SwUMyOHO8t1UK0aDMlnZqRWtAHPuN3+r UF3ujhgj3WbGOeEzPEBg =ekWR -END PGP SIGNATURE- -- 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: small project to learn clojure
On 09/16/2011 11:50 PM, Dennis Haupt wrote: i feel compelled to do something more complex in clojure. not too big, but bigger than what fits in 100 lines and offers some chances to use macros. it should also be fun, maybe something like robocode. Something that is not primitive but may stay small or at least has clearly defined boundaries right from start ... if you rule out pure logic puzzles, this does point to games, I think. There are so many simple games, some of which must have been implemented a million times. You could try to do one of those, but with a twist, perhaps. Like a Pacman, but where you steer the ghosts (only one at a time, changing the direction it heads to). Dungeonmaster-Sokoban, where you have to push boxes to create a path that will lead to the hero's death, once he arrives. That without trapping your own worker. OR, you look for an existing project, where you could implement a missing feature. Ideally one where you could interact with the author/contributors via IRC. http://www.webnoir.org/ might be a candidate, where a comment system or tagging come to mind (I'm not affiliated and don't know if something like that is underway, already). -- Thorsten Wilms thorwil's design for free software: http://thorwil.wordpress.com/ -- 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: including sound or image files with Leiningen uberjar command
Did you forget to set the name of the main class/namespace in project.clj? that would cause the behavior you're seeing. Dave On Saturday, September 17, 2011, loonster tbur...@acm.org wrote: On Sep 16, 1:24 am, Joost jo...@zeekat.nl wrote: On Sep 16, 7:20 am, loonster tbur...@acm.org wrote: Sound or image files will show up in the resulting uberjar if they reside in a /resources subdirectory of a Leiningen home project directory. I can't find any documentation for how to refer to and load such resource files within a project.clj and/or a source clj file so that that the resources can be used by a standalone jar. Many thanks for any hints. Tim You can refer to resources using (clojure.java.io/input-stream (clojure.java.io/resource path/to/ image)) See also ring.util.response/resource-response if you want to do this in a war/jar web app. Joost. Well, thanks all. The most succinct code turned out to be (clojure.java.io/resource fileName) and so my test fragment now consists of: (ns depExp (:gen-class)) (import '(java.applet Applet) '(java.io File) '(java.net URL)) (defn -main [ args] (.play (Applet/newAudioClip (clojure.java.io/resource looncall.au ;;;BTW, the looncall.au is a small sound file;;; ...which works fine in the REPL and it also compiles but the resulting standalone jar file throws an error: main java.lang.NullPointerException. Am using lein uberjar. ??? -- 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
Re: A bit of fun with core.logic
Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com writes: Hi Ambrose, For those with a bit of free time to experiment at a REPL this weekend. https://github.com/frenchy64/Logic-Starter/wiki/Arithmetic Oh, I didn't know that one times three is four! :-) Bye, Tassilo -- 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 bit of fun with core.logic
Hi Tassilo, On Sat, Sep 17, 2011 at 8:13 PM, Tassilo Horn tass...@member.fsf.orgwrote: Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com writes: Hi Ambrose, For those with a bit of free time to experiment at a REPL this weekend. https://github.com/frenchy64/Logic-Starter/wiki/Arithmetic Oh, I didn't know that one times three is four! :-) Are you referring to this example? logic-introduction.numbers= (run 1 [q] (times one three q))0 It may appear to return 4, but `run` returns a list of the values of `q` for each run. Here we request 1 run via `(run 1 [q] ..)` so a list of length 1 is returned: ( (((0))) ) ie. (3) Please share if you're referring to something else. Thanks, Ambrose -- 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 bit of fun with core.logic
Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com writes: Hi Ambrose, https://github.com/frenchy64/Logic-Starter/wiki/Arithmetic Oh, I didn't know that one times three is four! :-) Are you referring to this example? Yes. logic-introduction.numbers= (run 1 [q] (times one three q))0 It may appear to return 4, but `run` returns a list of the values of `q` for each run. Here we request 1 run via `(run 1 [q] ..)` so a list of length 1 is returned: ( (((0))) ) ie. (3) Of course, you are right. I should have read it a bit more carefully, not just glancing at it. Bye, Tassilo -- 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
Is there a reason that def- isn't part of the core lib?
Hi all, Whilst trying to minimise the visible surface areas of namespaces, I've often felt the need for a def- function/macro that marks a def'ed var with :private metadata. An analog of defn-, if you will. Is there a reason that I shouldn't do this or a reason that it doesn't seem to be a member of the core lib? In the spirit of Hunt Thomas' Select isn't broken, when I encounter something this trivial, useful and absent I tend to conclude that I'm the one who's got things wrong. Thanks in advance, Rob. -- 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
clojure type casting vs java type casting
Is the following clojure code: (long (.some-method-that-returns-int this)) equivalent in semantics and performance to the following java code: (long)some-method-that-returns-int(); I need to make type casts in an inner loop (hot zone), and I was wondering if there was something implicit that makes writing it in java faster. -- 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: including sound or image files with Leiningen uberjar command
Nope. The project.clj is: (defproject depExp 1.0.0-SNAPSHOT :description FIXME: write :dependencies [[org.clojure/clojure 1.2.1] [org.clojure/clojure-contrib 1.2.0]] :main depExp) Tim On Sep 17, 5:05 am, Dave Ray dave...@gmail.com wrote: Did you forget to set the name of the main class/namespace in project.clj? that would cause the behavior you're seeing. Dave On Saturday, September 17, 2011, loonster tbur...@acm.org wrote: On Sep 16, 1:24 am, Joost jo...@zeekat.nl wrote: On Sep 16, 7:20 am, loonster tbur...@acm.org wrote: Sound or image files will show up in the resulting uberjar if they reside in a /resources subdirectory of a Leiningen home project directory. I can't find any documentation for how to refer to and load such resource files within a project.clj and/or a source clj file so that that the resources can be used by a standalone jar. Many thanks for any hints. Tim You can refer to resources using (clojure.java.io/input-stream (clojure.java.io/resource path/to/ image)) See also ring.util.response/resource-response if you want to do this in a war/jar web app. Joost. Well, thanks all. The most succinct code turned out to be (clojure.java.io/resource fileName) and so my test fragment now consists of: (ns depExp (:gen-class)) (import '(java.applet Applet) '(java.io File) '(java.net URL)) (defn -main [ args] (.play (Applet/newAudioClip (clojure.java.io/resource looncall.au ;;;BTW, the looncall.au is a small sound file;;; ...which works fine in the REPL and it also compiles but the resulting standalone jar file throws an error: main java.lang.NullPointerException. Am using lein uberjar. ??? -- 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
Re: including sound or image files with Leiningen uberjar command
Ah. I think there are issues with single-segment namespaces and AOT. See comment on first answer here [1]. Maybe converting to depExp.core would help. Dave [1] http://stackoverflow.com/questions/3390268/how-to-setup-the-classpath-when-running-the-jar-made-from-lein-uberjar On Sat, Sep 17, 2011 at 10:57 AM, loonster tbur...@acm.org wrote: Nope. The project.clj is: (defproject depExp 1.0.0-SNAPSHOT :description FIXME: write :dependencies [[org.clojure/clojure 1.2.1] [org.clojure/clojure-contrib 1.2.0]] :main depExp) Tim On Sep 17, 5:05 am, Dave Ray dave...@gmail.com wrote: Did you forget to set the name of the main class/namespace in project.clj? that would cause the behavior you're seeing. Dave On Saturday, September 17, 2011, loonster tbur...@acm.org wrote: On Sep 16, 1:24 am, Joost jo...@zeekat.nl wrote: On Sep 16, 7:20 am, loonster tbur...@acm.org wrote: Sound or image files will show up in the resulting uberjar if they reside in a /resources subdirectory of a Leiningen home project directory. I can't find any documentation for how to refer to and load such resource files within a project.clj and/or a source clj file so that that the resources can be used by a standalone jar. Many thanks for any hints. Tim You can refer to resources using (clojure.java.io/input-stream (clojure.java.io/resource path/to/ image)) See also ring.util.response/resource-response if you want to do this in a war/jar web app. Joost. Well, thanks all. The most succinct code turned out to be (clojure.java.io/resource fileName) and so my test fragment now consists of: (ns depExp (:gen-class)) (import '(java.applet Applet) '(java.io File) '(java.net URL)) (defn -main [ args] (.play (Applet/newAudioClip (clojure.java.io/resource looncall.au ;;;BTW, the looncall.au is a small sound file;;; ...which works fine in the REPL and it also compiles but the resulting standalone jar file throws an error: main java.lang.NullPointerException. Am using lein uberjar. ??? -- 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 -- 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: Is there a reason that def- isn't part of the core lib?
A previous discussion on the topic can be found here [1]. You can easily add the private metadata yourself: Clojure 1.2: (def ^{:private true} size 25) Clojure 1.3: (def ^:private size 25) I think probably the reason against it is that generally there is not as much reason to use a constant, for example, outside of its namespace as there is with functions, and therefore more need for marking functions meant only for internal use as such (but that is just guessing at other peoples' thought processes). [1] http://groups.google.com/group/clojure/browse_thread/thread/80d873ef625221ac/243a0ad490150d3e?lnk=gstq=def-#243a0ad490150d3e On Sat, Sep 17, 2011 at 10:54 AM, Rob Lally rob.la...@gmail.com wrote: Hi all, Whilst trying to minimise the visible surface areas of namespaces, I've often felt the need for a def- function/macro that marks a def'ed var with :private metadata. An analog of defn-, if you will. Is there a reason that I shouldn't do this or a reason that it doesn't seem to be a member of the core lib? In the spirit of Hunt Thomas' Select isn't broken, when I encounter something this trivial, useful and absent I tend to conclude that I'm the one who's got things wrong. Thanks in advance, Rob. -- 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
Re: including sound or image files with Leiningen uberjar command
Dave: I tried adding .core, but to no avail. Still get null pointer exception. This is very puzzling; thanks for the effort...Tim On Sep 17, 8:06 am, Dave Ray dave...@gmail.com wrote: Ah. I think there are issues with single-segment namespaces and AOT. See comment on first answer here [1]. Maybe converting to depExp.core would help. Dave [1]http://stackoverflow.com/questions/3390268/how-to-setup-the-classpath... On Sat, Sep 17, 2011 at 10:57 AM, loonster tbur...@acm.org wrote: Nope. The project.clj is: (defproject depExp 1.0.0-SNAPSHOT :description FIXME: write :dependencies [[org.clojure/clojure 1.2.1] [org.clojure/clojure-contrib 1.2.0]] :main depExp) Tim On Sep 17, 5:05 am, Dave Ray dave...@gmail.com wrote: Did you forget to set the name of the main class/namespace in project.clj? that would cause the behavior you're seeing. Dave On Saturday, September 17, 2011, loonster tbur...@acm.org wrote: On Sep 16, 1:24 am, Joost jo...@zeekat.nl wrote: On Sep 16, 7:20 am, loonster tbur...@acm.org wrote: Sound or image files will show up in the resulting uberjar if they reside in a /resources subdirectory of a Leiningen home project directory. I can't find any documentation for how to refer to and load such resource files within a project.clj and/or a source clj file so that that the resources can be used by a standalone jar. Many thanks for any hints. Tim You can refer to resources using (clojure.java.io/input-stream (clojure.java.io/resource path/to/ image)) See also ring.util.response/resource-response if you want to do this in a war/jar web app. Joost. Well, thanks all. The most succinct code turned out to be (clojure.java.io/resource fileName) and so my test fragment now consists of: (ns depExp (:gen-class)) (import '(java.applet Applet) '(java.io File) '(java.net URL)) (defn -main [ args] (.play (Applet/newAudioClip (clojure.java.io/resource looncall.au ;;;BTW, the looncall.au is a small sound file;;; ...which works fine in the REPL and it also compiles but the resulting standalone jar file throws an error: main java.lang.NullPointerException. Am using lein uberjar. ??? -- 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 -- 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: ClojureBox on Window 7: classpath in .emacs file not working
Update: setting manually an environment variable named HOME, you can choose where clojurebox/emacs will search your .emacs file. On Thu, Sep 15, 2011 at 9:13 PM, Roberto Mannai roberm...@gmail.com wrote: Hi rsgoheen, Here how I'm now able to work with Clojurebox on Windows 7. Perhaps mine it isn't exactly the same as yours but can give some hints. After some process sniffing, I found that Emacs was searching the .emacs file under C:\, so I created it. In order to create it, you have to do it in DOS (the WIN Explorer doesn't allow you to make dotted files), furthermore acting as an Administrator. So: open the DOS console as an Administrator and type: C:\Windows\system32echo c:\.emacs Now you can open it with Notepad (again, as an Administrator) and type your classpath configuration: C:\Windows\system32notepad c:\.emacs After adding the (setq swank-clojure-classpath ... stuff, saving the file and restarting Clojurebox, you should be able to require/use the new classpath .clj files. Hope this help, ciao. On Fri, Jun 10, 2011 at 4:37 PM, rsgoheen goh...@gmail.com wrote: This is absolutely killing me. I'm starting to use ClojureBox to further my knowledge of Clojure, and I can't get it to pick up the individual *.clj files I'm working with or the example code from Halloway's book. There's lots of good information on line telling me how to set up my .emacs file, and none of it seems to work for me. I'm running on Windows 7, and here are the details: My .emacs (created through C-x C-f ./.emacs) looks like this --- (setq swank-clojure-extra-classpaths '()) (add-to-list 'swank-clojure-extra-classpaths C:/Work/schloj-code) (tool-bar-mode -1) --- I know it's reading correctly, because the last line is turning the toolbar off when emacs is started I've unzipped the sample files from Halloway's books to the C:\work \schloj-code\ location, and there is a subfolder called examples, and a file in there called introduction.clj When I go to the REPL and type in: (using 'examples.introduction) I get the following file-not-found exception stack: --- Could not locate examples/introduction__init.class or examples/ introduction.clj on classpath: [Thrown class java.io.FileNotFoundException] Restarts: 0: [QUIT] Quit to the SLIME top level Backtrace: 0: clojure.lang.RT.load(RT.java:412) 1: clojure.lang.RT.load(RT.java:381) 2: clojure.core$load$fn__4511.invoke(core.clj:4905) 3: clojure.core$load.doInvoke(core.clj:4904) 4: clojure.lang.RestFn.invoke(RestFn.java:409) --- How do I figure out what I might be doing wrong? Is there any way to tell where the REPL is looking for this file to know it's looking in the correct place? Is there a Windows or Windows 7 gotcha here that I'm missing (case sensitivity? permissions denied?) Please, this is making me nuts -- 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
Re: including sound or image files with Leiningen uberjar command
I found the problem. It turns out that uberjar doesn't like .au files; when I converted the audio file into a .wav, the standalone jar works fine. Weird. On Sep 17, 8:51 am, loonster tbur...@acm.org wrote: Dave: I tried adding .core, but to no avail. Still get null pointer exception. This is very puzzling; thanks for the effort...Tim On Sep 17, 8:06 am, Dave Ray dave...@gmail.com wrote: Ah. I think there are issues with single-segment namespaces and AOT. See comment on first answer here [1]. Maybe converting to depExp.core would help. Dave [1]http://stackoverflow.com/questions/3390268/how-to-setup-the-classpath... On Sat, Sep 17, 2011 at 10:57 AM, loonster tbur...@acm.org wrote: Nope. The project.clj is: (defproject depExp 1.0.0-SNAPSHOT :description FIXME: write :dependencies [[org.clojure/clojure 1.2.1] [org.clojure/clojure-contrib 1.2.0]] :main depExp) Tim On Sep 17, 5:05 am, Dave Ray dave...@gmail.com wrote: Did you forget to set the name of the main class/namespace in project.clj? that would cause the behavior you're seeing. Dave On Saturday, September 17, 2011, loonster tbur...@acm.org wrote: On Sep 16, 1:24 am, Joost jo...@zeekat.nl wrote: On Sep 16, 7:20 am, loonster tbur...@acm.org wrote: Sound or image files will show up in the resulting uberjar if they reside in a /resources subdirectory of a Leiningen home project directory. I can't find any documentation for how to refer to and load such resource files within a project.clj and/or a source clj file so that that the resources can be used by a standalone jar. Many thanks for any hints. Tim You can refer to resources using (clojure.java.io/input-stream (clojure.java.io/resource path/to/ image)) See also ring.util.response/resource-response if you want to do this in a war/jar web app. Joost. Well, thanks all. The most succinct code turned out to be (clojure.java.io/resource fileName) and so my test fragment now consists of: (ns depExp (:gen-class)) (import '(java.applet Applet) '(java.io File) '(java.net URL)) (defn -main [ args] (.play (Applet/newAudioClip (clojure.java.io/resource looncall.au ;;;BTW, the looncall.au is a small sound file;;; ...which works fine in the REPL and it also compiles but the resulting standalone jar file throws an error: main java.lang.NullPointerException. Am using lein uberjar. ??? -- 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 -- 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: Is there a reason that def- isn't part of the core lib?
There are other nine defs in core that don't have a dash version, either. I guess if they were to take def- they'd have to add the others and then add any new defs in pairs. But there's no reason to write ugly code; just write your own or use a contrib, if available. On Sep 17, 7:54 am, Rob Lally rob.la...@gmail.com wrote: Hi all, Whilst trying to minimise the visible surface areas of namespaces, I've often felt the need for a def- function/macro that marks a def'ed var with :private metadata. An analog of defn-, if you will. Is there a reason that I shouldn't do this or a reason that it doesn't seem to be a member of the core lib? In the spirit of Hunt Thomas' Select isn't broken, when I encounter something this trivial, useful and absent I tend to conclude that I'm the one who's got things wrong. Thanks in advance, Rob. -- 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: Reuse of generic Clojure/ClojureScript code?
ok -- 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
Clojurescript reader cannot handle \ in strings?
The cljs reader does not seem able to read strings that contain \ characters. Has anyone else seen this behaviour? probably causes: https://github.com/ibdknox/pinot/issues/4 (ns test (:require [cljs.reader :as reader] )) (defn log [x] (.log js/console x)) (def string [\hello\ \ \ ]) (log test) (log string) (log (reader/read-string string)) -- 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: why expressions in macro are not evaluated?
Michael, thanks for your explanation. I have used dorun to solve my problem following your suggestion. -- 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 embedded in a Java Application
Hi Meikel Thank you for your reply. Is there a way to populate the HashMap before passing it to the invoke method I tried the following Var keyword = RT.var(clojure.core, keyword); Var hashMap = RT.var(clojure.core, hash-map); hashMap.invoke(keyword.invoke(a), 1); then I created the following function (defn foo[key paramMap](key paramMap)) Object result=foo.invoke(keyword.invoke(a), hashMap); But I got null returned but when I do as you suggest Object result=foo.invoke(keyword.invoke(a), hashMap.invoke(keyword.invoke(a), 1)); I get 1 returned Any suggestions welcomed On Sep 16, 9:56 am, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: Hi, Am Donnerstag, 15. September 2011 23:39:10 UTC+2 schrieb Eamonn: The code works BUT if I try to pass in a map for example like so Object result = foo.invoke( hello,world,#{:a 1 :b 2}); This does not pass a map to the function, but the string #{:a 1 :b 2}. And from your example I don't see where the class cast exception should come from. To create a clojure map use the normal hash-map function. Var keyword = RT.var(clojure.core, keyword); Var hashMap = RT.var(clojure.core, hash-map); foo.invoke(hello, world, hashMap.invoke(keyword.invoke(a), 1, keyword.invoke(b), 2)); Hope this helps. Sincerely Meikel -- 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 embedded in a Java Application
On Sat, Sep 17, 2011 at 10:58 PM, Eamonn odon...@gmail.com wrote: Hi Meikel Thank you for your reply. Is there a way to populate the HashMap before passing it to the invoke method The easiest might be to just pass a map literal (in String form) through the Clojure reader. Variable integers or other simple objects can just be incorporated using the Java String + operator; the concatenation will always start with a string literal such as { so this will work in general. (It's likely keywords etc. will be constant while numbers might be variable.) -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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
Casting numbers to ints
Is it possible to cast a number into an int in 1.3.0-RC0? ;user= (type 0) java.lang.Long ;user= (type (int 0)) java.lang.Long -- 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