This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-25
Channels
- # aleph (15)
- # beginners (65)
- # boot (46)
- # chestnut (3)
- # cider (1)
- # clara (11)
- # cljs-dev (5)
- # cljsjs (4)
- # cljsrn (13)
- # clojure (180)
- # clojure-dev (2)
- # clojure-italy (10)
- # clojure-russia (62)
- # clojure-spec (6)
- # clojure-uk (85)
- # clojurescript (45)
- # community-development (11)
- # crypto (3)
- # cursive (10)
- # datomic (94)
- # defnpodcast (2)
- # fulcro (4)
- # heroku (1)
- # hoplon (4)
- # jobs (3)
- # juxt (10)
- # leiningen (1)
- # luminus (4)
- # mount (13)
- # music (1)
- # off-topic (10)
- # onyx (2)
- # portkey (15)
- # proton (2)
- # re-frame (16)
- # reagent (10)
- # shadow-cljs (194)
- # spacemacs (2)
- # specter (2)
in fact, you define your own test-runner
(defun my-test-runner () (cider-refresh) (cider-run-all-tests))
I'm not sure what the actual commands are but elisp can be quite nice
question guys - I don’t like doing 4clojure. The answers are too easy to find and I don’t feel like I’m learning anything from these puzzles. Are there techniques I can use to make 4clojure a more enjoyable experience or should I focus my learning efforts elsewhere?
are you comparing your answers to others?
because for me the solving of the problem was pretty quick, but when I saw other people's answers I realized they were doing things in a very simple way I didn't quite get yet
but if your answer looks like the good ones - you probably don't need 4clojure any more
i love seeing multiple ways to solve the same problem. compare your own to how someone else did it. sometimes you saw an easier path, sometimes they had a much more clever solution
@dpsutton if I’m stuck on a problem I can simply google the question and the second result is an answer
oh, then don't do that
@chris yeah that seems like the route I am going to take. I never have had much success with any kind of online problem solving website - I always finding myself just looking up the answer
my problem with 4clojure has always been that it's blind, you don't get any output to see where you're going wrong
i was working on an emacs mode that would pull down the code and tests so that you could work in emacs and then just copy it back in
i agree, writing lisp in a text box isn't great, but it was pretty simple to grab the things and throw them in a buffer locally
yeah that’s definitely the way to do it. Although they should explain that using a REPL is the real way to practice writing clojure
@alexkeyes Maybe you could try http://exercism.io ; you get to progress with your own development environment and I really learned a lot by viewing other people answers
@asiegfried thanks!
i did that for a bit but got annoyed that you have to have a whole project.clj file and project structure for each problem
@dpsutton but doesn’t that better represent the real world? More than a text box on a website?
from a practical standpoint, if you want to do 50 exercises, there's just gonna be 50 projects rather than 50 namespaces. some are very simple and quick and the time to crank up jvm and tooling approaches the time to craft the solution. i would rather just work in a exercise project rather than 50 different exercise projects
but that being said, the exercises were very good. so its worth the slight annoyance
if you were encouraged to use community libraries that would make for an odd set of exercises I think, but it might justify using leiningen
archiva? I've found this one https://github.com/tobyhede/lein-git-deps but doesnt work properly
I have used s3-wagon-private
which has some annoying quirks (like printing a pointless stack trace message when the repo is checked for an artifact that isn't there), but it works. We address the meaningless stack traces by reordering our :repositories
with the ^:replace
metadata so that the private repo is checked last https://github.com/s3-wagon-private/s3-wagon-private
@noisesmith how was your weekend escape from the internet?
it was good - and turned out to only be mostly an escape 😄 they had wifi but I didn't have much time for that, so many old friends to catch up with (it was a friend's wedding)
Thanks @noisesmith, I will test it
Hi. I'm trying to use core.match on record types but can't seem to get syntax right. Any help with this toy example would be appreciated. I'm familiar with OCaml's pattern matching and trying to do something similar based on the type of the record and also de-structure records field values. Thanks. (defrecord A []) (defrecord B [x]) (defrecord C [x y]) (defn eval [r] (match [(type r) r] [(:or (A []) "A" (B [x]) (str "B, x = " x) (C [x y]) (str "C, x = " x " y = " y))]))
Or would it be more idiomatic to use cond or should I just stick to Protocols and create an Evaluate protocol for each type?
this works (defn eval-cond [x] (condp = (type x) A "A" B "B" C "C")) (eval-cond (A.)) (eval-cond (B. 100)) (eval-cond (->C 100 200))
@ghadi and if I'm using records then I should be implementing protocols and not pattern matching on the type?
I was leaning towards multi methods, but read Eric Nomads post on them and he seems to say use multi methods for language features and records / protocols for program types
I'll read though this again and agree that maps and multi-methods seem like more than enough for what I'm doing. https://www.braveclojure.com/multimethods-records-protocols/
I love OCaml but sure, it's a very different world over here. Type dispatch isn't central, but it's available when you need it
seems like maps with multi-methods are the cleanest, just dispatch on :type. This post lead me to trying records, but I think I miss-understood him at first. http://www.lispcast.com/deftype-vs-defrecord
This blog post from 2011 is probably still good advice when trying to get your head around Clojure's different kinds of types: https://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/