This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-08
Channels
- # aleph (52)
- # beginners (74)
- # boot (8)
- # cider (4)
- # clara (3)
- # cljs-dev (1)
- # cljsjs (2)
- # cljsrn (1)
- # clojars (2)
- # clojure (300)
- # clojure-argentina (1)
- # clojure-dev (9)
- # clojure-italy (10)
- # clojure-nl (1)
- # clojure-russia (77)
- # clojure-sg (9)
- # clojure-spec (38)
- # clojure-uk (70)
- # clojurescript (108)
- # core-async (12)
- # cursive (9)
- # data-science (4)
- # datascript (7)
- # datomic (37)
- # defnpodcast (4)
- # emacs (11)
- # graphql (6)
- # jobs (3)
- # jobs-discuss (1)
- # juxt (3)
- # keechma (1)
- # klipse (4)
- # lein-figwheel (1)
- # lumo (1)
- # off-topic (3)
- # om (5)
- # onyx (10)
- # parinfer (3)
- # pedestal (1)
- # perun (1)
- # protorepl (3)
- # re-frame (35)
- # reagent (19)
- # spacemacs (4)
- # specter (2)
- # uncomplicate (279)
- # unrepl (32)
Vaadin. Turns out though that my problem was an out of date JDK on this machine. Horribly out of date. Updated it, and now fn-fx tests pass, so likely will try that.
Likely still try out Vaadin though
But won't be able to use for this project...has to be a desktop app (not my requirement, got handed to me)
that’s the one way to do it
other than something crazy like throwing an exception
that reduced is returned in the context of your chained preds’ input, the reduce is operating on the functions that you are composing
the reduce always completes - it returns a function - then that function has another function inside that returns (reduced nil) when you call it
but reduce isn’t consuming that reduced value, so it doesn’t prevent the propagation
because this course hasn't talked about throwing exceptions yet and I probably should stop this another way
you can check for reduced inside you fn x and stop if the previous step returned a reduced
or just use nil and check for that
maybe you meant for the reduce to be inside the function you return
rather than using the reduce to create the function you return?
Hello there! Does Clojure have a shorthand way to bundle a bunch of defs into a map? I'm currently doing:
(let [[first last email amount] (string/split % #",")]
{:first first :last last :email email :amount amount}
...and I was wondering if there's kind of an inverse of the :keys
destructuring form where I can do something like (vals->map first last email amount)
(zipmap [:first :last :email :amount] (clojure.string/split "Sean,Corfield,[email protected],100.00" #","))
=>
{:amount "100.00",
:email "",
:first "Sean",
:last "Corfield"}
@seancorfield thank you! that works
hello comrades, I'm learning macros, I want to concat things somehow like this: (concat ': 'attr '-get-width)
@qle-guen A good rule of thumb with macros is to write a function that does almost what you want first, then write a macro that wraps that function.
In this case, if you have a function that accepts a symbol and produces the keyword you want, then a macro is just a simple syntactic wrapper around that.
(and pretty much the "first rule of macros" is "you don't need macros")
@seancorfield thanks but that doesn't really answer my question. Does the function concat
exists in this context? Or am I just designing things wrong?
concat
lazily joins together two sequences.
I think you probably want str
to join strings together and then keyword
to convert the result into a keyword?
(keyword (str attr "-width"))
like that?
This blog does a great job summarize usages of clojure’s non-alphabetical characters. You might find it useful https://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/
Hi, I would like to save png image (clojure) server-side from base64 encoded string, could you help me? I tried a several method, and something bad.
you're gonna need https://github.com/clojure/data.codec
`(ns base64encode.core (:require [clojure.data.codec.base64 :as b64] [http://clojure.java.io :as io]))`
pkova I don’t know.. maybe I tried to fix that too many times.. and I can’t see what is the problem. Could you check once more what is the problem?
(def png "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABCgAAADICAYAAAAqY9BtAAA... ....mZmZmZmUWeAwozMzMzMzMzizwHFGZmZmZmZmYWeQ4ozMzMzMzMzCzyHFCYmZmZmZmZWeQ5oDAzMzMzMzOzyPv/tsxWdwyykUUAAAAASUVORK5CYII=")
(with-open [in (java.io.ByteArrayInputStream. (.getBytes png "UTF-8"))
out (io/output-stream "out.png")]
(b64/decoding-transfer in out))
data literals (or functions)
Hello all, how is the way to destructing this?
{"Link_EMBRATEL"
{:localidade :ITA, :icmp {:jitter 0.89, :perda 0, :latencia 23.0}}}
What value are you looking for?
(let [{e "Link_EMBRATEL"} a
{localidade :localidade icmp :icmp} e
{jitter :jitter perda :perda latencia :latencia} icmp]
;; ...
where a
is (def a {"Link_EMBRATEL" ...})
How do I make environment variables more convenient? Having to type source some-script.sh
with a number of export statements before running my app for local dev is a pain.
Using environ, I was under the impression that I could write to .boot-env
with a map of EDN key-values and it would be loaded at runtime, but (env :my-key)
doesn't seem to work. Am I doing something wrong, or is there a way to leverage environ in a different way?
petrus: alias launch='source ./vars.sh && lein repl
but this in your .bashrc or similar, and you can use launch
to start the project?
@petrus .boot-env
is an internal file. You can add environment variables programmatically in development by adding them as a map to the environ
task.
There’s an example in the README