-
-
Save kindlychung/efa8ae27afb7386fb163 to your computer and use it in GitHub Desktop.
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
(defproject testclojure "0.1.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:url "http://example.com/FIXME" | |
:license {:name "Eclipse Public License" | |
:url "http://www.eclipse.org/legal/epl-v10.html"} | |
:dependencies [[org.clojure/clojure "1.6.0"] | |
[org.clojure/core.typed "0.2.84"] | |
[alembic "0.3.2"]] | |
:main ^:skip-aot testclojure.core | |
:target-path "target/%s" | |
:profiles {:uberjar {:aot :all}}) |
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 testclojure.core | |
(:gen-class) | |
(:require [clojure.core.typed :refer [ann AnyInteger check-ns]]) | |
(:import [clojure.lang ISeq])) | |
(ann ^:no-check clojure.core/mod [AnyInteger AnyInteger -> AnyInteger]) | |
(ann div-by [AnyInteger AnyInteger -> Boolean]) | |
(defn div-by [x y] | |
(== (mod y x) 0)) | |
(ann div-by-3-or-5 [AnyInteger -> Boolean]) | |
(defn div-by-3-or-5 [x] | |
(or (div-by 3 x) (div-by 5 x))) | |
(ann euler1 [AnyInteger -> AnyInteger]) | |
(defn euler1 [n] | |
(reduce + (filter div-by-3-or-5 (range n)))) | |
(ann -main [-> nil] ) | |
(defn -main [] | |
(prn (euler1 "a"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment