This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Is there a function like map that doesn't expect a return value. Something that lets me call a function for every item in a list or do I just need to use loop?
There are several. Maybe you want run!
? https://clojuredocs.org/clojure.core/run!
Also doseq
(source run!)
is vaguely interesting from a learning perspective:
(defn run!
"Runs the supplied procedure (via reduce), for purposes of side
effects, on successive items in the collection. Returns nil"
{:added "1.7"}
[proc coll]
(reduce #(proc %2) nil coll)
nil)
keep in mind that "map with doall" returns (and thus retains) a seq, while run!
does not
Every time I see dorun
, I think of https://www.youtube.com/watch?v=uTqnam1zgiw.
hello there, i'm trying to import this kotlin lib https://github.com/supabase-community/supabase-kt on deps.edn io.github.jan-tennert.supabase/gotrue-kt {:mvn/version "1.0.3"} the lib is downloaded to m2/repository I can see it on clj -Spath but i can import, does anyone knows how i can import this lib?
How are you trying to import it in your code?
Is createSupabaseClient
a class? I wouldn't expect so with a name like that...
So that is the class you want to import then I expect
i was trying to do this but in clojure
import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.createSupabaseClient
import io.github.jan.supabase.gotrue.GoTrue
import io.github.jan.supabase.gotrue.gotrue
fun provideSupabaseClient(): SupabaseClient {
return createSupabaseClient(
supabaseUrl = BuildConfig.SUPABASE_URL,
supabaseKey = BuildConfig.API_KEY
) {
install(GoTrue)
}
}
No idea how that translates to Java naming under the hood, so I've no idea how to import it into Java (or Clojure) code...
Kotlin can be really tricky to call from other languages because you have to know how the various Kotlin-specific constructs compile down to JVM bytecode, at least in terms of naming.
i don't konw if this is the problem but someone send me this https://github.com/adambard/lein-kotlinc to compile
@UMMMKKADU send me this https://central.sonatype.com/artifact/io.github.jan-tennert.supabase/gotrue-kt-jvm/1.0.4/overview and i could import io.github.jan-tennert.supabase/gotrue-kt-jvm {:mvn/version "1.0.3"}
That doesn't work tho', right?
Ah, with -jvm
...
OK, yes, there you go... Does that help you with creating a client from Clojure now?
it help import all classes i'm exploring the namespaces i think it will help there is this import import io.github.jan.supabase.plugins.standaloneSupabaseModule
that i can just use like this standaloneSupabaseModule(GoTrue, url = supabaseUrl, apiKey = supabaseKey)
Perhaps not that much of a help, but I have a small (very small) example of Clojure/Kotlin interop here: https://github.com/dharrigan/cotlin
it works
(:import (io.github.jan.supabase SupabaseClientBuilder )))
(def c (SupabaseClientBuilder. "https://<your-project>." "public-anon-key"))
@U11EL3P9U thanks it will help i was think in create some wrapper or re implement in clojure this client for supabase since i will have to use it a lot
@UL618PRQ9 I think what you are trying to import is a top level function, and I believe it become a static method in a class with the filename + Kt at the end, maybe this import will work
(ns mat.api.auth
(:import (io.github.jan.supabase SupabaseClientBuilderKt)))
(SupabaseClientBuilderKt/createSupabaseClient #_...)