Fork me on GitHub
#beginners
<
2016-06-26
>
tungsten01:06:37

im having problems passing in a string to a function. The println on that string appears to be "nil" but when i run println on the string outside of the function the string is actually a string. Anyone have any insight here?

tungsten01:06:23

why would println work but not (#(println %&))

tungsten01:06:28

I feel like im taking crazy pills

leo.ribeiro01:06:51

did you solve?

akiva01:06:59

Why not just use (println _var-name_)? The way you’re doing it isn’t idiomatic. Furthermore you’re not passing anything to println there.

tungsten01:06:06

Im not actually trying to print the variable, I want to write it to a file

tungsten01:06:13

but as a sanity test - the println does not work

tungsten01:06:59

the prinln in a function doesnt work

akiva01:06:21

Right, because you’re not passing it anything in that function call. You mean something like (#(println %) _var-name_).

tungsten01:06:41

No, I want a function that takes in a variable

tungsten01:06:18

I am trying to use this

tungsten01:06:47

the recieve-loop function takes an input function

tungsten01:06:51

the example they use is println

tungsten01:06:59

i want to swap out println with a file io function

vandr0iy02:06:19

hi, clojurists!

vandr0iy02:06:01

best way to extract coordinates from a 2D array where a value is the one needed?

akiva02:06:56

@bfast, why not just pass println? That’s what it seems to be expecting, looking at the source.

vandr0iy02:06:10

say, I want all the coordinates of the values '2' in my 2D array... should I try to get them with two nested keep-indexed?

tungsten02:06:18

akiva, I want to swap out println so I can write it to a file instead of standard out

akiva02:06:25

Fair enough. def a partial for spit and pass that in.

akiva02:06:12

(def print-to-file (partial spit _file-name_).

tungsten02:06:16

thanks for your help @akiva

tungsten02:06:32

I still dont understand why my initial approach wouldn't work

akiva02:06:52

Because the anonymous function is complete with the closing parens. The results aren’t included inside the form containing the anonymous function so the #() never sees it.

akiva02:06:28

Anytime. Gotta run.

tungsten02:06:39

any ideas on the best way to remove first 2 bytes of a clojure string?

andreas-thoelke10:06:27

Hi everyone! I'm using the reloaded workflow. How can I exclude individual namespaces from being reloaded? I have created a file/namespace in my projects 'dev' folder where I put my repl code (using fireplace). I don't want that to be reloaded.

danlebrero18:06:03

@andreas-thoelke: (clojure.tools.namespace.repl/disable-reload!)

danlebrero18:06:35

use that fn on the ns that you dont want to be reloaded

Drew Verlee19:06:00

What does :- mean?

seancorfield19:06:41

It's just a keyword.

seancorfield19:06:57

What's the context? Midje?

Drew Verlee19:06:36

@seancorfield: ^ the context is this code from #C051WKSP3

Drew Verlee19:06:53

ah ok, so just a keyword. so no different then :dash

seancorfield19:06:28

That's Schema annotations. But yeah, it's just a keyword.

seancorfield19:06:03

Schema supports arg-name :- Type in arguments.