Fork me on GitHub
#beginners
<
2017-03-31
>
rgdelato00:03:25

is there any way to make a #() function that doesn't use it's arguments? For example, this throws an arity exception:

(map #(identity 1) (range 5))

seancorfield00:03:45

You could use (fn [_] (identity 1)) instead.

seancorfield00:03:05

(so I guess the answer is "no, but...")

rgdelato00:03:00

yeah, I ended up using (fn [_] 1), but was just wondering if there was something I didn't know

seancorfield00:03:40

Heh, I wasn't sure whether @rgdelato really meant to replace elements with 1 or that was just a dummy function body. constantly is a good option if that's the intent @madstap πŸ™‚

rgdelato01:03:29

yeah, the specific example was translating this silly Haskell thing:

sum (map (\x -> 1) "Hello there")
...but I've actually wondered for a while about arity in #() functions

seancorfield02:03:41

that was (map #(do % 1) (range 5)) which is cheating a bit πŸ™‚

lmergen10:03:49

so i'm a bit annoyed about a pattern i'm seeing in clojure, and organising my named keywords (e.g. for spec). so, let's assume i have an event, and an event has several attributes (such as type, id, whatever). when speccing these things out, i end up with namespaces keywords such as these:

:my.app/event
:my.app.event/type
:my.app.event/id
the problem being, i would prefer to put them all in one file, src/my/app/event.clj. but then referring to the my.app/event keyword becomes awkward, since i would prefer to use β›‘event or something. how are others solving this problem ? just accept the fact that it's sometimes going to be awkward ?

rauh10:03:27

@lmergen I think you can just use (alias 'ev 'my.app.event) and then ::ev/type

lmergen10:03:05

that's neat!

lmergen10:03:34

and what would β›‘ev result in in that case ?

dimovich10:03:05

trying to use use webica (selenium wrapper), execute-script method

dimovich10:03:25

can't find any documentation regarding the usage... maybe someone has some experience with this

teodorlu13:03:36

Hi! Just getting started with Clojure. I'm making a bunch of errors with namespaces. Any recommended reading?

teodorlu13:03:31

@rootkat Thanks!

rootkat13:03:29

@nonrecursive is the author, all thanks go to him πŸ™‚

sb15:03:49

Hi, could you help me where can I find a great tutorial about Google Charts and controllers with Clojure? or Library for this?

sb15:03:00

(I would like to load the controls too and use google.load("visualization", "1", {packages:["corechart", "controls"]});

sb15:03:28

for example.. I don’t want to share with you all code but maybe here is an easier way to do