Fork me on GitHub

Anyone worked with serverless project?


what do you need to know?


Sorry about late response @U79NZHC6A, what platform did you use?


about the cost, do you have to use heartbeat to beeing lambda functions up?


I researching if it worth using AWS with this heartbeat because the performance


scalability ...


I just suck up the cold start penalty and use nodejs rather than JVM clojure


JVM cold starts are brutal


nodejs ones are pretty short


but having to keep lambdas warm greatly increases yr cost


for my stuff I’m using cljs, at work we’re a python shop and even python feels substantially slower than node


but I’m not sure if that’s my imagination


Hello 👋 Maybe this is not the best place to ask this. This is also not intended to be a troll question. Any pointers to existing documentation/articles/talks or even hints on what to search would be appreciated. I do not expect lengthy answers, but mostly pointers. I am looking into types. I have some familiarity with the F# type system. I do understand most of what Rich is saying on his talks (especially the Effective programs talk). What is my (current) main concern in the debate of whether types should be used is wether people that do not use types go through the burden of verifying the contents of the parameters in every function. ie, if something like the following is common and if not how is such "verification" achieved?

(defn my-function [param1 param2 etc]
  verify param1 ; is a number and not null
I do get the "checks like that only happen on the edges of the program and internally nothing like that takes place", but is this your answer?


If you still want some points, I for once use Schemas to check for type and constraints only in development. I found out that eases legibility in multiple cases, and avoids some bugs


Also, I use prismatic-schema to coerce input messages (so I can receive a JSON and forget about "missing fields", or "a string that I need to transform on DateTime")


cool, I'll look it up


Also, you can use (schema.core/explain <some-symbol-here>) and you'll know what's the shape of data you're expecting (great for tests and understanding context while you're exploring code)


you can use assertions, via assert, or spec/assert, or pre/post conditions on the fn


they all are toggleable via jvm flags


@ivan.kanak_clojurians I agree with this view point. Assertions/specs are not equivalent to types (and the inverse is true as well). There's benefit to both. But that's not to say you need either, or that one is better than the other without any given context.


Put in another way: types are compile time checks, assertions are runtime checks. Both can help to write more robust code, but both have their costs as well.


I don’t typically verify that fn params are the right “type” unless there’s a significant likelihood that they’ll come in as wrong ones. Typically that means checking for not-nil, but it could be other constraints. So far I haven’t missed type checking, and on the rare occasions that I find a bug that type checking would have caught, it’s easy enough to add an appropriate check.


Thanks for your opinions. I also found this related post on types, on martintrojer's blog If any other has more to add, I'd be glad to look into 😉

👍 1

Hello, I am currently working with specs and I'm trying to activate the check-asserts feature for my unit tests. I've tried putting a :clojure.spec.check-assert "true" entry into the :env map of the :dev profile but I get the following message Warning: environ key clojure.spec.check-asserts has been corrected to :clojure-spec-check-asserts that obviously leads to check-asserts not being activated. Would anyone have any pointer as to how I should proceed ?


writing this I realize it may be environ that interferes 😞


I thought that :env key was standard leiningen


I have a valid point to make: clojure is awesome


is there an equivalent of Karsten Schmidt’s [rstream-graph]( in clojure? Basically looking for a graph with state and transducers in the nodes that can reactively subscribe to each other. I’m aware of plumatic’s graph but not sure how that would work with transducers.


is there a way to skip the :mvn/version section in deps.edn?


like have that somehow be a default


not within the existing tools. But deps.edn is pure data, so you can always generate it

Ben Hammond14:08:14

does anyone know of a good blog post discussing suitable use cases for

Ben Hammond14:08:01

I have picked up a general superstition against using it But would like to understand more of the issues


ummm have you done pattern matching.

Ben Hammond14:08:06

not sure what you mean


case is the fastest kind of multibranch dispatch you can do, but you need constants on the left hand side


what's the superstition you allude to?


say idk if you would have a couple of

if (= x y )   return y
elif (= x w)  return w
elif (= x z) return z
else return x


that is psuedocode but it literally what I think ghadi meant


if you would ever want to do something like that


sorry idk about a blogpost

Ben Hammond14:08:43

it has a complex implementation based on whether the keys are all ints, all keywords or a mixture and attempts to compact the key ranges

Ben Hammond14:08:00

I would use condp in that situation


well in case you would

case x
w return w
y return y
z return z


well I didn't know about the types making things complicated


that looks like identity to me


hahah it's an example


you could be dispatching different functions


but you can also use umm records

Ben Hammond15:08:13

it's great when the keys are ints

Ben Hammond15:08:20

and its great when the keys are keywords

Ben Hammond15:08:39

(but so are plain old maps, and introspectable to boot)

Ben Hammond15:08:02

still untangling the hash-code logic around the mixed case statement


I also don't know about case internals but I use with keywords


like some kind of record syntax


trying to come up with a deps.edn but I can't figure out how to list multiple deps. I have the below but it fails because it's not a valid map.

 {reagent {:mvn/version "0.8.0"}}
 {re-frame {:mvn/version "0.10.5"}}
 { "0.1.6"}
 {secretary {:mvn/version "1.2.3"}}
 {com.andrewmcveigh/cljs-time {:mvn/version "0.5.2"}}
 {proto-repl {:mvn/version  "0.3.1"}}
 {devcards {:mvn/version "0.2.5"}}
 {binaryage/devtools {:mvn/version  "0.9.10"}}
 {  {:mvn/version "0.3.3-react16"}}
 { {:mvn/version "0.5.1"}}
 { {:mvn/version "0.5.1"}}
 { {:mvn/version  "0.5.1"}}


deps should be a single map {:deps {reagent {} re-frame {} ...}}


keys are the lib names, values are corresponding coords


It makes sense now


I think I read somewhere either here or in the google groups that defn- is something to be generally avoided and is sometimes considered a regret in the core api. Am I remembering this right? If so, is there a discussion of this somewhere? I personally don't use it, but I'm having a discussion with some fellow devs and wanted to get my facts straight.


I remember someone mentioning this also. I think it was a response to a question about if there will be a corresponding def-. They said defn- was generally considered a bad idea. I don't remember the reasoning though.


there's no reason not to use it now that it's there


the discussion was just about regretting adding it in the first place


but it's not going anywhere and it's not problematic


I hadn't heard that it was to be avoided, I think they just regretted the inconsistency in the api. like, there's no defmacro- or defmulti- etc, because you can just do defmacro ^:private. I think they regretted that they exposed defn- as a "convenience" form, because in hindsight, that's not the job of the language design


ah, so the best practice is to mark the def/defn as private and not use defn-?


Bing doesn't turn up much but I did find a thread on Reddit that said defn- was an inconsistency and because there were so many def forms, adding a private version with - would have added a lot of new forms.


you gettin paid to rep Bing? 😆


So many folks use "Google" as a verb that I need to be careful to avoid saying that 🙂 I stopped using Google (and almost all of its infrastructure) years ago...


oh yeah, that makes sense. google is getting kind of scummy


not that MS is much better :thinking_face:


I'm liking MS more and more these days. Lots of innovation. And with WSL now, Windows 10 is a nice developer environment.


No, use defn- rather than defn ^:private -- for concision.


(according to bbatsov's community style guide)


yeah, there's zero concern about the usage of defn-, just as a feature of language design its irrelevant. I'm afraid your coworkers are right @markbastian 😆


But, in general, private functions don't add much really. You can still call them.


happy to be corrected


@markbastian there's literally no difference between defn- and defn ^:private so there's no reason to use the longer form to the short one


Some folks think you should avoid private functions -- put implementation details in a separate namespace; others think defn- is fine for functions that aren't part of a namespace's API.


I like that Joker (lint) tells me a private function is unused (and can therefore be removed), but I don't tend to write many private functions in my application code (just in libraries).


I've generally found that making functions private from an implementation standpoint when using external Clojure code never aids me in understand that API and on the rare occasion that I need to use the function I wish it were public.


And if they're pure, why hide them?

👍 1

To convey intent


"use these functions to manipulate it"


Again, just speaking aloud, but I see.


Thanks for the info. I definitely misunderstood the prior conversation.


good ask though!


defn- is part of the api, it’s not going away, if it’s what you need then use it


Oh, I wasn't suggesting anything like that. I was just under the impression from a prior statement that there was something regrettable about it (can't remember what, though). And it was in relation to not having def- now that @bmaddy reminds me.


and I should probably clarify my comment, I remember reading about a little regret that defn- was added, not that it should be avoided now.


I also just learned something interesting from my coworkers that not everyone on the channel might also know. You can invoke private functions by var quoting them. So, (#' my-private-fn x) can be used when you do need to spelunk the guts of an existing library to understand its implementation. This has been my #1 issue with private functions.


hmm wondering whether dev on onyx will continue


I haven't heard of a transducer graph thing in clojure/script. Sounds super cool though


I was wondering if it'd be possible to build an optimization thing that walked an ast, built a call graph and then "transducify" any functions that can automatically be turned into transducers


hi,how to add dependencies local jar in lein-project?


I can’t find a way to add him


@hacker.kill07 have you installed the local jar into a local maven repo?


I did not do this


let me try it.



👍 1

Not super scientific findings, but I thought this was pretty weird and maybe someone has a good explanation at first glance. But I opened up VisualVM to try to track down some issue and I noticed every time I evaluate something in the repl, the used heap grows by at least ~60mb. I can type 1 and enter in the REPL and the heap grows by that size. Doesn't that seem pretty odd? I think 60mb is pretty big


using clojure.main, socket repl? nrepl?


nREPL server started on port 33819 on host - 
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.9.0
Java HotSpot(TM) 64-Bit Server VM 10.0.2+13


it is odd at all


nrepl, reply, and whatever nrepl middleware you may or may not be running are complex bits of software, and the heap jumping by 60mb doesn't mean much if the gc hasn't run


you might find your profiling data easier to interpret without the nrepl stuff (eg. a clojure.main repl without the network server and middleware)


basically your environment is likely so full of confounding factors that your observations are not useful


Yea I just think that's interesting, curious about how that can be optimized. If GC is slow you can rack up quite a bit of used heap pretty quickly in the REPL.


I wouldn't spend my time optimizing dev tooling - if you find it too heavy there are lighter alternatives and none of that stack should be present when deployed


the way memory is used in the jvm doesn't seem to match the intuitions people show u p with


if you tell the jvm it has a max heap of N, you should assume it won't gc until it has used most of N


jvm defaults to a max heap of 1gig in most situations these days if you don't give it an explicit max heap


if you want it to assume it has less memory to work with, tell it that using -Xmx


Thanks for the insights


Always surprises me how hungry the jvm is for memory. Wrote some C# code for the first time in awhile the other day. The full GUI app used 16MB of ram and memory was released back to the OS after about 60 Sec of idle time.


I found out that OpenJ9 (IBM's JVM) uses significantly less memory (I use it for development). But still is way more than other solutions...


The JVM is really optimized for servers


"memory released to os ..." - what, was this a language developed by an OS company or something :D

😁 2