Fork me on GitHub
#beginners
<
2023-08-22
>
Ingy döt Net00:08:09

Looking for the source for load-file

user=> (resolve 'load-file)
#'clojure.core/load-file
user=> (source load-file)
Source not found
nil
user=> *clojure-version* 
{:major 1, :minor 11, :incremental 1, :qualifier nil}
but don't see it in https://github.com/clojure/clojure/blob/clojure-1.11.1/src/clj/clojure/core.clj

Alex Miller (Clojure team)00:08:15

kind of down in the guts there :)

Ingy döt Net00:08:26

Yeah. ns in-ns and load-file seem to be the only ones defined with Var.intern in RT (and a bunch of dynamic vars).

Ingy döt Net00:08:48

I'm working on a new version of yamlscript written in clojure and the 2 primary functions I have so far are yamlscript.core/load-file and yamlscript.core/read-string which take ys, convert it to clj and then do their clojure.core counterpart's equivalents. My load-file looks like (->> ys-file slurp yamlscript.core/read-string eval) ... But then I realized that clojure.core/read-string only reads the first form. So I was looking to see what clojure.core/load-file did. Unfortunately now that I've seen it, that's unlikely to help. :)

Alex Miller (Clojure team)00:08:30

You probably want read with some options instead of read-string

Ingy döt Net01:08:19

This seems to work fine for now:

(defn read-string
  [ys-string]
  (clojure.core/read-string
    (str "(do\n" (ys-to-clj ys-string) "\n)")))
😄

Bustanil Arifin00:08:29

Hi. I remember there's a website to find usable Clojure functions if we give the input and the expected output, but I forgot the URL. Tried Googling but no luck. Does anyone remember what the website's URL?

Bustanil Arifin00:08:16

Yes, this is it. Thank you!

lepistane13:08:53

maybe not the best channel to ask the question but i am really curious - How do you monetize your skills? What are different income streams you have? Yeah day job and working at the company is great, but not what i have in mind. I know some people who are involved in many projects at once, that have popular blogs or create content for a hobby they love, or have consulting agencies... I am really wondering what people here do. Thank you for your time

4
dpsutton13:08:11

this is an interesting question but this is absolutely the wrong channel for this. Can i ask you to delete this here and ask in #C03RZGPG3?

⬆️ 2
dpsutton14:08:37

i was hoping you would delete it. I’m going to delete this for you and hope you post it in a more appropriate channel.

lepistane16:08:16

I just saw the message. I will post there Thanks

🙏 2
Joel20:08:29

Does :refer-clojure actually do anything, or is purely for avoiding warnings?

Alex Miller (Clojure team)20:08:37

It happens automatically as part of ns and is usually only necessary if you wish to alter its default behavior re excludes or renames

Joel20:08:35

I ask because running older clojure code that defines things like abs actually gives an “unbound function” error when running on a Clojure 1.11 container. I was curious if refer-clojure would avoid that issue.

Alex Miller (Clojure team)20:08:00

that's a case where using :refer-clojure :exclude [abs] would help

2
Alex Miller (Clojure team)20:08:57

but another case where you could use it to "do something" would be to rename core functions to something else (occasionally useful if you are also defining things that overlap)

thanks3 2
Joel18:08:23

@U064X3EF3 Is there a way to make these warnings be errors? WARNING: int? already refers to: #’clojure.core/int? in namespace: org.acme, being replaced by: #’ai.dsl.backports/int?

Alex Miller (Clojure team)19:08:58

no, because it's not an error

✔️ 2