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
[settings] | |
line_length=88 | |
multi_line_output=3 | |
include_trailing_comma=True | |
use_parentheses=True |
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
#!/bin/python3 | |
import sys | |
# Import n lines from a file | |
t = int(input().strip()) | |
for a0 in range(t): | |
n = int(input().strip()) |
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
(use '[clojure.string :only (split triml)]) | |
( | |
let [ | |
n_t (read-line) | |
n (Integer/parseInt n_t) | |
] | |
( | |
let [ |
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
(let [in (slurp *in*) | |
lines (clojure.string/split in #"\s")] | |
(println lines)) |
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
https://circleci.com/gh/:owner/:repo.svg?style=shield&circle-token= |
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
base_data_sources = make_dict({ | |
'business': BusinessDataSource(clientUS), | |
'money': USMoneyDataSource(clientUS), | |
'technology': TechnologyDataSource(clientUS), | |
'sport': SportUSDataSource(clientUS), | |
'comment': CommentIsFreeDataSource(clientUS), | |
'culture': CultureDataSource(clientUS), | |
'top_stories': TopStoriesDataSource(clientUS), | |
'video': VideoDataSource(clientUS), | |
}) |
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
(defn all-nums? [cs] | |
(let [i (first cs) r (rest cs)] | |
(if (and i (Character/isDigit i)) | |
(if (empty? r) true (recur r)) | |
false))) | |
(all-nums? (seq "1234")) ;; true | |
(all-nums? (seq "12a4")) ;; false | |
(all-nums? (seq "")) ;; false |
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
(defn balanced? | |
([s] (apply balanced? 0 (seq s))) | |
([current-count x & xs] | |
(let [new-count | |
(cond | |
(= x \() (inc current-count) | |
(= x \)) (dec current-count) | |
:else current-count)] |
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 euroclojure.logic | |
(:use [clojure.core.logic])) | |
(defn query [] | |
(run 1 [q] | |
(membero q [1 2 3]))) | |
;; 1 | |
(defn query-all [] |
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
(def example-story-events [ | |
{ | |
:title "Funding cut again" | |
:tags [:science] | |
:author ["Chuck Newton"] | |
} | |
{ | |
:tags [:politics] | |
} | |
{ |
NewerOlder