[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

v143 available



goo v0_143 is now available.  included below is the set of changes.
by popular demand, i added experimental reader macros for elt/sub/sub*
and fun.  this corresponds to the python's collection access syntax
and smalltalk's block syntax.  the collection access syntax uses []'s
as follows:

  python   goo      expansion
  v[i]     [v i]    (elt v i)
  v[i:j]   [v i j]  (sub v i j)
  v[:j]    [v 0 j]  (sub v 0 j)
  v[i:]    [v i *]  (sub* v i)

by virtue of being a reader macro, this works in conjunction with set:

  goo              expansion
  (set [v i] x)    (set (elt v i) x)
  (set [v i j] w)  (set (sub v i j) w)

i've also introduced an experimental syntax for anonymous functions.
the following is the translation:

  goo       expansion
  {x}       (fun () x)
  {x . x}   (fun (x) x)

this makes for particularly concise syntax for thunks.  this new syntax
has inspired me to add a new function elt! which captures an often
used pattern and can be described a bit oversimplistically as:

  (dm elt! (c|<col!> k f|<fun>) 
    (or (elt-or c k #f) (set (elt c k) (f))))

and can be used as follows:

  (def offset (elt! lits e {(len lits)}))

which would assign a new offset item to a lits table if not present
(and corresponds to python's setdefault although allows one to avoid
evaluating default if unnecessary).

i would appreciate any feedback on these new ideas.

well here's the set of changes.

  summary

    condition hierarchy and experimental [] and {} syntax

  added

    #[] syntax for vecs
    condition hierarchy
    stack overflow check
    [] syntax 
    {} syntax
    elt!
    treap

  fixed

    try works at top level

jonathan