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 your.macros-for-cljs.ns | |
(:require [sablono.compiler :as sablono-c])) | |
;; Make sablono also walk into other forms: | |
;; if, for, let, do: Already exist | |
(.addMethod @(var sablono-c/compile-form) "when" | |
(fn | |
[[_ bindings & body]] | |
`(when ~bindings ~@(for [x body] (sablono-c/compile-html x))))) |
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
;; Datomic example code | |
(use '[datomic.api :only (db q) :as d]) | |
;; ?answer binds a scalar | |
(q '[:find ?answer :in ?answer] | |
42) | |
;; of course you can bind more than one of anything | |
(q '[:find ?last ?first :in ?last ?first] | |
"Doe" "John") |
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
-module(collector). | |
-behaviour(gen_server). | |
-export([start_link/1, do/2, ended/0]). | |
-export([handle_call/3, handle_cast/2]). | |
-export([init/1, terminate/2, handle_info/2, code_change/3]). | |
%% Client interface |
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
#include <stdio.h> | |
#include <unordered_map> | |
#include <iostream> | |
using namespace std; | |
#define N 1000000 | |
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
load('./cljjs.js') | |
// USING EXISTING PARSER | |
clj.read_string("#queue [1 2 3]") | |
//=> #queue [1 2 3] | |
// REGISTERING NEW PARSER |
NewerOlder