Rob Blackwell home projects resumé archive

Alphabetical List of Arc Functions

08 February 2008

I’m still trying to get a handle on Arc syntax so I wanted a list of all the Arc functions.

In arc.arc, I modified def like this:


(set *functions* nil)
(set def (annotate 'mac
            (fn (name parms . body)
              `(do (sref sig ',parms ',name)
	      	   (set *functions* (cons ',name *functions*))		
		(safeset ,name (fn ,parms ,@body))))))
 

Now, every time a function gets defined, its name gets put onto the functions list.

I modified as.scm to comment out the loading of libraries, so that just arc.arc is loaded.

;(aload "libs.arc")

Now when I start Arc I can say:


(sort (fn (x y) (< (coerce x 'string) (coerce y 'string))) *functions*)

And I get a list of all the Arc functions defined in arc.arc:


(<= >= abs acons adjoin alist all alphadig alref andf assoc atend atom avg before best bestn caar cache cadr carif caris cddr commonest compare consif copy count counts date dedup deq dotted downcase ellipsize empty enq enq-limit ensure-dir ero even expand-metafn-call expand= expand=list fill-table find firstn firstn-that flat idfn insert-sorted inst intersperse isa isnt iso join keep keys last list listtab load load-table load-tables map map1 mappend maps max median mem memo memtable merge mergesort metafn min mismatch most multiple no nonwhite nthcdr number odd only ontree orf pair parse-format plural pos positive pr prall prn prs punc qlen qlist queue rand-string random-elt range read read-table readall readfile readfile1 readline readstring1 reclist recstring reduce reinsert-sorted rem rev round roundup rreduce safe-load-table saferead save-table setforms since single some sort split splitn string subseq sym tablist temload temloadall templatize temread testify to-nearest trav tree-subst trues tuples upcase vals warn whitec write-table writefile1)

Now we just need to write some documentation…..

UPDATE

Thanks to contributors on the arclanguage.org forum, it turns out you can get better results without hacking the source – Try this:


(each key (sort < (keys sig))
      (prn key " " (sig key)))

*The opinions expressed on this site are my own and do not necessarily represent those of Two10degrees or Active Web Solutions Ltd.