No, it won't force a GC. But it should be eligible for GC, if that's
what you mean. Hopefully the memo cache will stay in the
generation-zero nursery, in which case it will incur effectively no GC
cost since the nursery collector runs in time O(live objects in
nursey) rather than O(total objects in
Ah, is there any concern with pummeling that var?
On Mar 19, 2:22 am, Meikel Brandmeyer wrote:
> Hi,
>
> On Mar 19, 7:05 am, Greg Fodor wrote:
>
> > Ah, I think I have the solution:
>
> > (defn foo []
> > (let [bar-memoized (memoize bar)]
> > ; Do stuff with bar-memoized
> > ))
>
> > Seem
Hi,
On Mar 19, 7:05 am, Greg Fodor wrote:
> Ah, I think I have the solution:
>
> (defn foo []
> (let [bar-memoized (memoize bar)]
> ; Do stuff with bar-memoized
> ))
>
> Seems to work -- to verify, this will GC the memoized cache for bar
> after each call to foo, right?
Yes. I would thin
On Fri, Mar 19, 2010 at 06:56, Greg Fodor wrote:
> I would like to memoize bar such that the memory used for memoization
> is GC'ed at the end of the call to foo, and additionally the cache
> used for memoization is thread local (so no need for heavyweight
> synchronization tools like atoms, etc
Hi,
In this particular case, his get-properties macros was a demonstration
of how to write a macro, but could have been replaced with an
out-of-the-box clojure.core/bean call.
2010/3/19 Per Vognsen :
> My experience as a newcomer to Clojure is that one of the most
> surprising things is the dicho
Hi Group,
there was a Stack Overflow question recently re: syntax highlighting
Clojure REPLs. This got me thinking that since I was going to tweak
SLIME REPL font-lock for quite some time now (I find the default a bit
too aggressive), I might as well do it now and have it use
clojure-mode's font-l
Ah, I think I have the solution:
(defn foo []
(let [bar-memoized (memoize bar)]
; Do stuff with bar-memoized
))
Seems to work -- to verify, this will GC the memoized cache for bar
after each call to foo, right?
On Mar 19, 1:56 am, Greg Fodor wrote:
> Hi there -- I am looking for a soluti
Hi there -- I am looking for a solution to a particular memoization
pattern. I have a function foo that is the entry point of a caller
that makes many thousands of calls to a function bar. In calling foo,
bar will be called with many different args but there are many
repeated calls to bar with the
My guess from looking at the API documentation for ResultSet is that
it doesn't know which of the several one-parameter overloads of
getObject to choose. Presumably you want the integer one, so try
(.getObject rs (int i)).
-Per
On Fri, Mar 19, 2010 at 12:08 PM, cageface wrote:
> I'm trying to el
I'm trying to eliminate some reflection overhead in little SQL utility
I'm working on and can't seem to get the type hint right for this
code:
(import 'java.sql.ResultSet)
(set! *warn-on-reflection* true)
(defn rs-get-row [#^ResultSet rs]
(if (.next rs)
(let [cols (.. rs getMetaData getCol
My experience as a newcomer to Clojure is that one of the most
surprising things is the dichotomy between the Clojure and JVM world.
I was reading one of Lau's blog posts on converting images to ASCII art:
http://www.bestinclass.dk/index.php/2010/02/my-tribute-to-steve-ballmer
His get-properties
how about 'patois' or 'creole'
On Mar 17, 12:08 am, mac wrote:
> After just a little more test and polish I plan on calling clj-native
> 1.0. But clj-native is a *really* boring name so I want to change it
> before 1.0 and I don't have very good imagination when it comes to
> these things.
> So I
* LauJensen [100318 00:26]:
> Hey Tim,
>
> Welcome - I might be restating, but this should get you going quickly:
Oh that's great Lau!
I have been looking at your videos and was wondering where I could
find text instructions
(see my posting subject: "Clojure 101 - Slime installation")
But using symbols for something like this is a bit contrived anyway.
Maybe, but I've seen it in other Common Lisp books/tutorials before.
e.g. I'm sure PAIP was one of them.
Part of the motivation is that CL symbols always compare with EQ and
EQL, whilst strings are not required to do so:
> Yes, of course, thats what a sane person would do ;-)
>
> I mentioned in my later post, this usage of symbols as data is 1. non-
> idiomatic but 2. really illuminating for somebody with Java
> background.
> Well, and its what this tutorial does.
>
> Nevertheless thank you for the answer!
>
>
Ha,
On 18 March 2010 23:40, Michael Gardner wrote:
> On Mar 18, 2010, at 4:17 PM, David Nolen wrote:
>
>> On Thu, Mar 18, 2010 at 4:25 PM, alux wrote:
>> Hello!
>>
>> I much enjoyed reading the tutorial http://www.lisperati.com/casting.html
>> , mentioned by eyeris today. The most mind-extending thin
On 18 March 2010 23:40, Dave M wrote:
> ...
>
>> (game-action weld chain bucket attic
>> (if ((and (have 'bucket) (alter-var-root (var *chain-welded*) (fn
> ^
> Your if-condition is nested one form too deeply; try "(if (and (have
> 'bucket) ...) ...)"
>
> I haven't tried it
...
> (game-action weld chain bucket attic
> (if ((and (have 'bucket) (alter-var-root (var *chain-welded*) (fn
^
Your if-condition is nested one form too deeply; try "(if (and (have
'bucket) ...) ...)"
I haven't tried it, so there might be other problems.
-Dave
--
You
On Mar 18, 2010, at 4:17 PM, David Nolen wrote:
> On Thu, Mar 18, 2010 at 4:25 PM, alux wrote:
> Hello!
>
> I much enjoyed reading the tutorial http://www.lisperati.com/casting.html
> , mentioned by eyeris today. The most mind-extending thing (to me,
> having Java background) is the, admittedly
Don't want to start my own thread, so here goes: we are starting a
functional programming user group in Vienna that - judging by the
people who showed interest so far - will probably be quite heavy on
all things Lisp, so it'd be nice if you could include that too:
http://metalab.at/wiki/Lambdahead
On 18 March 2010 22:38, alux wrote:
> Again, from my translation of the http://www.lisperati.com/casting.html
> tutorial.
>
> I completely lost track at the macro generating macro (defspel game-
> action ..
>
> In short, Barski writes a very simple (and neat) text adventure. To
> avoid wrong assum
On Mar 18, 2010, at 10:55 AM, Per Vognsen wrote:
> Is there any reason why a .method occurrence in non-operator position
> doesn't just do the closure wrapping automagically?
I'd like to know this as well. Smooth Java interop is one of Clojure's selling
points, but having to wrap Java methods in
On Thu, Mar 18, 2010 at 4:25 PM, alux wrote:
> Hello!
>
> I much enjoyed reading the tutorial http://www.lisperati.com/casting.html
> , mentioned by eyeris today. The most mind-extending thing (to me,
> having Java background) is the, admittedly non-idiomatic, use of
> symbols as data.
>
> But I
On 18 March 2010 20:31, Timothy Washington wrote:
> Too right. Thanks very much friend.
No problem :)
> On Wed, Mar 17, 2010 at 3:25 PM, Michael Wood wrote:
>>
>> On 17 March 2010 21:18, Michael Wood wrote:
>> [...]
>> > $ java -cp clojure-1.1.0.jar:clojure-contrib.jar clojure.mainClojure
>> >
Hello Fons,
(my former answer was to Brian)
I tried this one, actually. But the result is really used as output of
the adventure 'game' here. So the namespace prefix must not be there.
Thank you for the answer, alux
On 18 Mrz., 21:50, fons haffmans wrote:
> I just did this :
>
> (defn describe
Yes, of course, thats what a sane person would do ;-)
I mentioned in my later post, this usage of symbols as data is 1. non-
idiomatic but 2. really illuminating for somebody with Java
background.
Well, and its what this tutorial does.
Nevertheless thank you for the answer!
Kind regards, alux
I just did this :
(defn describe-path [path]
`(there is a ,(second path) going ,(first path) from here.))
which gives me :
(describe-path (list "left" "right"))
(user/there user/is user/a (clojure.core/second user/path) user/going
(clojure.core/first user/path) user/from here.)
Sure, it prepe
>
> But I have two translation problems, I want to pose before going to
> sleep (its pitch dark in Europe :). First the easy one:
>
> Common Lisp
> (defun describe-path (path)
> `(there is a ,(second path) going ,(first path) from here.))
>
> My Clojure version, I use a map:
> (defn describe-path
Again, from my translation of the http://www.lisperati.com/casting.html
tutorial.
I completely lost track at the macro generating macro (defspel game-
action ..
In short, Barski writes a very simple (and neat) text adventure. To
avoid wrong assumtions he doesnt talk about macros but SPELs, using
Hello!
I much enjoyed reading the tutorial http://www.lisperati.com/casting.html
, mentioned by eyeris today. The most mind-extending thing (to me,
having Java background) is the, admittedly non-idiomatic, use of
symbols as data.
But I have two translation problems, I want to pose before going to
On 18/03/10 06:57 AM, Michael Kohl wrote:
There's a really nice article series on monads in Clojure:
http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/
Oh, wow! Lucidly written. And it gives me something, maybe-m, that I
can't believe I got along without be
And upgrade the doc macro accordingly? That would make entirely too
much sense.
+1
On Mar 18, 2:36 pm, Seth wrote:
> Would :deprecated be a reasonable thing to include in a function's
> metadata? Just the presence of it seems good enough, but I guess
> pairing it with some programmer friendly m
See http://vimeo.com/8398020
Great video!
But, it would be great if I could capture the *text* of the video,
(if available) that would be very helpful in referrencing Lau's
instructions
Anyone know how to do that?
thanks
--
Tim
t...@johnsons-web.com
http://www.akwebsoft.com
--
You received t
Would :deprecated be a reasonable thing to include in a function's
metadata? Just the presence of it seems good enough, but I guess
pairing it with some programmer friendly message ("hey, use bar
instead of foo") might be nice.
Or... maybe 10,000 lines of XML as metadata! :-)
On Mar 18, 10:50 am,
Too right. Thanks very much friend.
Tim
On Wed, Mar 17, 2010 at 3:25 PM, Michael Wood wrote:
> On 17 March 2010 21:18, Michael Wood wrote:
> [...]
> > $ java -cp clojure-1.1.0.jar:clojure-contrib.jar clojure.mainClojure
> 1.1.0
> [...]
>
> Whoops! Not sure what happened there. That's of cou
clj-segfault
j/k :)
Seriously though, thank you for working on this. I'm sure it will
remove a serious barrier to entry for some people.
On Mar 13, 1:14 pm, 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 no
Is there any reason why a .method occurrence in non-operator position
doesn't just do the closure wrapping automagically?
-Per
On Thu, Mar 18, 2010 at 9:50 PM, Stuart Halloway
wrote:
> memfn is from the depths of time and should be deprecated -- it is idiomatic
> to write an anonymous fn around
Many thanks, all questions I had are answered. And some I didn't have
but should!
Greetings, alux
On 18 Mrz., 14:25, Meikel Brandmeyer wrote:
> Hi,
>
> On Mar 18, 12:06 pm, alux wrote:
>
> > is there a possibility to reload a clj-file that has been provided at
> > the REPL-start via -i filename
I love the reference, but I dunno dude, the word itself sounds venereal !
On 18 Mar 2010, at 14:36, Alexandre Patry wrote:
>
>>> On Wed, Mar 17, 2010 at 3:08 AM, mac wrote:
>>>
After just a little more test and polish I plan on calling clj-native
1.0. But clj-native is a *really*
memfn is from the depths of time and should be deprecated -- it is
idiomatic to write an anonymous fn around the method.
Stu
This seems like a potential usecase for (memfn):
-
clojure.core/memfn
([name & args])
Macro
Expands into code that creates a fn that expects t
On Wed, Mar 17, 2010 at 3:08 AM, mac wrote:
After just a little more test and polish I plan on calling clj-native
1.0. But clj-native is a *really* boring name so I want to change it
before 1.0 and I don't have very good imagination when it comes to
these things.
So I need your help.
It d
C-Foam
martin
On Wed, Mar 17, 2010 at 12:38 PM, mac wrote:
> After just a little more test and polish I plan on calling clj-native
> 1.0. But clj-native is a *really* boring name so I want to change it
> before 1.0 and I don't have very good imagination when it comes to
> these things.
> So I ne
Hi,
On Mar 18, 12:06 pm, alux wrote:
> is there a possibility to reload a clj-file that has been provided at
> the REPL-start via -i filename.clj ? (It doesn't have a name space.)
>
> This would save me to provide a namespace in the file an thus type (ns
> my-ns) after every REPL start.
I under
This seems like a potential usecase for (memfn):
-
clojure.core/memfn
([name & args])
Macro
Expands into code that creates a fn that expects to be passed an
object and any args and calls the named instance method on the
object passing the args. Use when you want to tr
Hello,
is there a possibility to reload a clj-file that has been provided at
the REPL-start via -i filename.clj ? (It doesn't have a name space.)
This would save me to provide a namespace in the file an thus type (ns
my-ns) after every REPL start.
Thank you and greetings,
alux
--
You received
Thank you Meikel. I just didnt encounter that information before ;-)
I'm still in the process of learning the core lib, so while learning I
sometimes avoid the contrib libraries, and try myself. Here this
proved educating again ;-)
(wouldn't do so for production ;-)
Thank you and regards, alux
Hi,
Java methods are not clojure functions. To treat them like first-class
functions you have to wrap them in clojure functions as you did in
your second example.
For your actual task: you might want to look at clojure.contrib.repl-
utils/show.
Sincerely
Meikel
--
You received this message bec
Hello, I just was to lazy to get my Javadoc, so I wanted to list the
methods of an object from the 1.1-REPL.
I got different results when mapping .getName or #(.getName %) over
the seq I produced - I expected this to be the same. So seemingly my
expectations are wrong. Would you please rectify?
(
On Wed, Mar 17, 2010 at 1:28 PM, Ben Armstrong wrote:
> What I would like to have is some sort of lexicon to at least help explain
> the terminology in a way that doesn't require three years of academic
> exposure to functional programming to read. Is there such a reference? Or
> should I just i
What about Clonure? Wordplay on Clone and leaving out the j ;)
2010/3/17 mac :
> After just a little more test and polish I plan on calling clj-native
> 1.0. But clj-native is a *really* boring name so I want to change it
> before 1.0 and I don't have very good imagination when it comes to
> these
Eugen,
Fantastic insight - I cant wait to work that into a blogpost :)
Lau
On 17 Mar., 15:56, Eugen Dück wrote:
> All,
>
> Developing in clojure is a lot of fun, at least it was for me and a
> project of mine - except for one thing: Deploying the app as Java Web
> Start app, that took me a bit
Hey Tim,
Welcome - I might be restating, but this should get you going quickly:
Getting ready:
http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/
Doing simple pages:
http://www.bestinclass.dk/index.php/2009/12/beating-the-arc-challenge-in-clojure/
Including
Hi Ben,
I think we often get the impression that functional programming is
directly connected to monads, but in practical terms the important
concepts are pure functions and persistent immutable datastructures.
The learning curve when coming from an imperative language, lies (for
me at least) most
Hi Lee,
Personally I think JSwat does the job right in that you can break the
code and get a look at local variables. There has also been release a
'debug-repl' which allows you to halt execution and jump into a REPL,
like so: http://georgejahad.com/clojure/debug-repl.html. There exists
2 versions
Hey Markus,
Probably not what you want to hear, but I think great names are both
memorable and descriptive. Leaning on those criterias clj-native is
not bad at all.
Lau
On 17 Mar., 08:08, mac wrote:
> After just a little more test and polish I plan on calling clj-native
> 1.0. But clj-native is
On 18.03.2010, at 04:50, Praki Prakash wrote:
> As others have mentioned, Haskell is heavy in its use of monads and many
> other algebraic structures. I don't know why the two languages feel so
> different with respect to the level of formalism you need to use them. But,
> Haskell is one of t
56 matches
Mail list logo