Fork me on GitHub
Muhammad Hamza Chippa11:11:23

I am getting the string from substring like `(subs (first x) 9)` which is time like 16000 `(*int (subs (first x) 9))`is not working on it it is saying "Expected number or character received string" ?* any alternate ?


Sorry, I don't understand what you're trying to do. What does x look like and what do you expect to get back in the end?


int doesn't convert a string to a number. It will cast from other numerical types into an int. What you're probably looking for is Long/parseLong ...

👀 1
Ziad Salah13:11:29

Hello, say I have a collection of a collection of maps, i.e:

[[{} {} ...] [{} {} ...] ...]
And I'd like to get the first map from every collection that satisfies some predicate. I've done that by mapping a filter on the main collection, then mapping first on the result. Is there a nicer or more idiomatic way of doing this?


Idiom for filtering out the first element has been rejected in the past, due to poor performance of linear search. Consider whether you could represent your data so you can do a lookup instead of searching. Having said that, you could use a reduce

(map (fn [list-of-maps]
       (reduce (fn [_a m]
                 (when (predicate m)
                   (reduced m)))


It is idiomatic. Also you can use transducers here to avoid intermediate collections -

Ziad Salah11:11:55

Thank you all


Hi, I am a beginner in clojure. I'm finding Emacs so hard to use


Yeah, learning Clojure and Emacs at once is a bit much IMO. You may want to try a simpler editor. is popular.


If you are not familiar with emacs.. then it might be not a best idea start with emacs. I did this mistake. Try to use VSCode + REPL from terminal. Later you can use Calva. IntelliJ+Cursive a good option too. And after this you could learn emacs too


Which editor are you using most of the time?


@UPWHQK562 thanks gonna check it out


@U2T2ZEVPC @U04V4KLKC currently trying to get used to Emacs, I used both Emacs and VScode. But I heard Emac itself is written in lisp and understand lisp structure very well but it very hard for me to get use to


@U02PG1GLZGQ Emacs Lisp and Clojure are two very different languages. So I suggest not making that the basis for you editor choice. I agree with the others here. Since you are new to Clojure, I'd say use VSCode + Calva. That said, as a happy Emacs user, I'd say please also mess around with Emacs, but don't let it be a blocker for your Clojure study! Welcome to Clojure, all the best and have fn! :)

👍 1

@U051MHSEK okay noted. Thanks


If you're used to VS Code, stick with it for Clojure and use Calva -- it's awesome! There's a #calva channel if you need help with it.

❤️ 1

What's the Clojure approach to pulling secrets out of the environment and into EDN config files? I found but I'm wondering if there's a more common approach that people use.


For configuration management, take a look at juxt/aero. Among other things, you can have environment variables inserted into config files. In the docs, there is also a suggested way of storing credentials in a separate file (so you can keep it out of version control) and then incorporate the secrets into the config.


@UPWHQK562 +1 to @U0AT6MBUL's suggestion. Here's a real example of a config file I wrote for juxt/aero, which pulls secrets from a separate secrets.edn file (which is .gitignored and not tracked in version control):


Thanks everyone, I had not heard of aero. Will check that out.


@U6T7M9DBR thanks, I've used that extensively before. There is also, which you might find of interest.


I just noticed that since I'm using Fulcro, it already has this built in: > Values can take the form :env/VAR, which will use the string value of that environment variable as the value. > Values can take the form :env.edn/VAR, which will use read-string to interpret the environment variable as the value. False alarm 🙂 just leaving this here for posterity.

John Bradens22:11:51

Hi I'm a beginner that's created some web apps in Clojure. I'm curious about the metaverse thing and how to develop an AR app. Is this possible using clojure? Or what languages do people typically use to make an AR or VR app? Are there any resources you can point me to, like a beginner how-to? I feel passionate about Clojure & fascinated by the new AR/VR stuff, so I think it would be super cool to make some kind of basic metaverse apps using clojure just as personal projects. I just don't know where to start or if it's even possible or been done before.


So there are a few layers to this


one is yes, you can make at least VR apps with Javascript and we have a dialect of clojure which compiles to javascript


there are a few proof of concepts out there and it will probably take some build system tinkering to get that up and running, but its definitely doable


as far as i know there isn’t any beginner todo for that in particular


the other is a challenge to you: define “metaverse”


i take a very, very, very dim view of that particular direction of hype


and if you have some picture in your head of the kind of VR/AR app you hope to make, its probably better to focus on that than “the metaverse”

John Bradens00:11:43

Cool, thank you @U3JH98J4R. I'm glad to hear that it's doable & that I can use javascript/clojurescript? I'll try to find the proof of concepts. I think I'm most curious about making an AR app, and I'm not sure about correct terminology. I thought "metaverse" is just a term for the 3D AR/VR space, can you please tell me what the direction of hype is? Is it related to the facebook meta stuff? Does it make more sense for me to just say "AR or VR app" and avoid the whole metaverse thing? I appreciate hearing your thoughts about it. On google I'm having trouble finding real information amongst clickbait articles but I'll keep searching there too


metaverse has some roots in scifi, but its been entirely co-opted by facebook’s whole deal. It doesn’t super work as a blanket term for the whole space. "AR or VR app" is good.


I don’t know much about AR devices - which one(s) do you have available to prototype on? That would probably influence what you are able to do


In my brain AR is anything where the “information” either doesn’t take up your whole visual space or is overlayed onto the environment

✔️ 1

so like pokemon go


HoloLens and stuff seem to be “mixed reality”, but im unclear if thats just in reference to it being strapped to your head

John Bradens01:11:20

I haven't gotten a device to prototype on yet, still researching to pick one. And ok thanks, that's good to know. I think for my use cases I'm most curious about things overlayed into the environment. Early stages of looking into all this. Thanks for the info!


There was a project to create Clojure bindings for Unity, although I'm not sure it's maintained anymore: But that'd give you a leg up for 3D stuff, and Unity has explicit AR and VR support.

John Bradens07:11:20

@UTF99QP7V thanks I'll look into that!