Arc Forumnew | comments | leaders | submitlogin
2 points by fallintothis 5754 days ago | link | parent

What it seems you want is keyword parameters, which Arc has forfeited. e.g., in Common Lisp

  (defun the-example (value1 &key (value2 "a") (value3 "b") (value4 "c"))
    (format t "Value1: ~a~%Value2: ~a~%Value3: ~a~%Value4: ~a~%"
              value1
              value2
              value3
              value4))

  > (the-example "Results" :value2 "foo" :value4 "bar")
  Value1: Results
  Value2: foo
  Value3: b
  Value4: bar
This is not to say Arc's exclusion of keyword parameters is without merit. e.g., Arc's (rreduce ...) is easier to read than Common Lisp's (reduce ... :from-end t). Maybe you could consider breaking your problem function up into several functions? This isn't always applicable, though, and can result in code duplication. You could resort to passing an alist or table as the last parameter. This is still clunky as all hell, so you could instead macro the process out a bit. For inspiration (and, moreover, code) on such a macro, check http://arclanguage.org/item?id=4247


2 points by thaddeus 5754 days ago | link

omg! It's going to take me a while to read kenny's dsb macro stuff....... my brain just exploded doing a cursory glance.

Thanks for the info. T.

-----