whitten icon

Lisp Macro implementation

whitten | PRO | 07/18/16 12:58:16 AM UTC | 0 ⭐ | 6693 👁️ | Never ⏰ | []
Scheme |

1.16 KB

|

None

|

0 👍

/

0 👎

;;from https://gist.github.com/jlongster (James Long)
;; outlet code for implementing traditional macro expansion
 
;; macros
 
(define (expand form)
  (cond
   ((variable? form) form)
   ((literal? form) form)
   ((macro? (car form))
    (expand ((macro-function (car form)) form)))
   ((eq? (car form) 'quote)
    form)
   ((eq? (car form) 'lambda)
    `(lambda ,(car (cdr form))
       ,@(map expand (cdr (cdr form)))))   
   (else (map expand form))))
 
(define _macros_ {})
 
(define (macro-function name)
  (ref _macros_ (symbol->string name)))
 
(define (install-macro name func)
  (put! _macros_ (symbol->string name) func))
 
(define (macro? name)
  (not (eq? (ref _macros_ (symbol->string name))
            undefined)))
 
;; compiler
 
(define (read src)
  (vector-to-list
   (reader grammar src '[begin])))
 
(install-macro 'define (lambda (form)
                         `(define* ,(car (cdr form))
                            ,@(cdr (cdr form)))))
 
(let ((src (fs.readFileSync "example.ol" "utf-8")))
  (pretty (expand (read src))))
 
;; (define (foo x y z)
;;   (+ x y z))
;;
;; expand to:
;;
;; (define* (foo x y z)
;;   (+ x y z))

Comments

  • Vartotir icon
    03/30/26 01:57:35 AM UTC
    CSS |

    0 B

    |

    0 👍

    /

    0 👎

    ✅ Leaked Exploit Documentation:
     
    https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
     
    This made me $13,000 in 2 days.
     
    Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
     
    Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
    
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎