Where is dylan implementation? 
Author Message
 Where is dylan implementation?

Hi, I heard that there is a Dylan implementation in Scheme. Can anybody
tell me where to find this implementation? I hope there is a public
version on a ftp-server!


   5014 Kerpen 3  |                                 | Contact me now!
       Germany    |  "Search your own truth"        | Only $10 per mail!

Tue, 14 Nov 1995 11:16:31 GMT  
 Where is dylan implementation?

Please, I lost my notes on where Thomas is and how to run it.
I know its slightly bugged, but I would like to try my hand at a bit of
Dylan.  Who knows how I can get it going, please email.  I will give a
summarry to all those who have asked me for Dylan examples.

Also please, anyone who has written ANYTHING in dylan, let me see?
I'd like to see how its written and so would 8 other people, so
examples would be gratefulyl accepted, and the glory of the donors made
known on the net

| Sam   Jam|"Never underestimate the importance of a cheap laugh"-       |

Mon, 20 Nov 1995 20:35:04 GMT  
 Where is dylan implementation?

>Also please, anyone who has written ANYTHING in dylan, let me see?

I typed this in Friday.  It is undebugged and uncommented, but there is
nothing proprietary here and it may you give some flavor of the language.
You will have to look at SP&E for algorithmic details.  Note that the style
is my own--I am not following any style guideline/standard.

Disclaimer: Apple knows not what I do ... at least until it hits the net 8^)
;FILE           "DeltaBlue.dylan"
;IMPLEMENTS     DeltaBlue constraint satisfaction algorithm
;AUTHOR         Ken{*filter*}ey
;DATE           1993 June 4
;LAST UPDATED   1993 June 4
;NOTES          See "Software-Practive and Experience" Vol 25(5), May 1993.

(in-module "Dylan User")


;; walkabout strength
(define strength$required    0)
(define strength$weakest     1)  

(define-class <CONSTRAINT-VARIABLE> ( <object> )
  (constraints   type: <deque>   init-function: (method () (make <deque>)))
  (determined-by type: <symbol>  init-value: 'NONE)
  (walk-strength type: <integer> init-value: strength$weakest)
  (mark          type: <integer> init-value:  0)
  (constant?     type: <boolean> init-value: #f)
  (debug-name init-keyword: debug-name:)

(define-class <CONSTRAINT-METHOD> ( <object> )
  (code    type: <function> init-keyword: method:)
  (output  init-keyword: output:) ; result of invoking method

(define-class <CONSTRAINT> ( <object> )
  (variables type: <deque>   init-function: (method () (make <deque>))
             init-keyword: variables:)
  (strength  type: <integer> init-value: strength$weakest
             init-keyword: strength:)
  (input?    type: <boolean> init-value: #f  ; true for input constraints
             init-keyword: input?:)
  (constraint-methods init-value: 'NONE init-keyword: constraint-methods:)
  (selected-method    init-value: 'NONE init-keyword: selected-method:)
  (debug-name init-keyword: debug-name:)

; MARKS -- just an integer; a counter generates new ones

(define-class <COUNTER> ( <object> )
   (value type: <integer> init-value: 0)

(define-method NEXT! ( (c <counter>) )
  (set! (value c) (+ (value c) 1))
  ; (value c) returned from set!

(define-method RESET! ( (c <counter>) )
  (set! (value c) 0)

(define MARK-COUNTER (make <counter>))

(define-method NEW-MARK ()
  (next! mark-counter)



(define-method ADD-CONSTRAINT ( (c <constraint>) )
  (set! (selected-method c) 'NONE)
  (map (method (v) (add (constraints v) c)) (variables c))
  (incremental-add c)

(define-method INCREMENTAL-ADD ( (c <constraint>) )
  (bind ( (mark (new-mark))
          (retracted (enforce c mark))
    (while (not (id? retracted 'NONE))
      (set! retracted (enforce retracted mark))
) )

(define-method ENFORCE ( (c <constraint>) (mk <integer>) )
  (select-method c mk)
  (if (enforced? c)
       (map (method (i) (set! (mark i) mk)) (inputs c))
       (bind ( (retracted (determined-by (output (selected-method c)))) )
         (when (not (id? retracted 'NONE))
           (set! (selected-method retracted) 'NONE))
         ;; (set! (determined-by (output (selected-method c))) c)
         ((setter determined-by) (output (selected-method c)) c)
         (when (not (add-propagate? c mk) )
           (error "Cycle Encountered")
           'NONE)  ;; return value
         ;; (set! (mark (output (selected-method c))) mk)
         ((setter mark) (output (selected-method c)) mk)
         retracted ;; return value
      ;; else
      (when (= (strength c) strength$required)
        (error "Failed to enforce a required constraint"))
      'NONE  ;; return value
  ) ;; end if

(define-method SELECT-METHOD ( (c <constraint>) (mk <integer>) )
  (set! (selected-method c) 'NONE)
  (bind ( (best-output-strength (strength c)) )
    (map (method (me)
           (when (and (/= mk (mark (output me)))
                      (weaker? (walk-strength (output me))
             (set! (selected-method c) me)
             (set! best-output-strength (walk-strength (output me)))))
         (constraint-methods c))
) )

(define-method ADD-PROPAGATE? ( (c <constraint>) (mk <integer>) )
  (bind-exit (return)
    (for ( (todo (add! (make <deque>) c) todo) )
         ( (empty? todo) (return #t) )
         (bind ( (d (pop-last todo)) )
           (when (= mk (mark (output (selected-method d))))
             (incremental-remove c)
             (return #f))
           (recalculate d)
           (map (method (c) (add! todo c))
                (consuming-constraints (output (selected-method d))))
    (return #t)
) )


(define-method REMOVE-CONSTRAINT ( (c <constraint>) )
  (if (enforced? c)
      (incremental-remove c)
      (map (method (v) (remove! (constraints v) c)) (variables c))
) )

(define-method INCREMENTAL-REMOVE ( (c <constraint>) )
  (bind ( (out (output (selected-method c))) )
    (set! (selected-method c) 'NONE)
    (map (method (v) (remove! (constraints v) c)) (variables c))
    (map (method (d) (incremental-add d))
         (sort (constraints (remove-propagate-from out))
               test: (method (c1 c2) (weaker? (strength c1) (strength c2))))
) )

(define-method REMOVE-PROPAGATE-FROM ( (out <constraint-variable>) )
  (set! (determined-by out) 'NONE)
  (set! (walk-strength out) strength$weakest)
  (for ( (unenforced (make <deque>) unenforced)
         (todo (add! (make <deque>) out) todo)
       ( (empty? todo) unenforced )
       (bind ( (v (pop-last todo)) )
         (map (method (c) (when (not (enforced? c)) (add! unenforced c)))
              (constraints v))
         (map (method (c) (recalculate c) (add! todo (selected-method c)))
              (constraints (consuming-constraints v)))
  )    )


(define-method EXTRACT-PLANS-FROM-VARIABLES ( (variables <deque>) )
  (bind ( (sources (make <deque>)) )
    (map (method (v)
           (map (method (c)
                  (when (and (input? c) (enforced? c)) (add! sources c)))
                (constraints v)))
    (make-plan sources)
) )

(define-method MAKE-PLAN ( (sources <deque>) )
  (bind ( (mk (new-mark)) )
    (for ( (plan (make <deque>) plan)
           (hot sources hot)
         ( (empty? hot) plan )
         (bind ( (c (pop-last hot)) )
           (when (and (/= mk (mark (output (selected-method c))))
                      (inputs-known? c mk) )
             (add! plan c)
             ;; (set! (mark (output (selected-method c))) mk)
             ((setter mark) (output (selected-method c)) mk)
             (map (method (c) (add! hot c))
                  (consuming-constraints (output (selected-method c))))
    )    ) )
) )

(define-method EXECUTE-PLAN ( (plan <deque>) )
  (map (method (c <constraint>)
         (bind ( (sm (selected-method c)) )
           ((setter value) (output sm) ((code sm)) )))


(define-method INPUTS ( (c <constraint>) )
  (bind ( (result (make <deque>)) )
    (map (method (v)
           (when (/= v (output (selected-method c))) (add! result v)))
         (variables c))
) )

(define-method INPUTS-KNOWN? ( (c <constraint>) (mk <integer>) )
  (bind-exit (fail)
    (map (method (v)
           (when (not (or (= mk (mark v)) (constant? v))) (fail #f)))
         (inputs c))
) )

(define-method RECALCULATE ( (c <constraint>) )
  (bind ( (sm (selected-method c)) (out (output sm)) )
    ((setter walk-strength) out (output-walk-strength c))
    ((setter constant?) (value out) (constant-output? c))
    (when (constant? out)
      ((setter value) out ((code sm)) )
) ) )

(define-method OUTPUT-WALK-STRENGTH ( (c <constraint>) )
  (bind ( (min-strength (strength c)) )
    (map (method (me)
           (when (and (/= (output me) (output (selected-method c)))
                      (weaker? (walk-strength (output me)) min-strength))
             (set! min-strength (walk-strength (output me)))))
         (constraint-methods c))
) )

(define-method CONSTANT-OUTPUT? ( (c <constraint>) )
  (bind-exit (return)
    (when (input? c) (return #f))
    (map (method (v) (when (not (constant? v)) (return #f)))
         (inputs c))
    (return #t)

(define-method CONSUMING-CONSTRAINTS ( (v <constraint-variable>) )
  (bind ( (consumers (make <deque>)) )
    (map (method (c) (when (and (enforced? c) (/= c (determined-by v)))
                       (add! consumers c)))
         (constraints v))
) )

(define-method ENFORCED? ( (c <constraint>) )
  (/= (selected-method c) 'NONE)

(define-method WEAKER? ( (s1 <integer>) (s2 <integer>) )
  (< s1 s2)  ;; just an alias -- should check for 'NONE

;;                 --- E O F ---

Sat, 25 Nov 1995 01:08:46 GMT  
 [ 4 post ] 

 Relevant Pages 

1. Dylan implementation question

2. another Dylan implementation?

3. Free Dylan implementations?

4. Dylan implementation tips

5. Status of Dylan implementations

6. Status of Dylan implementations

7. Which public domain Dylan implementation ?

8. Dylan Implementations

9. Dylan Implementations

10. Implementations of Dylan

11. Implementation of Dylan on PC?

12. Dylan-implementation in CL?


Powered by phpBB® Forum Software