Re: raspberry pi and clojure

2014-06-12 Thread Atamert Ölçgen
Hi Andre, When I tried to run your code, it didn't compile for me: user=> (defn infinite[f seconds](future (loop [] (f) (Thread/sleep (* seconds 1000)) (recur #'user/infinite user=> (infinite (printf "\nlooping") 10) looping NullPointerException user/infinite/fn--2267 (NO

raspberry pi and clojure

2014-06-12 Thread Andre Perez
Hi everyone, I just started trying to play with a raspberry pi for a variety of reasons, and given that java runs on it, I decided to use this as an opportunity to learn clojure. I'm playing with a blinkIo example which looks like this: public class BlinkGpioExample { public static void ma

Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Gary Trakhman
To be fair, I actually read the thing, but I hoped to see more interesting information on LSD, meditation and Clojure than the headline would suggest :-). On Thu, Jun 12, 2014 at 10:01 PM, Atamert Ölçgen wrote: > There's also Planet Clojure . > > @Divyansh > > Josh, Hussein

Re: [ANN] New templating library - Scijors released

2014-06-12 Thread Atamert Ölçgen
Nice! Since you use Django template syntax, you should get highlighting free in some editors. On Thu, Jun 12, 2014 at 11:31 PM, Marcin Skotniczny wrote: > >

Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Atamert Ölçgen
There's also Planet Clojure . @Divyansh Josh, Hussein and Gary are not the only ones who think this sort of traffic building is uncool. By traffic building I mean; sending a message with a link that has no valuable information for the group members. They are probably just nodd

Re: Functions in data structures?

2014-06-12 Thread Jeremy Heiler
On Thu, Jun 12, 2014 at 9:31 PM, Mike Fikes wrote: > Is there anything wrong with doing something like this? > > (def foo (atom {:fn inc})) > ((:fn @foo) 1) > ; => 2 > > This works in Clojure and ClojureScript. > > Just wondering if placing functions into immutable data structures could > cause a

Functions in data structures?

2014-06-12 Thread Mike Fikes
Is there anything wrong with doing something like this? (def foo (atom {:fn inc})) ((:fn @foo) 1) ; => 2 This works in Clojure and ClojureScript. Just wondering if placing functions into immutable data structures could cause any grief. Or are functions sufficiently “first class” so that this

Re: Instaparse - thank you!

2014-06-12 Thread John Wiseman
Yes, instaparse is awesome. (I use it to parse the grammar definitions of my own natural language parser, which is a little funny). On Thu, Jun 12, 2014 at 4:23 PM, Daniel Kersten wrote: > I started playing with Instaparse recently too and its by far the nicest > parsing library I've used (aft

[ANN] New templating library - Scijors released

2014-06-12 Thread Marcin Skotniczny
It's my great pleasure to announce the first public release of my templating libr

Re: Instaparse - thank you!

2014-06-12 Thread Daniel Kersten
I started playing with Instaparse recently too and its by far the nicest parsing library I've used (after having used a few in C++, Java and Python over the years). It makes parsing a pleasant and fun experience :) So: Thank You Mark! On 12 June 2014 03:43, Devin Walters wrote: > I think it's

Re: How to unit test (defn-) functions?

2014-06-12 Thread Sean Corfield
On Thu, Jun 12, 2014 at 7:33 AM, Timothy Baldridge wrote: > I say this too many times on this list, but I'll say it again. The best way > to test defn- functions is to never use defn- in the first place. Instead > move implementation functions into an internal namespace that way they can > be acce

Re: Given a CSV file, how do I take the values in each row and convert it into a map?

2014-06-12 Thread Devin Walters
I tend to do this: (require '[clojure.data.csv :as csv]) (require '[clojure.java.io :as io]) (require '[clojure.walk :as walk]) (let [[header rows] (-> "my.csv" io/file io/reader csv/read-csv)] (map #(-> (zipmap header %)

Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Gary Trakhman
Twitter's a more organic way to do this. Your followers can read it, decide to retweet or not. On Thu, Jun 12, 2014 at 5:37 PM, Divyansh Prakash < divyanshprakas...@gmail.com> wrote: > Sorry if you feel that way. Thought i could share my thoughts and start an > interesting discussion. > That is

Re: Given a CSV file, how do I take the values in each row and convert it into a map?

2014-06-12 Thread Marc Limotte
See https://github.com/clojure-cookbook/clojure-cookbook/blob/master/04_local-io/4-20_read-write-csv.asciidoc Which will give you a seq of the values for each row. To get Maps, try this: (def headers ["colA" "colB" ...]) (map (partial zipmap headers) result-of-read-csv) If your headers are the

Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Divyansh Prakash
Sorry if you feel that way. Thought i could share my thoughts and start an interesting discussion. That is what the group is for. You are obviously free to skip anything that doesn't interest you. That was the prime reason for the concise title. I have no intentions of misleading anyone. -- You

Given a CSV file, how do I take the values in each row and convert it into a map?

2014-06-12 Thread Shelley Tong
kinda like a key value pair for each row -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubsc

Re: Search seqs in seqs

2014-06-12 Thread Alex Walker
Updated the gist to fix a case '(:a :b) should've returned '((:a :b)) to match partition-by. New: The sub-seq can optionally contain fns, just like partition-by's f param. ;; Case: using a seq of fns instead of values (= (partition-by-seq [odd? odd? even?] [1 2 3 5 6 7 8 9 11 12]) '((1 2) (

if else list of commands

2014-06-12 Thread Mike Fikes
Also, check out when and when-not, which are great for conditionally executing some imperative code. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are mo

delete-file needs to be vector?

2014-06-12 Thread Mike Fikes
I had the same happen to me several times and then I got wise to it :) It is a correct diagnostic, but it would arguably be better if it could somehow simply indicate “function definition is missing a parameter declaration.” -- You received this message because you are subscribed to the Google

Re: delete-file needs to be vector?

2014-06-12 Thread Kevin Ilchmann Jørgensen
You seem to be missing the parameter vector (defn del-temps [] ..) On Jun 12, 2014 6:14 PM, "Glen Rubin" wrote: > I wrote a fn to delete a couple files: > > (defn del-temps > (clojure.java.io/delete-file "C:/temp/fs.png" true) > (clojure.java.io/delete-file "C:/temp/fs.txt" true)) > > > Whe

delete-file needs to be vector?

2014-06-12 Thread Glen Rubin
I wrote a fn to delete a couple files: (defn del-temps (clojure.java.io/delete-file "C:/temp/fs.png" true) (clojure.java.io/delete-file "C:/temp/fs.txt" true)) When I run my program I get the following error: Exception in thread "main" java.lang.IllegalArgumentException: Parameter dec

Re: if else list of commands

2014-06-12 Thread Timothy Baldridge
(if true (do (something) (something-else)) (do (something) 42)) On Thu, Jun 12, 2014 at 9:33 AM, Glen Rubin wrote: > Pretty basic question. How do I run a couple commands in the else section > on an if-else function? Or can I only run one and need to define > a function that

if else list of commands

2014-06-12 Thread Glen Rubin
Pretty basic question. How do I run a couple commands in the else section on an if-else function? Or can I only run one and need to define a function that does both commands? THanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Re: Clojure on iOS devices - Swift as a host?

2014-06-12 Thread Mike Fikes
Not me, but if I needed to build a web app, Cappuccino and Om would be on my list of things to dig into -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are

Re: How to unit test (defn-) functions?

2014-06-12 Thread Timothy Baldridge
There are 6 defn-'s in there? Rich must have wrote that code :-P . But yes, defn- is mostly used in clojure.core and other such libraries for functions that are created to simplify other functions. And I would probably never test those. Even then I would caution about using defn- too much as some

Re: Clojure on iOS devices - Swift as a host?

2014-06-12 Thread Gregg Reynolds
On Thu, Jun 12, 2014 at 8:14 AM, Mike Fikes wrote: > Hi Devin, > > A great place to start is > http://web.cecs.pdx.edu/~cpinera/javascriptcore-integration-with-clojurescript-in-ios.html > (some slight modifications are required to get that blog post examples > working with the latest, but it's no

Re: How to unit test (defn-) functions?

2014-06-12 Thread J Irving
Hey Timothy So I honestly don't mean to be a smart ass, but there are 6 defn- functions in clojure.core.async - how do you test those? Or are they just considered internals to other public functions? cheers, J On Thu, Jun 12, 2014 at 10:33 AM, Timothy Baldridge wrote: > I say this too many ti

Re: How to unit test (defn-) functions?

2014-06-12 Thread Timothy Baldridge
I say this too many times on this list, but I'll say it again. The best way to test defn- functions is to never use defn- in the first place. Instead move implementation functions into an internal namespace that way they can be accessed if needed, but are out of the way of the public api. It also m

Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Hussein B.
Thanks. Now, I have a clue how to skip some posts here. On Thursday, June 12, 2014 3:41:13 PM UTC+2, Divyansh Prakash wrote: > > I compare Clojure to acid in this > > rant. > -- You received this message because you ar

Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Josh Kamau
I feel "USED" when you use the mailing list to drive traffic to your blog. On Thu, Jun 12, 2014 at 4:44 PM, Divyansh Prakash < divyanshprakas...@gmail.com> wrote: > (and rant about other stuff I don't know a whole lot about) > > -- > You received this message because you are subscribed to the Go

Re: How to unit test (defn-) functions?

2014-06-12 Thread mynomoto
You can use a macro. Look how on http://nakkaya.com/2009/11/18/unit-testing-in-clojure/ On Thursday, June 12, 2014 5:44:21 AM UTC-3, Hussein B. wrote: > > Hi, > > I like to use (defn-) when it comes to internal implementation functions. > But since they aren't exposed, how to unit test them? > >

Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Divyansh Prakash
(and rant about other stuff I don't know a whole lot about) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your fir

Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Divyansh Prakash
I compare Clojure to acid in this rant. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from ne

Re: Clojure on iOS devices - Swift as a host?

2014-06-12 Thread Devin Walters
Very helpful info Mike, thank you. I'll fire up Xcode this weekend, give what you're saying a try, and report back. Thanks! '(Devin Walters) > On Jun 12, 2014, at 8:14, Mike Fikes wrote: > > Hi Devin, > > A great place to start is > http://web.cecs.pdx.edu/~cpinera/javascriptcore-integration

Re: [ANN] CrossClj, a tool for cross-referencing the clojure ecosystem

2014-06-12 Thread Devin Walters
You may be right about the union of all of these sites being difficult to harmonize "editorially", but I will stubbornly continue to dream of that tool/explorer anyhow. :) As for open source, no big deal if you don't ultimately decide to make your code available. You seem to know the drill, and

Re: Clojure on iOS devices - Swift as a host?

2014-06-12 Thread Mike Fikes
Hi Devin, A great place to start is http://web.cecs.pdx.edu/~cpinera/javascriptcore-integration-with-clojurescript-in-ios.html (some slight modifications are required to get that blog post examples working with the latest, but it's not that hard). Another great resource is the WWDC 2013 video

Re: How to unit test (defn-) functions?

2014-06-12 Thread James Reeves
On 12 June 2014 09:44, Hussein B. wrote: > > I like to use (defn-) when it comes to internal implementation functions. > But since they aren't exposed, how to unit test them? > Generally speaking it's a bad idea to unit-test private functions (in any language), as they're implementation details.

Re: [ANN] CrossClj, a tool for cross-referencing the clojure ecosystem

2014-06-12 Thread Francesco Bellomi
Hi Devin, I'm a strong believer in contributing to the community. CrossClj is my first attempt to contribute to the clojure community, and I hope to do more in the future, even in source code form. At the moment, I don't feel like it's the right time to release the source code: it's a sort of

Re: How to unit test (defn-) functions?

2014-06-12 Thread Ray Miller
On 12 June 2014 09:44, Hussein B. wrote: > Hi, > > I like to use (defn-) when it comes to internal implementation functions. > But since they aren't exposed, how to unit test them? > > Of course, I'm using Lein and clojure.test It feels like a bit of a hack, but: (#'other-ns/private-fn ...) sho

How to unit test (defn-) functions?

2014-06-12 Thread Hussein B.
Hi, I like to use (defn-) when it comes to internal implementation functions. But since they aren't exposed, how to unit test them? Of course, I'm using Lein and clojure.test Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this