antonio357 / learning-clojure

This repo its meant to save exemples and explanations about programming in clojure.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

learning-clojure

This repo its meant to save exemples and explanations about programming in clojure.
Disclaimer: All done in Ubuntu based distribution

summary

  • scalar variables
  • collections
  • keywords and symbols
  • aritmetic operators
  • relational operators
  • logical operators
  • conditional operators
  • functions
  • built-in functions and utils
  • loops
  • scope
  • parallelism

classes

  • first class
    • -> operator
    • # operator
    • % %1 %3
    • comment
    • map objects
    • functions map reduce filter some
    • destructing
    • importação
    • scopo let, restrição de acessos
    • utilizar funções java dentro do código clojure, com noitação de .
    • namespace
    • lazy things
    • syn4tdf-reports
    • issue 6391
    • projeto https://git.synchro.com.br/componentes/syn4tdf-report

setting up clojure enviroment

install brew, vscode and JDK with JAVA_HOME

in a terminal run brew install clojure lein

in vscode install bracket-pair-colorizer-2 and calva to run clojure code statements inside .clj files

paste the config below in ~/.config/Code/User/settings.json to customize bracket colors and stop calva to override vscode keybindings

  // brackets color and selection
  "editor.guides.bracketPairsHorizontal": false,
  "bracket-pair-colorizer-2.showHorizontalScopeLine": false,
  "bracket-pair-colorizer-2.showBracketsInGutter": true,
  "editor.guides.bracketPairs": true,

  // clojure
  "calva.enableJSCompletions": false,
  "calva.fmt.formatAsYouType": false,
  "editor.guides.bracketPairsHorizontal": false,
  "calva.highlight.enableBracketColors": false,
  "calva.highlight.highlightActiveIndent": false,
  "calva.showCalvaSaysOnStart": false,
  "calva.autoOpenJackInTerminal": false,
  "calva.evaluationSendCodeToOutputWindow": true,
  "calva.paredit.defaultKeyMap": "none",
  "calva.paredit.hijackVSCodeDefaults": false,
  "calva.keybindingsEnabled": false, 

paste the config below in ~/.config/Code/User/keybindings.json to enable a calva keybinding to run clojure code in .clj files

{  
  "key": "ctrl+enter",  
  "command": "calva.evaluateSelection",  
  "when": "calva:connected && editorTextFocus && editorLangId == 'clojure'"  
}  

how to quickly test clojure code

in a terminal run lein new my-cloruje-project

open my-cloruje-project with vscode
open command palette and run

then choose

then select uberjar and click in ok

on the right will appear the output.calva-repl tab

click/select on a line of code in any .clj file

then press ctrl + enter keybinding to run the code and check its return on the right after the => symbol

on the output.calva-repl tab will appear
output
code
return

About

This repo its meant to save exemples and explanations about programming in clojure.


Languages

Language:Clojure 100.0%