Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 9b5068521e
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (24 sloc) 0.834 kB
; basic type-based dispatch
mac =(lhs rhs) :case list?.lhs
; multiple-eval in case car.lhs needs assigning to
`((table_get (table_get coercions* 'function=) (type ,car.lhs)) ,lhs ,rhs)
; support new types in =
; body must return a form that will be macro-eval'd
mac defset(type params . body)
`(defcoerce ,type function=
(fn ',params
(eval (do ,@body) caller-scope)))
; keyword-based dispatch
mac =(lhs rhs) :case (and list?.lhs (table_get coercions* car.lhs))
`((table_get coercions* ',car.lhs) ,@cdr.lhs ,rhs)
; support new keywords in =
mac def=(op params . body)
`(table_set coercions* ',op (fn ,params ,@body))
; serial assignment
; this should be after clauses inspecting args
let $= =
mac! = args
if args
`(ret $ans ,cadr.args
(,$= ,car.args $ans)
(= ,@cddr.args))
Jump to Line
Something went wrong with that request. Please try again.