On Wednesday, October 14, 2015 at 11:40:19 AM UTC-4, Isaiah wrote:
>
> Q1) where to find julia macro tutorials (beyond the standard manual)?
>
>
> I'm not aware of any tutorials, but there were several JuliaCon talks that 
> are related to some of the nittier details if you are interested [1]. If 
> anything in the manual is unclear or could use more explanation, please do 
> make suggestions. (we're trying to make it accessible for people with no 
> macro background as well as advanced Lispers)
>

one specific thing that had me lost for a while was how to splat n a list 
of values (the old ,@ LISP operator)

for a while, this looked like the best option

    ex= quote end
    # some loop 
         push!(ex, someExpx)

then i found the wonder of ellipses. e.g. in my code

    type $(typename)
         $(ones...)
      end;

 
so I'd add that to the doco.


> Q2) ... improvements
>
>

two specific improvements would be

1)  "your top 10 most useful macros" into which I'd include @task

2) some macro examples in the doco whose complexities are a little more 
complex that @assert and @memo and a little less complex that 
Parameters.jl. 

just one idea on the second point. the other day for my SE modeling class I 
wrote a little python DSL for compartmental models. For fill details, 
see https://github.com/txt/mase/blob/master/src/dsl101.md. But here's what 
a subclass method of a Model class you have to offer to make the 
compartments flow

 def have(i):
    return o(C = S(100), D = S(0),
             q = F(0),  r = F(8), s = F(0))

  def step(i,dt,t,u,v):
    def saturday(x): return int(x) % 7 == 6
    v.C +=  dt*(u.q - u.r)
    v.D +=  dt*(u.r - u.s)
    v.q  =  70  if saturday(t) else 0 
    v.s  =  u.D if saturday(t) else 0
    if t == 27: # special case (the day i forget)
      v.s = 0

what would the **simplest** macros that you could do something like this in 
a  Julia DSL for compartmental models?

-- @timmenzies

>
>

Reply via email to