Set up a directory with project.clj
below.
Create namespaces in src/clj/server/core.clj
and src/cljs/client/core.cljs
Create an index.html as below in resource/public/
.
Start two REPLs with ' "
(jack-in-cljs)
Then in CLJS repl:
//: Playground - noun: a place where people can play | |
struct Room: IntegerLiteralConvertible { | |
let number: Int | |
init(integerLiteral value: Int) { | |
number = value | |
} | |
} |
Inspired from https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch5.html | |
// Curries by partially applying 1 out of 2 arguments | |
func curry<A, B, C>(fn: (A, B) -> C, _ val: A) -> (B -> C) { | |
return { b in | |
fn(val, b) | |
} | |
} | |
// "compose" operator |
// This shows a bug in Swift 2.2 (and 2.3) where `self` gets released in a recursive call | |
extension Dictionary { | |
mutating func append(_ other: [String: AnyObject]) { | |
// 2. After the call 1. below, `other` would have been dealloced in the recursive call :( | |
for (key, value) in other { | |
if let otherSubDict = value as? [String: AnyObject], | |
var selfSubDict = self[key] as? AnyObject as? [String: AnyObject] | |
{ | |
// 1. Make a recursive call |
module Main where | |
import Control.Monad | |
import Data.Char (toLower) | |
import Data.Maybe (isJust, isNothing, fromMaybe) | |
import Data.List (intersperse) | |
import System.Exit (exitSuccess) | |
import System.Random (randomRIO) | |
data Puzzle = Puzzle String [Maybe Char] String |
border: no | |
license: gpl-3.0 |
border: no | |
license: mit | |
height: 640 |
border: no | |
license: mit | |
height: 650 |
;; -*- mode: emacs-lisp -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
(defun dotspacemacs/layers () | |
"Configuration Layers declaration. | |
You should not put any user code in this function besides modifying the variable | |
values." | |
(setq-default | |
;; Base distribution to use. This is a layer contained in the directory |
;; -*- mode: emacs-lisp -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
(defun dotspacemacs/layers () | |
"Configuration Layers declaration. | |
You should not put any user code in this function besides modifying the variable | |
values." | |
(setq-default | |
;; Base distribution to use. This is a layer contained in the directory |
Set up a directory with project.clj
below.
Create namespaces in src/clj/server/core.clj
and src/cljs/client/core.cljs
Create an index.html as below in resource/public/
.
Start two REPLs with ' "
(jack-in-cljs)
Then in CLJS repl: