Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using String Interpolation macro in Clojure (<<)

Just getting started with clojure. I'm using leiningen and can't figure out why my importing of the << macro doesn't seem to be working

project.clj

(defproject myapp "0.1"
  :description "Clojure learning sandbox"
  :main myapp.core
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [org.clojure/core.incubator "0.1.2" ]])

core.clj

(ns clojure-shuffle
  (:require [clojure.core.incubator :refer [<<]]))

(defn -main [& args]
  (println (<< "The sum is: ~(reduce + (map read-string args))")))

and when i do a lein run 3 7 2 I expect

The sum is: 12

However I get this (followed by a large stacktrace):

 Exception in thread "main" java.lang.IllegalAccessError: << does not exist
like image 920
jondavidjohn Avatar asked Nov 23 '12 17:11

jondavidjohn


1 Answers

Perhaps you need to use the clojure.core.strint namespace?

like image 146
Scott Avatar answered Nov 09 '22 17:11

Scott