Re: getting started: generated address-book directory does not match tutorial

2016-01-30 Thread gianluca torta
are you using leiningen 2.x?

in such a case, it should download and install the desired template on the 
fly when you give command:
$ lein new hoplon address-book

hth,
Gianluca

On Saturday, January 30, 2016 at 3:54:32 AM UTC+1, hiskennyness wrote:
>
> [Also posted in the Hoplon github issues area.]
>
>
> I have been working thru the 
> https://github.com/hoplon/hoplon/wiki/Get-Started guide on a brand new 
> Ubuntu VM running under vmware on windows 10 and all went well until:
>
> lein new hoplon address-book
>
> That actually went fine, but the resulting directory does not match at all 
> the contents advertised in the tutorial. I just see .gitignore, 
> project.clj, README, and two sub-directories, src and test. And src just 
> has a hoplon directory containing core.clj. The README looks like a stub.
>
> I tried: lein new hoplon-template address-book as well, and the castra 
> template. Same result. It looks as if I am not getting a web client 
> template, actually.
>
> I think the only mistake I made following the tutorial was installing boot 
> before leiningen.
>
> Did I miss a step?
>
> Thx, kenneth
>

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


error in receipe 1 of "Clojure Data Structures and Algorithms Cookbook"?

2016-01-29 Thread gianluca torta
Hi all,

I have just started reading this book, and went through the 1st Recipe:
https://www.packtpub.com/application-development/clojure-data-structures-and-algorithms-cookbook

Unfortunately, the recipe apparently does not work. On page 2, the author 
informally describes the recipe as taking:
["a" "a" "a" "b" "b" "b" "b" "b" "b" "b" "c" "c"]

and producing a "compressed" version looking like:
[3 times "a", 7 times "b", 2 times "c"]
i.e., recognizing the repetitions of characters

The code in the book (which can be downloaded after registration from the 
above site), however, produces the following:
(LZ77 ["a" "a" "a" "b" "b" "b" "b" "b" "b" "b" "c" "c"] 100)
;=> ["a" [1 1] "a" "b" [1 1] "b" [3 3] "b" "c" [1 1]]

(100 is just the size of the history window used by the compression 
function)

While I would have expected:
["a" [1 3] "b" [1 7] "c" [1 2]]

Has anyone tried the recipe and can (dis)confirm my experience?

Thanks in advance

Cheers
Gianluca

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: macro question

2016-01-27 Thread gianluca torta
Hi Dan,


And, if I understand correctly, what was really happening with the macro 
> bar was that in ('+ 2 'u), '+ was looking itself up in 2, not finding 
> itself, and so returning the default value 'u. This was the expansion of 
> the macro, and so at run time, it was bound to 10.
>
>
exactly, indeed one would expect that the list:
('+ 2 'u)

would throw an exception, since the first element does not evaluate to a 
macro/function

however, Clojure allows the use of symbols (in this case, '+) as functions 
that lookup themselves into the collection that follows

this special syntax does not apply to numbers:
(1 2 'u)
;=> ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn  
user/eval7633 (form-init2468783434806143559.clj:1)

cheers,
Gianluca

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can anyone help with a jug problem in clojure

2016-01-26 Thread gianluca torta
Hi Steve,

this lookslike a typical problem that requires "artificial intelligence" 
(AI) search:
http://www.tutorialspoint.com/artificial_intelligence/artificial_intelligence_popular_search_algorithms.htm

once you have a general strategy based on the above algos in mind, a quite 
orthogonal problem is how to encode it and solve it in Clojure

looking forward to your thoughts

cheers,
Gianluca

On Tuesday, January 26, 2016 at 12:37:07 PM UTC+1, stevega...@gmail.com 
wrote:
>
> Hi, i am completely new to clojure and i have been given the task of 
> finding 3 different ways of solving the problem here: 
> https://uva.onlinejudge.org/external/5/571.html
>
> Im hoping that if someone can point me in right direction of a solution 
> hopefully ill be able to figure out the other 2 solutions from that
>
> thanks
>

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question concerning eval

2016-01-14 Thread gianluca torta
Hi Adrian,

with your suggestion it certainly works also with avec'

however, I still don't see why the original code from Burt works with avec 
and does not work with avec'

cheers,
Gianluca

On Thursday, January 14, 2016 at 5:06:02 PM UTC+1, adrian...@mail.yu.edu 
wrote:
>
> You need to quote the entire vector `avec`, because otherwise the function 
> you want to bind to `foo` will be evaluated before being evaluated by the 
> `let` special operator, which expects only standard readable object 
> literals to be embedded.  
>
> Try changing:
>
> (def avec
>   ['p   true
>   'foo (fn [x] (+ 2 x))])
>
>
> to:
>
>
> (def avec
>   '[p   true
> foo (fn [x] (+ 2 x))])
>
>
> On Thursday, January 14, 2016 at 5:05:55 AM UTC-5, Burt wrote:
>>
>> Hi, 
>>
>> I got an exception using eval and I do not understand why!
>> Can anybody explain what happens?
>>
>> Here is a small piece of code showing the problem:
>>
>> (defn eval-phi [avec phi]
>>   (eval `(let ~avec ~phi)))
>>
>> ; The idea of eval-phi is the evaluation of
>> ; arbitrary lists where the symbols are
>> ; defined in avec
>>
>> ; example:
>> ; in avec the symbol p is defined as true
>> ; and the symbol foo as a function adding 2
>>
>> (def avec
>>   ['p   true
>>   'foo (fn [x] (+ 2 x))])
>>
>> ; here are two lists
>> (def phi '(and p (= 7 (foo 5
>> (def psi '(and (not p) (= 7 (foo 5
>>
>> ; and here their evaluation
>> (eval-phi avec phi)
>> ; => true
>> (eval-phi avec psi)
>> ; => false
>>
>> ; second approach:
>> ; the attempt to give the definition of a
>> ; function in avec by a function which
>> ; returns a function leads to an exception:
>>
>> (defn make-adder [n]
>>   (fn [x] (+ n x)))
>>
>> ((make-adder 2) 5)
>> ; => 7
>>
>> ; here the second definition of a binding vector:
>> (def avec'
>>   ['p true
>>'foo (make-adder 2)])
>>
>> (eval-phi avec' phi)
>> ; CompilerException java.lang.ExceptionInInitializerError
>>
>> ; in my mental model of the substitution of symbols by 
>> ; their value there should be no difference between the
>> ; first approach and the second.
>>
>> ; Actually avec' contains the function returned by make-adder
>> ((nth avec' 3) 5)
>> ; => 7
>>
>> ; Why does avec' leads to an exception?
>>
>>
>> *Kind regards,*
>>
>> *Burkhardt Renz*
>>
>>

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question concerning eval

2016-01-14 Thread gianluca torta
Hi Burt,

I have done some investigation, further reducing your issue to the 
following:

(def g (make-adder 2))
(eval `(let [~'f ~g] (~'f 5)))
; --> error IllegalArgumentException No matching ctor found for class 
user$make_adder$fn__7609 etc.

(defn h [x] (+ x 2))
(eval `(let [~'f ~h] (~'f 5)))
; --> 7

but it is still not completely clear to me why they behave differently

hth,
Gianluca



On Thursday, January 14, 2016 at 11:05:55 AM UTC+1, Burt wrote:
>
> Hi, 
>
> I got an exception using eval and I do not understand why!
> Can anybody explain what happens?
>
> Here is a small piece of code showing the problem:
>
> (defn eval-phi [avec phi]
>   (eval `(let ~avec ~phi)))
>
> ; The idea of eval-phi is the evaluation of
> ; arbitrary lists where the symbols are
> ; defined in avec
>
> ; example:
> ; in avec the symbol p is defined as true
> ; and the symbol foo as a function adding 2
>
> (def avec
>   ['p   true
>   'foo (fn [x] (+ 2 x))])
>
> ; here are two lists
> (def phi '(and p (= 7 (foo 5
> (def psi '(and (not p) (= 7 (foo 5
>
> ; and here their evaluation
> (eval-phi avec phi)
> ; => true
> (eval-phi avec psi)
> ; => false
>
> ; second approach:
> ; the attempt to give the definition of a
> ; function in avec by a function which
> ; returns a function leads to an exception:
>
> (defn make-adder [n]
>   (fn [x] (+ n x)))
>
> ((make-adder 2) 5)
> ; => 7
>
> ; here the second definition of a binding vector:
> (def avec'
>   ['p true
>'foo (make-adder 2)])
>
> (eval-phi avec' phi)
> ; CompilerException java.lang.ExceptionInInitializerError
>
> ; in my mental model of the substitution of symbols by 
> ; their value there should be no difference between the
> ; first approach and the second.
>
> ; Actually avec' contains the function returned by make-adder
> ((nth avec' 3) 5)
> ; => 7
>
> ; Why does avec' leads to an exception?
>
>
> *Kind regards,*
>
> *Burkhardt Renz*
>
>

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question concerning eval

2016-01-14 Thread gianluca torta
small update: I found that the problem happens because make-adder returns a 
closure; with a simple function it works:

(defn make-2-adder [] (fn [x] (+ 2 x)))
(def g2 (make-2-adder))
(eval `(let [~'f ~g2] (~'f 5)))
; --> 7


On Thursday, January 14, 2016 at 12:52:47 PM UTC+1, gianluca torta wrote:
>
> Hi Burt,
>
> I have done some investigation, further reducing your issue to the 
> following:
>
> (def g (make-adder 2))
> (eval `(let [~'f ~g] (~'f 5)))
> ; --> error IllegalArgumentException No matching ctor found for class 
> user$make_adder$fn__7609 etc.
>
> (defn h [x] (+ x 2))
> (eval `(let [~'f ~h] (~'f 5)))
> ; --> 7
>
> but it is still not completely clear to me why they behave differently
>
> hth,
> Gianluca
>
>
>
> On Thursday, January 14, 2016 at 11:05:55 AM UTC+1, Burt wrote:
>>
>> Hi, 
>>
>> I got an exception using eval and I do not understand why!
>> Can anybody explain what happens?
>>
>> Here is a small piece of code showing the problem:
>>
>> (defn eval-phi [avec phi]
>>   (eval `(let ~avec ~phi)))
>>
>> ; The idea of eval-phi is the evaluation of
>> ; arbitrary lists where the symbols are
>> ; defined in avec
>>
>> ; example:
>> ; in avec the symbol p is defined as true
>> ; and the symbol foo as a function adding 2
>>
>> (def avec
>>   ['p   true
>>   'foo (fn [x] (+ 2 x))])
>>
>> ; here are two lists
>> (def phi '(and p (= 7 (foo 5
>> (def psi '(and (not p) (= 7 (foo 5
>>
>> ; and here their evaluation
>> (eval-phi avec phi)
>> ; => true
>> (eval-phi avec psi)
>> ; => false
>>
>> ; second approach:
>> ; the attempt to give the definition of a
>> ; function in avec by a function which
>> ; returns a function leads to an exception:
>>
>> (defn make-adder [n]
>>   (fn [x] (+ n x)))
>>
>> ((make-adder 2) 5)
>> ; => 7
>>
>> ; here the second definition of a binding vector:
>> (def avec'
>>   ['p true
>>'foo (make-adder 2)])
>>
>> (eval-phi avec' phi)
>> ; CompilerException java.lang.ExceptionInInitializerError
>>
>> ; in my mental model of the substitution of symbols by 
>> ; their value there should be no difference between the
>> ; first approach and the second.
>>
>> ; Actually avec' contains the function returned by make-adder
>> ((nth avec' 3) 5)
>> ; => 7
>>
>> ; Why does avec' leads to an exception?
>>
>>
>> *Kind regards,*
>>
>> *Burkhardt Renz*
>>
>>

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: mexpand on macrolet

2015-12-07 Thread gianluca torta
Hi Hunter,

however, in this way you are expanding the application of the macro 
"symbol-macrolet" (which is itself a macro), not just the symbol macro "b":

(pprint (mexpand-1 '(symbol-macrolet [b (+ 1 2)] b ["something" "else"])))
;; (do (+ 1 2) ["something" "else"])
;; nil

cheers,
Gianluca

On Monday, December 7, 2015 at 5:09:44 PM UTC+1, retnuH wrote:
>
> This worked for me (after some experimentation):
>
> (pprint (mexpand-1 '(symbol-macrolet [b (+ 1 2)] b)))
>
> ;; (do (+ 1 2))
> ;; nil
>
>
> Cheers, 
>
> H
>
> On Saturday, 5 December 2015 07:45:38 UTC, Ritchie Cai wrote:
>>
>> I'm not sure how to print a macroexpand on macros that defined in 
>> macrolet or symbol-macrolet.
>>
>> with normal macros, I can do:
>>
>> (defmacro test-macro [] '(+ 1 2))
>> (pprint (macroexpand-1 '(test-macro))) 
>>
>> ;; (+ 1 2)
>> ;; nil
>>
>> but with macrolet or symbol-macrolet:
>>
>> (symbol-macrolet [(b [] '(+ 1 2))]
>>(pprint (mexpand-1 '(b
>>
>> ;; (b)
>> ;; nil
>>
>> (symbol-macrolet [(b [] '(+ 1 2))]
>>(pprint (mexpand-1 (b
>>
>> ;; 3
>> ;; nil
>>
>> what am I doing wrong?
>>
>> Thanks
>> Ritchie
>>
>>

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Extend ns macro?

2015-12-02 Thread gianluca torta
for some reason, it looks like the implementation of the ns macro assumes 
that the macro itself is being defined in namespace clojure.core

try defining myns in the namespace clojure.core, and it should work

cheers,
Gianluca

On Tuesday, December 1, 2015 at 9:49:08 PM UTC+1, Gregg Reynolds wrote:
>
> I'm trying to extend ns, to add some functionality, but it's not working.  
> Is it even possible?  If not, is there a way to implement a custom 
> version?  I can defmacro my-ns in namespace foo and then start a file with 
> (foo/my-ns ...), but I can't get it to behave like ns (I copied the ns code 
> from core.)  Plus I want (my-ns...), without the foo/.
>
> Suggestions? 
>
> Gregg
>

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Poor parallelization performance across 18 cores (but not 4)

2015-11-18 Thread gianluca torta
by the way, have you tried both Oracle and Open JDK with the same results?
Gianluca

On Tuesday, November 17, 2015 at 8:28:49 PM UTC+1, Andy Fingerhut wrote:
>
> David, you say "Based on jvisualvm monitoring, doesn't seem to be 
> GC-related".
>
> What is jvisualvm showing you related to GC and/or memory allocation when 
> you tried the 18-core version with 18 threads in the same process?
>
> Even memory allocation could become a point of contention, depending upon 
> how the memory allocation works with many threads.  e.g. Depends on whether 
> a thread gets a large chunk of memory on a global lock, and then locally 
> carves it up into the small pieces it needs for each individual Java 'new' 
> allocation, or gets a global lock for every 'new'.  The latter would give 
> terrible performance as # cores increase, but I don't know how to tell 
> whether that is the case, except by knowing more about how the memory 
> allocator is implemented in your JVM.  Maybe digging through OpenJDK source 
> code in the right place would tell?
>
> Andy
>
> On Tue, Nov 17, 2015 at 2:00 AM, David Iba  > wrote:
>
>> correction: that "do" should be a "doall".  (My actual test code was a 
>> bit different, but each run printed some info when it started so it doesn't 
>> have to do with delayed evaluation of lazy seq's or anything).
>>
>>
>> On Tuesday, November 17, 2015 at 6:49:16 PM UTC+9, David Iba wrote:
>>>
>>> Andy:  Interesting.  Thanks for educating me on the fact that atom 
>>> swap's don't use the STM.  Your theory seems plausible... I will try those 
>>> tests next time I launch the 18-core instance, but yeah, not sure how 
>>> illuminating the results will be.
>>>
>>> Niels: along the lines of this (so that each thread prints its time as 
>>> well as printing the overall time):
>>>
>>>1.   (time
>>>2.(let [f f1
>>>3.  n-runs 18
>>>4.  futs (do (for [i (range n-runs)]
>>>5. (future (time (f)]
>>>6.  (doseq [fut futs]
>>>7.@fut)))
>>>
>>>
>>> On Tuesday, November 17, 2015 at 5:33:01 PM UTC+9, Niels van Klaveren 
>>> wrote:

 Could you also show how you are running these functions in parallel and 
 time them ? The way you start the functions can have as much impact as the 
 functions themselves.

 Regards,
 Niels

 On Tuesday, November 17, 2015 at 6:38:39 AM UTC+1, David Iba wrote:
>
> I have functions f1 and f2 below, and let's say they run in T1 and T2 
> amount of time when running a single instance/thread.  The issue I'm 
> facing 
> is that parallelizing f2 across 18 cores takes anywhere from 2-5X T2, and 
> for more complex funcs takes absurdly long.
>
>
>1. (defn f1 []
>2.   (apply + (range 2e9)))
>3.  
>4. ;; Note: each call to (f2) makes its own x* atom, so the 
>'swap!' should never retry.
>5. (defn f2 []
>6.   (let [x* (atom {})]
>7. (loop [i 1e9]
>8.   (when-not (zero? i)
>9. (swap! x* assoc :k i)
>10. (recur (dec i))
>
>
> Of note:
> - On a 4-core machine, both f1 and f2 parallelize well (roungly T1 and 
> T2 for 4 runs in parallel)
> - running 18 f1's in parallel on the 18-core machine also parallelizes 
> well.
> - Disabling hyperthreading doesn't help.
> - Based on jvisualvm monitoring, doesn't seem to be GC-related
> - also tried on dedicated 18-core ec2 instance with same issues, so 
> not shared-tenancy-related
> - if I make a jar that runs a single f2 and launch 18 in parallel, it 
> parallelizes well (so I don't think it's machine/aws-related)
>
> Could it be that the 18 f2's in parallel on a single JVM instance is 
> overworking the STM with all the swap's?  Any other theories?
>
> Thanks!
>
 -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 unsubscribe from this group, send email to

Re: Writing Friendlier Clojure

2015-10-13 Thread gianluca torta
Hi,

"Whenever you notice this pattern, you can probably turn to one of the 
> threading macros instead." 
>
> that would fly in the face of being more declarative; when we start to 
> put in explicit ordering, instead of leaving it as just relationships, 
> that can be bad. of course it can also be good. even both at the same 
> time. 
>
 
at least in this example, ordering is required for the operations to 
produce the correct result, so I would say it for good

cheers,
-Gianluca

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with macro.

2015-10-04 Thread gianluca torta


>
> Yes, your solution works, but only on clojure. ClojureScript doesn't have 
> `resolve`. It there any portable solution?
>
>
I'm not sure if and how you can do it in ClojureScript... have you tried:
https://groups.google.com/forum/#!forum/clojurescript 

cheers,
Gianluca

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with macro.

2015-10-03 Thread gianluca torta
Hi,

the behavior you describe is not specific to macros, but is due to the use 
of aliases

after:
(require '[foo.bar :as b])

this will give you false:
(= 'foo.bar/x (first '(b/x)))

while this will give you true:
(= 'foo.bar/x (first '(foo.bar/x)))

one way to solve it, is comparing the resolved vars instead of the names:
(= (resolve 'foo.bar/x) (resolve (first '(b/x
;=>true
(= (resolve 'foo.bar/x) (resolve (first '(foo.bar/x
;=>true

hth,
Gianluca


On Saturday, October 3, 2015 at 3:03:49 PM UTC+2, Andrey Antukh wrote:
>
> Hi!
>
> I have a little trouble writing a macro because I'm getting unexpected 
> (for me) behavior.
>
> Let see some code:
>
> (ns foo.bar)
>
> (defn debug
>   [x]
>   (println "debug:" x)
>   x)
>
> (defn debug-expr?
>   [expr]
>   (and (seq? expr)
>(symbol? (first expr))
>*(= 'foo.bar/debug  (first expr))*))
>
> (defmacro without-debug
>   [& body]
>   (let [body' (reduce (fn [acc v]
> (if (debug-expr? v)
>   (conj acc (second v))
>   (conj acc v)))
>   [] body)]
> `(do
>~@body')))
>
>
> And then I use it from other namespace:
>
> (ns foo.baz)
>
> (require '[foo.bar :as b])
>
> (macroexpand '(b/without-debug (b/debug 3)))
> ;; => (do (b/debug 3))
>
> (macroexpand '(b/without-debug (foo.bar/debug 3)))
> ;; =>(do 3)
>   
> I expect that the both expressions will evaluate to the same result, but 
> is not. Seems that symbols inside macros are not fully qualified. It there 
> any way to get them fully qualified? I'm missing something?
>
> Any help is welcome!
>
> Thank you very much.
>
> Andrey
> -- 
> Andrey Antukh - Андрей Антух - 
> http://www.niwi.nz
> https://github.com/niwinz
>

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: macro help

2015-10-02 Thread gianluca torta
Hi Colin,

as far as I can tell, your solution looks fine... here are a couple of 
comments on your step-by-step analysis

cheers,
Gianluca


1(defmacro form [state & elements]
> 2  (let [m-state (gensym)]
> 3`(let [~m-state ~state]
> 4   [:div.form.horizontal
> 5~@(map (fn [[f m & rest]]
> 6 `[~f (assoc ~m
> 7 :value (get @(:values ~m-state) (:id ~m))
> 8 :on-change #(swap! (:values ~m-state) assoc 
> (:id ~m) "UPDATED"))
> 9   ~@rest])
> 10   elements)])))
>
> 0 - ` means "emit, don't evaluate", ~@ means "splice, e.g. remove the 
> outer sequence so [a ~@[1 2]] becomes [a 1 2] and ' means 'the symbol of 
> rather than the value of'.
>
~@ means "evaluate and splice", i.e., it overrides the "don't evaluate" of 
` and splices the result in the outer sequence
~ means just "evaluate" without the splicing
 

> 2 - declare m-state, which is lexically scoped to the macro and is bound 
> to a random identifier created by gensym
> 3 - the back-tick (syntax-quote) returns the form rather than evaluating 
> the form, so the macro will return (let* [m-8_324230_ ]) The [~m-state 
> ~state] is just bewildering though.
> 3 - in addition, the 'state' argument appears to be destructured, but only 
> to one level so if the state contains an atom it is the var of the atom
>
'state' is evaluated due to ~, not sure what you mean by 'destructured, but 
only to one level'
 

> 4 - literal text emitted in-line
> 5 - splice the results of the map (i.e. rather than [:div.form.horizontal 
> [child1 child2]] return [:div.form.horizontal child1 child2])
> 5 - also destructure each element assuming [f m(ap) and 0 or more other 
> args]
>
yes, the destructuring is just a normal destructuring of the args passed to 
the fn by map
 

> 6 - emit [ where  is the first symbol, 'f' l in each element. Also 
> prevent this being evaluated in the macro with the syntax-quote as (5) has 
> introduced some new scope because of the ~@ - not sure.
>
as said above, rather than introducing a new scope, ~@ just overrides the 
"don't evaluate" of back-tick
 

> 6 - also associate onto the symbol m (which is assumed to be associative, 
> e.g. a map)...
> 7/8 - extract data out of the 'run-time' (e.g. not macro-time) value of 
> the provided state (magically captured under ~m-state)
> 9 - splice in the rest of the arguments, if any, that were part of the 
> element
> 10 - and do that magic for each element
>
 

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is this expected behavior with meta data?

2015-06-25 Thread gianluca torta
to get the meta-data of a var (I'm guessing symbol n refers to a var...) 
you should call it on the var iself, not its value or symbol:

user= (def ^{:some-meta 123} n 0)
#'user/n

user= (meta n)
nil

user= (meta 'n)
nil

user= (meta #'n)
{:some-meta 123, :ns #Namespace user, :name n, :file NO_SOURCE_PATH, 
:column 1, :line 1}

hth,
-Gianluca


On Thursday, June 25, 2015 at 4:00:59 PM UTC+2, Sarkis Karayan wrote:


 Why doesn't this work?
 user= (meta ^{:some-meta 123} 'n)
 nil

 While this works:
 user= (meta ^{:some-meta 123} (fn [n] n))
 {:some-meta 123}

 And this works too:
 user= (meta (with-meta 'n {:some-meta 123}))
 {:some-meta 123}


 Is this intended behavior?  If so, what's the reasoning?

 Thanks,
 Sarkis



-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I'm trying to decode some source code to understand how it works

2015-06-23 Thread gianluca torta
Hi Gregg,
 

 When you look at the function given as the first argument to 'recurse', (fn 
 [f g]   #(f (apply g %))), how do you think about when '%' is replaced 
 by [1 2 3 4]? Does this happen only when 'recurse' has consumed all the 
 items in the collection it's been given (as the second argument)?

 I would guess that given an expression such as:
((mycomp inc first reverse) [1 2 3 4])

Clojure will first evaluate the innermost list, building a composed 
function with reduce, and only then pass the vector [1 2 3 4] to such 
composed function
 
in any case, the good thing about pure functional programming is that you 
don't have to worry too much about the evaluation order, the result should 
be the same

hth,
-Gianluca

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with data structure transformation

2015-06-07 Thread gianluca torta
see also this page:
http://clojure.org/sequences

where for is listed among the seq library functions

HTH
Gianluca

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: macro question

2014-06-18 Thread gianluca torta
you can also use macroexpand-1 to see how your macro expands

for example, having defined your macro as suggested by Gary and James 
above, you can write something like:
(macroexpand-1 '(if-zero (- 4 2 2) (+ 1 1) (+ 2 2)))

and see that it correctly to:
(if (clojure.core/= (- 4 2 2) 0) (+ 1 1) (+ 2 2))

cheers,
Gianluca

-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: The Cons in iterate's return value

2014-04-16 Thread gianluca torta
this issue on core.typed
http://dev.clojure.org/jira/browse/CTYP-96

in particular the comment:
This is starting to make me rethink what a clojure.core docstring means 
exactly by a lazy sequence

cheers,
Gianluca

On Wednesday, April 16, 2014 6:45:01 PM UTC+2, Mars0i wrote:

 The docstring for iterate says that it returns a lazy sequence, but it 
 returns a Cons wrapped around a LazySeq.  This means, for example, that 
 realized? can't be applied to what iterate returns.  Is this a problem 
 with the iterate docstring?  Or should realized? be applicable to 
 Conses?  I assume that there's a good reason that iterate returns a Cons 
 instead of a LazySeq.

 Clojure 1.6.0
 user= (doc iterate)
 -
 clojure.core/iterate
 ([f x])
   Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of 
 side-effects
 nil

 user= (def xs (iterate inc 0))
 #'user/xs

 user= (class xs)
 clojure.lang.Cons

 user= (class (rest xs))
 clojure.lang.LazySeq

 user= (realized? (rest xs))
 false

 user= (realized? xs)
 ClassCastException clojure.lang.Cons cannot be cast to 
 clojure.lang.IPending  clojure.core/realized? (core.clj:6883)

 user= (take 5 xs)
 (0 1 2 3 4)

 user= (realized? (rest xs))
 true

 user= (realized? xs)
 ClassCastException clojure.lang.Cons cannot be cast to 
 clojure.lang.IPending  clojure.core/realized? (core.clj:6883)

 user= (doc realized?)
 -
 clojure.core/realized?
 ([x])
   Returns true if a value has been produced for a promise, delay, future 
 or lazy sequence.
 nil


-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Lazy sequence - how they work internally

2014-04-06 Thread gianluca torta
Hi sorin,

your function computes a sequence of just one element (the sum of the 
collection members), so I would say it is not a typical use of (lazy) seqs

to see that the code is indeed lazy, you can try:
  (def x (test-fc (range 210432423543654675765876879)))
and see that it returns immediately; however, as soon as you evaluate x:
  x
the whole computation of the only element of x starts and continues all the 
way to process the 210432423543654675765876879 elements of the range

As for your question on recursion: this is an example of tail recursion, 
that is automatically converted into plain iteration.
When there is only a recursive call, and such a call is the last thing in 
the body of the function, it can be easily (and automatically) converted to 
iteration, with no stack overflow problems.

hope this helps
Gianluca



On Sunday, April 6, 2014 6:56:00 PM UTC+2, sorin cristea wrote:


  Hi,

  maybe this question was already put it here, but can someone explain how 
 exactly work internal a function wrapped with lazy-seq keyword. For example 
 in the below code sample:

 (
   defn test-fc
   sum of all collection elements using recursion and laziness
   [coll]
   (letfn [(sum-fc [sum coll]
 (if (empty? coll)
   (cons sum nil)
   (lazy-seq(sum-fc (+ sum (first coll)) (rest coll

   )
  ]
 (sum-fc 0 coll)
   )
 )

 if I test the function: (test-fc (range 5)) I got the right result, if I 
 continue to test with bigger number I don't got StackoverflowException, but 
 if run  (test-fc (range 210432423543654675765876879)) I didn't get 
 StackoverflowEx but the application didn't return any result, because take 
 to much time to compute this ?

 How exactly work this internally and how is removed recursion( inside call 
 sum-fc with new parameters) from the flow in this case ? From what I saw in 
 java code of LazySeq class and clojure source code, it's made a list with 
 LazySeq object and in my opinion in that list the LazySeq object contain 
 enough information to compute the requested item and in this way is removed 
 recursion and implicit StackoverflowException issue, if I understand 
 something wrong please explain to me. 
 I test this function from IntellijIDEA + LaClojure plugin.

 Thanks
 Sorin.


-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Example in Joy of Clojure, 2nd edition (MEAP)

2014-02-16 Thread gianluca torta
as a side note, since we are within the backquote, simply using r (instead 
of ~'r) would not work since it would incorrectly expand to the fully 
qualified symbol, e.g. user/r

Gianluca

On Saturday, February 15, 2014 5:49:57 PM UTC+1, Jan Herich wrote:

 Hello Eric,

 You can rewrite this functionality with key# and r# instead of ~'key and 
 ~'r and it would work just as well, 
 it's only not necessary to use unique symbols here, because you are not 
 using them in the function body
 anyway, so there is no danger of accidental var capture. 

 To be honest, i would rather use underscore symbols (written as ~'_ inside 
 macro definition) to indicate 
 that i won't use any of the first two parameters in the function body. 

 Dňa sobota, 15. februára 2014 9:32:48 UTC+1 Eric napísal(-a):

 Hi,

 I'm reading the second edition of Joy of Clojure (the MEAP), and there is 
 an example that I don't quite get, and I was hoping someone here could help 
 me. It's in chapter 8, talking about macros. There is an example of a macro 
 called def-watched, which prints a message each time the root binding of a 
 var changes:

 (defmacro def-watched [name  value]
   `(do
 (def ~name ~@value)
 (add-watch (var ~name)
 :re-bind
 (fn [~'key ~'r old# new#]
   (println old#  -  new#)

 I understand almost everything, but I don't see why we have to use ~'keyand 
 ~'r rather than simply key# and r#. As I understand it, the first option 
 (~'var-name) would be useful to capture an external var inside the 
 macro, but I don't see the point of doing it here, especially since ~'keyis 
 defined in the parameter list, so that it would anyway hide any external 
 var. Could someone please help me understand this?

 Thank you in advance,

 Eric



-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Looking for advice to fine tune a simple function

2014-02-16 Thread gianluca torta
to me it seems that you are anyway relying on the assumption that the 
sequence is ordered, so I think it would be convenient to drop the ands

Gianluca


On Sunday, February 16, 2014 11:31:46 PM UTC+1, Laurent Droin wrote:

 Hi,

 Disclaimer - I am completely new to Clojure. I just implemented my very 
 first (simple) program, letting me find out, from a GPX file, how much time 
 is spent in the various heart rate zones. Now that it's working, I'm 
 reviewing the code and trying to use best practices. From what I have read 
 so far, there are many ways in Clojure to do the same thing and for a 
 newbie, it's not always obvious to get a good grasp on what is the best way 
 to  code a feature.
 As a developer, and even though I love how concise Clojure programs can 
 be, I am very concerned with readability and ease of maintenance so I would 
 like to keep functions as short and tight as possible, but not to the point 
 where it becomes hard to understand what it does.

 Here is a function that I came up with that takes  a bpm (heart beats per 
 minute) value, as well as a sequence of 4 values that represent the 
 boundaries defining the 5 different heart rate zones for a particular 
 person.
 The function needs to finds out in what heart zone the bpm value falls 
 into and return that zone (as a keyword - I later use that keyword in a 
 map).

 If you're an experienced Clojure developer, what would you have done 
 differently (and why) ?

 *(defn hr-zone*
 *  Return the HR zone as a keyword according to the bpm value.*
 *  [bpm [max-zone-1 max-zone-2 max-zone-3 max-zone-4]] *
 *  (cond *
 *(= bpm max-zone-1) :hr-zone-1*
 *(and ( max-zone-1 bpm) (= max-zone-2 bpm)) :hr-zone-2 *
 *(and ( max-zone-2 bpm) (= max-zone-3 bpm)) :hr-zone-3 *
 *(and ( max-zone-3 bpm) (= max-zone-4 bpm)) :hr-zone-4 *
 *( max-zone-4 bpm) :hr-zone-5))*

 FYI, here is how I call this function in the REPL:
 (def my-hr-zones-defs [120 150 165 180])

 (hr-zone 115 my-hr-zones-defs)
 (hr-zone 133 my-hr-zones-defs)
 (hr-zone 161 my-hr-zones-defs)
 (hr-zone 175 my-hr-zones-defs)
 (hr-zone 192 my-hr-zones-refs)

 Questions I have:
 Would that make sense to consider (and maybe enforce) that the sequence 
 received as parameter is sorted? If this was the case, I would assume I 
 could avoid the and calls- assuming that all the conditions in the cone 
 form are evaluated in order. 
 Assuming that I need to test bpm against the two boundaries of each range, 
 would there be a better way to do this:
 *(and ( max-zone-1 bpm) (= max-zone-2 bpm))*
 ?
 Maybe this would work, but is it preferable?
 *( max-zone-1 bpm (dec **max-zone-2**))*

 *Thanks in advance for the advice.*

 *Laurent. *



-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: instaparse: composing smaller rules into a bigger one

2013-11-18 Thread gianluca torta
I am not familiar with instaparse, but the parser may be reasoning as 
follows:

- Exposure matches a PK TOKEN that is preferred over WORD TOKEN, so 
it is parsed as PK TOKEN
- to matches a WORD TOKEN that is not preferred, but there's no other 
choice, so it is parsed as a WORD TOKEN
- ...

I don't think that instaparse will consider aggregating more complex TOKENS 
when it can parse each word as a TOKEN (at worst a WORD token if none of 
the preferred one-word TOKENs match)

I'd say you have to rework your grammar to be less ambiguous (i.e., only 
one way to decompose a sentence) but unfortunately I don't know how exactly 
you should fix it for instaparse

HTH
-Gianluca

On Monday, November 18, 2013 2:47:22 PM UTC+1, Jim foo.bar wrote:

  Hi all,

 I'm having a small problem composing smaller matches in instaparse. Here 
 is what I'm trying...just observe the bold bits:

 (def parsePK
   (insta/parser
S  = TOKEN (SPACE TOKEN PUNCT?)* END
TOKEN = (NUM | DRUG | PK | DRUGPK | MECH | SIGN | EFF | ENCLOSED) / 
 WORD 
WORD = #'\\w+' | PUNCT 
PUNCT = #'\\p{Punct}'
ENCLOSED = PAREN | SQBR
PAREN = #'\\[.*\\]'
SQBR =  #'\\(.*\\)'
 NUM =  #'[0-9]+'
 ADV =   #'[a-z]+ly'
SPACE = #'\\s+'
 DRUG =  #'(?i)didanosine|quinidine|tenofovir'
 PK =#'(?i)exposure|bioavailability|lower?[\\s|\\-]?clearance'
 *DRUGPK =  PK SPACE TO SPACE DRUG SPACE EFF? SPACE *
 MECH =  #'[a-z]+e(s|d)'
 *EFF = BE? SPACE SIGN? SPACE MECH | BE? SPACE MECH SPACE ADV? *
 SIGN =  ADV | NEG
 NEG = 'not'
 TO = 'to' | 'of'
 BE = 'is' | 'are' | 'was' | 'were'
 END =  '.'  ))

 Running the parser returns the following. It seems that the 2 bigger 
 composite rules DRUGPK  EFF are not recognised at all. Only the smaller 
 pieces are actually shown. I would expect [:TOKEN [:DRUGPK Exposure to 
 didanosine is increased]] and  [:TOKEN [:EFF is increased]] entries.
 (pprint   
 (parsePK Exposure to didanosine is increased when coadministered with 
 tenofovir disoproxil fumarate [Table 5 and see Clinical Pharmacokinetics 
 (12.3, Tables 9 and 10)].)) 
  

 [:S
  [:TOKEN [:PK Exposure]]
   
  [:TOKEN to]
   
  [:TOKEN [:DRUG didanosine]]
   
  [:TOKEN is]
   
  [:TOKEN [:MECH increased]]
   
  [:TOKEN when]
   
  [:TOKEN [:MECH coadministered]]
   
  [:TOKEN with]
   
  [:TOKEN [:DRUG tenofovir]]
  ,
   
  [:TOKEN disoproxil]
   
  [:TOKEN fumarate]
  [:END .]]

  Am I thinking about it the wrong way? Can ayone shed some light? 

 many thanks in advance,

 Jim





  

-- 
-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Pedestal introduction question

2013-07-04 Thread gianluca torta
Hi,

I am pretty new to clojure and trying to learn a lot from this great list

anyway, looking at the code you point to, it seems that the name 
templates has two roles:

   - one deriving from:

(:require ...
[io.pedestal.app.render.push.templates :as templates]
...)

   - one deriving from:

(def templates (html-templates/hello-world-templates))

looks like the one used for calling add-template etc. is the first one

hth

-Gianluca

-- 
-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Pedestal introduction question

2013-07-04 Thread gianluca torta
right, sorry!

I found the double role of template in this sample file on the pedestal
repo:
https://github.com/pedestal/samples/blob/master/chat/chat-client/app/src/chat_client/web/rendering.cljs

maybe the doc you originally refer to is inspired by this, but something
got lost in the doc

-Gianluca

-- 
-- 
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 unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.