This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-22
Channels
- # beginners (114)
- # boot (10)
- # cljs-dev (18)
- # clojure (57)
- # clojure-russia (12)
- # clojure-spec (2)
- # clojure-uk (1)
- # clojurescript (62)
- # cursive (49)
- # datomic (3)
- # emacs (2)
- # mount (1)
- # off-topic (25)
- # onyx (58)
- # pedestal (5)
- # re-frame (5)
- # ring-swagger (1)
- # specter (8)
- # unrepl (2)
- # untangled (4)
- # vim (10)
- # yada (39)
I found on google that many people had this problem even on previous versions, but their solutions did not work for me
vitruvia: what happens if you run lein repl
directly in your project directory in a terminal?
OK - so we know the project is fine, it's specifically a lighttable issue...
I think opening an issue is a good idea since I can't tell what is exactly wrong, unfortunately. For the issue, if you could provide the project.clj, or even better, a link to the github repo, it would make reproducing the problem easier
Short term, I don't have a better solution than using lein repl or giving cursive a try 😞
There isn't a repo for this project, I'm just trying to make a repl in lighttable (and I'm copying someone else's tutorial, I don't even know how to commit and pull on github yet). Also it happens whenever I try to run any code, and even when I try to update the plugin.
But I'll open an issue, that is indeed the best choice. Thanks for trying, too, I'll stick with the lein repl for now =]
there's a few things that make lein repl a lot less painful (though of course not as powerful of what instarepl does for you) - load-file, the :reload optional arg to require, find-doc, source - all are worth checking out
oh and apropos too
This is the tutorial if you want to know https://www.safaribooksonline.com/blog/2013/09/11/light-table-workflow-for-interactive-clojure-development/
so i was able to follow the first few steps of that tutorial and connect to the project fine via light table
a common issue on windows is permission to open network ports - though if lein gets away with it I'd think lighttable would too...
clojure is just a jar
if lein repl works, you have clojure
given a lazy seq of [ [:keyword value] [:keyword value] [:keyword value] ], how can I create a hash-map so that all the values associated with the same :keyword are summed?
I've attempted (doseq) (map) and (reduce) however I'm trying to use (update) to mutate an initialize empty map, but it just seems incorrect to do this and I'm positive that there is an elegant solution that I'm missing
@foamdino play around with this: https://clojuredocs.org/clojure.core/merge-with
and pay attention to your types: you have a seq of key value pairs and merge with works on maps. but luckily keyvalue pair => map is very easy
^^ since I was constructing the kv pairs myself I can just as easily create hash-maps - the issue now is that I'm getting duplicates
so your reducer function is more or less identity
and will return the last item in the collection you are reducing over
your function returns the second of two words you compare, not the last. so over a list it returns the last in the list
well that is pretty confusing xD if you always want to return b then why cant you just write (fn [a b] b)?
yeah but the people who wrote the koans made a strange choice by writing it like this xD pretty confusing for a beginner. I spent hours trying to figure what this if(0<1) could possibly mean
yeah the meaning is obvious, but since they could have just returned b I started thinking there was a reason for this comparison that I was not seeing
(meditations
"You will face many decisions"
(= __ (if (false? (= 4 5))
:a
:b))
"Some of them leave you no alternative"
(= __ (if (> 4 3)
[]))
"And in such a situation you may have nothing"
(= __ (if (nil? 0)
[:a :b :c]))
"In others your alternative may be interesting"
(= :glory (if (not (empty? ()))
:doom
__))
hi all, i am trying to solve this problem where i need to create a string of first 3 characters of a string and I am trying to use clojure.string/replace
i am trying to write something like this
(clojure.string/replace "14451" #"^.{0,2}" "")
but i am able to either remove first few chars or the last few chars and since the input string can be of arbitrary length, that won’t work
@wallydrag if it's just by count, then subs
might be simpler
you just have to do some math to make the 0, 1, and 2 char strings work
for map, lazy-seqs on strings are almost never appropriate. I recommended subs because it's specialized for exactly the case of using N characters of a string or dropping N chars of a string by position.
is there a way to get help with functions on lein? Like get what args they take, what they return, etc
@vitruvia in any repl you can run (doc f)
or (find-doc re-or-string)
(rarely that doesn't work and you can fix it by running (use 'clojure.repl)
)
for example I don't undertand why there is a when funtion and then a :when keyword that somehow does the same thing
:when is a special case for specific forms
it's not a general thing
generally keywords act as a function that looks the keyword up in an associative data structure
and they are often used as switches for function behavior or enums, or as you've seen, they can also be syntax in some forms
no, because :when is a special syntax in for
and doseq
forms
similarly you can use (spit "file.txt" "some text" :append true)
- the keyword is just use as a way to name a syntactic option
and it's up to the code you are calling to look for keywords and decide what to do with them