Re: [racket-users] HTDP2E 22.3 Domain-Specific Languages: Configurations

2020-03-31 Thread Ben Greenman
On 3/30/20, Aron Zvi  wrote:
> Hey guys
>
> In 22.3 Domain-Specific Languages: Configurations, the book introduces the
> following data example and data definitions for FSM configurations
>
>
> (define
> 
>  xm0
>   '(machine ((initial "red"))
>  (action ((state "red") (next "green")))
>  (action ((state "green") (next "yellow")))
>  (action ((state "yellow") (next "red")
>
> ; An XMachine is a nested list of this shape:
> ;   `(machine ((initial ,FSM-State
> )) [
> List-of
> 
>
> X1T ])
> ; An X1T is a nested list of this shape:
> ;   `(action ((state ,FSM-State
> ) (
> next ,FSM-State
> )))
> I do no understand the XMachine data definition properly. In the definition
>
> it appears that it would be a list with 3 elements:
>
> 1*. *'machine
> 2. `((initial ,FSM-State
> ))
> 3. [List-of
> 
>
> X1T ]
>
> However, from the data example (and the fact that it is an Xexpr
> ) I know
> that the intention is different and that it is a list of the form:
>
> 1. 'machine
> 2.  `((initial ,FSM-State
> ))
> 3. X1T -1
> ...
> X1T -n
>
> where is seems that [List-of
> 
>
> X1T ]is
> expanded and included in the list  ([List-of
> 
>  X1T ] is
> consed
> onto)
>
> Can you please explain how the given  `(machine ((initial ,FSM-State
> )) [
> List-of
> 
>
> X1T ])
> translates
> to this?
>

I think you are right. An XMachine should be a list of 3 elements by
that data definition.

The definition should probably have a "." (or use `cons`es):

`(machine ((initial ,FSM-State)) . [List-of X1T])

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFUu9R7z4NZMpvRmNMqFsgxoaWQReZDokS19E4o60GJX8rye-Q%40mail.gmail.com.


[racket-users] HTDP2E 22.3 Domain-Specific Languages: Configurations

2020-03-30 Thread Aron Zvi
Hey guys

In 22.3 Domain-Specific Languages: Configurations, the book introduces the 
following data example and data definitions for FSM configurations


(define 

 xm0
  '(machine ((initial "red"))
 (action ((state "red") (next "green")))
 (action ((state "green") (next "yellow")))
 (action ((state "yellow") (next "red")

; An XMachine is a nested list of this shape:
;   `(machine ((initial ,FSM-State 
)) [
List-of 
 
X1T ])
; An X1T is a nested list of this shape:
;   `(action ((state ,FSM-State 
) (
next ,FSM-State 
)))
I do no understand the XMachine data definition properly. In the definition 
it appears that it would be a list with 3 elements:

1*. *'machine
2. `((initial ,FSM-State 
))
3. [List-of 
 
X1T ]

However, from the data example (and the fact that it is an Xexpr 
) I know 
that the intention is different and that it is a list of the form:

1. 'machine
2.  `((initial ,FSM-State 
))
3. X1T -1 
... 
X1T -n

where is seems that [List-of 
 
X1T ]is 
expanded and included in the list  ([List-of 

 X1T ] is 
consed 
onto)

Can you please explain how the given  `(machine ((initial ,FSM-State 
)) [
List-of 
 
X1T ]) 
translates 
to this?





-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/26d8c34b-8ca8-4525-847f-25ba5b6124fa%40googlegroups.com.