My first Clojure Presentation (appropriately Star Wars themed)
Submitted December 16, 2017 at 05:55AM by BWStearns
via reddit http://ift.tt/2ohnENL
What Is a Chan With No Buffer?
Hey all, I'm pretty confused by the core.async (chan) function. I have this example (at the end of this post) where it prints nothing when I don't add the "optional buffer" and works when I add the buffer. I would think (chan) with no buffer creates an "infinite size buffer" or "as big as you need it to be", but it seems to just create a channel with buffer zero. Is this really what's happening? What useful things could you do with a channel of buffer size zero? Also, I'm not sure if the functionality is the same for both Clojure and ClojureScript, but the code example is in ClojureScript. thanks 🙂
(ns jims.async.space (:require-macros [cljs.core.async.macros :refer [go]]) (:require [cljs.core.async :refer [chan <! >! take!]])) ;; chan takes an "optional" buffer, but is it really optional? ;; (go ;; (let [derp (chan 1)] ;; (>! derp "Yo") ;; (take! derp println))) ;; => prints "Yo" (go (let [derp (chan)] (>! derp "Yo") (take! derp println))) ;; => prints nothing
Submitted December 16, 2017 at 01:52AM by _woj_
via reddit http://ift.tt/2ARI9H1
Any ClojureScript lib that converts markdown into hiccup?
I want to read some markdown files and display them as reagent components. Reagent functions return hiccup rather than HTML, so I think I would need to hack in HTML support. Using HTML also messes up the composability with other reagent components. I did some Googling and it seems like the existing libraries all convert directly into HTML, including the most popular one (markdown-clj) by /u/yogthos.
Submitted December 15, 2017 at 03:46PM by SimonGray
via reddit http://ift.tt/2B3J7wm
A humble question about clojure language “host” possibilities
Basically, what's the next target that everyone's looking at? I've heard a bit about pixie, and the CLR counterpart. I've often wondered about basic shell scripting. I need to look more into conch. Anyways, just wanted to pose this out there. Is there a next likely environment that could be a big deal?
Submitted December 15, 2017 at 06:02AM by barry0bama
via reddit http://ift.tt/2j29sTk
Your favourite abuse of syntax in Clojure?
Do you have any examples of code that is overly cryptic, against all reasonable guidelines and probably unmaintainable, but at the same time cool to look at?
One example I like is a thread-last macro with
let, like the below – the lines are much shorter than with nested
for and it looks a bit like Python's comprehensions:
(defn to-csv [data] (->> (if (string? val) (str \" (cs/replace val \" "\"\"") \") (str val)) (for [val row]) (cs/join ",") (for [row data]) (cs/join "\n")))
Submitted December 15, 2017 at 03:35AM by neighbouring
via reddit http://ift.tt/2j5v0hY