<b>osdir.com</b>/ml/java.clojure.user/2008-03/msg001. Website Performance Monitoring On Mar 26, 5:55 pm, Robert Feldt <robert.fe...
@xxxxxxxxx> wrote: > To better grok Clojure and its idioms I'm trying to translate some > Lisp macros to Clojure. This one is problematic though: > > (defmacro combine-results (&body forms) > (with-gensyms (result) > `(let ((,result t)) > ,@(loop for f in forms collect `(unless ,f (setf ,result nil))) > ,result))) > > I understand how to handle the gensym issues in Clojure but the > explicit setting of the result var does not feel like what one would > do in idiomatic Clojure.
Follow Up to "Bug or Feature" The last few days I have run across several pointers to Scala and Clojure, two dynamic languages that support functional programming style on the JVM.
Whenever I run into a new programming language, I start thinking about how much time I should put into learning and using it. If it is a functional language, I think a bit harder, and naturally wonder whether I should consider migrating my Programming Languages course from the venerable but now 30-plus-years-old Scheme to the new language. My time is finite and in scarce supply, so I have to choose wisely. If I try to chase every language thread that pops up everywhere, I'll end up completely lost and making no progress on anything important. Choosing which threads to follow requires good professional judgment and, frankly, a lot of luck. Scala and Clojure have been on my radar for a while and, like books that receive multiple recommendations, are nearing critical mass for a deeper look. Lam is wise to think consciously of this now. Dynamic Scope as Bug or Feature. The last few days I have run across several pointers to Scala and Clojure, two dynamic languages that support functional programming style on the JVM.
Whenever I run into a new programming language, I start thinking about how much time I should put into learning and using it. If it is a functional language, I think a bit harder, and naturally wonder whether I should consider migrating my Programming Languages course from the venerable but now 30-plus-years-old Scheme to the new language. My time is finite and in scarce supply, so I have to choose wisely. If I try to chase every language thread that pops up everywhere, I'll end up completely lost and making no progress on anything important.
Choosing which threads to follow requires good professional judgment and, frankly, a lot of luck. Scala and Clojure have been on my radar for a while and, like books that receive multiple recommendations, are nearing critical mass for a deeper look. Lam is wise to think consciously of this now. Ruby Blocks 101. January 20, 2006 at 1:00 am One of the difficulties you might have with jumping into Ruby on Rails is that you need to learn the Ruby language (yes, you do ;) ). And if you come from the PHP background as I am, the single weirdest thing in Ruby would be the notion of blocks. I have never seen the blocks in any other language. The concept seems beautiful, but completely unrelated to anything I know about programming. The concept of blocks is logical and intuitive, but most likely very different from the way you experienced programming. As blocks are the basic structures of Ruby, chances are you have already seen them and did not really understand what was going on.
So let’s start with an easy example. Inder Development » More Named Scope Awesomeness. I’m back writing about named scopes and still including silly scope visual pun pictures.
Named Scopes and Find Methods First off, I wanted to mention something that I haven’t seen talked about much in other discussions of named scopes — integrating your names scopes with traditional ActiveRecord finder methods. This is possible, but only in a limited kind of way. If you have a chain of named scopes, you can add a regular finder method at the end of the chain, and only at the end of the chain.
In other words, you can augment the contains scope introduced in last week’s post with a regular find method like this: >> Person.contains(:first_name, "el").find_all_by_last_name("Smith") Person Load (0.000763) SELECT * FROM `people` WHERE (`people`. (SQL statement in the console via a little .irbrc hack that maps the Rails logger to standard out.) The find method needs to be last in the chain: Named Scopes and Advanced Search. Looking for a hacker's framework?
Anonymous Scopes. The scoped method allows you to generate named scopes on the fly. In this episode I show how to use anonymous scopes to improve the conditional logic which was used in the previous episode on advanced search form. Download: mp4Full Size H.264 Video (16.2 MB)m4vSmaller H.264 Video (10 MB)webmFull Size VP8 Video (27 MB)ogvFull Size Theora Video (24.1 MB) Activerecord. Block-scope. I've recently been puzzled by what I considered to be a design error in Javascript. Then I realized that Python behaved the same. Finally, I realized that people were aware of the issue: these languages don't have block-scope, the only scoping construct is the function.
If you declare a variable inside a loop, the same instance will be used for every iteration, and it will be visible after the end of the loop.