Fork me on GitHub
#beginners
<
2015-12-28
>
agile_geek11:12:40

@kopasetik: just saw your message about kebab-case. You might find this useful - https://github.com/bbatsov/clojure-style-guide

frankk3850617:12:11

Does anyone know why I’m getting the FileNotFoundException?

frankk3850618:12:37

I switched back to the command line repl instead of the sublime text 3 repl for now

noisesmith18:12:02

frankk38506: is the sublime text 3 repl using your project.clj for its settings? you could check the output of ps ax to see what classpath it is setting for example

noisesmith18:12:15

(if you are on a *nix system of some sort)

noisesmith18:12:58

frankk38506: also, you could check whether sublime can connect to a running repl, because it can be nice to have your repl in a real terminal even if you connect with your editor too

noisesmith18:12:25

it prints the port your editor can connect to on startup 64838 in your last paste

frankk3850618:12:05

probably a pibkac issue using ST3’s REPL, i’m more comfortable on the command line

frankk3850618:12:26

Thanks for your help @noisesmith

noisesmith18:12:00

also, you could check (System/getenv "PWD") in the sublime repl, to see what the working directory was that it started in

noisesmith18:12:11

if that isn't your project directory, that would be the problem right there

noisesmith18:12:11

np - I don't actually connect my repl inside my editor either - I have three different repls running for this project, and juggling them properly was just clumsy

kopasetik20:12:44

When I use lein’s repl, do I need to require/use my dependencies any differently than in other code?

kopasetik20:12:55

*other clojure code

kopasetik20:12:09

Also, can I make http requests by using ring? Not sure from looking at the source code

seancorfield20:12:15

clj-http is the most popular library for making HTTP requests.

seancorfield20:12:24

Except perhaps in terms of syntax? In the ns declaration you say :require but in the REPL you would use the require function instead...

seancorfield20:12:15

So (ns myname.space (:require [clojure.string :as str])) but in the REPL: (require '[clojure.string :as str]) — note in particular the ' in the function call form, to prevent evaluation of symbols.

kopasetik20:12:20

@seancorfield: Thanks! The require vs :require answer was especially helpful

kopasetik20:12:53

Is clj-http what compojure uses?

seancorfield20:12:57

clj-http is a library for making HTTP requests. Not sure I see the connection with compojure?

seancorfield20:12:28

Compojure is a routing library for use inside a web application, along with Ring.

seancorfield20:12:30

Ring / Compojure are server libraries. clj-http is a client library.

seancorfield20:12:55

(i.e., it acts as a client for consuming web sites / APIs)

kopasetik20:12:57

Yeah, but don’t servers have to make API calls to other servers sometimes?

kopasetik20:12:38

Well, I write servers that have to make http requests for API calls. That’s common, right?

kopasetik22:12:10

REPL question: Is there any way that I jump to the front of the command line (and then back to the end of it)?

kopasetik22:12:39

I don’t like holding down left until i reach the beginning of a line

jtbeckha22:12:04

@kopasetik: what platform are you on? fn-left arrow / fn-right arrow works for me on mac

christopherbui22:12:13

Control A / Control E as well

kopasetik22:12:03

@jtbeckha: Thanks for your willingness to help!

jtbeckha22:12:15

No problem simple_smile

kopasetik23:12:26

How would you create a lazy sequence of positive integers through infinity?

kopasetik23:12:22

of course I could do (map-indexed #(%1) (repeat 1)) and take what i need, but is there a simpler way?

christopherbui23:12:59

user> (take 10 (iterate (partial + 1) 1)) (1 2 3 4 5 6 7 8 9 10)

solicode23:12:04

You can use inc to shorten that a bit: (iterate inc 1)