In F#:
> let f x = x + 2;;
val f : int -> int
> let g x = f x;;
val g : int -> int
> g 10;;
val it : int = 12
> let f x = x + 3;;
val f : int -> int
> g 10;;
val it : int = 12
In Clojure:
1:1 user=> (defn f [x] (+ x 2))
#'user/f
1:2 user=> (defn g [x] (f x))
#'user/g
1:3 user=> (g 10)
12
1:4 user=>…
When and where do you put type annotations in Clojure code? Obviously when performance counts. But are there rules by which you can live of when (only when doing Java Interop?) and where to add them (function definition arguments)?
Form Based Authentication For Websites
Please help us create the definitive resource for this topic. We believe that stackoverflow should not just be a resource for very specific technical questions, but also for general guidelines on how to solve variations on common problems. "Form Based Authentication For Websites" should be a fine topic…
I am reverse engineering some Java code into a class diagram. Now I'm wondering how to model classes that are from a library that I didn't design. If I'm writing them down as classes, I should maybe also know what interfaces they implement, etc, and put that in the diagram. How far do I go with this? Is it better to write them down as…
I regularly listen to the podcasts DotNetRocks and Software Engineering Radio. Lately I have become more interested in Clojure. Are there any podcasts that target more toward the Clojure (more general FP/LISP/dynamic languages) audience?
I know of some single podcast episodes but I'm looking for a podcast I can regularly listen to.
Hi,
I want to release an update for my app.
I'm stuck on how to update the existing core data database which also stores data entered by the user.
All i need to do is update a couple of records and preserve current user data. No changes are made to the model.
Thanks.
I am now reading Foundations of F# by Robert Pickering and parallelly the book in progress 'Real World Functional Programming' by Tomas Petricek.
My question is, what is the added value I would get from buying and reading the following books:
1) Expert F# by Don Syme and others
2) F# for Scientists by John Harrop
Are those books…
I already know how to use the CLLocationManager, so I could do it the hard way, with delegates and all that.
But I'd like to have a convenience method that just gets the current location, once, and blocks until it gets the result.
Hi,
I have a method used to save an image when the user clicks Save.
I use performSelectorInBackground to save the image, the viewcontroller is popped and the previous viewcontroller is shown.
I want the table (on the previousUIViewController) to reload its data when the imagesaving is done.
How can I do this?
The save method is…
What's the best way to create an iPhone application that runs in landscape mode from the start, regardless of the position of the device? Both programmatically and using the Interface Builder.
Clojure is said to be a language that makes multi-thread programming easier.
From the Clojure.org website:
Clojure simplifies multi-threaded
programming in several ways.
Now I'm looking for a non-trivial problem solved in Java and in Clojure so I can compare/contrast their simplicity. Anyone?
This is the PATH variable without sudo:
$ echo 'echo $PATH' | sh
/opt/local/ruby/bin:/usr/bin:/bin
This is the PATH variable with sudo:
$echo 'echo $PATH' | sudo sh
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
As far as I can tell, sudo is supposed to leave PATH untouched. What's going on? How do…
Are the square brackets around arguments in Clojure's defn, defmacro and binding (am I forgetting some?) really creating a vector or is it just a matter of syntax, making the arguments stand out from the rest?
I'm reading Clojure in Action which states:
Clojure uses vectors to denote
function arguments or binding forms.
…
I am running a GWT Web Application project in Eclipse with certain Entities that I make persisent using JDO. Where (on my file system) do these Entities actually get saved if I run the project in development mode from Eclipse (so not on the Google App Engine, but locally)?
Are there ever situations while developing in Clojure when you miss the static type system you have available in languages like Haskell and F#?
Can you give an example of a piece of code when the type system would come in very handy?
In F#:
> let f x = x + 2;;
val f : int -> int
> let g x = f x;;
val g : int -> int
> g 10;;
val it : int = 12
> let f x = x + 3;;
val f : int -> int
> g 10;;
val it : int = 12
In Clojure:
(defn f [x]
(+ x 2))
(defn g [x]
(f x))
(g 10) ;; => 12
(defn f [x]
(+ x 3))
(g 10) ;; => 13
…
Hi,
I have a slight problem. What my application is supose to do, is to watch a folder for any newly copied file with the extention '.XSD' open the file and assign the lines to an array. After that the data from the array should be inserted into a MySQL database, then move the used file to another folder if it's done.
The…
I hear a lot of Emacs users have their init file under git version control and sync the git repository over Dropbox, when they run Emacs on multiple systems.
Why would you use git in this situation exactly?
Usually checking which system you're on and which things to load and set depending on that can happen in one and the…
I heard some rumors on the web that some classic Lisp books are going to be ported to Clojure, but I forgot which.
Which books will be indeed ported to Clojure? Does this involve the complete text or only the code files?
I have the following code from a GWT Project that is part of the onModuleLoad() method (similar to Java's main method, if you don't know GWT):
final TextBox t1 = new TextBox();
final Label lt1 = new Label();
t1.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(KeyUpEvent event) {
// TODO…
I'm currently facing a problem which I can not resolve and I really don't know what to do anymore.
When I'm trying to start the service I receive the message: "The service is started but again also stopped, this because that some of the services will stop if they have nothing to do, for example the performance logs and the…
I just upgraded my slime using elpa in Emacs. But I wonder if things are like they should be now, because when I removed the old version using elpa, it complained it could not remove a certain folder. So, when I start up Emacs (I know, I shouldn't have closed it), how I can see which slime version actually gets used? Is…