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
user=> (time (nbody/main 100000)) ;;one above | |
(time (nbody/main 100000)) | |
-0.16907516382852444 | |
-0.16907985939166476 | |
"Elapsed time: 2124.75375 msecs" | |
nil | |
user=> (time (main 100000)) ;;; nbody_v2 | |
(time (main 100000)) | |
-0.16907516382852444 |
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
(defmap hsv-color-fractal | |
(let [val % | |
z (.xy val) | |
n (.z val) | |
normalized-count (/ (- n (log2 (log2 (sqrt (+ (* (.x z) (.x z)) (* (.y z) (.y z))))))) | |
(float max-iterations)) | |
h (* 360.0 normalized-count) | |
s 0.8 | |
v 1.0 | |
h_v (floor (/ h 60.0)) |
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
(defmap rgb-color-fractal | |
(let [val % | |
z (.xy val) | |
n (.z val) | |
normalized-count (/ (- n (log2 (log2 (sqrt (+ (* (.x z) (.x z)) (* (.y z) (.y z))))))) | |
(float max-iterations))] | |
(? (< 4.0 (dot z z)) | |
(color3 normalized-count normalized-count (mix 0.2 1.0 normalized-count)) | |
(color3 0.0 0.0 0.0)))) |
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
(defmap rgb-color-fractal | |
(let [val % | |
z (.xy val) | |
n (.z val) | |
normalized-count (/ (- n (log2 (log2 (sqrt (+ (* (.x z) (.x z)) (* (.y z) (.y z))))))) | |
(float max-iterations))] | |
(? (< 4.0 (dot z z)) | |
(color3 normalized-count normalized-count (mix 0.2 1.0 normalized-count)) | |
(color3 0.0 0.0 0.0)))) |
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 mouse-click [[x y] state] | |
(let [ul (:upper-left state) | |
lr (:lower-right state) | |
coord (map / [x y] (:dim state))] | |
(update-bounds | |
(assoc state | |
:offset (map + ul (map * coord (map - lr ul))))))) | |
(defn key-press [key s] | |
(if-let [dispatch-fn ({:Z (fn [state] |
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
(defmodule resource4 | |
(author '[email protected]) | |
(export (out 1))) | |
(include-file "/home/jon/clyawjure/yaws-1.85/include/yaws_api.lfe") | |
(defun out (arg) | |
(let* ((url (: yaws_api request_url arg)) | |
(method (http_request-method (arg-req arg))) | |
(path (: string tokens (url-path url) '"/"))) |
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
If you look at test_macro.lfe | |
(defmacro let@ | |
(((vb . vbs) . b) `(let (,vb) (let@ ,vbs . ,b))) | |
((() . b) `(begin . ,b))) | |
(defsyntax let& | |
([(vb . vbs) . b] [let (vb) (let& vbs . b)]) | |
([() . b] [begin . b])) |
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
(defmethod emit-special 'aget! [type [set! var idx]] | |
(str (emit var) "[" (emit idx) "]")) |
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
(defmodule imp (export (bar 0))) | |
(eval-when-compile | |
(defun import-function-1 (module function) | |
;(: io format '"~p~p~n" (list module function)) | |
(let ((mod-fun (list_to_atom | |
(: lists concat (list module '":" function))))) | |
; (: io format '"~p~n" (list mod-fun)) |
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
;;Jonathan Smith 2010 | |
;;inspired by esessoms clj-interface | |
;;http://github.com/esessoms/clj-interface | |
(ns libs.erlang (:import | |
[com.ericsson.otp.erlang | |
OtpErlangAtom | |
OtpErlangBinary | |
OtpErlangBoolean | |
OtpErlangChar |
OlderNewer