Fork me on GitHub
#beginners
<
2018-08-18
>
stardiviner01:08:51

@chad I opened an issue on CIDER to enhance this javadoc support. https://github.com/clojure-emacs/cider/issues/2406

Logan Powell16:08:19

So, I'm running into the limits of my js VM (using a bunch of js interop that requires sequential operations between multiple fs async calls) and I'm hitting this error:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node_module_register
 2: v8::internal::FatalProcessOutOfMemory
 3: v8::internal::FatalProcessOutOfMemory
 4: v8::internal::Factory::NewFillerObject
 5: v8::internal::wasm::WasmOpcodes::TrapReasonMessage
 6: 000002033BF843C1
I'm thinking I need to digest this work into smaller bites, i.e., instead of trying to run 1000 concurrent fs reads/writes, break it up into smaller batches so as not to exhaust the available RAM. Is there a best-practice for "waiting" inside a function on a batch of work to be done before kicking off the process on the next batch?

noisesmith17:08:33

N looping workers consuming from the queue of input data

noisesmith17:08:16

each worker could be a core.async go block, read from queue, async op, read from queue etc., start as many as your process can safely handle

Logan Powell19:08:28

Thank you as always!

Logan Powell19:08:13

Do you have a patreon account or something? I'd like to be able to buy you a coffee once in a while

Logan Powell19:08:39

Also, when you say "N looping workers", do you mean like (go-loop...?

noisesmith20:08:45

go-loop makes one worker, so (doseq [etc. etc.] (go-loop ....)) yeah

Logan Powell20:08:04

You're the man

Logan Powell20:08:35

Dude, it took me a while to get all the shit figured out, but your approach worked like a goddamn charm! Thank you so much

noisesmith20:08:31

it's what's worked for me in the past

noisesmith20:08:30

oh and I finally noticed the thing you said about patreon - I work in fintech, you really don't need to worry about me having money :D

Logan Powell20:08:44

haha of course you do! πŸ™ anyway

noisesmith20:08:45

when the revolution comes you can inform the people with the guillotines I'm one of the good ones

Logan Powell20:08:39

vive la resistance

dangercoder18:08:57

Anyone with some recommendations on good reads about WHEN to use datomic? Is it still very expensive?

pepas19:08:38

Turns out this video is broken at about 6 minutes in. https://www.youtube.com/watch?v=cPNkH-7PRTk

pepas19:08:55

"Clojure for Lisp programmers, part 1" by Rich

pepas19:08:43

I've tried using VLC to stream it, tried downloading it, still broken. Using mplayer, the video will continue, but the audio just drops out after ~6 minutes.

pepas19:08:06

Using youtube-dl to download a few different versions of the audio track and see if I can find a working one.

pepas19:08:35

(Really interested in seeing this, because Part 2 was great!)

andy.fingerhut19:08:14

Just added that link as a comment to the YouTube video

sundarj19:08:30

fwiw, the video works fine for me

pepas19:08:54

@sundarj can you seek to, say, 10 minutes in and still hear audio?

pepas19:08:26

then there is hope yet! perhaps your youtube client is streaming a different encoding.

sundarj19:08:42

i'm just using the website

andy.fingerhut19:08:06

It might depend upon which browser is used, perhaps? What are you using, sundarj?

sundarj19:08:03

vivaldi, which uses chrome's engine

sundarj19:08:12

works in chrome as well for me

andy.fingerhut19:08:18

FYI, transcripts for many of Rich Hickey's talks are available here, inside the same git repo linked above: https://github.com/matthiasn/talk-transcripts/tree/master/Hickey_Rich

Michael Stokley23:08:10

is there a naming convention to avoid shadowing? for example, in python, they append a trailing underscore

andy.fingerhut23:08:15

You mean, if you want a local function parameter name or a name bound by a let expression that would otherwise match a widely used name like key or map?

andy.fingerhut23:08:09

It is not conventional in Clojure to append a trailing underscore, that I have seen. It is conventional to pick a different name for the parameter or locally bound name, if you want to avoid the shadowing, e.g. use m instead of map, or k instead of key.

andy.fingerhut23:08:39

It is not an error to shadow the name, as long as you do not want to use the name that has been shadowed.

andy.fingerhut23:08:41

The eastwood Clojure lint tool will warn if you create a local name that shadows a function name, and then try to call that name as a function. It does not warn on all occurrences of shadowing, though, since sometimes people do shadow and don't try calling the shadowed function.

Michael Stokley23:08:37

> It is not an error to shadow the name, as long as you do not want to use the name that has been shadowed.

Michael Stokley23:08:52

would you say clojure / lisp is unique in having this rule?

andy.fingerhut23:08:50

I may not have been very clear in my statement there. It isn't a compiler error in Python to shadow a name, I don't think. It isn't a compiler error in Clojure/lisps, either, but I don't think they are unique in this.

andy.fingerhut23:08:27

It is a functional error in your code if you shadow a name, and then try to use the shadowed name's original value. Not a compiler error, though.

Michael Stokley23:08:52

makes sense. i think i may have been unclear. πŸ™‚ i'm under the impression that in some contexts / communities, shadowing is always considered bad practice. i was wondering if clojure stood out in that regard

Michael Stokley23:08:29

(i could easily be mistaken, of course)

andy.fingerhut23:08:26

I mean, if you have a simple 3-line function definition that uses a parameter named map, and do not call the function map anywhere in there, sure you are open to the possible future problem that if you change the definition to then try to call clojure.core/map as just the name map, you've introduced a bug. Will people warn you about this and recommend a different parameter name if you are a beginner? Probably. Will people file bug reports against an experienced developer's open source project for doing that? Probably not.

βž• 1
πŸ‘ 1
sundarj23:08:00

some think it's fine, others think it should be avoided. it's really up to you

andy.fingerhut23:08:29

I would bet that there are some teams of Clojure coders in private companies that always consider it a bad practice, via their own internal coding styles, and file bugs against each other if they violate it.

sundarj23:08:39

the community style guide (which is opinionated, but is often idiomatic) has this to say: https://github.com/bbatsov/clojure-style-guide#dont-shadow-clojure-core

πŸ‘ 3