Fork me on GitHub
#beginners
<
2016-05-04
>
ghaskins02:05:30

i had a question about protocols: I am a little unclear on how to refer to a protocol in a remote namespace

ghaskins02:05:08

all the literature gives examples with defprotocol, deftype, etc in the same module

ghaskins02:05:34

but if I have (ns foo) (defprotocol bar (baz [x])), would I access that as (foo/baz) ?

ghaskins02:05:01

from outside the module, i mean

ghaskins02:05:15

i.e. it seems like the protocol name falls away?

ghaskins02:05:10

nm, i figured out what was happening

kimsnj07:05:01

@lucaska: Maybe you can start playing with Emacs using Org-Mode. It's really great note-taking / journalling / to-do-listing application simple_smile

kimsnj07:05:36

And you won't have to learn a thousand keybindings before using it.

mss16:05:43

anyone know the idiomatic way to validate that an argument to a function is a channel using schema?

mss16:05:49

(protocol Channel) is what I’m currently thinking, just want to make sure there’s not a better way to do it

giga19:05:23

Hello everyone

giga19:05:55

Hello Jeff

giga19:05:32

Finally I have found a time for Clojure, tried IRC channel and in fact no one is there simple_smile so I have questions if anyone is willing to answer...

lucaska19:05:05

Do you guys have any great Clojure projects you can recommend, so I can read some well written source? Maybe download it and eval it?

jeff.engebretsen19:05:59

@lucaska: Do you want small projects or big?

lucaska19:05:37

One of each? 😄

lucaska19:05:12

I’m newer to Clojure, so just seeing how people organize and write a functional program would be cool.

jjfine19:05:54

works on my machine 😕

roberto19:05:06

I’d also recommend to :require instead of :use. :use is considered bad practice.

giga19:05:46

hm, I was trying to make it work for twenty more minutes and it has just worked on my machine too. I guess I have to look up the history of a file to find precise mistake.

giga19:05:42

Thank you @roberto simple_smile I have bought Clojure Programming by Chas but it seems a bit tough to digest.

roberto19:05:01

my preferred clojure book for beginners is Living Clojure

surreal.analysis19:05:06

My guess is that, at some point, you were trying to interact with data outside of the let block

surreal.analysis19:05:27

Getting the parenthesis nested correctly tripped me up a couple of times early on, and I messed up the scope a lot

jeff.engebretsen19:05:44

@lucaska: I wrote an Alexa skill in Clojure. It’s not very big. It’s also my first full app in Clojure so, yeah. https://github.com/JeffEngebretsen/bf-helper. It’s a character generator/ rule and spell lookup tool.

giga19:05:33

At first that was the mistake, but then I figured out and resolved. Now I’ve looked up the history and has found the mistake > (= data (string/reverse data) true false))) true and false should have been after the second closing parentheses, but in fact I eliminated both as they’re redundant.

lucaska19:05:26

@jeff.engebretsen: Thanks, I appreciate that. I also like RPGs so thats a bonus

giga19:05:50

@roberto by the way, can you suggest a “Clojure”(if there is such :))) way of checking for palindrome?

jeff.engebretsen19:05:02

There’s no good site navigation but this blog has a series on writing a rouge-like in clojure. http://stevelosh.com/blog/ Part 1: http://stevelosh.com/blog/2012/07/caves-of-clojure-01/

roberto19:05:53

I have that bookmarked. I’ve learned a lot by looking at the source code for that game.

roberto19:05:18

@giga just a reverse seems to be enough for plain palindromes.

lucaska19:05:24

Oh I remember when he was doing that, I wasn’t looking at Clojure at the time. Nice

giga19:05:47

Honestly, this is the first time I genuinely enjoy by writing code.

tom20:05:42

Is there a way to dynamically set! a var in the CLJS context? I'm trying to do something like this but it's not registering.

(def random-id (symbol "js" (str "id-" (rand-int 10))))
(set! random-id (fn [] (.log js/console "Test")))

magomimmo23:05:25

I just published the in the modern-cljs series the 21th and 22th tutorials: Part I and Part II of a reasoned step by step guide to port the official react tutorial to reagent: https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-21.md and https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-22.md