Fork me on GitHub
#beginners
<
2015-06-05
>
yusup17:06:26

@gary: Yes. I know Java interop. I am just having trouble modelling my domain in more of a Clojurish way.

gary17:06:16

@yusup well you've come to the right place. 😄 are you able to elaborate

yusup17:06:03

I am writing a app. In my app , I go from A (an url of a certain website) ,B( crawl it with phantomjs or just with clj-http if phantomjs crawling fails in given time) ,C(Index crawled page in ElasticSearch, and extract URLs and save them in a DB. ).... Thing is that if certain step fails I want to have throw exception which includes Information about previous steps.

yusup17:06:32

I've already implemented what I described above , but it just felt awkward and not lispy.

akiva17:06:18

My first thought on that would be to have a map with information in it that gets passed from step to step and then queried for information if there’s an error somewhere along the way.

yusup18:06:07

@akiva: what if there are many nested function calls?

akiva18:06:24

Think about it like this: what you’re doing is essentially keeping a log of the process. So you can have each function add its action and result to the data.

akiva18:06:46

But, keep in mind, nesting functions isn’t really idiomatic for FP.

akiva18:06:24

Functions should operate independently of each other and be ultimately unaware. They just take input and produce output. Chaining rather than nesting.

yusup18:06:57

Thanks. I will think about it. I have to refactor my code now.

akiva18:06:23

Sure, sure. Keep asking questions and there is a #C053PTJE6 channel if you want people to look at what you’re doing.