Clojurians
#beginners
<
2016-01-23
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

eggsyntax00:01:18

Spacemacs is pure win in my experience. It occurred to me today, though, that I would hate to be the maintainer. Complaints from irritated vim users and irritated emacs users? Good lord…🙀

slester00:01:36

@eggsyntax: do I just bang my head against it until it makes sense?

slester00:01:42

and I can't find rainbow parens for it

slester00:01:09

oh wait, it's already there right

eggsyntax00:01:16

My strategy is: pretend it’s vim until something doesn’t work, and then do SPC-? and start searching commands. Definitely the lovely thing (compared to vi) is that most commands are sensibly named. Finding it that way gives you the current key binding and makes it easy (using the exact name) to rebind it yourself.

meow00:01:10

there is also Proton, which is spacemacs in Atom w/Parinfer and REPL #C0GCNE3B3

eggsyntax00:01:19

Once you know the command name, setting up a binding is often as easy as (random example) (global-set-key (kbd "M-v") 'evil-paste-after).

eggsyntax00:01:53

Also it’s usually easy to get quick, expert advice at https://gitter.im/syl20bnr/spacemacs

eggsyntax00:01:47

A few useful commands for experimentation purposes (it’s possible that the first one is my custom binding, but I don’t think so):

SPC-k-:          write and exec a line of lisp
SPC-f-e-d:       edit .spacemacs
SPC-f-e-R:       reload .spacemacs

eggsyntax00:01:20

@slester: also feel free to PM me if you’re stuck on something in spacemacs, I’ll help if I can. Or post it here, I doubt anyone would mind the off-topicness since it’s #C053AK3F9.

chris00:01:27

There's also a #spacemacs too

eggsyntax01:01:57

^ Cool, I didn’t know that! <goes to join>

tmtwd05:01:55

so type hints aren’t strict? ie

(defn type-hint
  [^String str]
  (println str))

(type-hint 32)
32

tmtwd05:01:04

works fine, I would have expected it to fail

alexmiller12:01:46

They are hints

alexmiller12:01:45

Not type signatures

alexmiller12:01:28

When that function is compiled that parameter will have an Object type in the bytecode

mfikes15:01:43

One thing to consider is ^long and ^double which end up being type declarations.

(defn type-declare
  [^long n]
  (println n))

mfikes15:01:57

(type-declare "a")
ClassCastException java.lang.String cannot be cast to java.lang.Number  user/eval4 (NO_SOURCE_FILE:5)

jeff.engebretsen19:01:00

I'm having a hard time with this Java interop. I've got a file generating a class from an interface. I'm trying to test it but I keep getting ClassNotFoundException. Is there a problem with the file structure? src/ is on the classpath so I don't under stand why it could be that. Just stabbing.

jonahbenton19:01:28

hey @jeff.engebretsen you have to (compile) the file

jonahbenton19:01:00

see http://clojure.org/reference/compilation "gen-class and the :gen-class directive are ignored when not compiling."

jeff.engebretsen19:01:21

There it is. :aot :all was in an uberjar profile so it wasn't compiling for the tests.

jonahbenton20:01:28

presumably you need to an actual physical .class for your use case and can't use proxy or reify?

jeff.engebretsen20:01:48

Yeah. The class is used in aws Lambda.

jeff.engebretsen20:01:02

Another question. Lambda uses log4j. I have two property files one for Lambda and one for dev. When I do lein uberjar it pulls the Lambda property file like I want but since the compiler is executing my clojure forms it spits out log4j errors because the Lambda logger class isn't on the classpath. It compiles fine it just clutters the terminal. Is there something I can do for it?

jonahbenton20:01:55

Hmm. I haven't looked at lambda but this sounds like a :provided problem: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#framework-uberjars

jonahbenton20:01:23

certainly, good luck!

guru0123:01:45

Hi guys. I'm trying to pick up clojure on my own for the last year - as my first language. I've done almost all 4clojure problems, (except the hardest 😎 and cut teeth on Project Euler - about 100 problems. This is to say - I understand how to use the basics of the language. I've also used some libraries to create a tic-tac-toe game with AI and a web interface with enlive and ring. For my next task, I'd like to understand how to implement a basic http server in clojure - i.e. basic network programming. Are there any guides out there that can help me? Or do I need to understand Java (hoping not) and translate my way into Clojure? I've been searching around for some time now - and I can't find anything that starts gently.

guru0123:01:15

(that was meant to - the hardest eight - not sunshades)

guru0123:01:36

ANY help would be deeply appreciated

guru0123:01:15

needless to say - i don't have a CS background