Re: [racket-users] Seeking a graphviz like, diagramming language for Racket

2017-08-25 Thread Sam Tobin-Hochstadt
You might be interested in some of the line-drawing/edge-finding code
here: https://github.com/samth/edinburgh-2017/blob/edinburgh-2017/lib.rkt#L144

Sam

On Fri, Aug 25, 2017 at 7:12 PM, Andrew Gwozdziewycz  wrote:
> As promised, I mocked up my original vs a quick iteration using pict.
> It's not nearly as time consuming as I thought it'd be (took about 30
> minutes not being familiar with the pict api):
>
> https://gist.github.com/apg/e193b3f4b1626397ebb3065947a6ae8a
>
> It's obviously not visually the same, but the same information is
> basically conveyed in both. My biggest complaints are that of where
> arrows end up, but other than that, This isn't tooo horrible as is,
> but could be oodles better with some helpers.
>
> Cheers,
>
> Andrew
>
>
> On Sat, Aug 19, 2017 at 10:22 PM, WarGrey Gyoudmon Ju
>  wrote:
>> On Sun, Aug 20, 2017 at 1:20 AM, Andrew Gwozdziewycz 
>> wrote:
>>>
>>> Are you focused more on replacing Graphviz, or a generalized drawing
>>> and visualization library that could be used to more easily put
>>> together a Graphviz like tool? I guess they are likely somewhat
>>> similar goals...
>>
>>
>> Firstly, I just write it for fun, but also focus on high quality real world
>> applications
>> since I do not want to use any software design tools that force me dragging
>> and clicking.
>>
>> In untyped racket (but may not in the main distribution), there are a lot of
>> small packages
>> that focus on one or more subfields of graph visualization and layout
>> algorithms. In typed
>> racket, there also are pict3d, plot, and flomap based images. So I think
>> they definitely benefit
>> user-designers and covers lots of everyday usage, but user-developers may
>> need more
>> extension abilities since modern applications grow too fast.
>>
>> Therefore, I am writing a modern design engine for programmers with an
>> elegant functional interface,
>> graphviz like tool is one of the applications of this engine, actually it is
>> likely to be the first one.
>>
>> For now,
>> * CSS syntax and its computation model is chosen to style elements and
>> items;
>> * New architecture and datatypes is coming soon for
>> reading/composing/writing image resources.
>>
>> Also I am glad to write the entire tex system in native Typed Racket, though
>> it is really a huge
>> project and therefore a long term plan.
>>
>
>
>
> --
> http://www.apgwoz.com
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Seeking a graphviz like, diagramming language for Racket

2017-08-25 Thread Andrew Gwozdziewycz
As promised, I mocked up my original vs a quick iteration using pict.
It's not nearly as time consuming as I thought it'd be (took about 30
minutes not being familiar with the pict api):

https://gist.github.com/apg/e193b3f4b1626397ebb3065947a6ae8a

It's obviously not visually the same, but the same information is
basically conveyed in both. My biggest complaints are that of where
arrows end up, but other than that, This isn't tooo horrible as is,
but could be oodles better with some helpers.

Cheers,

Andrew


On Sat, Aug 19, 2017 at 10:22 PM, WarGrey Gyoudmon Ju
 wrote:
> On Sun, Aug 20, 2017 at 1:20 AM, Andrew Gwozdziewycz 
> wrote:
>>
>> Are you focused more on replacing Graphviz, or a generalized drawing
>> and visualization library that could be used to more easily put
>> together a Graphviz like tool? I guess they are likely somewhat
>> similar goals...
>
>
> Firstly, I just write it for fun, but also focus on high quality real world
> applications
> since I do not want to use any software design tools that force me dragging
> and clicking.
>
> In untyped racket (but may not in the main distribution), there are a lot of
> small packages
> that focus on one or more subfields of graph visualization and layout
> algorithms. In typed
> racket, there also are pict3d, plot, and flomap based images. So I think
> they definitely benefit
> user-designers and covers lots of everyday usage, but user-developers may
> need more
> extension abilities since modern applications grow too fast.
>
> Therefore, I am writing a modern design engine for programmers with an
> elegant functional interface,
> graphviz like tool is one of the applications of this engine, actually it is
> likely to be the first one.
>
> For now,
> * CSS syntax and its computation model is chosen to style elements and
> items;
> * New architecture and datatypes is coming soon for
> reading/composing/writing image resources.
>
> Also I am glad to write the entire tex system in native Typed Racket, though
> it is really a huge
> project and therefore a long term plan.
>



-- 
http://www.apgwoz.com

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 2htdp place world frame on screen

2017-08-25 Thread Laurent
Great, thanks, I'll take a look this weekend.

On Fri, Aug 25, 2017 at 6:01 PM, Jay McCarthy 
wrote:

> On Fri, Aug 25, 2017 at 11:46 AM, Laurent 
> wrote:
> > Jay: Oh that's right, I'd forgotten about Lux! Thanks for the reminder, I
> > guess I should switch to that at some point. Correct me if I'm wrong,
> but it
> > seems to integrate well with 2htdp/image also.
>
> The default way to use the gui gives you the dc, but you can use
> `lux/chaos/gui/val` and give it a 2htdp/image value.
>
> > Although apparently it's not
> > solving my problem at hand yet :) But maybe it would make more sense to
> > patch Lux than big-bang?
>
> Correct, it should be really easy though:
>
> https://github.com/jeapostrophe/lux/blob/master/chaos/gui.rkt#L34
>
> add #:start-x/y and then `or` them with the defaults computed in the
> next few lines
>
> --
> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
> -=[ Moses 1:33: And worlds without number have I created; ]=-
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 2htdp place world frame on screen

2017-08-25 Thread Jay McCarthy
On Fri, Aug 25, 2017 at 11:46 AM, Laurent  wrote:
> Jay: Oh that's right, I'd forgotten about Lux! Thanks for the reminder, I
> guess I should switch to that at some point. Correct me if I'm wrong, but it
> seems to integrate well with 2htdp/image also.

The default way to use the gui gives you the dc, but you can use
`lux/chaos/gui/val` and give it a 2htdp/image value.

> Although apparently it's not
> solving my problem at hand yet :) But maybe it would make more sense to
> patch Lux than big-bang?

Correct, it should be really easy though:

https://github.com/jeapostrophe/lux/blob/master/chaos/gui.rkt#L34

add #:start-x/y and then `or` them with the defaults computed in the
next few lines

-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 2htdp place world frame on screen

2017-08-25 Thread Laurent
On Fri, Aug 25, 2017 at 2:44 PM, Matthias Felleisen 
wrote:

>
> :-)
>
> That’s not what I meant. I think that I need to figure out
> how to produce two version of ‘universe’ for the non-teaching
> world w/o completely forking the repo:
>
>  — a functional one
>  — an object-oriented one
>
> From what I can tell, 2htdp/universe + image has some appeal as
> as simple GUI framework for simple tasks and I should accommodate
> this (which will also reduce the overhead).
>


I see. Indeed I'm only doing something very basic here, like a small 2D
grid world where a yellow triangle can go left and right and navigates a
labyrinth looking for a red circle. I don't really need speed, it's just a
demonstrator.

Jay: Oh that's right, I'd forgotten about Lux! Thanks for the reminder, I
guess I should switch to that at some point. Correct me if I'm wrong, but
it seems to integrate well with 2htdp/image also. Although apparently it's
not solving my problem at hand yet :) But maybe it would make more sense to
patch Lux than big-bang?

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Unit tests for a #lang implementation

2017-08-25 Thread Konrad Hinsen

On 25/08/2017 16:30, Matthew Flatt wrote:

At Fri, 25 Aug 2017 16:04:01 +0200, Konrad Hinsen wrote:

Putting those together, and using `current-namespace` so that both
`eval-syntax` and check-module-form` use the same namespace:


Thanks, that works!

At least to the point of not getting any error message. I can't say if a
module is actually defined.


I should have suggested setting `current-module-declare-name` during
evaluation of the module form, so that you get to pick the name:



That adds the missing piece - thanks a lot! I had seriously 
underestimated the complexity of module definitions in Racket.


Konrad.

--
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Unit tests for a #lang implementation

2017-08-25 Thread Matthew Flatt
At Fri, 25 Aug 2017 16:04:01 +0200, Konrad Hinsen wrote:
> > Putting those together, and using `current-namespace` so that both
> > `eval-syntax` and check-module-form` use the same namespace:
> 
> Thanks, that works!
> 
> At least to the point of not getting any error message. I can't say if a 
> module is actually defined. 

I should have suggested setting `current-module-declare-name` during
evaluation of the module form, so that you get to pick the name:

  (parameterize ([current-namespace (make-base-namespace)])
;; Read module as a syntax object:
(define mod-form
  (parameterize ([read-accept-lang #t]
 [read-accept-reader #t])
(read-syntax
 "test-module"
 (open-input-string
  "#lang scribble/base\n@section{Introduction}"

;; Declare the module:
(parameterize ([current-module-declare-name 
;; declare as name 'demo:
(make-resolved-module-path 'demo)])
  (eval mod-form))

;; Access the module with `dynamic-require`, `namespace-require`, etc.:
(dynamic-require ''demo 'doc))

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Unit tests for a #lang implementation

2017-08-25 Thread Konrad Hinsen

Matthias,


Matthew’s response is probably all you want in principle,
but I think that your ‘unit test’ looks like another person’s
‘integration tests’. Both are useful.

Wouldn’t you want to use unit tests to validate the parser
independently of the macros that expand the S-expression
syntax you create with the parser? If you then discover a
failure, it becomes much easier to search for the bug in
either of the two pieces. (I understand that there are many
more pieces but let’s say ‘two’ for now.)


Thanks for your reply!

I guess what I want to do is somewhere in between unit and integration 
tests. I don't really care much about the labels.


I do have unit tests for the low-level implementation details of my 
#lang. They are plain Racket functions with straightforward tests.


What I want to write additional tests for is

 1) The macros that expand the S-expression for my module

 2) Some of the functions used in the expansion, for which
suitable input is difficult to generate without those
macros.

The parser is not my problem - it's borrowed from Scribble and 
presumable tested by someone else :-)


Konrad.

--
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Unit tests for a #lang implementation

2017-08-25 Thread Konrad Hinsen

Matthew,


Putting those together, and using `current-namespace` so that both
`eval-syntax` and check-module-form` use the same namespace:


Thanks, that works!

At least to the point of not getting any error message. I can't say if a 
module is actually defined. A plain


  (require 'anonymous-module)

fails ("unknown module"). I tried changing the name by manipulating the 
s-expression returned by read-syntax, but I am never able to instantiate
the module that was presumably defined by eval under that name. Is this 
perhaps one of those 
"your-identifier-is-not-from-the-scope-you-think-it-is" problems?


Konrad.

--
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Unit tests for a #lang implementation

2017-08-25 Thread Matthias Felleisen

Konrad, 

Matthew’s response is probably all you want in principle, 
but I think that your ‘unit test’ looks like another person’s
‘integration tests’. Both are useful. 

Wouldn’t you want to use unit tests to validate the parser 
independently of the macros that expand the S-expression 
syntax you create with the parser? If you then discover a
failure, it becomes much easier to search for the bug in 
either of the two pieces. (I understand that there are many
more pieces but let’s say ‘two’ for now.) 

— Matthias






> On Aug 25, 2017, at 9:17 AM, Matthew Flatt  wrote:
> 
> I forgot to explain why this fails:
> 
> At Fri, 25 Aug 2017 14:59:14 +0200, Konrad Hinsen wrote:
>> (eval-syntax
>>  (parameterize ([read-accept-lang #t]
>> [read-accept-reader #t])
>>(read-syntax "test-module"
>> (open-input-string "#lang 
>> scribble/base\n@section[Introduction]")))
>>  (module->namespace 'racket/base))
>> 
>> only says
>> 
>> ; test-module::1: module: unbound identifier;
>> ;  also, no #%app syntax transformer is bound
>> ;   at: module
>> 
>> although both module and %app are defined in racket/base.
> 
> The `eval-syntax` function refrains from adding any scopes to the given
> syntax object before trying to expand it. So, it doesn't add the scope
> for the namespace's top-level bindings (unlike `eval`, which does add
> that scope before trying to expand). That's why `#%app` and `module`
> are not bound when trying to expand the syntax object in the above
> example; the syntax object has no scopes and therefore no bindings.
> 
> The `check-module-form` function adds a suitable scope to the `module`
> binding in the given syntax object. It would work just as well to not
> use `check-module-form` and to use `eval` so that the `module` binding
> is taken from the namespace.
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 2htdp place world frame on screen

2017-08-25 Thread Jay McCarthy
If you are interested in non-teaching and something LIKE 2htdp/world,
then I suggest my package, lux. It uses generics (rather than classes
for OO) and exposes a lot more options in the gui. (It doesn't expose
starting position, but it would be appropriate to add them to
lux/chaos/gui's make-gui.)

http://docs.racket-lang.org/lux/index.html

On Fri, Aug 25, 2017 at 9:44 AM, Matthias Felleisen
 wrote:
>
> :-)
>
> That’s not what I meant. I think that I need to figure out
> how to produce two version of ‘universe’ for the non-teaching
> world w/o completely forking the repo:
>
>  — a functional one
>  — an object-oriented one
>
> From what I can tell, 2htdp/universe + image has some appeal as
> as simple GUI framework for simple tasks and I should accommodate
> this (which will also reduce the overhead).
>
> ;; - - -
>
> But, if it is about managing concurrency in GUIs, you might be
> interested in Syndicate, which is where research and input
> from Tony Garnock-Jones has taken this idea:
>
>  http://syndicate-lang.org
>
> — Matthias
>
>
>
>
>
>
>> On Aug 25, 2017, at 8:46 AM, Laurent  wrote:
>>
>> It's about non-teaching, which I suspect will not be in my favour :)
>>
>> On Fri, Aug 25, 2017 at 1:31 PM, Matthias Felleisen  
>> wrote:
>>
>>> On Aug 25, 2017, at 7:43 AM, Laurent  wrote:
>>>
>>> Hi all,
>>>
>>> 2htdp is really neat and very useful, so thank you designers and 
>>> programmers of 2htdp!
>>>
>>> Sometimes I wish to place the window/frame on the screen at a particular 
>>> position, but the default sets it to (2, 2) as defined here:
>>>
>>> https://github.com/racket/htdp/blob/master/htdp-lib/2htdp/private/world.rkt#L216
>>>
>>> I'd like the user to be able to specify these values, but I'm not confident 
>>> about doing changes in there as there seem to be several layers in between 
>>> big-bang and world%, and a particular DSL.
>>>
>>> I suppose a clause must be added around here:
>>> https://github.com/racket/htdp/blob/master/htdp-lib/2htdp/universe.rkt#L139
>>> though I'm not sure what the format for a pair of numbers would be, or if 
>>> it would be better in on-draw instead (or if parameters wouldn't be better 
>>> for this, but 2htdp doesn't seem to use many parameters).
>>>
>>> Any advice?
>>
>>
>> Is this about teaching or about non-teaching uses of 2htdp? — Matthias
>>
>>
>>
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 2htdp place world frame on screen

2017-08-25 Thread Matthias Felleisen

:-) 

That’s not what I meant. I think that I need to figure out 
how to produce two version of ‘universe’ for the non-teaching 
world w/o completely forking the repo: 
 
 — a functional one 
 — an object-oriented one 

>From what I can tell, 2htdp/universe + image has some appeal as
as simple GUI framework for simple tasks and I should accommodate
this (which will also reduce the overhead). 

;; - - - 

But, if it is about managing concurrency in GUIs, you might be
interested in Syndicate, which is where research and input
from Tony Garnock-Jones has taken this idea: 

 http://syndicate-lang.org

— Matthias






> On Aug 25, 2017, at 8:46 AM, Laurent  wrote:
> 
> It's about non-teaching, which I suspect will not be in my favour :)
> 
> On Fri, Aug 25, 2017 at 1:31 PM, Matthias Felleisen  
> wrote:
> 
>> On Aug 25, 2017, at 7:43 AM, Laurent  wrote:
>> 
>> Hi all,
>> 
>> 2htdp is really neat and very useful, so thank you designers and programmers 
>> of 2htdp!
>> 
>> Sometimes I wish to place the window/frame on the screen at a particular 
>> position, but the default sets it to (2, 2) as defined here:
>> 
>> https://github.com/racket/htdp/blob/master/htdp-lib/2htdp/private/world.rkt#L216
>> 
>> I'd like the user to be able to specify these values, but I'm not confident 
>> about doing changes in there as there seem to be several layers in between 
>> big-bang and world%, and a particular DSL.
>> 
>> I suppose a clause must be added around here:
>> https://github.com/racket/htdp/blob/master/htdp-lib/2htdp/universe.rkt#L139
>> though I'm not sure what the format for a pair of numbers would be, or if it 
>> would be better in on-draw instead (or if parameters wouldn't be better for 
>> this, but 2htdp doesn't seem to use many parameters).
>> 
>> Any advice?
> 
> 
> Is this about teaching or about non-teaching uses of 2htdp? — Matthias
> 
> 
> 

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Unit tests for a #lang implementation

2017-08-25 Thread Matthew Flatt
I forgot to explain why this fails:

At Fri, 25 Aug 2017 14:59:14 +0200, Konrad Hinsen wrote:
> (eval-syntax
>   (parameterize ([read-accept-lang #t]
>  [read-accept-reader #t])
> (read-syntax "test-module"
>  (open-input-string "#lang 
> scribble/base\n@section[Introduction]")))
>   (module->namespace 'racket/base))
> 
> only says
> 
> ; test-module::1: module: unbound identifier;
> ;  also, no #%app syntax transformer is bound
> ;   at: module
> 
> although both module and %app are defined in racket/base.

The `eval-syntax` function refrains from adding any scopes to the given
syntax object before trying to expand it. So, it doesn't add the scope
for the namespace's top-level bindings (unlike `eval`, which does add
that scope before trying to expand). That's why `#%app` and `module`
are not bound when trying to expand the syntax object in the above
example; the syntax object has no scopes and therefore no bindings.

The `check-module-form` function adds a suitable scope to the `module`
binding in the given syntax object. It would work just as well to not
use `check-module-form` and to use `eval` so that the `module` binding
is taken from the namespace.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Unit tests for a #lang implementation

2017-08-25 Thread Matthew Flatt
I'd say that using `eval` or `eval-syntax` is the right idea, but:

 * It's better to use `make-base-namespace` instead of
   `module->namespace`, since `(module->namespace 'racket/base)` gives
   you a namespace for the inside of `racket/base` instead of a
   top-level namespace that has imported `racket/base`.

 * Use `check-module-form` from `syntax/modread` to make the `module`
   identifier in an S-expression module form (from `read-syntax`) is
   bound to the core `module` form.

Putting those together, and using `current-namespace` so that both
`eval-syntax` and check-module-form` use the same namespace:

   (require syntax/modread)

   (parameterize ([current-namespace (make-base-namespace)])
 (eval-syntax
  (check-module-form
   (parameterize ([read-accept-lang #t]
  [read-accept-reader #t])
  (read-syntax
   "test-module"
   (open-input-string
"#lang scribble/base\n@section{Introduction}")))
   'ignored #f)))


At Fri, 25 Aug 2017 14:59:14 +0200, Konrad Hinsen wrote:
> Hi all,
> 
> I have been trying for a while to write proper unit tests for a language 
> implementation I am working on. By "proper" tests I mean tests that are
> run using raco test just like any other tests. Until now, I have a 
> separate shell-script based testing framework that runs scripts written
> in my own #lang, but all too often I forgot to run those tests.
> 
> For a standard s-exp based language, this is not difficult:
> 
> (module+ test
> 
>(module demo lazy
>  (provide foo)
>  (define (foo x) (* 2 x)))
> 
>(require (only-in 'demo foo))
> 
>(check-equal? (force (foo 2)) 4))
> 
> But for a #lang that uses a different reader, I haven't found a working 
> solution yet. Even if I am willing to re-write my examples in s-exp 
> syntax, I run into problems:
> 
> (module+ test
> 
>(module example scribble/base
>  (section "Introduction"))
> 
>(require (only-in 'example doc))
> 
>(check-equal? (force (foo 2)) 4))
> 
> This yields the error message
> 
>module: no #%module-begin binding in the module's language
> 
> Anyway, what I really want is use the #lang's standard syntax. Reading 
> it isn't much of a problem:
> 
> (parameterize ([read-accept-lang #t]
>  [read-accept-reader #t])
> (read-syntax "test-module"
>  (open-input-string "#lang 
> scribble/base\n@section[Introduction]")))
> 
> But then I get a syntax-object for my module, which I need to evaluate 
> somehow. I'd expect eval-syntax to do the job, but...
> 
> (eval-syntax
>   (parameterize ([read-accept-lang #t]
>  [read-accept-reader #t])
> (read-syntax "test-module"
>  (open-input-string "#lang 
> scribble/base\n@section[Introduction]")))
>   (module->namespace 'racket/base))
> 
> only says
> 
> ; test-module::1: module: unbound identifier;
> ;  also, no #%app syntax transformer is bound
> ;   at: module
> 
> although both module and %app are defined in racket/base.
> 
> Any ideas (or pointers to examples) for doing this correctly?
> 
> Thanks in advance,
>Konrad.
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Unit tests for a #lang implementation

2017-08-25 Thread Konrad Hinsen

Hi all,

I have been trying for a while to write proper unit tests for a language 
implementation I am working on. By "proper" tests I mean tests that are
run using raco test just like any other tests. Until now, I have a 
separate shell-script based testing framework that runs scripts written

in my own #lang, but all too often I forgot to run those tests.

For a standard s-exp based language, this is not difficult:

(module+ test

  (module demo lazy
(provide foo)
(define (foo x) (* 2 x)))

  (require (only-in 'demo foo))

  (check-equal? (force (foo 2)) 4))

But for a #lang that uses a different reader, I haven't found a working 
solution yet. Even if I am willing to re-write my examples in s-exp 
syntax, I run into problems:


(module+ test

  (module example scribble/base
(section "Introduction"))

  (require (only-in 'example doc))

  (check-equal? (force (foo 2)) 4))

This yields the error message

  module: no #%module-begin binding in the module's language

Anyway, what I really want is use the #lang's standard syntax. Reading 
it isn't much of a problem:


(parameterize ([read-accept-lang #t]
[read-accept-reader #t])
   (read-syntax "test-module"
(open-input-string "#lang 
scribble/base\n@section[Introduction]")))


But then I get a syntax-object for my module, which I need to evaluate 
somehow. I'd expect eval-syntax to do the job, but...


(eval-syntax
 (parameterize ([read-accept-lang #t]
[read-accept-reader #t])
   (read-syntax "test-module"
(open-input-string "#lang 
scribble/base\n@section[Introduction]")))

 (module->namespace 'racket/base))

only says

; test-module::1: module: unbound identifier;
;  also, no #%app syntax transformer is bound
;   at: module

although both module and %app are defined in racket/base.

Any ideas (or pointers to examples) for doing this correctly?

Thanks in advance,
  Konrad.

--
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 2htdp place world frame on screen

2017-08-25 Thread Laurent
It's about non-teaching, which I suspect will not be in my favour :)

On Fri, Aug 25, 2017 at 1:31 PM, Matthias Felleisen 
wrote:

>
> On Aug 25, 2017, at 7:43 AM, Laurent  wrote:
>
> Hi all,
>
> 2htdp is really neat and very useful, so thank you designers and
> programmers of 2htdp!
>
> Sometimes I wish to place the window/frame on the screen at a particular
> position, but the default sets it to (2, 2) as defined here:
>
> https://github.com/racket/htdp/blob/master/htdp-lib/
> 2htdp/private/world.rkt#L216
>
> I'd like the user to be able to specify these values, but I'm not
> confident about doing changes in there as there seem to be several layers
> in between big-bang and world%, and a particular DSL.
>
> I suppose a clause must be added around here:
> https://github.com/racket/htdp/blob/master/htdp-lib/
> 2htdp/universe.rkt#L139
> though I'm not sure what the format for a pair of numbers would be, or if
> it would be better in on-draw instead (or if parameters wouldn't be better
> for this, but 2htdp doesn't seem to use many parameters).
>
> Any advice?
>
>
>
> Is this about teaching or about non-teaching uses of 2htdp? — Matthias
>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 2htdp place world frame on screen

2017-08-25 Thread Matthias Felleisen

> On Aug 25, 2017, at 7:43 AM, Laurent  wrote:
> 
> Hi all,
> 
> 2htdp is really neat and very useful, so thank you designers and programmers 
> of 2htdp!
> 
> Sometimes I wish to place the window/frame on the screen at a particular 
> position, but the default sets it to (2, 2) as defined here:
> 
> https://github.com/racket/htdp/blob/master/htdp-lib/2htdp/private/world.rkt#L216
>  
> 
> 
> I'd like the user to be able to specify these values, but I'm not confident 
> about doing changes in there as there seem to be several layers in between 
> big-bang and world%, and a particular DSL.
> 
> I suppose a clause must be added around here:
> https://github.com/racket/htdp/blob/master/htdp-lib/2htdp/universe.rkt#L139 
> 
> though I'm not sure what the format for a pair of numbers would be, or if it 
> would be better in on-draw instead (or if parameters wouldn't be better for 
> this, but 2htdp doesn't seem to use many parameters).
> 
> Any advice?


Is this about teaching or about non-teaching uses of 2htdp? — Matthias


-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] 2htdp place world frame on screen

2017-08-25 Thread Laurent
Hi all,

2htdp is really neat and very useful, so thank you designers and
programmers of 2htdp!

Sometimes I wish to place the window/frame on the screen at a particular
position, but the default sets it to (2, 2) as defined here:

https://github.com/racket/htdp/blob/master/htdp-lib/2htdp/private/world.rkt#L216

I'd like the user to be able to specify these values, but I'm not confident
about doing changes in there as there seem to be several layers in between
big-bang and world%, and a particular DSL.

I suppose a clause must be added around here:
https://github.com/racket/htdp/blob/master/htdp-lib/2htdp/universe.rkt#L139
though I'm not sure what the format for a pair of numbers would be, or if
it would be better in on-draw instead (or if parameters wouldn't be better
for this, but 2htdp doesn't seem to use many parameters).

Any advice?

Thanks!
Laurent

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Racket PPA updated for v6.10

2017-08-25 Thread Asumu Takikawa
Hi all,

The Ubuntu PPA has been updated for v6.10. Sorry for the delay this time around
and also for skipping a release! The PPA is available here:

  https://launchpad.net/~plt/+archive/ubuntu/racket

for trusty, xenial, and zesty.

The packaging repo (which tracks Debian's upstream repo) is also up on Github
now, so if you find any problems please submit them as issues there:

  https://github.com/takikawa/racket-ppa

Cheers,
Asumu 

-- 
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.
For more options, visit https://groups.google.com/d/optout.