[racket] Confusion with circular structs

2013-07-26 Thread Nicholas Labich
I'm running into what I find to be surprising behavior with circular structures (vertices of a simple graph). Graphically (see code below to reproduce): 0 --> 1 ;; no problem 2-+ ;; also no problem ^-+ But when I try to add an edge between 0 and 2, I hit an infinite loop at line 88 of racke

Re: [racket] Confusion with circular structs

2013-07-26 Thread Nicholas Labich
vertex 0 '() (list #0# #2=(vertex 2 '(#1# #2#) '(#2#) > '()) > > (set-vertex-s! x (vertex-s y)) > > x > #0=(vertex > 0 > #1='(#0#) > (list (vertex 1 #1# '()) #2=(vertex 2 '(#0# #2#) '(#2# > > > > Does

Re: [racket] Confusion with circular structs

2013-07-26 Thread Nicholas Labich
then mutating the data. That changes the keys, which > causes problems for the underlying hash table. > > If you change each occurrence of 'set' to 'seteq' below, the program > should run. > > Ryan > > > > On 07/26/2013 05:25 PM, Nicholas Labich w

[racket-users] As clean as possible in a dirty macro

2016-04-25 Thread Nicholas Labich
I'm trying to write a small monad transformer library with macros. My goal: (define-monad IdM [(return a) a] [(bind m f) (f m)] [(foo) 'id-foo]) (define-trans ListT [(return a) (returnₘ (list a))] [(bind m f) (bindₘ m (λ (loa) (foldl (λ (a m′) (returnₘ (append (f a)

[racket-users] Re: As clean as possible in a dirty macro

2016-04-26 Thread Nicholas Labich
#'id)) (make-set!-transformer (λ (stx) (syntax-case stx () [id (identifier? #'id) #'val]])) (splicing-let ([bar-local 500] [baz-local 1000]) (dyn-bind FOO BAR BAZ)) (equal? baz 6) Nick On Monday, April 25, 2016 at 6:18:

[racket-users] Re: As clean as possible in a dirty macro

2016-04-26 Thread Nicholas Labich
now, this should be a good starting point. Nick On Monday, April 25, 2016 at 6:18:41 PM UTC-4, Nicholas Labich wrote: > I'm trying to write a small monad transformer library with macros. > > My goal: > > (define-monad IdM > [(return a) a] > [(bind m f) (f

Re: [racket-users] As clean as possible in a dirty macro

2016-04-27 Thread Nicholas Labich
On Wednesday, April 27, 2016 at 8:55:29 AM UTC-4, Alex Knauth wrote: > I'm not sure if this is what you wanted, but here's a version of your monad > file with much less weird macro stuff. It used syntax-local-introduce in two > places right next to each other, and it doesn't use datum->syntax, >