Fork me on GitHub
#beginners
<
2016-08-04
>
porglezomp03:08:41

I’m having trouble writing code that uses .requestAnimationFrame and reloads well.

porglezomp03:08:35

If I just call it on the first page load, then the old function definition stays running, and if I call it again then the function runs multiple times.

porglezomp04:08:49

Well, I think I just solved my own problem, I call @draw-fn and just (reset! draw-fn draw) every time. Is this the best way to do this?

krchia06:08:24

not sure what to make of this - when i set! a javascript data structure to add a new property, i’m unable to read that particular property later on - although .log js/console shows that the property is already there

krchia06:08:38

aget does not work too 😞

krchia06:08:48

existing properties are okay, but not properties i added dynamically

rockiger08:08:37

Could you show some code.

krchia10:08:19

i fixed it

krchia10:08:25

it’s already morning

krchia10:08:41

my code is an abomination as well

avabinary11:08:50

i'm trying to match filenames to a regexp to read only some files from a directory

avabinary11:08:41

i have a problem ... the accumulator in which I read the filenames is a Lazy seq

avabinary11:08:54

how can I apply the pattern matching to it ?

avabinary12:08:40

anyone here ?

dominicm12:08:36

I don't understand the question. You have a lazy sequence of java.io.File?

avabinary12:08:14

i have a java.io.File object composed of 10 files that I read from a dir

avabinary12:08:39

(#object[...] #object[...] ... )

avabinary12:08:53

I need to filter with this command

avabinary12:08:57

(filter #(re-find #"^\d{1,3}\.sql$" (str %)) files)

avabinary12:08:22

i need all files starting with 3 digits and with extension sql

avabinary12:08:36

problem is ... i want to filter the digits at the beginning of the file names

avabinary12:08:05

i think that's a problem because my files contains objects not strings maybe ??

dominicm12:08:09

Replace (str %) with (.getName %)

avabinary12:08:03

thanks @dominicm

avabinary12:08:23

also @rauh this method is more elegant, thanks for your input, I'll use it

domparry12:08:54

4Clojure app on Android has been awesome to get my head around syntax nice and slowly. Also embeds some concepts quite nicely. I can do an exercise whenever I have time, so it’s convenient. Thought I’d throw it out.

guano15:08:24

I haven't tried the app, but the 4clojure web site is pretty great. Although it has only been ok to help me learn the concepts from scratch- after a lot of looking up things, I still often wind up stuck. I have started reading Clojure for the Brave and True, though, and it is better for a complete beginner

abhishekamralkar15:08:34

What is the best way to start writing code in Clojure?

abhishekamralkar15:08:41

Any beginner project?

jswart15:08:34

Rewrite something small that you have done before in another language.

akiva16:08:23

@abhishekamralkar, or look at Clojure Koans, Clojure Katas, Wonderland Clojure Katas, and 4Clojure.

akiva16:08:46

Those are good ways to get exposed to ‘coding’ in Clojure without investing in an entire personal project.

scriptor16:08:43

he asked for a project, though

akiva16:08:33

And I was offering a possible alternative which is why I added the clause ‘…without investing in an entire personal project’.

abhishekamralkar16:08:17

I will check it out

shaun-mahood22:08:34

I'm running into a problem with some clojurescript / javascript interop, and I'm pretty sure I'm just doing something dumb... I have the function

function callback() {	Acad.Editor.executeCommand("_erase","all","");}
in js and my translation to cljs is
(defn callback [] (js/Acad.Editor.executeCommand "_erase" "all" ""))
When I compare the output, I am getting
function my-ns$core$callback(){return Acad.Editor.executeCommand("_erase","all","");} 
Any ideas how to get my output to match the original javascript? Or is there something else I'm doing wrong?