Re: Newbie Classpath issues on OSX

2020-10-10 Thread Jeremy Heiler
Can you share your project.clj and your project's directory structure? On Oct 3, 2020 at 6:17:36 PM, ok_computer wrote: > After reinstalling Leiningen via brew, I started getting classpath > errors. I uninstalled all my Clojure libs, deleted the ~/.lein folder and > started fresh with a new in

Re: newbie trying to mod a clojure based game

2017-01-29 Thread James Reeves
If you have Leiningen installed, then run: lein cljsbuild once The compiled Javascript will be in target/app.js Admittedly this isn't very obvious to beginners unless you happen to guess what the cljsbuild plugin does. - James On 29 January 2017 at 23:45, James Thorne wrote: > I'm trying

Re: Newbie question

2016-09-05 Thread Andy Fingerhut
On Mon, Sep 5, 2016 at 9:25 AM, hiskennyness wrote: > > In other languages you might see: > > (defn himom [] ..) > (defn himom [x] ...) > (defn himom [x y z] ...) > > > Come to think of it, maybe Clojure does that, too, (nooby myself) but the > Clojure syntax for overloading I know puts each defi

Re: Newbie question

2016-09-05 Thread hiskennyness
On Sunday, September 4, 2016 at 4:58:34 PM UTC-4, Charlie wrote: > > I'm going through the Do Things: A Clojure Crash Course, and the following > example (in REPL) is presented: > > (defn recursive-printer > ([] > (recursive-printer 0)) > ([iteration] > (println iteration) > (

Re: Newbie question

2016-09-04 Thread Charlie
Thanx Colin & James - got it now - Charlie On Sunday, September 4, 2016 at 5:31:40 PM UTC-4, Colin Yates wrote: > > This form allows the fn to have multiple arities. So if I call > (recursive-printer) it will 'invoke' ([] (recursive-printer 0)). If I call > (recursive-printer 1) then it will 'in

Re: Newbie question

2016-09-04 Thread Colin Yates
This form allows the fn to have multiple arities. So if I call (recursive- printer) it will 'invoke' ([] (recursive-printer 0)). If I call (recursive- printer 1) then it will 'invoke' ([iteration] ...). HTH -- Colin Yates colin.ya...@gmail.com On Sun, 4 Sep 2016, at 09:54 PM, Charlie wrote

Re: Newbie question

2016-09-04 Thread James Reeves
Functions in Clojure can behave differently depending on the number of arguments they receive (their "arity"). A function can be written: (defn foo [x] (str "foo" x)) But you can also write: (defn foo ([] "empty foo") ([x] (str "foo" x)) This will do different things d

Re: Newbie Question: Why is "reduced?" used in the reductions function?

2015-10-17 Thread Alex Eberts
Ah, that makes total sense. Thanks for the assistance! best, Alex On Saturday, October 17, 2015 at 7:35:00 AM UTC-4, Nicola Mometto wrote: > > > The `reduced?` check is there in case somebody returns a `reduced` as > acc value from the reducing function, as a way to terminate the > reduction ea

Re: Newbie Question: Why is "reduced?" used in the reductions function?

2015-10-17 Thread Nicola Mometto
The `reduced?` check is there in case somebody returns a `reduced` as acc value from the reducing function, as a way to terminate the reduction early: user=> (reductions (fn [_ x] (if (= 10 x) (reduced x) x)) (range)) (0 1 2 3 4 5 6 7 8 9 10) deref is the way to retrieve the value of a reduced o

Re: Newbie trying HTML parsing

2015-10-16 Thread edbond
Hello Mike, Take a look at hickory, it's more straightforward than enlive if you want to find something in html: https://github.com/davidsantiago/hickory (ns .. (:require [hickory.core :as h] [hickory.select :as hs] [cljs.core.async :as a])) let [html (:

Re: Newbie trying HTML parsing

2015-10-15 Thread James Reeves
On 15 October 2015 at 18:00, Mike wrote: (dzx/xml1-> my-zipper dz/descendants) > > gives me what appears to be the original zipper structure, which I wasn't > expecting. I was expecting a flattened-out seq of the nodes. > The dz/descendants function doesn't return a seq of nodes, but a seq of z

Re: Newbie trying HTML parsing

2015-10-15 Thread Mike
> > I've read the clojure.data.xml.zip docs carefully and looked at many > examples, but I don't understand this behavior: > (require '[clj-http.client :as client] '[clojure.zip :as z] '[clojure.data.zip :as dz] '[clojure.data.zip.xml :as dzx] '[crouton.html

Re: Newbie trying HTML parsing

2015-10-14 Thread James Reeves
It looks like the response body is a string rather than a stream. Try using crouton.html/parse-string instead. - James On 15 October 2015 at 01:27, Mike wrote: > So now I'm trying to make the conversion to Crouton. Of course that is > not going well. Here is a chunk of code: > > (ns one.core

Re: Newbie trying HTML parsing

2015-10-14 Thread Mike
So now I'm trying to make the conversion to Crouton. Of course that is not going well. Here is a chunk of code: (ns one.core (:gen-class)) (require '[clj-http.client :as client] '[clojure.zip :as z] '[clojure.data.zip :as dz] '[clojure.data.zip.xml :as dzx]

Re: Newbie trying HTML parsing

2015-10-14 Thread Matching Socks
(Enlive wraps JSoup and TagSoup and causes them both to return a value in the same format as clojure.xml. Likewise, Enlive's transformation features will work with anything that looks like clojure.xml.) -- You received this message because you are subscribed to the Google Groups "Clojure" grou

Re: Newbie trying HTML parsing

2015-10-14 Thread James Reeves
I'm not that familiar with Enlive, so I can't comment on the ease of that approach. However, the way I'd personally do it is that I'd make use of Crouton and the zipper functions in clojure.zip and clojure.data.zip. A zipper is a functional way of navigating an immutable data structure. So first

Re: Newbie trying HTML parsing

2015-10-14 Thread Mike
Thanks James! You helped me get another step along the way, I got this working. Of course you mentioned Crouton; you should and I asked for advice on my approach. So please allow me to expand the problem statement and you may advise me further... Once I get this HTML parsed, I know that some

Re: Newbie trying HTML parsing

2015-10-14 Thread James Reeves
In the clj-tagsoup example it has the following line: (use 'pl.danieljanus.tagsoup) The use function is like require, except it aliases the vars to the current namespace. So the pl.danieljanus.tagsoup is the namespace to use. If the README doesn't provide any clues, you can sometimes figure

Re: newbie Q: how to tweak file-seq (original: how to selectively iterate through a tree of directories) ?

2015-10-05 Thread Andy-
Try to adapt my code: https://gist.github.com/rauhs/63054a06631c0be598d3 where you change your accept function to incorporate: http://stackoverflow.com/questions/813710/java-1-6-determine-symbolic-links HTH On Saturday, October 3, 2015 at 5:14:51 PM UTC-4, hpw...@gmail.com wrote: > > The direc

Re: newbie Q: where is isSymbolicLink function and how to access it ?

2015-10-05 Thread Ray Miller
You need Java interop for this: (import 'java.nio,file.Files) (Files/isSymbolicLink (.toPath (io/file "/some/path"))) See http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html for the other methods provided by this class. On 5 October 2015 at 16:47, wrote: > > In the clojure.java.

Re: newbie Q: how to tweak file-seq (original: how to selectively iterate through a tree of directories) ?

2015-10-03 Thread Gary Verhaegen
Sorry, I meant :when, not :where. Though it won't change the problem. Here's the rub: first file-seq produces its whole seq, then for comes along and filters out some of it. So (ignoring lazyness) file-seq ha already traversed symbolic links (at least for folders) by the time for sees it. I fear

Re: newbie Q: how to tweak file-seq (original: how to selectively iterate through a tree of directories) ?

2015-10-03 Thread hpwei01
The directory structure is /path/top/dir1 /path/top/dir1/f1 /path/top/dir1/f2 /path/top/dir2 -> /another/path/dir2 -- /another/path/dir2/g1 /another/path/dir2/g2 I tried this (following suggestion): (for [file (file-seq dir) :while (.isFile file)] (.getPath file))

Re: newbie question: how to selectively iterate through a tree of directories ?

2015-10-03 Thread Gary Verhaegen
I'm on Windows at the moment, so I can't test, but I think you can filter on isFile: (for [file (file-seq dir) :where (.isFile file)] (.getName file)) should work, I think. On 3 October 2015 at 07:36, wrote: > Under linux, I have a tree of directories like this: > > /path/top > > /path

Re: newbie question on agent/transaction

2015-07-15 Thread William la Forge
Or perhaps find a way to extend agents. hm? On Wednesday, July 15, 2015 at 9:45:29 AM UTC-4, William la Forge wrote: > > Thanks, Ragnar. > > My reason for asking is that I've implemented a robust form of actor in > Java https://github.com/laforge49/JActor2 and want to play with a > simplified ve

Re: newbie question on agent/transaction

2015-07-15 Thread William la Forge
Thanks, Ragnar. My reason for asking is that I've implemented a robust form of actor in Java https://github.com/laforge49/JActor2 and want to play with a simplified version in Clojure as a first project in the language. But I'm just hardly getting started. I've only been looking at Clojure for

Re: newbie question on agent/transaction

2015-07-15 Thread Ragnar Dahlén
You can check with `(clojure.lang.LockingTransaction/isRunning)` (the io! macro does this) but I'm not sure if it's considered a public API. https://github.com/clojure/clojure/blob/f6a90ff2931cec35cca0ca7cf7afe90ab99e3161/src/clj/clojure/core.clj#L2390 On Wednesday, 15 July 2015 13:53:11 UTC+1,

Re: newbie question on agent/transaction

2015-07-15 Thread Ragnar Dahlén
Hi Bill, You are correct in that this involves close integration with the STM. The agent implementation is aware of transactions and if a transaction is running when dispatching an action, it will be enqneued in a special agent action queue that STM implementation respects. AFAIK there is no p

Re: Newbie

2015-05-01 Thread Brett Morgan
I second, http://www.braveclojure.com. It's a great tutorial. I've switch from using Emacs as IDE to Cursive, an Intellij plugin. https://cursiveclojure.com On Thursday, April 30, 2015 at 4:03:47 PM UTC-4, Jeff Heon wrote: > > I quite like these two resources for total beginners. > > (Starts

Re: Newbie

2015-04-30 Thread Jeff Heon
I quite like these two resources for total beginners. (Starts up assuming you know nothing about Lisp.) aphyr.com/tags/Clojure-from-the-ground-up (Quite humorous) http://www.braveclojure.com/ -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post t

Re: Newbie

2015-04-30 Thread Gary Schiltz
If you like videos, the ClojureTV YouTube channel is a good place to start. Dimitri Sotnokov has a free, concise introduction to the language that you can download from the publisher's page for his book Web Development with Clojure

Re: Newbie question about filtrering defrecord

2015-04-04 Thread Paul L. Snyder
On Sun, 05 Apr 2015, Michael Blume wrote: > your list doesn't contain the records, your list contains the symbols 'a1 > and 'a2. You can't make a list the way you're trying to. To be specific, you're quoting the list in your def, so the a1 and a2 symbols are not evaluated. user=> (defrecord A

Re: Newbie question about filtrering defrecord

2015-04-04 Thread Michael Blume
your list doesn't contain the records, your list contains the symbols 'a1 and 'a2. You can't make a list the way you're trying to. On Sat, Apr 4, 2015 at 5:14 PM Luc Préfontaine wrote: > You mean the a1 record no ? > > > > Hi! > > > > I'm new to clojure, and have problem understanding how to fil

Re: Newbie question about filtrering defrecord

2015-04-04 Thread Luc Préfontaine
You mean the a1 record no ? > Hi! > > I'm new to clojure, and have problem understanding how to filter a list of > defrecords. > I have tried different variations on the following: > > (defrecord Ape [fname lname]) > (def a1 (->Ape "test1" "test2")) > (def a2 (->Ape "test3" "test4")) > (def a

Re: Newbie re-implement 'interleave' found type conversion error

2015-04-02 Thread Stephen Wakely
Instead of : (if (s1) You just want : (if s1 s1 is a Long, not a function. On Thu, Apr 2, 2015 at 8:56 AM michael zhuang wrote: > : i'm new to clojure, when I try to implementation 'interleave', get error > from type convertion "java.lang。Long cannot be cast to clojure.lang.IFN". > ; Now

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-13 Thread Fluid Dynamics
Then all of them must be schizophrenic: forcing delay X while forcing delay X gives a stack overflow except if the delay happens to be the rest-part of a lazy seq, and then gives nil instead making the sequence seem to terminate early. That's very odd. How does it "know" whether the delay it's

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-13 Thread Nicola Mometto
Clojure 1.6.0 user=> (def foo (delay (str @foo))) #'user/foo user=> @foo StackOverflowError clojure.lang.Delay.deref (Delay.java:37) user=> same with Clojure 1.7.0-master-SNAPSHOT, I don't see it returning nil as you said. On Fri, Feb 13, 2015 at 7:53 AM, Fluid Dynamics wrote: > On Friday, Feb

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-13 Thread Nicola Mometto
Clojure 1.5.1 user=> (def bar (cons 1 (map #(do (println %) (+ (nth bar %) %)) (range #'user/bar user=> (take 10 bar) (0 1 IndexOutOfBoundsException clojure.lang.RT.nthFrom (RT.java:795) It is possible that it is lein/REPLy that's causing the output not to be print, I've seen it done a num

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Fluid Dynamics
And here's some really crazy behavior from 1.5.1! => (def bar (cons 1 (map #(do (println %) (+ #_(nth bar %) %)) (range #'user/bar => (take 10 bar) (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 1 0 1 2 3 4 5 6 7 8) => (def bar (cons 1 (map #(do (println

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Fluid Dynamics
On Friday, February 13, 2015 at 12:47:17 AM UTC-5, Justin Smith wrote: > > I don't want to sound too brusque in my defense of Clojure. I'm a huge > fan, so criticism of the language does get me a bit defensive. > I am a fan as well. Constructive criticism is useful as it can lead to improvements

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Justin Smith
To go into a bit more detail about what this code does: Here's the code formatted idiomatically - (defn divides? [x y] (zero? (mod x y))) (defn prime-ub [x] (/ x (if (even? x) 2 3))) (defn lower-primes [primes x] (let [ub (prime-ub x)] (take-while #(<= % ub) primes))) (defn prime? [prime

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Fluid Dynamics
On Friday, February 13, 2015 at 12:05:24 AM UTC-5, Justin Smith wrote: > > it's an infinite lazy sequence with itself as a dependency. The first n > elements see a value of the initial non-lazy prefix. The alternative would > be a compilation error. Nope. Every component of the sequence should

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Justin Smith
it's an infinite lazy sequence with itself as a dependency. The first n elements see a value of the initial non-lazy prefix. The alternative would be a compilation error. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send em

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Justin Smith
it's an infinite lazy sequence with itself as a dependency. The first n elements see a value of the initial non-lazy prefix. The alternative would be a compilation error. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send em

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Fluid Dynamics
On Thursday, February 12, 2015 at 11:24:03 PM UTC-5, Justin Smith wrote: > > Not unbound primes, primes as (cons 2 ...). If you look at my post above > where I added a print statement to prime? the first 32 inputs see (2) as > the value of primes. 32 is the chunking size of the range function.

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Timothy Baldridge
Oh, it's much worse than anyone has mentioned yet. The whole (def primes ...) bit is also a problem. What you are saying to the compiler is "create a var named primes and assign it this lazy-seq...", and then while defining that lazy seq you are creating closures that use "primes". That sort of cir

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Justin Smith
Not unbound primes, primes as (cons 2 ...). If you look at my post above where I added a print statement to prime? the first 32 inputs see (2) as the value of primes. 32 is the chunking size of the range function. -- You received this message because you are subscribed to the Google Groups "Clo

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Jorge Marques Pelizzoni
I really fail to see how this can be related to chunking. So in: (def primes (cons 2 (lazy-seq (filter #(prime? primes %) (drop 3 (range)) *prime?* would be being called with unbound *primes*? And no exception would be raised and again no 4 or even numbers left to testify? Em sexta-feira,

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Justin Smith
Clojure is quite elegant, but it's not always unsurprising. Even if one surprising behavior around lazy-seq realization is changed, others are likely to continue to occur. The solution to this is to not write code that implicitly relies on a specific timing of lazy realization. If you need resu

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Jorge Marques Pelizzoni
Even THIS works now: (defn primes [] (let [primes' (atom nil)] (reset! primes' (cons 2 (filter #(prime? @primes' %) (iterate inc 3)) Em sexta-feira, 13 de fevereiro de 2015 01:28:13 UTC-2, Jorge Marques Pelizzoni escreveu: > > Anyway, I would be in awe that being Closure

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Jorge Marques Pelizzoni
Anyway, I would be in awe that being Closure such an expressive and elegant language its user base is really ok with an state of affairs in which: (def primes (cons 2 (lazy-seq (filter #(prime? primes %) (drop 3 (range)) does not mean what it obviously should and above all means something

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Justin Smith
no, we have not moved past this, and the error is absolutely because you take too much for granted about lazy behavior (defn divides? [x y] (zero? (mod x y))) (defn prime-ub [x] (/ x (if (even? x) 2 3))) (defn lower-primes [primes x] (let [ub (prime-ub x)] (println "primes" primes "x" x) (tak

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Jorge Marques Pelizzoni
So why isn't 4 and any even numbers in the result list? Empty primes' allows everything to pass. We are already beyond this. I've already posted that even this does not work: (def primes (cons 2 (lazy-seq (filter #(prime? primes %) (drop 3 (range)) Em sexta-feira, 13 de fevereiro de 2015

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Justin Smith
Considering for the sake of argument the possibility that it is a legitimate bug, and not a result of misusing the language features, it is a family of bug that will be more common than most, because it reflects a style of programming that is rare in real Clojure code. But it isn't a bug. Lazy

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Jorge Marques Pelizzoni
Not even this works (in which I try to avoid state mutation): (def primes (cons 2 (lazy-seq (filter #(prime? primes %) (drop 3 (range)) Em quinta-feira, 12 de fevereiro de 2015 23:26:03 UTC-2, Fluid Dynamics escreveu: > > AFAICT the issue here is combining lazy evaluation with state mutat

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Fluid Dynamics
AFAICT the issue here is combining lazy evaluation with state mutation. Don't do that. :) -- 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 - p

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Jorge Marques Pelizzoni
Beautiful, Armando! Thanks for your the insight. Anyway, I really don't buy the "that's the way it is" argument. Totally looks like a bug and I don't find it a coincidence it is working differently in the development branch. Thank you all for your time :) Em quinta-feira, 12 de fevereiro de 20

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Justin Smith
This is excellent, I was just working out something similar myself. The version using an atom is not idiomatic Clojure, and isn't a translation of the Haskell version either. On Thursday, February 12, 2015 at 4:30:02 PM UTC-8, Armando Blancas wrote: > > Jorge, I tried this on 1.6 and seemed to w

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Armando Blancas
Jorge, I tried this on 1.6 and seemed to work: (def primes (cons 2 (for [n (iterate inc 3) :when (prime? primes n)] n))) On Thursday, February 12, 2015 at 4:21:45 PM UTC-8, Jorge Marques Pelizzoni wrote: > > Neither did delay help: > > (defn primes [] (let [primes' (atom nil)] >

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Andy Fingerhut
Laziness is pervasive in Haskell, for all computation (unless you force it off with special constructs). Laziness in Clojure is as pervasive as sequences, but it is not for all computation like in Haskell, and sequences have the previously-mentioned features of sometimes-more-eager-than-the-minimu

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Jorge Marques Pelizzoni
Neither did delay help: (defn primes [] (let [primes' (atom nil)] (reset! primes' (delay (cons 2 (filter #(prime? (force (deref primes')) %) (drop 3 (range Serious this is not a bug? Em quinta-feira, 12 de fevereiro de 2015 22:14:46 UTC-2, Jorge Marques Pelizzoni esc

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Jorge Marques Pelizzoni
Thanks, Michael, for your analysis and explanation. However not even this worked: (defn primes [] (let [primes' (atom nil)] (lazy-seq (reset! primes' (lazy-seq (cons 2 (lazy-seq (filter #(prime? (deref primes') %) (drop 3 (range)) And one thing we klnow for sure is th

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Michael Blume
Hmm, upon further investigation I think I would not call this a bug in Clojure that got fixed, I think I'd call this an unspecified behavior in Clojure that happened to break your function and now happens to allow it to work. Your function depends heavily on Clojure's laziness, and laziness is an

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Andy Fingerhut
Or perhaps 1.7.0-alpha5 has a change vs. 1.6.0 that makes this code work by accident. Using lazy sequences to define later elements in terms of the prefix of the sequence up to that point has come up multiple times, usually with the example of generating primes (but different code each time). I d

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Jorge Marques Pelizzoni
Well, that's a bug then :) And seems to have been fixed. Thanks! Em quinta-feira, 12 de fevereiro de 2015 17:51:13 UTC-2, Michael Blume escreveu: > > Oh, well this is fun -- with bleeding edge clojure I get the right answer, > but with 1.6.0 I see the same results you did. > > > -- You receive

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Michael Blume
Oh, well this is fun -- with bleeding edge clojure I get the right answer, but with 1.6.0 I see the same results you did. On Thu Feb 12 2015 at 11:47:54 AM Michael Blume wrote: > Strange, when I run your code I don't get 9 or 15 > > On Thu Feb 12 2015 at 11:02:00 AM Jorge Marques Pelizzoni < > j

Re: [newbie] strange behaviour in self-referential primes lazy-seq attempt

2015-02-12 Thread Michael Blume
Strange, when I run your code I don't get 9 or 15 On Thu Feb 12 2015 at 11:02:00 AM Jorge Marques Pelizzoni < jorge.pelizz...@gmail.com> wrote: > Hi, there! Please bear with me as I am very new to Closure (this is my > second program ever) but have a kind of solid Haskell background. > > I was tr

Re: Newbie Gloss questions - dynamic buffer structure

2015-01-12 Thread Zach Tellman
I'm sorry, that should have been :ubyte. Being able to insert arbitrary data into a codec is a feature, though. On Mon, Jan 12, 2015 at 6:27 AM, Tzach wrote: > Hi Zach > Thanks for the detailed response > > On Wednesday, January 7, 2015 at 7:28:06 AM UTC+2, Zach Tellman wrote: >> >> Hey Tzach, >

Re: Newbie Gloss questions - dynamic buffer structure

2015-01-12 Thread Tzach
Hi Zach Thanks for the detailed response On Wednesday, January 7, 2015 at 7:28:06 AM UTC+2, Zach Tellman wrote: > > Hey Tzach, > > If I understand what you're trying to do, you want something like this: > > [ :uint32 > :ubyte ;; or bit-seq, depending > (delimited-block (prefix uint24 #(- % 5)

Re: Newbie Gloss questions - dynamic buffer structure

2015-01-06 Thread Zach Tellman
Hey Tzach, If I understand what you're trying to do, you want something like this: [ :uint32 :ubyte ;; or bit-seq, depending (delimited-block (prefix uint24 #(- % 5) #(+ % 5))) ] And then you'll need to parse the final block separately. I've left defining the uint24 as an exercise for the

Re: Newbie: adding items to a global vector in doseq

2014-08-14 Thread Tassilo Horn
phi...@free.fr writes: > I have read up on atoms and used swap! to set the urls2 vector atom in > my code. Thanks. > > One problem remains though: I can't retrieve the atom vector's items > > *(nth urls 10)* > > throws the following exception > > java.lang.UnsupportedOperationException: nth not su

Re: Newbie: adding items to a global vector in doseq

2014-08-14 Thread Mike Fikes
Thomas is absolutely right, Philippe. Things also get easier if you avoid, or defer side effects, and first focus on pure functions. So, for example at the REPL, you might first try processing a literal sequence of lines, repeatedly adjusting the processing code, tweaking the regex, until you

Re: Newbie: adding items to a global vector in doseq

2014-08-14 Thread Thomas Heller
Hey, it's not how you'd usually do things in Clojure and I'd consider the use of an atom in this place as "wrong". I was struggling with Clojure in the beginning too and my code looked pretty much like yours, but the faster you get into the Clojure mindset the easier it will be. This might be

Re: Newbie: adding items to a global vector in doseq

2014-08-14 Thread phiroc
Just solved the problem by prepending at at-sign, in both cases: ( *nth @urls 10)(doseq [x @urls] (println x))* Le jeudi 14 août 2014 18:05:25 UTC+2, phi...@free.fr a écrit : > > > Hello, > > I am trying to add URLs contained in a text file (eg. apple.com, > ibm.com...), to a global vector

Re: Newbie: adding items to a global vector in doseq

2014-08-14 Thread phiroc
Hi Mike, I have read up on atoms and used swap! to set the urls2 vector atom in my code. Thanks. One problem remains though: I can't retrieve the atom vector's items *(nth urls 10)* throws the following exception java.lang.UnsupportedOperationException: nth not supported on this type: Atom

Re: Newbie needs help: Unable to resolve symbol....

2014-06-10 Thread Bill Cohagan
I figured out the problem. Although the article fails to mention the need for modifying the (ns ...) form to reflect the *quil* dependency, the code available for download has the needed change. Now I'm on to the next error, this time using the downloaded code. I'll spend a bit more time try

Re: newbie seq question

2014-04-13 Thread François Rey
On 14/04/14 01:29, Stephen Feyrer wrote: To be honest I am still not confident in what I'm doing but there are still avenues to explore. The REPL is you best friend, keep experimenting, keep reading, and I'm sure it will all make sense at some point. On 13/04/14 08:02, François Rey wrote: The

Re: newbie seq question

2014-04-13 Thread Stephen Feyrer
Hi François, Thank you. I have read through each of the articles you've indicated and will read in full the braveclojure book. I am playing the syntax-quotes and will explore the io/resource package. To be honest I am still not confident in what I'm doing but there are still avenues to explore

Re: newbie seq question

2014-04-12 Thread François Rey
On 13/04/14 02:21, Stephen Feyrer wrote: // Get the java file io library (import '(java.io File)) // Get some files (def f (File. "/My/files/")) (def fs (file-seq f)) // Filters for suffixes ".mp3" (def get-mp3 (filter #(.endsWith (.getName %) ".mp3") fs)) // Get the path of

Re: newbie question: how to include external libraries from Leiningen REPL

2013-11-07 Thread Qiu Xiafei
you may have a look at alembic: https://github.com/pallet/alembic -- -- 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

Re: newbie question: how to include external libraries from Leiningen REPL

2013-11-07 Thread Sean Corfield
On Thu, Nov 7, 2013 at 5:18 AM, Starry SHI wrote: > Hi, I am new to clojure and I find lein REPL very convenient to use. But I > have one question: in REPL, how to include functions defined in other > libraries and call them in my clojure code? As Marshall indicated, you need to edit your project

Re: newbie question: how to include external libraries from Leiningen REPL

2013-11-07 Thread Mars0i
I'm pretty new, also. The Leiningen documentation that's easy to find has all of the information you need ... but it's not easy to sort out at first. Cedric Greevey gives the answer for standard libraries that usually come with Clojure. For others, I suggest: Find the library name and versio

Re: newbie question: how to include external libraries from Leiningen REPL

2013-11-07 Thread Cedric Greevey
Assuming the Java or Clojure library is on your classpath, it *should* be usable from the REPL. (import '[java.library SomeClass]) (.foo (SomeClass. 42)) (require '[clojure.contrib.math :as m]) (m/sqrt 42.0) or whatever. (Didn't this exact question just get asked by someone five minutes ago?

Re: Newbie questions: include external libraries from lein REPL

2013-11-07 Thread Cedric Greevey
Assuming the Java or Clojure library is on your classpath, it *should* be usable from the REPL. (import '[java.library SomeClass]) (.foo (SomeClass. 42)) (require '[clojure.contrib.math :as m]) (m/sqrt 42.0) or whatever On Thu, Nov 7, 2013 at 8:00 AM, Starry SHI wrote: > Hi. I am new to c

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-21 Thread Christopher Bird
Laurent, that is outstanding. Thank you so much. Yup, I am working from the particular to the general here, so having a working example really makes a big difference. I must say that this is a really helpful community. Thanks evryone Chris On Monday, October 21, 2013 7:15:38 AM UTC-5, Laurent P

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-21 Thread Laurent PETIT
Hello Christopher, I will try to address exactly your example, with Counterclockwise, and hopefully you'll get the general view of how to do things on the go. So you want to instanciate a new namespace like this : (ns play.xml-example (:require [clojure.zip :as zip] [clojure.data.zip :as zf] [cl

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-19 Thread John Mastro
> John, thanks. Not a stupid question at all. When learning a new language, a > new environment, and using an unfamiliar OS, there are so many moving parts > that it is sometimes hard to know where to begin when tracking stuff down. My > old and favorite line here is that "signposts are generall

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-19 Thread Christopher Bird
John, thanks. Not a stupid question at all. When learning a new language, a new environment, and using an unfamiliar OS, there are so many moving parts that it is sometimes hard to know where to begin when tracking stuff down. My old and favorite line here is that "signposts are generally made b

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-18 Thread John Mastro
> So, clearly I need to get the libs onto the classpath. The questions are > what libs, where and how? Forgive me if this is a stupid question, but have you already listed the dependency coordinates under the :dependencies key of your project.clj? Leiningen has a sample project.clj here: http

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-18 Thread Josh Kamau
Install counterclockwise plugin on your eclipse. Then import your project into eclipse. There right click the project and there is something like "Convert to leiningen project" . Hope that helps. Josh. On Fri, Oct 18, 2013 at 5:41 PM, Christopher Bird wrote: > Josh, thanks for replying. The cod

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-18 Thread Christopher Bird
Josh, thanks for replying. The code sample was from my batch lein and not the counterclockwise version. So I am clearly still totally messed up[! C On Friday, October 18, 2013 9:11:54 AM UTC-5, Josh Kamau wrote: > > I find it easier to let leiningen handle the dependencies. Eclipse via > count

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-18 Thread Josh Kamau
I find it easier to let leiningen handle the dependencies. Eclipse via counterclockwise plugin adds dependencies declared in project.clj to the classpath. Josh On Fri, Oct 18, 2013 at 4:42 PM, Christopher Bird wrote: > I know this is a pretty old thread, but my questions are quite > similar/re

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-18 Thread Christopher Bird
I know this is a pretty old thread, but my questions are quite similar/related, so I figured here would be a good place for them. I am seriously struggling with both the Eclipse/Kepler-CounterClockwise version in general and the command prompt versions of lein. My major issue is how to tell the

Re: Newbie seeks advice

2013-10-07 Thread Nando Breiter
Functional Thinking with Neal Ford http://www.youtube.com/watch?v=JeK979aqqqc Aria Media Sagl Via Rompada 40 6987 Caslano Switzerland +41 (0)91 600 9601 +41 (0)76 303 4477 cell skype: ariamedia On Mon, Oct 7, 2013 at 4:22 PM, vMac wrote: > Thank you very much James for that detailed advice

Re: Newbie seeks advice

2013-10-07 Thread vMac
Thank you very much James for that detailed advice. I think it will take a while to get used to that new programming style. Is there any good source of information for learning functional programming (online, book) you could recommend? I'm right now programming mostly C -stylish with a bit knowle

Re: Newbie seeks advice

2013-10-06 Thread James Reeves
The key to writing an algorithm functionally is to break it up into simple components. You're performing three calculations: (def x (myfunc x)) (def buffer (in_buffer buffer x)) (+ (nth buffer 1) (nth buffer 3)) Let's tackle each in turn. The first is a continually changing value

Re: (newbie-ish) Modelling question - multi methods?

2013-08-12 Thread Jonah Benton
It sounds like it depends on whether the collaborators are properly known to the command, e.g. at command generation/creation time, or to the handler, e.g. at handler creation/registration time. If the former, then it would make sense for each command to be a record that was created with all requi

Re: (newbie-ish) Modelling question - multi methods?

2013-08-12 Thread Colin Yates
Hi Russell, Maybe the concrete case will help. I have a single entry point into which Commands can be posted, let's call it a CommandGateway. This gateway will do many things, the least of which will be to delegate the handling of the command to the command handler registered with the gateway.

Re: (newbie-ish) Modelling question - multi methods?

2013-08-12 Thread Russell Mull
Generally, I'd go for a simple strategy (ahem) like this: (defn make-handler [wibblie wooblie] (fn [woosy] )) But perhaps there's something about your case that I don't understand; I'm not entirely sure where multimethods need to come into it, unless you need to change which handler you'r

Re: newbie struggling with Clooj and jars

2013-08-12 Thread Jason Turner
Thanks very much - that explains it, I didn't realize that Leiningen behaviour had changed from what Clooj expects - I could see the jars were in the Maven repo. On Monday, 12 August 2013 00:51:10 UTC+1, yair wrote: > > The problem is that clooj depends on leiningen 1 which used to have the > d

Re: newbie struggling with Clooj and jars

2013-08-11 Thread yair
The problem is that clooj depends on leiningen 1 which used to have the dependencies in the /lib directory of the project. Leiningen 2 use the maven repo directory (typically ~/.m2) for dependencies and builds the classpath directly to those jars, which you can check by running 'lein classpath

  1   2   3   4   5   6   7   >