clojure

When you type "hello, world" in Clojure REPL, why does it say 'nil'?

I typed this into Clojure REPL (using the enclojure Netbeans plugin): user=> "hello, world" "hello, world" nil What's the nil about? ...

I get lots of warning and errors when installing Clojure in Emacs

I used the EPL package manager and installed the clojure -mode.el v1.5 I get these errors while installing the major mode In clojure-mode: clojure-mode.el:174:34:Warning: reference to free variable `paredit-mode' clojure-mode.el:174:51:Warning: reference to free variable `paredit-version' In clojure-font-lock-extend-region-def: cloj...

Sliding window over seq

In Clojure, what would be the nicest way to have a sliding window over a (finite, not too large) seq? Should I just use drop and take and keep track of the current index or is there a nicer way I'm missing? ...

enabling UTF-8 encoding for clojure source files.

Hi all, I'm working on a project which involves maven, java and clojure. The problem I'm facing is this, I have some UTF-8 chars in my clojure source files because of which my source code is not interpreted correctly by the java compiler, I kinda got it working by setting the environment variable JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF...

Parsing wiki markup using a state machine

I would like to parse a simple grammar such as wiki markup using state machines. I have never written or played with one. I would like to lean how to implement a simple one. I am thinking of using Clojure for this. My question is can you point me to some good tutorials that are for complete newbies on this topic such as my self? ...

Clojure Parse String

I have the following string layout: default title: Envy Labs What i am trying to do is create map from it layout->default title->"envy labs" Is this possible to do using sequence functions or do i have to loop through each line? Trying to get a regex to work with and failing using. (apply hash-map (re-split #": " meta-info))...

In Clojure, Is it idiomatically correct to use require ... as rather than use... in the ns macro

I'm writing a clojure application which is growing from small to medium sized. We're currently importing modules using (ns foo (:use bar)) (fn-in-bar) but I think that switching to (ns foo (:require [bar :as b])) (b/fn-in-bar) would help with clarity and code comprehension. Is this a good way to do things? Is there a better w...

What very large functional language projects are freely available?

To begin with, I'm virtually sold on the 'whole functional language thing'. It occurs to me that, for years, I've been doing mostly functional-style programming in Java. But I'm a bit loss as to how to start a large functional app. I'd like to see the source and build structure of a large project (OSS or whatever) so that I can see ho...

Clojure: How to generate a 'trie'?

Given the following... (def inTree '((1 2) (1 2 3) (1 2 4 5 9) (1 2 4 10 15) (1 2 4 20 25))) How would you transform it to this trie? (def outTrie '(1 (2 () (3 ()) (4 (5 (9 ())) (10 (15 ())) (20 (25 ())))))) ...

git pull - changes from Java

I have a web app that serves some markdown files. What i would like to do is when there is a push to github i would ping my application using a webhook and i want my application to run git pull to retrieve changes. I am sure that no application specific files will change only markdown files in a specific folder. Does any one done somet...

Clojure web application - where do I start?

So lately I've been looking into Clojure, and I love the language. I would like to see if I can make a small web application in it, just to challenge myself. However, I have absolutely no experience setting up any Java-related web applications. In fact, I don't really have much experience with Java at all. Where do I start? I have lots o...

Stuck with JVM, Sick of Java... Where to go?

For the next 3 years I will have to work with the JVM (project requirement) using a very specific third party API. They want Java but I've been given leeway to move away from Java. I was hoping we could move back to the .NET framework so I could develop code in F#, being absolutely in love with OCaml. .NET development has been struck ...

How do I access an SQLite database in Clojure?

(ns db-example (:use [clojure.contrib.sql :only (with-connection with-query-results)] ) (:import (java.sql DriverManager))) ;; need this to load the sqlite3 driver (as a side effect of evaluating the expression) (Class/forName "org.sqlite.JDBC") (def +db-path+ "...") (def +db-specs+ {:classname "org.sqlite.JDBC", ...

Clojure Emacs etags

I want to index clojure files, using etags so that i can use Emacs's tag functionality. But etags does not recognize clojure functions. is it possible to extend etags to include clojure definitions? ...

Can Java reflection in Clojure be memoized?

Type-hints can make a huge improvement on execution time where reflection occurs many times. My understanding of type-hints is that it just allows the compiler to cache a reflection lookup. Can that caching occur dynamically? Or is there some reason this would be bad/impossible? ...

From Static Typing to Dynamic Typing

I have always worked on staticly typed languages (c/c++,java). For the poast months i have been playing with clojure and i really like it. One thing i am worried about is, say that i have a windows that takes 3 modules as arguments and along the way requirements change and i need to pass another module to the function. I just change the ...

On Performance and Java Interoperability: Clojure vs. Scala

I have already read various accounts of Clojure vs. Scala and while I realize that both have their place. There are a few considerations that I haven't acquired a complete explanation on when it comes to comparing both Clojure with Scala: 1.) Which of the two languages is generally faster? I realize that this will vary from one langua...

How can I send a file in a POST request?

Hello, there. I'm building a clojure API to my website that is basically a wrapper around the original web API. One of the features that I'm not being able to implement is file sending via POST requests, basically what I would do in shell with curl -F foo=bar [email protected] foobar.com. I'm using clojure-http-client, and initially tried ...

How to remove multiple items from a list?

Hi, I have a list [2 3 5] which I want to use to remove items from another list like [1 2 3 4 5], so that I get [1 4]. thanks ...

Clojure infinite loop

What is the idiomatic way to create an infinite loop? while(true){ calc(); } I want to call the calc function forever. Only one function is called over and over again. EDIT: One other thing I forgot to mention is that calc has side effects. It does some calculations and modifies a byte array. ...