planck

Planck ClojureScript REPL
mathpunk 2016-06-16T03:05:52.000007Z

I’m working on understanding the difference between planck at the repl and planck for running scripts.

mathpunk 2016-06-16T03:06:10.000008Z

Here is a two-liner that works at the repl but not when run with planck hi.cljs:

mathpunk 2016-06-16T03:07:18.000010Z

What surprises me is, running it with planck gives me errors like, WARNING: Use of undeclared Var cljs.user/require at line 1

mathpunk 2016-06-16T03:07:34.000011Z

yet, when I’m at the repl, I’m in the ns cljs.user and require is a thing that it knows about.

mfikes 2016-06-16T03:08:41.000012Z

@mathpunk: require is a REPL special. It is not part of the ClojureScript language. But, you can get what you want by instead employing an ns form.

mfikes 2016-06-16T03:09:08.000013Z

(ns foo.core
  (:require [clojure.string :refer [split]]))

mfikes 2016-06-16T03:11:14.000014Z

@mathpunk: You’ll also likely want to wrap your split call in println

mathpunk 2016-06-16T03:11:52.000015Z

Right you are.

mathpunk 2016-06-16T03:16:04.000016Z

great, and I think that clears up a problem I had where I couldn’t tell whether to try and get spit/slurp out of planck.core or http://planck.io — now I see I must have been abusing require again

mfikes 2016-06-16T03:18:18.000017Z

@mathpunk: Either namespace is OK for those functions. They used to be in <http://planck.io|planck.io> but were moved to planck.core to make them consistent with clojure.core. If you do (source <http://planck.io/spit|planck.io/spit>) you’ll see what I mean.

mfikes 2016-06-16T13:42:44.000019Z

If you are interested in contributing to the Linux / C port, a list of TODOs is being maintained here: https://github.com/mfikes/planck/wiki/Planck-C-TODOs