chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] Use vertical space more liberally in some


From: megane
Subject: Re: [Chicken-hackers] [PATCH] Use vertical space more liberally in some scrutinizer messages
Date: Thu, 21 Mar 2019 14:19:40 +0200
User-agent: mu4e 1.0; emacs 25.1.1

address@hidden writes:

>> '(list a123) -> `(list ,(gensym 'a123)), where the symbol a123 is the
>> name of the TV. This symbol is used to store a value in the unification
>> trail.
>
> Note that you could store the original name on the plist of the gensym, 
> then deref the chain of gensyms/orig names when printing.

That's what Peter suggested too.

I guess it isn't too bad performance-wise:

(import (chicken base) (chicken time) (chicken plist))
(define (rename v)
  (let* ([orig (or (get v 'orig-name #f)
                   (strip-syntax v))]
         [new (gensym orig)])
    (put! new 'orig-name  orig)
    new))

(let ([t (current-milliseconds)])
  (let lp ([v 'a] [i 0])
    (if (< i 1000000)
        (lp (rename v) (add1 i))
        (print (- (current-milliseconds) t) " " (get v 'orig-name)))))

;; $ csc -O3 gensym.scm && ./gensym
;; 377 a


>
>
> felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]