(println "Hello, world!")
- The same in Python,
(defn ws-listener | |
[_request _response ws-map] | |
(proxy [WebSocketAdapter] [] | |
(onWebSocketConnect [^Session ws-session] | |
(proxy-super onWebSocketConnect ws-session) | |
(when-let [f (:on-connect ws-map)] | |
(f ws-session))) | |
(onWebSocketClose [status-code reason] | |
(when-let [f (:on-close ws-map)] | |
(f (.getSession this) status-code reason))) |
package com.github.hindol.clj_fn.core; | |
import clojure.lang.*; | |
import com.microsoft.azure.functions.*; | |
import com.microsoft.azure.functions.annotation.*; | |
public final class Function implements Functional, IType | |
{ | |
public static final Object const__0; | |
;; Let's say, we want a sequence of all the powers of a number. | |
(defn powers | |
([x] (powers x x)) | |
([x p] | |
(cons p (powers x (* x p))))) | |
(powers 2) | |
;; => integer overflow | |
;; This throws an error because we cannot really calculate an infinite sequence. |
(ns com.github.hindol.euler.collections | |
(:import | |
(clojure.lang IPersistentCollection | |
IPersistentSet | |
Seqable))) | |
(deftype Bag [^clojure.lang.IPersistentMap m | |
^long n] | |
IPersistentSet | |
(get [this k] |
;; Prime factorize all numbers in the range [2 100,000] | |
;; Naive, no sieve | |
(def prime-seq | |
(concat | |
[2 3 5 7] | |
(lazy-seq | |
(let [primes-from (fn primes-from | |
[n [f & r]] | |
(if (some #(zero? (rem n %)) |
(ns com.github.hindol.euler | |
(:require | |
[clojure.test :refer [is]] | |
[clojure.tools.trace :refer [trace-ns untrace-ns]]) | |
(:gen-class)) | |
(set! *unchecked-math* true) | |
(set! *warn-on-reflection* true) | |
(defn pentagonal-seq |
;;; gn-mode.el --- A major mode for editing gn files. | |
;; Copyright 2015 The Chromium Authors. All rights reserved. | |
;; Use of this source code is governed by a BSD-style license that can be | |
;; found in the LICENSE file. | |
;; Author: Elliot Glaysher <[email protected]> | |
;; Version: 1.0 | |
;; Created: April 03, 2015 | |
;; Keywords: tools, gn, ninja, chromium |
#!/usr/bin/env bash | |
INPUT_DIR="../50_5_5" | |
OUTPUT_DIR=".." | |
PARAMETERS=( "like-mindedness" "modularity" ) | |
LABELS=( "Like-mindedness" "Modularity (Q)" ) | |
for i in ${!PARAMETERS[*]}; do | |
gnuplot <<- EOF |
# The following should be in `/etc/sudoers`. To edit `/etc/suoders` use the command `sudo visudo` in a terminal. | |
# *Do NOT attempt to modify the file directly* | |
Defaults env_reset | |
Defaults mail_badpass | |
Defaults env_keep+="http_proxy ftp_proxy all_proxy https_proxy no_proxy" # Add this line | |
... |