This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:deps {org.apache.logging.log4j/log4j-api {:mvn/version "2.17.2"} | |
org.apache.logging.log4j/log4j-core {:mvn/version "2.17.2"} | |
org.apache.logging.log4j/log4j-layout-template-json {:mvn/version "2.17.2"} | |
org.apache.logging.log4j/log4j-slf4j18-impl {:mvn/version "2.17.2"}}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns spreads | |
(:use zeder)) | |
(def legal-cards | |
[:🂡 :🂱 :🃁 :🃑 | |
:🂢 :🂲 :🃂 :🃒 | |
:🂣 :🂳 :🃃 :🃓 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns overtone-tutorial.mary) | |
(use 'overtone.core) | |
(boot-external-server) | |
(definst saw-wave [freq 440 attack 0.01 sustain 0.4 release 0.1 vol 0.4] | |
(* (env-gen (lin-env attack sustain release) 1 1 0 1 FREE) | |
(saw freq) | |
vol)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Datomic example code | |
;; demonstrates various update scenarios, using a news database | |
;; that contains stories, users, and upvotes | |
;; grab an in memory database | |
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://foo") | |
(d/create-database uri) | |
(def conn (d/connect uri)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns tetris.core | |
(:import (java.awt Color Dimension BorderLayout) | |
(javax.swing JPanel JFrame JOptionPane JButton JLabel) | |
(java.awt.event KeyListener)) | |
(:use clojure.contrib.import-static deflayout.core | |
clojure.contrib.swing-utils) | |
(:gen-class)) | |
(import-static java.awt.event.KeyEvent VK_LEFT VK_RIGHT VK_DOWN VK_UP VK_SPACE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; FizzBuzz, the fib of pattern matching | |
;; with https://github.com/clojure/core.match | |
(require '[clojure.core.match :refer [match]]) | |
(doseq [n (range 1 101)] | |
(println (match [(mod n 3) (mod n 5)] | |
[0 0] "FizzBuzz" | |
[0 _] "Fizz" | |
[_ 0] "Buzz" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/$ lein new ring-on-heroku | |
Created new project in: /home/jim/Development/ring-on-heroku | |
~/$ cd ring-on-heroku | |
~/ring-on-heroku$ echo 'web: lein run -m ring-on-heroku.core' > Procfile | |
~/ring-on-heroku$ cat > src/ring_on_heroku/core.clj | |
(ns ring-on-heroku.core | |
(:use ring.util.response | |
ring.adapter.jetty)) | |
(defn app [req] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; The New Year in Snowflakes | |
; A Clojure doodle by Chouser | |
(import '(java.awt Color Graphics Frame RenderingHints)) | |
(defonce draw-agent (agent nil)) | |
(defonce halt (atom false)) | |
(defmacro ui-thread [& body] | |
`(javax.swing.SwingUtilities/invokeAndWait (fn [] ~@body))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Andrew Yourtchenko - Programming Challange from Erann Gat: | |
-- http://www.flownet.com/ron/papers/lisp-java/ | |
-- Given a list of words and a list of phone numbers, find all the ways that | |
-- each phone number can be expressed as a list of words. | |
-- No batteries included. We have to define our own split() function. | |
function string:split(sep) | |
local sep, fields = sep or ":", {} | |
local pattern = string.format("([^%s]+)", sep) | |
self:gsub(pattern, function(c) fields[#fields+1] = c end) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ Example: | |
sa = StringAccessor 'hello' | |
for c in sa:iter() do | |
print(c) | |
end | |
print(sa[1],sa[3]) | |
print('end',sa[-1]) | |
--]] |
NewerOlder