martes, 16 de marzo de 2021

Corre Clojure en .net con ClojureCLR


Supongamos que queremos programar en .net y con Clojure. Y se puede! con ClojureCLR. 

Primero debemos instalarlo, utilizando una terminal con el siguiente comando: 

dotnet tool install --global --version 1.10.0-beta1 Clojure.Main

Hoy estoy en powershell, sería algo así  : 

PS C:\dotnet> dotnet tool install --global --version 1.10.0-beta1 Clojure.Main                                          

You can invoke the tool using the following command: Clojure.Main

Tool 'clojure.main' (version '1.10.0-beta1') was successfully installed.


Y luego, escribimos  Clojure.Main en la terminal y podemos acceder al RELP : 


PS C:\dotnet> Clojure.Main

Clojure 1.10.0-beta1

user=> (defn mayor [L]

  (cond

        (empty? (rest L)) (first L)

        (> (first L) (mayor (rest L))) (first L)

        :else (mayor (rest L))

  )

)

#'user/mayor

user=> (mayor '(1 2 3 50 40))

50


Dejo link :  https://github.com/clojure/clojure-clr


No hay comentarios.:

Publicar un comentario