Clojurians
# beginners

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

seancorfield 00:03:29

Why not just call .delete on the File object?

seancorfield 00:04:48

(.delete (first @g))

mfm 00:05:38

perfect!

timgilbert 00:06:19

@mruzekw: :refer-macros is a CLJS-only construct. From CLJ you'd just use :refer [html]. For CLJC, you might want a reader conditional as @carly suggested

mfm 00:06:23

oh wait, can .delete be passed in to a higher order function like map?

mruzekw 00:06:53

Thanks @timgilbert

timgilbert 00:08:05

It might be simpler to just do :require [sablono.core :as s] ... (s/html [:head ...]), with more recent versions of ClojureScript the CLJS compiler will figure out what things are macros and pull them in on :require

timgilbert 00:09:36

Getting macros working in CLJS still seems like a bit of a black art though. You might find this useful if you're mixing macros and CLJC: https://github.com/cgrand/macrovich

mfm 00:10:33

i found: (map #(.delete %) (take 5 @g)) deletes the first five files in @g. thanks @seancorfield !

seancorfield 00:13:05

@mfm See also memfn

payal 00:30:30

I am trying to understand how class loading works.. I am using clojure.string in one of my functions and somehow the code throws runtime error 'java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils’ SO looks like ‘org/apache/commons/lang/StringUtils’ class is not found.. What is the right way to fix this?

payal 00:41:07

Should I include org.apache.commons.lang.StringUtils in project.clj?

donaldball 00:46:35

That’s… weird. clojure.string has no direct dependency on anything other than java and clojure itself

donaldball 00:46:59

Perhaps you could paste the code in question?

payal 00:47:11

I knoww…but I started coming across it only after I added this code

payal 00:50:23

@payal uploaded a file: Splitting on space and commented: Its just this that I have added in core.clj so that t can be used in project.

timgilbert 01:01:07

Do you have something like (ns foo (:require [clojure.string :as string])) at the top of your file @payal? Maybe somehow your editor tried to automatically import a different string library or something?

payal 01:01:34

wohoo yes I do

payal 01:02:53

But why will that import different string library?

timgilbert 01:02:58

Very odd, I'm not sure

timgilbert 01:03:08

No, the stuff I posted above should be correct

timgilbert 01:03:46

But I was thinking sometimes IDEs can auto-insert other classes for you and it's easy to get the wrong one sometimes

timgilbert 01:03:52

But you'd see it in your code

timgilbert 01:05:10

If you're using leiningen you could try running lein deps from your project to make sure your local repository has the correct dependencies

payal 01:06:33

hmm okay let me do that .. by that you mean there should be no package other than clojure.string which lein is puling right?

timgilbert 01:06:57

How are you running your code?

timgilbert 01:08:40

Basically if you have a leiningen project, all the classes that are loaded when you run your code should come from the :dependencies key in your project.clj

payal 01:09:11

right

timgilbert 01:10:04

You can run lein deps :tree to view the whole tree of jar files that lein will pull in based on that list

timgilbert 01:10:24

And lein deps by itself will try to download any files that you don't have locally

payal 01:10:44

thanks I was looking for this command because lein deps does not shoe downloaded packages

timgilbert 01:11:43

If nothing else you can start from scratch by deleting ~/.m2/repository and then lein deps again. Not sure about the exception you're getting

timgilbert 01:13:01

But yeah, just with the code you posted I wouldn't expect it to require the apache string libraries

payal 01:17:49

yeah i am also not convinced that it would require StringUtils, but then it is failing with that exception so not sure…thanks for the help though :slightly_smiling_face:

adamkowalski 01:22:04

is there a way to find out what protocols something implements?

adamkowalski 01:23:11

like given an object get back a set of protocols

alexmiller 04:35:02

@adamkowalski I don't think there is. The extenders function is the other direction. The protocol is itself a data structure, really a map, so you could just look at it.

sb 12:40:43

Could you help me, where is a good tutorial about clojurescript (reframe, natal) & ios/android development (Ok I know how to start and test..), with export part too?

sb 12:41:15

Which give me a full view about the full flow. Many thanks.

jumar 12:58:26

and you can always ask in #cljsrn

sb 13:00:09

@jumar thanks!! that article is fantastic! :+1: