Clojure is a modern Lisp dialect for the Java Virtual Machine (with versions for the CLR and JavaScript).
0
votes
1answer
5 views
Clojure: How to get the metadata of inner function?
I have this code and would like to get the metadata transform
(defn truncate
[& {:keys [len]}]
(fn ^:transform [value]
(clojure.string/join (take len value))))
Ex: (meta (var ...
0
votes
1answer
14 views
How to convert a list form into a function in clojure
I have a function spec defined like this, and I want to evaluate it into a function object so I can pass around.
(def spec '(foo [n] (* 2 n)))
I can create a macro like this
(defmacro evspec ...
0
votes
0answers
16 views
Clojure + Lemur
I am trying to run some multi step job using lemur+clojure.
I have issue with passing multiple input as argument to clojure+lemur.
As first step for my job I trying to run emr Streaming Job
lemur ...
0
votes
0answers
15 views
Vim syntax: Matching namespace qualified symbols
I'm using vim-clojure-static, a Clojure plugin. I can add my own functions and macros to a syntax group by doing for example:
syntax keyword clojureMacro defsystem
But in Clojure, after one has ...
0
votes
1answer
24 views
How to make this macro work as expected?
(defmacro switch [choices choice] '(do (choices choice)))
(macroexpand-1 '(switch {1 (print 1) 2 (print 2)} (+ 1 1)))
gives: (do (choices choice))
Just to learn macros, I wanted to emulate ...
1
vote
1answer
30 views
How to print time as #inst
It's easy to read a date literal:
(read-string "#inst \"2012\"")
;;; ⇒ #inst "2012-01-01T00:00:00.000-00:00"
How can I output a date as a #inst... literal?
This does not work:
(pr-str ...
2
votes
1answer
47 views
Is there a better way to do that in Clojure?
I have this function to read a file and convert it to a list of two-elements lists:
(def f1 "/usr/example")
(defn read-file [file]
(let [f
(with-open [rdr (clojure.java.io/reader file)]
...
1
vote
1answer
18 views
bug in clojure URL shortener during auto-generation of IDs
I came across a snippet of code in the Clojure Programming and it was buggy. I'm a newbie to Clojure and cant figure out where the bug is in the code.
(ns ring-tutorial.core
(:require ...
1
vote
1answer
22 views
Clojure.logic difference with The Reasoned Schemer
I've been working through The Reasoned Schemer (TRS) using Clojure.logic and paying attention to the differences documented here. I reached frame 24 of Chapter 3, where TRS reports that
(run 5 [x]
...
1
vote
1answer
25 views
Not able to use namespace clojure.data.zip.xml in Clojure
I'm following this article for XML parsing. It has an example code which doesn't work for me when I play out in the REPL:
(require '[clojure.data.zip.xml :as zip-xml])
It throws me the following ...
1
vote
0answers
28 views
parse method in xml throws IllegalArgumentException in Clojure
I'm following this article for parsing XML in clojure. In the REPL, I enter the following things:
(require '[clojure.java.io :as io])
(require '[clojure.xml :as xml])
(require '[clojure.zip :as zip])
...
1
vote
1answer
22 views
Lein Deployment on Clojars and Dependencies
I am working on an application that uses Apache Hbase as its datastore. I coded up a clojure wrapper around some common hbase operations,
https://github.com/mobiusinversion/hbase
and pushed it to ...
3
votes
2answers
58 views
Clojure excel interaction (formulas)
I'm looking for a clojure library that can easily read and write to excel with the following features:
needs to be compatible with .xlsx
reading: needs to be able to evaluate a formula before ...
3
votes
3answers
52 views
how do i get the last last group in a regex expression in clojure
I have a string of data from a data base
[context]=[context desc].[context level].&[data]
I have a regex written to find the data part that looks like this
(.* [.&;^])(?:[^*])([^]]+)
...
3
votes
1answer
48 views
Creating a collection of functions
I have the following function that receives a list of functions:
(defn foo
[fn-list]
(map #(%) fn-list))
I want to pass it instances of this bar function as a parameter.
(defn bar
[x]
...