This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-06
Channels
- # beginners (137)
- # cider (60)
- # cljs-dev (52)
- # cljsrn (5)
- # clojars (15)
- # clojure (156)
- # clojure-brasil (1)
- # clojure-dev (7)
- # clojure-italy (13)
- # clojure-serbia (2)
- # clojure-spec (12)
- # clojure-uk (76)
- # clojurescript (129)
- # core-async (27)
- # core-typed (1)
- # cursive (3)
- # datomic (105)
- # devcards (39)
- # emacs (10)
- # figwheel (1)
- # fulcro (68)
- # graphql (6)
- # juxt (3)
- # klipse (85)
- # lein-figwheel (47)
- # leiningen (3)
- # midje (1)
- # mount (26)
- # off-topic (71)
- # om (4)
- # overtone (4)
- # parinfer (3)
- # pedestal (4)
- # portkey (37)
- # re-frame (37)
- # reagent (13)
- # reitit (3)
- # ring (1)
- # rum (5)
- # shadow-cljs (191)
- # spacemacs (35)
- # specter (26)
- # tools-deps (45)
- # vim (20)
@whilo what do you want to achieve exactly?
Anglican uses a continuation passing style transform to compile probabilistic programs (special forms it defines as a DSL) into Clojure. This happens at macro-expansion time.
I would like to render these Gorilla sheets with Klipse into interactive worksheets for the Browser (at least for examples where the inference is not too compute heavy).
I have managed to get the macro-expansion work in a normal ClojureScript compilation, but I am trying to figure out right now how to do it in self-hosted cljs and in particular in klipse.
I have found https://markbastian.github.io/posts-output/2017-07-10-polymacro/ and think this is pretty close to what I would love to have: https://markbastian.github.io/posts-output/2017-07-10-polymacro/
In self hosted cljs, there is a special syntax for macro definition and usage. Take a look here for example http://blog.klipse.tech/clojure/2016/05/01/macro-tutorial-1.html
1. The namespace must end with $macros 2. You must call the macro by its fully qualified name
Thats when you need to define your own macro
Is that your case @whilo?
Ideally I would like to make the normal Anglican Clojure/Script macro namespaces just loadable in klipse. I have managed to get some basic macros working.
I am atm. also using ns-publics from cljs.core in one of them, which causes a problem, but I might be able to AOT expand these expressions somehow.
So I think I need to support load-fn for these macro namespaces in the klipse evaluator?
The external loading concept for github won't work for me, because the code is currently not public (not to my choice). I would prefer to somehow inject the anglican namespaces directly from the figwheel klipse REPL, so I can first get some integration working before I factorize Anglican.
Is there a way a to make namespaces of the host available? I see klipse.lang.clojure.bundled-namespaces
@whilo What do you mean by: 1. the code is not public 2. inject the anglican namespaces directly from figwheel Klipse REPL
2. i would like to make (:require [anglican.runtime :refer [...]]) work in my klipse repo first
maybe the external loading is ok though. but going through all the indirections is harder to understand in the beginning
@whilo Can you share a webpage/jsfiddle that shows your work in progress?
i don't have something reasonable to present in this direction. i have just got simple macro-expansions to work for some anglican macros
i am just wondering how do i load a full library into klipse including runtime macro-expansion
if there is some example for this, i will try to first follow it before i come with more questions
Have you tried something like this? @whilo http://app.klipse.tech/?cljs_in=(ns%20my.m%24macros)%0A(defmacro%20foo%20%5Bx%5D%20%60(if%20~x%20~x%20false))%0A%0A(macroexpand%20'(my.m%2Ffoo%201))%0A
ideally i would like to load anglican cljs functions as well, but i realized that they interleave with the macros
wait a minute
@whilo what external-libs are you providing to Klipse in order to load core.matrix
?
with the original idea of setting up eval so that it can access these "hosted" functions directly
Are you running Klipse locally?
Oh! I see
we have a bunch of gorilla worksheets that i would emit into a klipse style worksheet, if everything goes as planned
@whilo Plotly plotting should not be an issue I’m still trying to understand exactly what is you issue with macro-expansion
how would i load anglican properly, assuming that i port its macros to properly named namespaces?
i have a WIP version that works with normal cljs (the released Anglican only works in Clojure)
Have you taken a look at macrovich?
It simplifies a lot the write of self-host compatible macros
happy to help.
Let me know when you need further help
are there some standard formats or environments for worksheet style documents with klipse?
@whilo can you please be more specific
like https://markbastian.github.io/posts-output/2017-07-10-polymacro/ but also with plotting maybe(?)
I’d love to have some contribute to Klipse and make it like jupyter client side
@whilo What do you mean by standard formats?
whether there is something in this direction already that people tend to use to build klipse documents (beyond plain HTML)
I use markdown for my blog posts
@whilo you might be interested in discovering that there is already an integration of Google Charts with Klipse. See http://blog.klipse.tech/data/2017/03/17/data-driven-documents-google-charts.html We could make something similar for plotly
Also, for “Function plot” http://blog.klipse.tech/data/2017/03/28/function-plot.html
external-libs is the simpler option but it has a performance hit at loading time Here are the instructions for adding a lib to the classpath: https://github.com/viebel/klipse/blob/master/contributing.md#update-clojurescript-analysis-cache @whilo
Enjoy! 😎