Fork me on GitHub
#beginners
<
2016-03-25
>
grounded_sage03:03:00

I'm working on hosting a static website on S3 but having issues with the DNS settings. Is anyone familiar with S3

grounded_sage03:03:37

I got the CNAME host as www and the value as the bucket endpoint but it's not working.

saicheong04:03:06

I work with a fairly large java JEE app running on WebLogic, and I hope to be able to use Clojure. It is not possible to move the app to Clojure even if I want to. So one possibility is to start with implementing some functions in Clojure library, and have the java app use this library.

saicheong04:03:09

Are there any Clojure libraries which are specifically built to be called from Java?

saicheong05:03:59

Or are there examples of Java programs using Clojure libraries or functions?

bwstearns14:03:14

@saicheong: Haven't done it yet but I'd suggest starting here: http://clojure.org/reference/java_interop#_calling_clojure_from_java Looks like you just need to package it in a certain way for it to be used.

seancorfield16:03:57

@saicheong: We use a mixture of Clojure invoked via clojure.java.api.Clojure and AOT-compiled Clojure that we call just like a "native" Java library. You only need to AOT-compile your Clojure library’s "interface" namespace — you can let it call into the rest of your Clojure code and compile-on-demand when it loads.

martinklepsch16:03:09

@grounded_sage: check out this: https://github.com/confetti-clj/confetti — should get you going with minimal effort for static sites on S3

bwstearns17:03:52

So this is kind of a generic question and may be applicable beyond clojure to any FP, but does anyone have book recommendations related to Clojure and FP? I've worked through Brave Clojure (awesome intro to the language, thanks Dan!), been using Sotnikov's Web Development in Clojure as a reference. Unboxed Okasaki's Purely Functional Data Structures from AMZN not 10 minutes ago. Does anyone have other books on clojure specifically or functional programming more generally that they would recommend? And as a corollary, any recommendations on how to read specific books in terms of ordering within or between books or organizing related work?

mss17:03:47

@bwstearns: the joy of clojure (http://www.joyofclojure.com/) is also excellent. really nice complement to brave clojure with some more meaty examples

mss17:03:24

if you’re up for diving through something like okasaki, you might also really appreciate SICP

bwstearns17:03:52

Good call. I unfortunately have a herd-acquired aversion to SICP because I hear how much discipline it requires but now that I'm actually using a lisp anyways I suppose I really should just buckle down and do it.

mss17:03:16

there was also a list of books on amazon of all the texts that had a pretty large impact on rich hickey’s design of clojure. unfortunately the link seems to eb broken: http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH

bwstearns17:03:42

Ah bummer. Just tried to get a cached version but Amzn must have it set up so google doesn't cache 😕

bwstearns17:03:54

maybe internet archive?

mss17:03:54

I think a lot of how difficult sicp is depends on how deeply you dive into the exercises. I’ve found it pretty readable as long as you take it in regular small doses.

bwstearns17:03:09

ok so marathon not sprint with SICP. Mind me asking how long it took you at approx what pace?

mss17:03:29

hah still working through it – about 2/3rds of the way through and it’s taken me a couple of months

mss17:03:14

I just try and get in 5-10 pages a day a few times a week. as long as you enjoy the journey and don’t try to get to the end as quickly as possible it’s not that much of a slog.

bwstearns17:03:43

haha nice. ok that doesn't sound too traumatizing then.

mss18:03:29

yeah really wish that clojure bookshelf link was up. so disappointing – it had a ton of stuff. maybe someone copied it over to a blog

bwstearns18:03:53

I found an HN discussion but unfortunately no one copied it down.

codonnell18:03:56

@bwstearns: I found Applied Clojure to be extremely useful for learning how to design nontrivial applications

mss18:03:56

that has most of them that I can remember seeing

bwstearns18:03:05

@codonnell: thanks for that. Definitely running into those kinds of questions especially about state management. On the cljs side it seems like the idea is to use the "big atom" pattern (anyone else can't help but hear the "big board" from dr strangelove?).

bwstearns18:03:36

@mss thanks! That looks like an awesome list. Blog posts are awesome (and to all who publish them thank you so much) but in general I find if someone went through the trouble to kill a tree over it then there tends to be more learning per page especially when you don't precisely know what you're trying to know.

mss19:03:09

so I’m newish to jvm clojure and the java ecosystem. I’m wondering how best to structure the following given clojure’s concurrency primitives.

mss19:03:14

I have a non-thread safe, stateful object that manages a connection to an outside service. that object generates work to be done, which needs processing, and then that stateful object needs to send information to the outside service about that accomplished processing.

mss19:03:36

I’m wondering especially how something like that would fit into an application built around component

mss19:03:24

would I give that stateful object its own thread? if so, what’s the best way to communicate bidirectionally between the polling thread and the processing thread in a thread-safe way?

mss19:03:30

the first avenue I tried (before I knew more about the nature of the problem) was just throwing the object in a core.async pipeline inside a go-loop. that pretty quickly led to a ConcurrentModificationException

mss19:03:14

apologies if that’s a pretty simplistic question

codonnell19:03:54

@mss: You could connect your object to the processor with a channel. Whenever it generates work, it puts that work into a channel which your processor consumes from. When your processor has finished processing, it sends the result into a channel which your object consumes.

mss19:03:16

awesome, I didn’t realize channels were thread-safe

mss19:03:07

that does make a lot of sense

mss19:03:51

thanks for the suggestion

bwstearns21:03:52

@mss: so it didn't occur to me that the examples in Okasaki were in a language that I wouldn't have had any experience with. Now several hours after opening the book am on page 3 and I'm midway through learning basic ML. Do you ever feel like a slow biological build system?

roberto21:03:13

ML is a nice language

bwstearns21:03:49

It looks lovely. I know some Haskell so it's not totally as foreign as I joke, but I thought someone might get a giggle out of the idea.

bwstearns21:03:14

the one thing that is freaking me out a bit wrt ML (using OCaml so maybe it's not the same in other MLs) is the whole no overloaded operators thing (+ vs +.), but it seems like that might just be ML's version of parentheses in that they're ugly for 30 minutes before you stop noticing them.

roberto21:03:27

yeah, everytime I look at Scala I get so upset, because they could have been a good ML implementation on the jvm, but they over complicated it

roberto21:03:51

yeah, OCaml has some weird syntax

bwstearns21:03:04

UTop though is AWESOME. I want one for clojure/it seems like it'd be fun to make

roberto21:03:06

I lean more towards SML

dottedmag22:03:57

I'd like to pass a string to cloure.xml/parse. How do I make an InputStream out of a string?

dottedmag22:03:43

Uhm, but probably passing a string is not a good idea, I'll better hang to the original byte stream.