This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-28
Channels
- # admin-announcements (21)
- # beginners (102)
- # boot (8)
- # cider (40)
- # cljsrn (2)
- # clojure (52)
- # clojure-nl (2)
- # clojure-russia (6)
- # clojure-taiwan (2)
- # clojure-uk (1)
- # clojurescript (363)
- # datavis (22)
- # datomic (69)
- # emacs (4)
- # hoplon (1)
- # immutant (2)
- # jobs-rus (13)
- # ldnclj (6)
- # lein-figwheel (2)
- # leiningen (9)
- # liberator (1)
- # off-topic (1)
- # om (68)
- # onyx (28)
- # parinfer (3)
So I think it worked, just gave that message. lein repl takes me to a repl at least
@andyshuxin: I use the normal prompt on Windows 10 and everything works well
Yeah I just installed lein.bat on Windows 10 and using the regular cmd.exe it works fine (I had to wipe/reinstall my laptop recently).
I previously installed it via the packaged installer but went with the plain .bat file this time.
FWIW I also have GOW installed (Gnu On Windows). Highly recommended. Lighter weight than Cygwin.
(I'm only here briefly -- middle of the night and can't sleep!)
@seancorfield: never heard of GOW , I use only plain windows so some plugins are not working. They need bash
i need a bit of a hand with namespaces and protocols in clojurescript
so i did this
(ns app.vectors)
(defprotocol IEnsureValue
"Protocol for data types that can have a value ensured at a position"
(ensure-last [this v] "Ensure the last item of this is v"))
(extend-type PersistentVector
IEnsureValue
(ensure-last [this v] (let [z (last v)]
(cond
(not= z l) (conj v l)
:else v))))
now in another file, i have
( app.vectors-test)
(ns app.vectors-test)
so I’m not sure how to get (ensure-last …)
working
i tried the things i normally would to require a function and pull it in
but when i run tests, i get things like "WARNING: Use of undeclared Var"
i feel like i’m missing something obvious
i’ve never done this before
but i’m trying to extend vanilla vectors
i thought records were for new data types
@andymyers: I just got the same thing on Windows 10. Seemed to work though
trying to follow instructions at https://funcool.github.io/clojurescript-unraveled/#abstractions-and-polymorphism
oh, i got another bug in that code from copying and pasting wrong 😛
markmandel, what would go into that docker container? (I ask because I've built some docker containers for new folks to play with clojure in codenvy...)
Has anyone worked through the following exercise (or willing to help me having not worked through it) from the concurrency chapter in Clojure for the Brave and True: Create a new function that takes a search term and search engines as arguments, and returns a vector of the URLs from the first page of search results from each search engine
@binduwavell: I would use future
java, lein, an emacs setup that is ready to go? maybe node in case of clojurescript?
@binduwavell: making 1 future per search engine, then deref'ing them all at the end to build the map.
@val_waeselynck: I have already completed: Write a function that takes a string as an argument and searches for it on Bing and Google using the slurp function. Your function should return the HTML of the first page returned by the search.
And then updated that to provide a list of search engines
Just a thought
ah nice
@val_waeselynck: my implementation uses a promise and a future for each request.
@binduwavell: Exactly what I was thinking
However, what I realized is that both bing and google don't actually return results, they return a bunch of javascript
@markmandel: check these out:
Part 1: https://www.youtube.com/watch?v=avDgIn4c-oc Part 2: https://www.youtube.com/watch?v=iZBVt2l_vOs Part 3: https://www.youtube.com/watch?v=5V9S_P7qTGw
Also very nice
@val_waeselynck: so part of the challenge is just go figure out how to get search results rather than a bunch of javascript.
@val_waeselynck: the second thing is how to extract URLs... I figure I could just use regexes for the second part... I prototyped something in the repl:
(re-seq #"(?i)https?://[^ ]+" "one two glumpkins")
So mostly I'm not really sure how to get actual search results rather than js
And I'm interested if there is a better way with vanilla clojure to extract URLs from HTML than REs.
@markmandel: I also plan to setup an image with vim instead of (or as well as) emacs... I played with a basic vim setup the other day and it was WAY faster than emacs/cider...
I think there are really two things you miss out on with vim (compared to emacs)... first is sort of obvious, if you're an emacs person, you miss out on emacs but second is more important for newbies or vi/m folks... emacs has much better refactoring support... you can do refactoring with vim, but it's all pretty much clever RE tricks.
@binduwavell: when writing scrapers, I personally use something like jsoup to parse the dom and query on it
you could also use enlive I hear it's good for scraping
@val_waeselynck: cool thanks for the pointers, I'll give those a look
anyone who can give me a hint how I can flatten a seq without using flatten. That one is not allowed
@cjmurphy: thanks for the idea. I was thinking for this one for 2 days and still no good idea
It is not that easy. I did plenty of Scala before so knew about identity and flatmap as they call it in that world.
@roelof: seems like it would be relatively simple to create a recursive implementation of flatten using into and recusion
@roelof (apply concat seqs)
That's right - implicits and the cake pattern and variations of it and how slow it is with using Option all the time, and then not so many opportunities to 'close over'...
@cjmurphy: yeah, they should have called it 'irony', not SBT
I saw a video by the creators of SBT and they said 'we won't help you with your build problems'.
oke, my plan is to do first do the easy exercises of 4clojure and then make the transition to the brave book
@roelof: I really like "Web development with Clojure"
@val_waeselynck: Does that one uses a framework
@cjmurphy: im now with challenge 28 and the last "easy" on has the number 153 so a lot to do
@roelof not really
just a composition of library
@val_waeselynck: I saw that it uses Lighttable a lot. I hope I can make it work with Cursive and Intelij also
yes of course it's completely orthogonal
I actually went through all of the book with counterclockwise personally, and am now using cursive
oke, so cursive is "better" then counterclockwise. I tried Lighttable and Cursive so far
i recommend it
@roelof : I tried to work through the flatten exercise last night and found it quite difficult. I'm deciding not to worry about the “easy” designation and rather focus on the fact that the koans are helping me to dig through Clojure’s functions, and maybe even how to think through solving problems using Clojure.
@roelof flatten is implemented using tree-seq I guess you could do the same...
@nando: still stuck on flatten?
@markmandel: my first two "simple and obvious" attempts were simple and obviously wrong so I still need to come up with more ideas
I have an idea .. mebbe it works, mebbe it doesn't