Fork me on GitHub
#beginners
<
2016-07-25
>
leo.ribeiro02:07:43

hey guys, why I cannot type quotes on http://www.tryclj.com/ ?

scriptor02:07:44

@leo.ribeiro: double quotes work fine, "foo" worked

scriptor02:07:28

if you're trying to use single quotes, you should know that single quotes are not used for string literals in clojure

leo.ribeiro02:07:54

@scriptor: it must be my computer, language, etc… when I try to type “ nothing happens.

krchia03:07:54

is there a better way to write this?

krchia03:07:52

okay, the proper way to write this since i’m not allowed to mutate let variables 😞

leo.ribeiro03:07:50

@krchia what you want to do?

krchia03:07:03

project euler 4

krchia03:07:08

but i gave up on an elegant solution

krchia03:07:12

just wrapped a loop over it

leo.ribeiro04:07:37

(defn palindrome? [x] (= (str x) (apply str (reverse (str x)))))

krchia04:07:23

@leo.ribeiro: yup, that’s my palindrome 😂

leo.ribeiro04:07:22

krchia: trying to solve the project here 😛

leo.ribeiro04:07:38

krchia: almost there but I need to leave now… (defn palindrome-hp ([min max] (if (> max min) (palindrome-hp min max max) nil)) ([min max cur] (if (palindrome? (* max cur)) (vector (list (* max cur) max cur) (palindrome-hp min (dec max))) (if (> (dec cur) 0) (recur min max (dec cur)) (recur min (dec max) (dec max))))))

leo.ribeiro04:07:03

need to adjust the (vector (list… and then pick the (max (first

leo.ribeiro05:07:14

and this one in case of you don’t need the pairs: (defn palindrome-hp ([min maxx] (when (> maxx min) ((comp last sort) (map #(palindrome-hp min % %) (range min maxx))))) ([min max cur] (if (palindrome? (* max cur)) (* max cur) (if (> (dec cur) 0) (recur min max (dec cur)) (recur min (dec max) (dec max))))))

greenhorse12:07:23

https://www.youtube.com/watch?v=3uXXJ5UmLOw I haven't seen syntax used in this video at 32:06 f(* % %). What is that ?

martinklepsch12:07:42

@greenhorse: most likely a custom font for #(* % %) which is an anonymous function squaring it's argument

ordnungswidrig12:07:34

@greenhorse: I guess it’s „pretty-lambda“ configure for clojure. Or it’s a fork thereof, https://github.com/yonkornilov/clojure-pretty-lambda.el

ordnungswidrig12:07:15

@greenhorse: actually this uses the 𝑓 symbol („mathematic italic small f“) instead of a small lambda: https://github.com/cemerick/.emacs.d#pretty-lambda-and-co

martinklepsch12:07:34

@ordnungswidrig: @greenhorse probably worth noting that this is just editor (emacs) configuration and has nothing to do with actual clojure syntax

ordnungswidrig12:07:09

Good point! And it messes up navigation commands in evil.

dominicm12:07:54

I don't think symbols and ligatures like these are a particularly good idea yet. They still break many things.

akiva13:07:04

I’ve yet to come across the issues. [fingers crossed]

dominicm13:07:17

I also personally decided they're kinda boring after a while 😉

ordnungswidrig16:07:17

you can also do a (defmacro 𝑓 [bindings & body] `(fn bindings @body)) 😛

magoeke21:07:42

Hi. I know that there exist an extra channel for code reviews but mine is a very beginner code that's why I ask here. Can anyone please look through my code and can give me feedback about what I've done right and what wrong. Maybe you can recommend me what'll be the next steps for me to get further into clojure programming. I appreciate everyone's effort 🙂

scriptor21:07:46

@magoeke: this cond expression should just be an or expression of the 4 victory conditions

scriptor21:07:51

@magoeke: also, don't have handle-input call game-loop, this could blow the stack

scriptor21:07:04

instead, have a call to recur inside game-loop

leo.ribeiro23:07:40

any examples on compojure routes which uses path parameters mixed with query parameters?