clojure

18/03/2017 HackTheTower

ryoji@ubuntu:~$ sudo apt-get install clojure1.6
ryoji@ubuntu:~$ clojure
Clojure 1.6.0
user=> (println "Hello, world")
Hello, world
nil

https://www.4clojure.com

http://www.tryclj.com/

try_clojure.png

http://clojurescriptkoans.com/

http://timothypratley.blogspot.co.uk/2017/01/reagent-deep-dive-part-1.html

Leiningen

mkdir ~bin
cd ~bin
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod +x ./lein
./lein
Downloading Leiningen to /home/ryoji/.lein/self-installs/leiningen-2.7.1-standalone.jar now...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   605    0   605    0     0   1013      0 --:--:-- --:--:-- --:--:--  1013
100 14.6M  100 14.6M    0     0  1212k      0  0:00:12  0:00:12 --:--:-- 1963k
Leiningen is a tool for working with Clojure projects.

Several tasks are available:
change              Rewrite project.clj by applying a function.
check               Check syntax and warn on reflection.
classpath           Print the classpath of the current project.
clean               Remove all files from project's target-path.
compile             Compile Clojure source into .class files.
deploy              Build and deploy jar to remote repository.
deps                Download all dependencies.
do                  Higher-order task to perform other tasks in succession.
help                Display a list of tasks or help for a given task.
install             Install the current project to the local repository.
jar                 Package up all the project's files into a jar file.
javac               Compile Java source files.
new                 Generate project scaffolding based on a template.
plugin              DEPRECATED. Please use the :user profile instead.
pom                 Write a pom.xml file to disk for Maven interoperability.
release             Perform :release-tasks.
repl                Start a repl session either with the current project or standalone.
retest              Run only the test namespaces which failed last time around.
run                 Run a -main function with optional command-line arguments.
search              Search remote maven repositories for matching jars.
show-profiles       List all available profiles or display one if given an argument.
test                Run the project's tests.
trampoline          Run a task without nesting the project's JVM inside Leiningen's.
uberjar             Package up the project files and dependencies into a jar file.
update-in           Perform arbitrary transformations on your project map.
upgrade             Upgrade Leiningen to specified version or latest stable.
vcs                 Interact with the version control system.
version             Print version for Leiningen and the current JVM.
with-profile        Apply the given task with the profile(s) specified.

Run `lein help $TASK` for details.

cd
lein
ryoji@ubuntu:~$ lein repl
Retrieving org/clojure/tools.nrepl/0.2.12/tools.nrepl-0.2.12.pom from central
Retrieving org/clojure/pom.contrib/0.1.2/pom.contrib-0.1.2.pom from central
Retrieving clojure-complete/clojure-complete/0.2.4/clojure-complete-0.2.4.pom from clojars
Retrieving org/clojure/clojure/1.8.0/clojure-1.8.0.pom from central
Retrieving org/clojure/tools.nrepl/0.2.12/tools.nrepl-0.2.12.jar from central
Retrieving org/clojure/clojure/1.8.0/clojure-1.8.0.jar from central
Retrieving clojure-complete/clojure-complete/0.2.4/clojure-complete-0.2.4.jar from clojars
nREPL server started on port 41724 on host 127.0.0.1 - nrepl://127.0.0.1:41724
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
OpenJDK 64-Bit Server VM 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> 
http://qiita.com/ka_/items/a3f79b761e25d485f2a9

user=> (defn add [x y] (+ x y))
#'user/add
user=> add(1,2)
#object[user$add 0x33386a37 "user$add@33386a37"]

user=> ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn  user/eval1247 (form-init1219150188545707425.clj:1)


user=> (add[1 2])

ArityException Wrong number of args (1) passed to: user/add  clojure.lang.AFn.throwArity (AFn.java:429)
user=> (add(1,2))

ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn  user/eval1251 (form-init1219150188545707425.clj:1)
user=> (add 1 2)
3
user=> ((fn add-anonymous [x y] (+ x y)) 1 2)
3

Hiccap React.js

(use 'hiccup.core)
https://github.com/weavejester/hiccup

Klipse

http://blog.klipse.tech/clojure/2016/03/17/klipse.html

Regent/atom

https://reagent-project.github.io/

    last modified: 18 March 2017 [ View wiki source Close ]
     
SEARCH DIFFERENCE ATTACHMENT RECENT POST