vincenz


22 points by vincenz over 2 years ago | link | top
cached 9 days ago
Yes, quite easily, just make a new script like this:

ar.sh:

    #! /bin/sh
    #|
    exec mzscheme -fmv "$0" ${1+"$@"}
    |#
    (require mzscheme)
    (load "ac.scm") 
    (require "brackets.scm")
    (use-bracket-readtable)
    (aload "arc.arc")
    (aload "libs.arc")
    (aload (car (vector->list (current-command-line-arguments))))
main.arc:

    (whilet line (readline)
      (prn line))
shell:

    chmod +x ar.sh
    ar.sh main.arc

11 points by vincenz over 2 years ago | link | top
cached 9 days ago
I'll add my pitch:

    1) proper phase-distinction between compilation and evaluation
       - not possible with the way that macros are currently done
    2) if not (1), then there's no excuse for not making macros first-class
       - see how to in: http://arclanguage.com/item?id=842
    3) modules (like everyone :)
    4) Extend the concept of application to data to all data types by making it programmable in arc
       - Currently you can do ((list 1 2 3) 0) and you'll get 1, 
       - why not allow this for all data-types by having a call-back into arc, such that arc-code can switch on the type.
    5) Hygienic macros
    6) Removal of 'nil
       - 'nil does nothing more than '(), and often it breaks (e.g:
            - when printing cyclic structures
            - the fact that not all '()'s are replaced by 'nil). )
       - Seriously, what's the need for 'nil?  Just use '()
    7) That's it for now, if you want unicode, but bleh
In general, I think the focus on conciseness, while a good thing, should not be the sole purpose. I think pg is slightly misguided on focusing solely on that. You can get conciseness, if your language is powerful enough, through the use of libraries. Small changes like fn and the way if works are easily done through the use of some macrology.

10 points by vincenz over 2 years ago | link
cached 9 days ago

7 points by vincenz over 2 years ago | link
cached 11 days ago

5 points by vincenz over 2 years ago | link
cached 11 days ago

5 points by vincenz over 2 years ago | link | top
cached 5 days ago
What you basically want, since you do not want pattern matching, is eliminators/folds/church-encoding (pick your favourite terminology).

4 points by vincenz over 2 years ago | link | top
cached 11 days ago
Seems that to get first-class macros one would have to:

    1) Not evaluate arguments directly in ac-call, but keep the original arguments and envs
    2) Add a clause in ar-apply to deal with macros
    3) Make sure that in ar-apply, arguments are evaluated for the case where it is still a function/list/hashtable and not a macro
Basically use lazyness only until we find out we're calling a macro.

I'd implement it, but I'm not certain pg wants to go this direction. I don't think it'd change anything else to the language even though under-the-hood it uses some lazy techniques.


4 points by vincenz over 2 years ago | link | top
cached 11 days ago
Finally, a big clean for 'ac-call'

    (define (ac-call fn args env)
      (let ((macfn (ac-macro? fn)))
        (if macfn
          (ac-mac-call macfn args env)
          (let ((afn (ac fn env))
                (aargs (map (lambda (x) (ac x env)) args))
                (nargs (length args)))
            (cond 
              ((eqv? (xcar fn) 'fn)
               `(,afn ,@aargs))
              ((and (>= nargs 0) (<= nargs 4))
               `(,(string->symbol (string-append "ar-funcall" (number->string nargs)))
                                  ,afn ,@aargs))
               (#t
                `(ar-apply ,afn (list ,@aargs))))))))

4 points by vincenz over 2 years ago | link | top
cached 11 days ago
Idem for 'ac-macex' and cleaning up some more

    (define (ac-macex e . once)
      (let ((m (ac-macro? (xcar e))))
        (if m
          (let ((expansion (ac-denil (apply m (map ac-niltree (cdr e))))))
            (if (null? once) (ac-macex expansion) expansion))
          e))
      )

4 points by vincenz over 2 years ago | link | parent | top
cached 9 days ago
That's completely the opposite of what I want :)

I want:

    a) The ability to define within arc what happens when a list is 
         used as function, instead of it being predefined in scheme
    b) The ability to do this for any type and custom types.
 
And potentially:

    c) For annotated values to be able to do this per-object, 
        by storing an extra field in there that is the getter, 
        where the default value is the one for the type.

    E.g:  (annotate 'blabla value getter)
If there is no getter, then use the one for type 'blabla