This file contains 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
(import '(java.nio ByteBuffer) | |
'(java.net InetSocketAddress) | |
'(java.util.concurrent LinkedBlockingQueue) | |
'(java.nio.channels SelectionKey | |
SocketChannel | |
SelectableChannel | |
ServerSocketChannel | |
Selector) | |
'(java.io Closeable) | |
'(clojure.lang PersistentQueue) |
This file contains 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
;; clj -J-Xmx32m -Sdeps '{:deps {org.jgroups/jgroups {:mvn/version "4.0.12.Final"}}}' | |
(defn server [] | |
(let [channel (org.jgroups.JChannel.) | |
_ (.connect channel "clojure-eval") | |
_ (.setReceiver | |
channel | |
(proxy [org.jgroups.ReceiverAdapter] [] | |
(receive [msg-batch] | |
(doseq [msg (.array msg-batch) |
This file contains 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
user=> | |
(as-> clojure.lang.RT % | |
(.getDeclaredField % "checkSpecAsserts") | |
(doto % (.setAccessible true)) | |
(.get % nil) | |
(doto % prn) | |
(if % :a :b)) | |
false | |
:a | |
user=> |
This file contains 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 deployer | |
(:require [clojure.tools.deps.alpha :as deps] | |
[clojure.tools.deps.alpha.reader :as reader] | |
[clojure.java.io :as io] | |
[clojure.string :as string]) | |
(:import (java.security MessageDigest) | |
(com.jcraft.jsch JSch) | |
(java.net URI))) | |
(def hex-alphabet (vec "0123456789ABCDEF")) |
This file contains 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
(defn inc-more [nums] | |
(if (first nums) | |
(cons (inc (first nums)) | |
(inc-more (rest nums))) | |
(list))) | |
(inc-more [1 2]) | |
(if (first [1 2]) | |
(cons (inc (first [1 2])) |
This file contains 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
2018:Jun:01:23:25:15< hiredman> the tail is the same in clojure and in scheme, but in scheme because tail calls look no | |
different from regular calls, and most of the time when testing you won't be using inputs large enough to exhaust your stack, you can easily be mistaken about when and where tco is happening | |
2018:Jun:01:23:26:03< hiredman> that function is not tail recursive, so no tco | |
2018:Jun:01:23:27:48< jaawerth> jjman: to clarify, for that to be a tail call, the add1* would have to wrap the other stuff rather than the other way around | |
2018:Jun:01:23:27:57< jjman> so how does racket does it if it is no tco? it let you grows your stack to all your available memory? | |
2018:Jun:01:23:28:11< hiredman> or until you hit some limit | |
2018:Jun:01:23:28:42< hiredman> I wouldn't be surprised if dr racket had some fancy gizmo to hilight non-tail recursive calls | |
2018:Jun:01:23:29:23< loli> racket has proper tail calls | |
2018:Jun:01:23:29:40< hiredman> no one said it didn't | |
2018:Jun:01:23:29:41< loli> often one builds a c |
This file contains 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
(defn optionFourWorkOut [] | |
(println "Enter user name") | |
(let [use-input (read-line) | |
user-name-id (first | |
(for [x (range @customer-size) | |
:while (= (compare user-input (get (get customer-list x) 1)) 0)] | |
(get (get customer-list x) 0))) | |
user-product-id-and-quantity (vec (for [y (range @sales-size) | |
:while (= (compare user-name-id (get (get sales-list y) 1)) 0)] |
This file contains 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
(define (add1* l) | |
(let ((x (empty? l))) | |
(if x | |
'() | |
(let ((m (first l)) | |
(y (add1 m)) | |
(n (rest l)) | |
(z (add1* n))) | |
(cons y z))))) |
This file contains 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
#!/bin/bash | |
#_ ( | |
true;exec java -jar /home/kevin/.m2/repository/org/clojure/clojure/1.7.0/clojure-1.7.0.jar $0 | |
) | |
(let [pom-uber-jar (str "http://thelibraryofcongress.s3.amazonaws.com/" | |
"pomegranate-0.3.1-SNAPSHOT-jar-with-dependencies.jar")] | |
(.addURL @clojure.lang.Compiler/LOADER (java.net.URL. pom-uber-jar)) | |
(require '[cemerick.pomegranate :as pom]) |
This file contains 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
∵ dallben /tmp ∴ git clone ~/src/alacritty/ | |
git clone ~/src/alacritty/ | |
Cloning into 'alacritty'... | |
done. | |
∵ dallben /tmp ∴ cd alacritty/ | |
cd alacritty/ | |
∵ dallben /tmp/alacritty ∴ git log --oneline | head -10 | |
git log --oneline | head -10 | |
03f9e0c Add install instructions via cargo --git | |
dddf664 Add info about default configuration for macOS |