Re: [racket-users] malloc + structs = ???

2019-01-01 Thread Ronald Garcia
Thanks Matthew!  That clears things up.  Indeed, I'll steer clear of 
'interior until next release. 
Cheers!
Ron


On Tuesday, January 1, 2019 at 10:27:00 AM UTC-8, Matthew Flatt wrote:
>
> Oh, right --- I was confusing 'interior with 'atomic-interior... and so 
> does the implementation! The `malloc` implementation uses the 
> 'atomic-interior allocator for 'interior. 
>
> That's easy to fix, and I'll push a repair. Meanwhile, I guess the 
> answer is to avoid 'interior. 
>
> At Tue, 1 Jan 2019 10:10:33 -0800 (PST), Ronald Garcia wrote: 
> > Hi Matthew, 
> > 
> > Thanks for the reply.  However, I see I mis-wrote:  I meant to say that 
> > 'interior is supposed to be like 'non-atomic, (whereas 'atomic-interior 
> is 
> > like 'atomic). 
> > Does that not make a difference? 
> > 
> > Thanks! 
> > Ron 
> > 
> > 
> > On Tuesday, January 1, 2019 at 10:06:56 AM UTC-8, Matthew Flatt wrote: 
> > > 
> > > Hi Ron, 
> > > 
> > > You can't install a Racket value into memory allocated with 'atomic or 
> > > 'interior. (That is, 'interior is like 'atomic, just as you write, and 
> > > not like 'nonatomic.) 
> > > 
> > > If you need a value that doesn't move and can reference a Racket 
> value, 
> > > try `malloc-immobile-cell`. 
> > > 
> > > Matthew 
> > > 
> > > At Tue, 1 Jan 2019 10:00:42 -0800 (PST), Ronald Garcia wrote: 
> > > > Hello, 
> > > > 
> > > > I'm trying to better understand how ffi/unsafe works, and I've run 
> into 
> > > > something I'm failing to understand.  Consider the following code: 
> > > > 
> > > > #lang racket 
> > > > (require ffi/unsafe) 
> > > > 
> > > > ;; 
> > > > ;; cbox-struct.rkt 
> > > > ;; 
> > > > 
> > > > (define-struct data (a b)) 
> > > > 
> > > > (define (cbox s)   
> > > >   (define ptr (malloc _racket 'interior)) 
> > > >   (ptr-set! ptr _racket s) 
> > > >   ptr) 
> > > > 
> > > > (define (cunbox cb) 
> > > >   (ptr-ref cb _racket 0)) 
> > > > 
> > > > (define cb1 (cbox (make-data 1 2))) 
> > > > 
> > > > (collect-garbage 'major) 
> > > > 
> > > > (data-a (cunbox cb1)) 
> > > > 
> > > > 
> > > > If I run this in Dr. Racket 7.1, I get the following error: 
> > > > data-a: contract violation; 
> > > >  given value instantiates a different structure type with the same 
> name 
> > > >   expected: data? 
> > > >   given: # 
> > > > 
> > > > - If I replace 'interior with 'nonatomic, the program successfully 
> > > produces 
> > > > 1. 
> > > > This difference in behaviour surprises me, since the docs for malloc 
> > > seem 
> > > > to suggest 
> > > > (by appeal to the "scheme_malloc" C functions) that interior and 
> atomic 
> > > > only differ in 
> > > > whether interior pointers are allowed and whether the object is ever 
> > > moved. 
> > > > 
> > > > Any ideas about what's happening here? 
> > > > 
> > > > Thanks! 
> > > > Ron 
> > > 
> > > 
> > 
> > -- 
> > 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...@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] Functional augmenting

2019-01-04 Thread Neil Van Dyke
I don't know what all is currently available for Racket[1], but two 
search keywords to slog through are "advice" and "aspect".


Aspects and other framework-y interfaces can be good for extensibility 
of a system.  (But maybe try to make loosely-coupled reusable modules 
that don't need it, as much as practical.)  When you don't have an 
interface like that, but really-really need it, advice is sometimes a 
lifesaver.


Separately, your particular example suggests that Racket's generics 
might do what you currently need to do.



[1] It seems a lot of researchy/experimenty independent Racket stuff is 
not well-advertised.


--
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] Functional augmenting

2019-01-04 Thread David Storrs
Cool, thanks.  I'll look into generics more.  I've skimmed past them before
this but never really dug in.

On Fri, Jan 4, 2019 at 1:46 PM Neil Van Dyke  wrote:

> I don't know what all is currently available for Racket[1], but two
> search keywords to slog through are "advice" and "aspect".
>
> Aspects and other framework-y interfaces can be good for extensibility
> of a system.  (But maybe try to make loosely-coupled reusable modules
> that don't need it, as much as practical.)  When you don't have an
> interface like that, but really-really need it, advice is sometimes a
> lifesaver.
>
> Separately, your particular example suggests that Racket's generics
> might do what you currently need to do.
>
>
> [1] It seems a lot of researchy/experimenty independent Racket stuff is
> not well-advertised.
>
>

-- 
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] Functional augmenting

2019-01-04 Thread Philip McGrath
I can't think of "something similar in functional Racket" (of course you
can write purely functional programs with racket/class, but I know what you
mean). I think it would be fairly easy to implement "something similar,"
but I want to clarify what you have in mind, because augmentable methods
don't quite match up with your pseudocode.

The first point is that what you're doing seems more like "override" than
"augment." Overriding methods is probably familiar to OOP people, but for
illustration, here's a class that implements an overridable method:
(define hi%
  (class object%
(super-new)
(define/public (greet who)
  (string-append  "Hi, " who
When a subclass overrides the `greet` method, its implementation of the
method gets called. The subclass can chose to call the superclass'
implementation using `super`:
(send (new (class hi%
 (super-new)
 (define/override (greet)
   (list (super greet "Alice")
 (super greet "Bob")
  greet)
;; -> '("Hi, Alice." "Hi, Bob.")
Or, it can ignore the superclass's implementation altogether:
(send (new (class hi%
 (super-new)
 (define/override (greet)
   "Leave me alone!")))
  greet)
;; -> "Leave me alone!"

In contrast, with an augmentable method, control start's with the
superclass' implementation. The subclass only gets control if/when the
superclass uses `inner` to invoke its implementation:
(define librarian%
  (class object%
(super-new)
(define/pubment (goodnight)
  (format "Goodnight, ~a."
  (or (with-handlers ([exn:fail? (λ (e) #f)])
(inner #f goodnight))
  "my someone")

(send (new librarian%) goodnight)
;; -> "Goodnight, my someone."
(send (new (class librarian%
 (super-new)
 (define/augment (goodnight)
   "my love")))
  goodnight)
;; -> "Goodnight, my love."
A subclass can't use `augment` to escape the superclass:
(send (new (class librarian%
 (super-new)
 (define/augment (goodnight)
   (eprintf "We've got trouble!\n")
   (error "Leave River City"
  goodnight)
;; prints "We've got trouble!\n" to stderr
;; -> "Goodnight, my someone."

Aside from that, neither `augment` nor `override` change the implementation
of a method for immediate instances of the superclass, whereas your
`before`, `after`, and `around` effectively `set!` the identifier greet to
a different value than it had before. With that insight, it isn't difficult
to make your pseudocode run:

#lang racket

(require rackunit
 syntax/parse/define
 racket/stxparam
 (for-syntax syntax/transformer))

(define-simple-macro (before name:id proc:expr ...+)
  (set! name (compose name proc ...)))
(define-simple-macro (after name:id proc:expr ...+)
  #:with name* #`(compose #,@(reverse (syntax->list #'(name proc ...
  (set! name name*))
(define-syntax-parameter inner
  (λ (stx) (raise-syntax-error #f "only allowed inside of around" stx)))
(define-simple-macro (around name:id proc:expr)
  (set! name
(let ([inner-name name])
  (syntax-parameterize
  ([inner (make-variable-like-transformer #'inner-name)])
proc

(define (greet name)
  (string-append  "Hi, " name "!"))

(check-equal? (greet "Bob") "Hi, Bob!")
(check-exn #rx"string-append" (λ () (greet 'Bob)))

(before greet ~a)
(check-equal? (greet 'Bob) "Hi, Bob!")

(after greet list)
(check-equal? (greet "Bob") '("Hi, Bob!"))

(around greet
(λ (name)
  (list "You asked me to say:"
(inner name)
"so I did.")))

(check-equal? (greet 'Bob)
  '("You asked me to say:"
("Hi, Bob!")
"so I did."))



-Philip


On Fri, Jan 4, 2019 at 2:51 PM David Storrs  wrote:

> Cool, thanks.  I'll look into generics more.  I've skimmed past them
> before this but never really dug in.
>
> On Fri, Jan 4, 2019 at 1:46 PM Neil Van Dyke  wrote:
>
>> I don't know what all is currently available for Racket[1], but two
>> search keywords to slog through are "advice" and "aspect".
>>
>> Aspects and other framework-y interfaces can be good for extensibility
>> of a system.  (But maybe try to make loosely-coupled reusable modules
>> that don't need it, as much as practical.)  When you don't have an
>> interface like t

[racket-users] Re: Functional augmenting

2019-01-06 Thread George Neuner
On Fri, 4 Jan 2019 13:30:43 -0500, David Storrs
 wrote:

>Racket's OO system has the 'augment' family of functionality that allows
>you to change how a function works.  I'm wondering if there's a way to do
>something similar in functional Racket.  For example, when I was working in
>Perl I used to be able to do something like this Racket pseudocode:
>
>> (define (greet name)
>  (println (string-append  "Hi, " name)))
>
>> (greet "bob")
>"Hi, bob!"
>
> :
>
>> (before greet ~a)  ; argument to greet is now passed to ~a before greet
>gets it
>
> :
>
>; or, alternatively, instead of pre, let's do:
>> (after greet list)
>
> :
>
>; or, how about full control?
>> (around greet
>  (lambda (name)
>(displayln "About to enter greet")
>(inner (~a name))
>(displayln "After greet"))>


Not that I can help wrt Racket, but this looks a lot like generic
functions in Lisp.  Is that what you're trying to achieve?


George

-- 
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] Functional augmenting

2019-01-07 Thread David Storrs
 2:51 PM David Storrs 
> wrote:
>
>> Cool, thanks.  I'll look into generics more.  I've skimmed past them
>> before this but never really dug in.
>>
>> On Fri, Jan 4, 2019 at 1:46 PM Neil Van Dyke 
>> wrote:
>>
>>> I don't know what all is currently available for Racket[1], but two
>>> search keywords to slog through are "advice" and "aspect".
>>>
>>> Aspects and other framework-y interfaces can be good for extensibility
>>> of a system.  (But maybe try to make loosely-coupled reusable modules
>>> that don't need it, as much as practical.)  When you don't have an
>>> interface like that, but really-really need it, advice is sometimes a
>>> lifesaver.
>>>
>>> Separately, your particular example suggests that Racket's generics
>>> might do what you currently need to do.
>>>
>>>
>>> [1] It seems a lot of researchy/experimenty independent Racket stuff is
>>> not well-advertised.
>>>
>>> --
>> 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] go cheney yourself

2019-01-08 Thread Tim Hanson
great piece by Michelle Goldberg, imho:

https://www.nytimes.com/2019/01/07/opinion/rashida-tlaib-profanity.html

-- 
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] Re: Functional augmenting

2019-01-09 Thread George Neuner
Hi Neil,

On Tue, 8 Jan 2019 14:28:29 -0500, Neil Van Dyke
 wrote:

>In current Racket, the defining module wasn't expecting its own 
>procedure definition to change out from under it, and other users of 
>that module also weren't expecting it to change.
>
>Racket semantics for procedures seems good for software engineering, as 
>well as for tools static analysis, and as a foundation for DSLs and 
>other languages implemented as transformations to Racket, and I don't 
>want to break all that.
>
>When we want polymorphism, we can use something like generics, which 
>normally tells both humans and tools that a particular different 
>abstraction is happening (even if you implemented it with normal 
>procedures -- the code and documentation would tell you of the 
>abstraction).  Whether to do that is also a decision of the module that 
>provides the procedure/generic definition and documents it.
>
>[1] However, if `before` in the quoted example is actually only 
>syntactic sugar for `define` with `apply`, then it's not mutating the 
>original procedure, so I can put down the fire extinguisher.  

AFAICS the example is nothing but a wrapper that mutates the input to
the original.  I see nothing wrong with that.

Even in the case of generics, in no case is the original procedure
being mutated.  It's simply being superceded by a new [same name]
function that (theoretically) adds value.  The new function may (or
not) call the original as part of its working.

For normal functions/procedures I don't see harm in wrappers that
specialize them to new environments.  This is done all the time.  If
you are objecting to the wrapper having the same name as the original
function then I take your point about potential confusion ... but
otherwise I'm lost.


>In that 
>syntactic sugar case, whether to do it is a very local decision, of each 
>module that internally opts to use that sugar. Maybe that sugar makes 
>sense, for those particular modules that use it, within whatever 
>project/organization maintains that source code.

George

-- 
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] Re: Output values

2019-01-20 Thread Jonathan Simpson
Are you looking for the values function? 

https://docs.racket-lang.org/reference/values.html?q=values#%28def._%28%28quote._~23~25kernel%29._values%29%29

In your example you'd end EnumTriplet with this:

(values x y z)


-- Jonathan

On Friday, January 18, 2019 at 8:49:30 AM UTC-5, Alain Bertrand wrote:
>
> Hi all, 
>
> I am an absolute beginner in Racket. 
> I wrote the following function which deals with Cantor pairing function. 
>
> (define (EnumTriplet n) 
>   (define inter (Enum n)) 
>   (define z (fst inter)) 
>   (define result (Enum (snd inter))) 
>   (define x (fst result)) 
>   (define y (snd result)) 
>   x 
>   ;;y 
>   ;;z 
>   ) 
>
> (EnumTriplet 5259 ) should output  5 8 6 
> How can I modify EnumTriplet so that I got this output ? 
>
> Thanks for your help. 
>
> Alain 
>

-- 
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] ann: forms

2019-01-21 Thread Jack Rosenthal
> Documentation: http://docs.racket-lang.org/forms/index.html
> Source code: https://github.com/Bogdanp/racket-forms

Bogdan,

That looks really cool! I'll have to make use of it in a future project
;)

Thanks for sharing!

-- 
Jack M. Rosenthal
http://jack.rosenth.al

Be kind to everyone that you meet.

-- 
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.


signature.asc
Description: PGP signature


[racket-users] Distributed places question

2019-01-21 Thread Matt Jadud
Hi all,

I have too much code for a "minimal working example."

Every time I run a distributed places program, I get different results.
Sadly, it's complex, and I'm confident there are multiple places I could be
missing something. This is all running on a 256-core machine, and my
distributed places are all ssh connections to localhost. Each worker
spawned gets a unique port. I get non-deterministic results regardless of
whether I am running 2 or 64 or 128 places.

1. I have a queen bee process that reads in IDs from a database table.
2. Workers request, via distributed place channel, an ID.
3. The queen (which has a separate router for each worker running in
separate threads) sends an ID. This is dequeued from a semaphore-protected
queue.
4. The workers do queries based on that ID, some arithmetic calculations,
and then send a serializable struct back to the queen (received by the
router assigned to that worker). All comms, actually, use serializable
structs, and I match on those structs at both ends.
5. The queen uses a channel (local/internal) to send that struct to a
thread managing a queue.
6. Because there are multiple writers to that internal channel, a semaphore
is used within the processing thread to protect the queue.
7. A final thread picks elements off the queue (protected by the same
semaphore), and those structs are written into a database. There is a
separate DB for storing the results. There are no contention issues between
the table from which data is read during runtime and the DB where data is
stored at the end.

It's... not the simplest structure. That said, the comms between
queen/worker are deterministic; from ID fetch to final result, there is no
non-determinism. It is a bit of back-and-forth, but unrolled, it is a
pipeline pattern. So, between queen and worker, there should be no
impediments to communication, and no non-deterministic/branching
communications.

If I understand channels in Racket correctly, I can have multiple writers
to a single channel end, so although there is non-determinism in the
routers writing to the queuing thread, they should all be serviced. The
queue itself is, therefore, doubly-protected, once by the comms structure,
and once by the semaphore: it should not be possible for two threads to
ever be in the queue, either to insert or dequeue. The database tables are
either for reading or writing: never the two shall meet.

 1. If a worker chokes on something, will I ever know? I don't believe I
have a logging/error interface set up for the workers. (Besides... if they
die, how do they communicate that back over a channel before dying?) If
they threw an exception, would I hear about it while I'm watching the queen
run?

2. Is it possible for a distributed channel to drop data silently? Should I
add logging that lets me trace all of my comms from Q->W and back again?

3. Should I have a set of logs (for queen and all workers) that let me
reconstruct all comms/computations? I can do this, but I was hoping someone
would say "X possibly fails in Y way...", and that would provide insight
before I do all of that instrumentation work.

Ultimately, I think the heart of my questions have to do with the way
workers might silently die (if they can), and whether it is possible that
distributed channels can silently drop data without my queen process
knowing. (The latter would seem like an awfully big thing, and so I
sincerely doubt that's the issue.) Those are two big holes in my mental map
of how distributed places work, and I've spent enough time cleaning
up/refactoring/simplifying things that I thought I would ask the community
at this point.

I'm bothered because the DB work and calculations are all so deterministic.
I've only parallelized this because of the volume of data that ultimately
needs to be processed...

Cheers,
Matt

-- 
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] snake game

2019-01-23 Thread David Storrs
What happens when you run it?  Are you getting any error messages?

On Wed, Jan 23, 2019 at 1:01 PM orenpa11  wrote:
>
> Hi
> I am trying to implemet this code of "snake game "
> https://course.ccs.neu.edu/csu211/code/snake-full.ss
>
> in DrRacket (Pretty big)
>  But when I run it it is not working .
> any Idea ?
>
> Thanks
> Or
>
> --
> 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] snake game

2019-01-23 Thread orenpa11
Hi David,
Thanks for your swift response ,I simply do not know how to run this 
program.
I thought that when I press the run button I should see the snake GUI .

Maybe the language is not pretty big ?
Thanks,
Or


On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs wrote:
>
> What happens when you run it?  Are you getting any error messages? 
>
> On Wed, Jan 23, 2019 at 1:01 PM orenpa11 > 
> wrote: 
> > 
> > Hi 
> > I am trying to implemet this code of "snake game " 
> > https://course.ccs.neu.edu/csu211/code/snake-full.ss 
> > 
> > in DrRacket (Pretty big) 
> >  But when I run it it is not working . 
> > any Idea ? 
> > 
> > Thanks 
> > Or 
> > 
> > -- 
> > 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...@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] snake game

2019-01-23 Thread 'John Clements' via Racket Users
Interesting problem; your screenshot shows header text that should not appear 
in the window, which suggests to me that you copied and pasted the text from 
somewhere else into a buffer where the language level was already set. It looks 
to me like you should do the following:

1) Delete the first three lines of the file.
2) Set the language level to “beginner with list abbreviations”.
3) Click “run”

John Clements

> On Jan 23, 2019, at 10:44 AM, orenpa11  wrote:
> 
> Hi David,
> Thanks for your swift response ,I simply do not know how to run this program.
> I thought that when I press the run button I should see the snake GUI .
> 
> Maybe the language is not pretty big ?
> Thanks,
> Or
> 
> 
> On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs wrote:
> What happens when you run it?  Are you getting any error messages? 
> 
> On Wed, Jan 23, 2019 at 1:01 PM orenpa11  wrote: 
> > 
> > Hi 
> > I am trying to implemet this code of "snake game " 
> > https://course.ccs.neu.edu/csu211/code/snake-full.ss 
> > 
> > in DrRacket (Pretty big) 
> >  But when I run it it is not working . 
> > any Idea ? 
> > 
> > Thanks 
> > Or 
> > 
> > -- 
> > 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...@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.



-- 
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] snake game

2019-01-23 Thread K H
Hello Or,

The language is not "Pretty Big".

You should be using "Beginning Student with List Abbreviations".

The DrRacket metadata lines referred to by John set the correct language.
In your case you must have changed the language somehow. Or perhaps the
file needs to be saved before the metadata is acted upon.

HTH,

Kieron.


On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users <
racket-users@googlegroups.com> wrote:

> Interesting problem; your screenshot shows header text that should not
> appear in the window, which suggests to me that you copied and pasted the
> text from somewhere else into a buffer where the language level was already
> set. It looks to me like you should do the following:
>
> 1) Delete the first three lines of the file.
> 2) Set the language level to “beginner with list abbreviations”.
> 3) Click “run”
>
> John Clements
>
> > On Jan 23, 2019, at 10:44 AM, orenpa11  wrote:
> >
> > Hi David,
> > Thanks for your swift response ,I simply do not know how to run this
> program.
> > I thought that when I press the run button I should see the snake GUI .
> >
> > Maybe the language is not pretty big ?
> > Thanks,
> > Or
> >
> >
> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs
> wrote:
> > What happens when you run it?  Are you getting any error messages?
> >
> > On Wed, Jan 23, 2019 at 1:01 PM orenpa11  wrote:
> > >
> > > Hi
> > > I am trying to implemet this code of "snake game "
> > > https://course.ccs.neu.edu/csu211/code/snake-full.ss
> > >
> > > in DrRacket (Pretty big)
> > >  But when I run it it is not working .
> > > any Idea ?
> > >
> > > Thanks
> > > Or
> > >
> > > --
> > > 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...@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.
>
>
>
> --
> 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] snake game

2019-01-23 Thread K H
It seems the metadata lines added by DrRacket (mentioned by John) are
processed when the a source file is loaded into DrRacket (via the menu
option File/Open), but are not processed if the source code is directly
copied (e.g. from a browser window) into a DrRacket window and then
executed with the 'Run' button.

The metadata includes a #reader directive, e.g.:
(#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full)
...)

This reader directive appears to be silently ignored by DrRacket when the
source is 'Run', even though DrRacket shows "#reader" in red (as when an
error is detected). The actions taken by DrRacket when 'Run' is pressed
seem to depend on the settings in effect when the code is executed, which
could be nothing, or throwing a confusing error.

The solution for the original poster's issue is as John directs; remove the
metadata (i.e. #reader directive) and manually set the language.

However, I feel that DrRacket should recognize and act on (and perhaps also
remove/hide from view) the metadata if the metadata occurs as from a
copy/paste directly into a DrRacket window (e.g. as from a URL). The
current behaviour is, I think, a bug and a trap (perhaps showstopping) for
a new user experimenting with Racket.

Note that the Racket executable seems to process the metadata properly,
understanding the language to use, etc.. so that the code behaves as
intended.

On Wed, Jan 23, 2019 at 12:32 PM K H  wrote:

> Hello Or,
>
> The language is not "Pretty Big".
>
> You should be using "Beginning Student with List Abbreviations".
>
> The DrRacket metadata lines referred to by John set the correct language.
> In your case you must have changed the language somehow. Or perhaps the
> file needs to be saved before the metadata is acted upon.
>
> HTH,
>
> Kieron.
>
>
> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users <
> racket-users@googlegroups.com> wrote:
>
>> Interesting problem; your screenshot shows header text that should not
>> appear in the window, which suggests to me that you copied and pasted the
>> text from somewhere else into a buffer where the language level was already
>> set. It looks to me like you should do the following:
>>
>> 1) Delete the first three lines of the file.
>> 2) Set the language level to “beginner with list abbreviations”.
>> 3) Click “run”
>>
>> John Clements
>>
>> > On Jan 23, 2019, at 10:44 AM, orenpa11  wrote:
>> >
>> > Hi David,
>> > Thanks for your swift response ,I simply do not know how to run this
>> program.
>> > I thought that when I press the run button I should see the snake GUI .
>> >
>> > Maybe the language is not pretty big ?
>> > Thanks,
>> > Or
>> >
>> >
>> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs
>> wrote:
>> > What happens when you run it?  Are you getting any error messages?
>> >
>> > On Wed, Jan 23, 2019 at 1:01 PM orenpa11  wrote:
>> > >
>> > > Hi
>> > > I am trying to implemet this code of "snake game "
>> > > https://course.ccs.neu.edu/csu211/code/snake-full.ss
>> > >
>> > > in DrRacket (Pretty big)
>> > >  But when I run it it is not working .
>> > > any Idea ?
>> > >
>> > > Thanks
>> > > Or
>> > >
>> > > --
>> > > 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...@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.
>>
>>
>>
>> --
>> 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] snake game

2019-01-23 Thread orenpa11
Thanks I will check it.




On Wednesday, January 23, 2019 at 9:32:56 PM UTC+2, Kieron Hardy wrote:
>
> Hello Or,
>
> The language is not "Pretty Big".
>
> You should be using "Beginning Student with List Abbreviations".
>
> The DrRacket metadata lines referred to by John set the correct language. 
> In your case you must have changed the language somehow. Or perhaps the 
> file needs to be saved before the metadata is acted upon.
>
> HTH,
>
> Kieron.
>
>
> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users <
> racket...@googlegroups.com > wrote:
>
>> Interesting problem; your screenshot shows header text that should not 
>> appear in the window, which suggests to me that you copied and pasted the 
>> text from somewhere else into a buffer where the language level was already 
>> set. It looks to me like you should do the following:
>>
>> 1) Delete the first three lines of the file.
>> 2) Set the language level to “beginner with list abbreviations”.
>> 3) Click “run”
>>
>> John Clements
>>
>> > On Jan 23, 2019, at 10:44 AM, orenpa11 > 
>> wrote:
>> > 
>> > Hi David,
>> > Thanks for your swift response ,I simply do not know how to run this 
>> program.
>> > I thought that when I press the run button I should see the snake GUI .
>> > 
>> > Maybe the language is not pretty big ?
>> > Thanks,
>> > Or
>> > 
>> > 
>> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs 
>> wrote:
>> > What happens when you run it?  Are you getting any error messages? 
>> > 
>> > On Wed, Jan 23, 2019 at 1:01 PM orenpa11  wrote: 
>> > > 
>> > > Hi 
>> > > I am trying to implemet this code of "snake game " 
>> > > https://course.ccs.neu.edu/csu211/code/snake-full.ss 
>> > > 
>> > > in DrRacket (Pretty big) 
>> > >  But when I run it it is not working . 
>> > > any Idea ? 
>> > > 
>> > > Thanks 
>> > > Or 
>> > > 
>> > > -- 
>> > > 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...@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...@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...@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] snake game

2019-01-23 Thread orenpa11
Thanks

On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy wrote:
>
> It seems the metadata lines added by DrRacket (mentioned by John) are 
> processed when the a source file is loaded into DrRacket (via the menu 
> option File/Open), but are not processed if the source code is directly 
> copied (e.g. from a browser window) into a DrRacket window and then 
> executed with the 'Run' button.
>
> The metadata includes a #reader directive, e.g.:
> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
> ...) 
>
> This reader directive appears to be silently ignored by DrRacket when the 
> source is 'Run', even though DrRacket shows "#reader" in red (as when an 
> error is detected). The actions taken by DrRacket when 'Run' is pressed 
> seem to depend on the settings in effect when the code is executed, which 
> could be nothing, or throwing a confusing error. 
>
> The solution for the original poster's issue is as John directs; remove 
> the metadata (i.e. #reader directive) and manually set the language.
>
> However, I feel that DrRacket should recognize and act on (and perhaps 
> also remove/hide from view) the metadata if the metadata occurs as from a 
> copy/paste directly into a DrRacket window (e.g. as from a URL). The 
> current behaviour is, I think, a bug and a trap (perhaps showstopping) for 
> a new user experimenting with Racket. 
>
> Note that the Racket executable seems to process the metadata properly, 
> understanding the language to use, etc.. so that the code behaves as 
> intended.
>
> On Wed, Jan 23, 2019 at 12:32 PM K H > 
> wrote:
>
>> Hello Or,
>>
>> The language is not "Pretty Big".
>>
>> You should be using "Beginning Student with List Abbreviations".
>>
>> The DrRacket metadata lines referred to by John set the correct language. 
>> In your case you must have changed the language somehow. Or perhaps the 
>> file needs to be saved before the metadata is acted upon.
>>
>> HTH,
>>
>> Kieron.
>>
>>
>> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users <
>> racket...@googlegroups.com > wrote:
>>
>>> Interesting problem; your screenshot shows header text that should not 
>>> appear in the window, which suggests to me that you copied and pasted the 
>>> text from somewhere else into a buffer where the language level was already 
>>> set. It looks to me like you should do the following:
>>>
>>> 1) Delete the first three lines of the file.
>>> 2) Set the language level to “beginner with list abbreviations”.
>>> 3) Click “run”
>>>
>>> John Clements
>>>
>>> > On Jan 23, 2019, at 10:44 AM, orenpa11 > 
>>> wrote:
>>> > 
>>> > Hi David,
>>> > Thanks for your swift response ,I simply do not know how to run this 
>>> program.
>>> > I thought that when I press the run button I should see the snake GUI .
>>> > 
>>> > Maybe the language is not pretty big ?
>>> > Thanks,
>>> > Or
>>> > 
>>> > 
>>> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs 
>>> wrote:
>>> > What happens when you run it?  Are you getting any error messages? 
>>> > 
>>> > On Wed, Jan 23, 2019 at 1:01 PM orenpa11  wrote: 
>>> > > 
>>> > > Hi 
>>> > > I am trying to implemet this code of "snake game " 
>>> > > https://course.ccs.neu.edu/csu211/code/snake-full.ss 
>>> > > 
>>> > > in DrRacket (Pretty big) 
>>> > >  But when I run it it is not working . 
>>> > > any Idea ? 
>>> > > 
>>> > > Thanks 
>>> > > Or 
>>> > > 
>>> > > -- 
>>> > > 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...@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...@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...@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] snake game

2019-01-24 Thread orenpa11
Hi,
when I removed the line
#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
(read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor 
repeating-decimal #f #t none #f (

And changed the  language to pretty big.
I recived this error:
Welcome to DrRacket, version 7.1 [3m].
Language: Pretty Big; memory limit: 128 MB.
. . check-expect: undefined;
 cannot reference an identifier before its definition

Any idea ?

Thanks,
Or





On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy wrote:
>
> It seems the metadata lines added by DrRacket (mentioned by John) are 
> processed when the a source file is loaded into DrRacket (via the menu 
> option File/Open), but are not processed if the source code is directly 
> copied (e.g. from a browser window) into a DrRacket window and then 
> executed with the 'Run' button.
>
> The metadata includes a #reader directive, e.g.:
> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
> ...) 
>
> This reader directive appears to be silently ignored by DrRacket when the 
> source is 'Run', even though DrRacket shows "#reader" in red (as when an 
> error is detected). The actions taken by DrRacket when 'Run' is pressed 
> seem to depend on the settings in effect when the code is executed, which 
> could be nothing, or throwing a confusing error. 
>
> The solution for the original poster's issue is as John directs; remove 
> the metadata (i.e. #reader directive) and manually set the language.
>
> However, I feel that DrRacket should recognize and act on (and perhaps 
> also remove/hide from view) the metadata if the metadata occurs as from a 
> copy/paste directly into a DrRacket window (e.g. as from a URL). The 
> current behaviour is, I think, a bug and a trap (perhaps showstopping) for 
> a new user experimenting with Racket. 
>
> Note that the Racket executable seems to process the metadata properly, 
> understanding the language to use, etc.. so that the code behaves as 
> intended.
>
> On Wed, Jan 23, 2019 at 12:32 PM K H > 
> wrote:
>
>> Hello Or,
>>
>> The language is not "Pretty Big".
>>
>> You should be using "Beginning Student with List Abbreviations".
>>
>> The DrRacket metadata lines referred to by John set the correct language. 
>> In your case you must have changed the language somehow. Or perhaps the 
>> file needs to be saved before the metadata is acted upon.
>>
>> HTH,
>>
>> Kieron.
>>
>>
>> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users <
>> racket...@googlegroups.com > wrote:
>>
>>> Interesting problem; your screenshot shows header text that should not 
>>> appear in the window, which suggests to me that you copied and pasted the 
>>> text from somewhere else into a buffer where the language level was already 
>>> set. It looks to me like you should do the following:
>>>
>>> 1) Delete the first three lines of the file.
>>> 2) Set the language level to “beginner with list abbreviations”.
>>> 3) Click “run”
>>>
>>> John Clements
>>>
>>> > On Jan 23, 2019, at 10:44 AM, orenpa11 > 
>>> wrote:
>>> > 
>>> > Hi David,
>>> > Thanks for your swift response ,I simply do not know how to run this 
>>> program.
>>> > I thought that when I press the run button I should see the snake GUI .
>>> > 
>>> > Maybe the language is not pretty big ?
>>> > Thanks,
>>> > Or
>>> > 
>>> > 
>>> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs 
>>> wrote:
>>> > What happens when you run it?  Are you getting any error messages? 
>>> > 
>>> > On Wed, Jan 23, 2019 at 1:01 PM orenpa11  wrote: 
>>> > > 
>>> > > Hi 
>>> > > I am trying to implemet this code of "snake game " 
>>> > > https://course.ccs.neu.edu/csu211/code/snake-full.ss 
>>> > > 
>>> > > in DrRacket (Pretty big) 
>>> > >  But when I run it it is not working . 
>>> > > any Idea ? 
>>> > > 
>>> > > Thanks 
>>> > > Or 
>>> > > 
>>> > > -- 
>>> > > 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, 
>>> s

Re: [racket-users] snake game

2019-01-24 Thread Kieron Hardy
The language you should be using is "Beginning Student with List Abbreviations".

> On Jan 24, 2019, at 4:33 AM, orenpa11  wrote:
> 
> Hi,
> when I removed the line
> #reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
> (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor 
> repeating-decimal #f #t none #f (
> 
> And changed the  language to pretty big.
> I recived this error:
> Welcome to DrRacket, version 7.1 [3m].
> Language: Pretty Big; memory limit: 128 MB.
> . . check-expect: undefined;
>  cannot reference an identifier before its definition
> 
> Any idea ?
> 
> Thanks,
> Or
> 
> 
> 
> 
> 
>> On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy wrote:
>> It seems the metadata lines added by DrRacket (mentioned by John) are 
>> processed when the a source file is loaded into DrRacket (via the menu 
>> option File/Open), but are not processed if the source code is directly 
>> copied (e.g. from a browser window) into a DrRacket window and then executed 
>> with the 'Run' button.
>> 
>> The metadata includes a #reader directive, e.g.:
>> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
>> ...) 
>> 
>> This reader directive appears to be silently ignored by DrRacket when the 
>> source is 'Run', even though DrRacket shows "#reader" in red (as when an 
>> error is detected). The actions taken by DrRacket when 'Run' is pressed seem 
>> to depend on the settings in effect when the code is executed, which could 
>> be nothing, or throwing a confusing error. 
>> 
>> The solution for the original poster's issue is as John directs; remove the 
>> metadata (i.e. #reader directive) and manually set the language.
>> 
>> However, I feel that DrRacket should recognize and act on (and perhaps also 
>> remove/hide from view) the metadata if the metadata occurs as from a 
>> copy/paste directly into a DrRacket window (e.g. as from a URL). The current 
>> behaviour is, I think, a bug and a trap (perhaps showstopping) for a new 
>> user experimenting with Racket. 
>> 
>> Note that the Racket executable seems to process the metadata properly, 
>> understanding the language to use, etc.. so that the code behaves as 
>> intended.
>> 
>>> On Wed, Jan 23, 2019 at 12:32 PM K H  wrote:
>>> Hello Or,
>>> 
>>> The language is not "Pretty Big".
>>> 
>>> You should be using "Beginning Student with List Abbreviations".
>>> 
>>> The DrRacket metadata lines referred to by John set the correct language. 
>>> In your case you must have changed the language somehow. Or perhaps the 
>>> file needs to be saved before the metadata is acted upon.
>>> 
>>> HTH,
>>> 
>>> Kieron.
>>> 
>>> 
>>>> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users 
>>>>  wrote:
>>>> Interesting problem; your screenshot shows header text that should not 
>>>> appear in the window, which suggests to me that you copied and pasted the 
>>>> text from somewhere else into a buffer where the language level was 
>>>> already set. It looks to me like you should do the following:
>>>> 
>>>> 1) Delete the first three lines of the file.
>>>> 2) Set the language level to “beginner with list abbreviations”.
>>>> 3) Click “run”
>>>> 
>>>> John Clements
>>>> 
>>>> > On Jan 23, 2019, at 10:44 AM, orenpa11  wrote:
>>>> > 
>>>> > Hi David,
>>>> > Thanks for your swift response ,I simply do not know how to run this 
>>>> > program.
>>>> > I thought that when I press the run button I should see the snake GUI .
>>>> > 
>>>> > Maybe the language is not pretty big ?
>>>> > Thanks,
>>>> > Or
>>>> > 
>>>> > 
>>>> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs 
>>>> > wrote:
>>>> > What happens when you run it?  Are you getting any error messages? 
>>>> > 
>>>> > On Wed, Jan 23, 2019 at 1:01 PM orenpa11  wrote: 
>>>> > > 
>>>> > > Hi 
>>>> > > I am trying to implemet this code of "snake game " 
>>>> > > https://course.ccs.neu.edu/csu211/code/snake-full.ss 
>>>> &g

Re: [racket-users] snake game

2019-01-24 Thread orenpa11
Hi
I need to create a project in pertty big .
why this code is not been supported ?

Thanks,
Or

On Thursday, January 24, 2019 at 3:29:11 PM UTC+2, Kieron Hardy wrote:
>
> The language you should be using is "Beginning Student with List 
> Abbreviations".
>
> On Jan 24, 2019, at 4:33 AM, orenpa11 > 
> wrote:
>
> Hi,
> when I removed the line
> #reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
> (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor 
> repeating-decimal #f #t none #f (
>
> And changed the  language to pretty big.
> I recived this error:
> Welcome to DrRacket, version 7.1 [3m].
> Language: Pretty Big; memory limit: 128 MB.
> . . check-expect: undefined;
>  cannot reference an identifier before its definition
>
> Any idea ?
>
> Thanks,
> Or
>
>
>
>
>
> On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy wrote:
>>
>> It seems the metadata lines added by DrRacket (mentioned by John) are 
>> processed when the a source file is loaded into DrRacket (via the menu 
>> option File/Open), but are not processed if the source code is directly 
>> copied (e.g. from a browser window) into a DrRacket window and then 
>> executed with the 'Run' button.
>>
>> The metadata includes a #reader directive, e.g.:
>> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
>> ...) 
>>
>> This reader directive appears to be silently ignored by DrRacket when the 
>> source is 'Run', even though DrRacket shows "#reader" in red (as when an 
>> error is detected). The actions taken by DrRacket when 'Run' is pressed 
>> seem to depend on the settings in effect when the code is executed, which 
>> could be nothing, or throwing a confusing error. 
>>
>> The solution for the original poster's issue is as John directs; remove 
>> the metadata (i.e. #reader directive) and manually set the language.
>>
>> However, I feel that DrRacket should recognize and act on (and perhaps 
>> also remove/hide from view) the metadata if the metadata occurs as from a 
>> copy/paste directly into a DrRacket window (e.g. as from a URL). The 
>> current behaviour is, I think, a bug and a trap (perhaps showstopping) for 
>> a new user experimenting with Racket. 
>>
>> Note that the Racket executable seems to process the metadata properly, 
>> understanding the language to use, etc.. so that the code behaves as 
>> intended.
>>
>> On Wed, Jan 23, 2019 at 12:32 PM K H  wrote:
>>
>>> Hello Or,
>>>
>>> The language is not "Pretty Big".
>>>
>>> You should be using "Beginning Student with List Abbreviations".
>>>
>>> The DrRacket metadata lines referred to by John set the correct 
>>> language. In your case you must have changed the language somehow. Or 
>>> perhaps the file needs to be saved before the metadata is acted upon.
>>>
>>> HTH,
>>>
>>> Kieron.
>>>
>>>
>>> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users <
>>> racket...@googlegroups.com> wrote:
>>>
>>>> Interesting problem; your screenshot shows header text that should not 
>>>> appear in the window, which suggests to me that you copied and pasted the 
>>>> text from somewhere else into a buffer where the language level was 
>>>> already 
>>>> set. It looks to me like you should do the following:
>>>>
>>>> 1) Delete the first three lines of the file.
>>>> 2) Set the language level to “beginner with list abbreviations”.
>>>> 3) Click “run”
>>>>
>>>> John Clements
>>>>
>>>> > On Jan 23, 2019, at 10:44 AM, orenpa11  wrote:
>>>> > 
>>>> > Hi David,
>>>> > Thanks for your swift response ,I simply do not know how to run this 
>>>> program.
>>>> > I thought that when I press the run button I should see the snake GUI 
>>>> .
>>>> > 
>>>> > Maybe the language is not pretty big ?
>>>> > Thanks,
>>>> > Or
>>>> > 
>>>> > 
>>>> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs 
>>>> wrote:
>>>> > What happens when you run it?  Are you getting any error messages? 
>>>> > 
>>>> > On Wed, Jan 23, 2019 at 1:01 P

Re: [racket-users] snake game

2019-01-24 Thread George Neuner



On 1/24/2019 12:56 PM, orenpa11 wrote:

I need to create a project in pertty big .
why this code is not been supported ?


"Pretty Big" is supported.
  - go to the Language menu
  - select "Choose Language"
  - go down to "Other Languages"

If you don't see a list under "Other Languages", click the circle next 
to it.

You will find "Pretty Big" there.

George

--
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] snake game

2019-01-24 Thread Matthias Felleisen



Where did you find the snake game? 
Where did it say it’s written in Pretty Big? 

We have not used Pretty Big in over a decade in education, 
neither does anyone in the Racket edu community proper. 

This community supports people readily wth answers, but 
we need to know what you know. 

— Matthias




> On Jan 24, 2019, at 12:56 PM, orenpa11  wrote:
> 
> Hi
> I need to create a project in pertty big .
> why this code is not been supported ?
> 
> Thanks,
> Or
> 
> On Thursday, January 24, 2019 at 3:29:11 PM UTC+2, Kieron Hardy wrote:
> The language you should be using is "Beginning Student with List 
> Abbreviations".
> 
> On Jan 24, 2019, at 4:33 AM, orenpa11  wrote:
> 
>> Hi,
>> when I removed the line
>> #reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
>> (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor 
>> repeating-decimal #f #t none #f (
>> 
>> And changed the  language to pretty big.
>> I recived this error:
>> Welcome to DrRacket, version 7.1 [3m].
>> Language: Pretty Big; memory limit: 128 MB.
>> . . check-expect: undefined;
>>  cannot reference an identifier before its definition
>> 
>> Any idea ?
>> 
>> Thanks,
>> Or
>> 
>> 
>> 
>> 
>> 
>> On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy wrote:
>> It seems the metadata lines added by DrRacket (mentioned by John) are 
>> processed when the a source file is loaded into DrRacket (via the menu 
>> option File/Open), but are not processed if the source code is directly 
>> copied (e.g. from a browser window) into a DrRacket window and then executed 
>> with the 'Run' button.
>> 
>> The metadata includes a #reader directive, e.g.:
>> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
>> ...) 
>> 
>> This reader directive appears to be silently ignored by DrRacket when the 
>> source is 'Run', even though DrRacket shows "#reader" in red (as when an 
>> error is detected). The actions taken by DrRacket when 'Run' is pressed seem 
>> to depend on the settings in effect when the code is executed, which could 
>> be nothing, or throwing a confusing error. 
>> 
>> The solution for the original poster's issue is as John directs; remove the 
>> metadata (i.e. #reader directive) and manually set the language.
>> 
>> However, I feel that DrRacket should recognize and act on (and perhaps also 
>> remove/hide from view) the metadata if the metadata occurs as from a 
>> copy/paste directly into a DrRacket window (e.g. as from a URL). The current 
>> behaviour is, I think, a bug and a trap (perhaps showstopping) for a new 
>> user experimenting with Racket. 
>> 
>> Note that the Racket executable seems to process the metadata properly, 
>> understanding the language to use, etc.. so that the code behaves as 
>> intended.
>> 
>> On Wed, Jan 23, 2019 at 12:32 PM K H  wrote:
>> Hello Or,
>> 
>> The language is not "Pretty Big".
>> 
>> You should be using "Beginning Student with List Abbreviations".
>> 
>> The DrRacket metadata lines referred to by John set the correct language. In 
>> your case you must have changed the language somehow. Or perhaps the file 
>> needs to be saved before the metadata is acted upon.
>> 
>> HTH,
>> 
>> Kieron.
>> 
>> 
>> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users 
>>  wrote:
>> Interesting problem; your screenshot shows header text that should not 
>> appear in the window, which suggests to me that you copied and pasted the 
>> text from somewhere else into a buffer where the language level was already 
>> set. It looks to me like you should do the following:
>> 
>> 1) Delete the first three lines of the file.
>> 2) Set the language level to “beginner with list abbreviations”.
>> 3) Click “run”
>> 
>> John Clements
>> 
>> > On Jan 23, 2019, at 10:44 AM, orenpa11  wrote:
>> > 
>> > Hi David,
>> > Thanks for your swift response ,I simply do not know how to run this 
>> > program.
>> > I thought that when I press the run button I should see the snake GUI .
>> > 
>> > Maybe the language is not pretty big ?
>> > Thanks,
>> > Or
>> > 
>> > 
>> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs wrote:
>> > What happens when you run it?  Are

Re: [racket-users] snake game

2019-01-24 Thread orenpa11
Hi Matthias ,
Unfortunately I need to write the project in pretty big language.
The game is not written in pretty big language as far as I know.
I thought that can copy andycode that was written in any language in racket 
to pretty big.
Is there a way to transfer code that was written in  "Beginning Student 
with List Abbreviations" to pretty big ?

Thanks,
Or




On Thursday, January 24, 2019 at 9:19:14 PM UTC+2, Matthias Felleisen wrote:
>
>
>
> Where did you find the snake game? 
> Where did it say it’s written in Pretty Big? 
>
> We have not used Pretty Big in over a decade in education, 
> neither does anyone in the Racket edu community proper. 
>
> This community supports people readily wth answers, but 
> we need to know what you know. 
>
> — Matthias 
>
>
>
>
> > On Jan 24, 2019, at 12:56 PM, orenpa11 > 
> wrote: 
> > 
> > Hi 
> > I need to create a project in pertty big . 
> > why this code is not been supported ? 
> > 
> > Thanks, 
> > Or 
> > 
> > On Thursday, January 24, 2019 at 3:29:11 PM UTC+2, Kieron Hardy wrote: 
> > The language you should be using is "Beginning Student with List 
> Abbreviations". 
> > 
> > On Jan 24, 2019, at 4:33 AM, orenpa11  wrote: 
> > 
> >> Hi, 
> >> when I removed the line 
> >> #reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
> (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor 
> repeating-decimal #f #t none #f ( 
> >> 
> >> And changed the  language to pretty big. 
> >> I recived this error: 
> >> Welcome to DrRacket, version 7.1 [3m]. 
> >> Language: Pretty Big; memory limit: 128 MB. 
> >> . . check-expect: undefined; 
> >>  cannot reference an identifier before its definition 
> >> 
> >> Any idea ? 
> >> 
> >> Thanks, 
> >> Or 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy 
> wrote: 
> >> It seems the metadata lines added by DrRacket (mentioned by John) are 
> processed when the a source file is loaded into DrRacket (via the menu 
> option File/Open), but are not processed if the source code is directly 
> copied (e.g. from a browser window) into a DrRacket window and then 
> executed with the 'Run' button. 
> >> 
> >> The metadata includes a #reader directive, e.g.: 
> >> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
> snake-full) ...) 
> >> 
> >> This reader directive appears to be silently ignored by DrRacket when 
> the source is 'Run', even though DrRacket shows "#reader" in red (as when 
> an error is detected). The actions taken by DrRacket when 'Run' is pressed 
> seem to depend on the settings in effect when the code is executed, which 
> could be nothing, or throwing a confusing error. 
> >> 
> >> The solution for the original poster's issue is as John directs; remove 
> the metadata (i.e. #reader directive) and manually set the language. 
> >> 
> >> However, I feel that DrRacket should recognize and act on (and perhaps 
> also remove/hide from view) the metadata if the metadata occurs as from a 
> copy/paste directly into a DrRacket window (e.g. as from a URL). The 
> current behaviour is, I think, a bug and a trap (perhaps showstopping) for 
> a new user experimenting with Racket. 
> >> 
> >> Note that the Racket executable seems to process the metadata properly, 
> understanding the language to use, etc.. so that the code behaves as 
> intended. 
> >> 
> >> On Wed, Jan 23, 2019 at 12:32 PM K H  wrote: 
> >> Hello Or, 
> >> 
> >> The language is not "Pretty Big". 
> >> 
> >> You should be using "Beginning Student with List Abbreviations". 
> >> 
> >> The DrRacket metadata lines referred to by John set the correct 
> language. In your case you must have changed the language somehow. Or 
> perhaps the file needs to be saved before the metadata is acted upon. 
> >> 
> >> HTH, 
> >> 
> >> Kieron. 
> >> 
> >> 
> >> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users <
> racket...@googlegroups.com> wrote: 
> >> Interesting problem; your screenshot shows header text that should not 
> appear in the window, which suggests to me that you copied and pasted the 
> text from somewhere else into a buffer where the language level wa

Re: [racket-users] snake game

2019-01-24 Thread Matthias Felleisen


Yes there is. Use (require test-engine/racket-tests)
at the top and (test) at the bottom. 

But it sounds like you’re copying and pasting homework 
solutions. Hmph. 




> On Jan 24, 2019, at 3:44 PM, orenpa11  wrote:
> 
> Hi Matthias ,
> Unfortunately I need to write the project in pretty big language.
> The game is not written in pretty big language as far as I know.
> I thought that can copy andycode that was written in any language in racket 
> to pretty big.
> Is there a way to transfer code that was written in  "Beginning Student with 
> List Abbreviations" to pretty big ?
> 
> Thanks,
> Or
> 
> 
> 
> 
> On Thursday, January 24, 2019 at 9:19:14 PM UTC+2, Matthias Felleisen wrote:
> 
> 
> Where did you find the snake game? 
> Where did it say it’s written in Pretty Big? 
> 
> We have not used Pretty Big in over a decade in education, 
> neither does anyone in the Racket edu community proper. 
> 
> This community supports people readily wth answers, but 
> we need to know what you know. 
> 
> — Matthias 
> 
> 
> 
> 
> > On Jan 24, 2019, at 12:56 PM, orenpa11  wrote: 
> > 
> > Hi 
> > I need to create a project in pertty big . 
> > why this code is not been supported ? 
> > 
> > Thanks, 
> > Or 
> > 
> > On Thursday, January 24, 2019 at 3:29:11 PM UTC+2, Kieron Hardy wrote: 
> > The language you should be using is "Beginning Student with List 
> > Abbreviations". 
> > 
> > On Jan 24, 2019, at 4:33 AM, orenpa11  wrote: 
> > 
> >> Hi, 
> >> when I removed the line 
> >> #reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
> >> (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor 
> >> repeating-decimal #f #t none #f ( 
> >> 
> >> And changed the  language to pretty big. 
> >> I recived this error: 
> >> Welcome to DrRacket, version 7.1 [3m]. 
> >> Language: Pretty Big; memory limit: 128 MB. 
> >> . . check-expect: undefined; 
> >>  cannot reference an identifier before its definition 
> >> 
> >> Any idea ? 
> >> 
> >> Thanks, 
> >> Or 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy wrote: 
> >> It seems the metadata lines added by DrRacket (mentioned by John) are 
> >> processed when the a source file is loaded into DrRacket (via the menu 
> >> option File/Open), but are not processed if the source code is directly 
> >> copied (e.g. from a browser window) into a DrRacket window and then 
> >> executed with the 'Run' button. 
> >> 
> >> The metadata includes a #reader directive, e.g.: 
> >> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) 
> >> ...) 
> >> 
> >> This reader directive appears to be silently ignored by DrRacket when the 
> >> source is 'Run', even though DrRacket shows "#reader" in red (as when an 
> >> error is detected). The actions taken by DrRacket when 'Run' is pressed 
> >> seem to depend on the settings in effect when the code is executed, which 
> >> could be nothing, or throwing a confusing error. 
> >> 
> >> The solution for the original poster's issue is as John directs; remove 
> >> the metadata (i.e. #reader directive) and manually set the language. 
> >> 
> >> However, I feel that DrRacket should recognize and act on (and perhaps 
> >> also remove/hide from view) the metadata if the metadata occurs as from a 
> >> copy/paste directly into a DrRacket window (e.g. as from a URL). The 
> >> current behaviour is, I think, a bug and a trap (perhaps showstopping) for 
> >> a new user experimenting with Racket. 
> >> 
> >> Note that the Racket executable seems to process the metadata properly, 
> >> understanding the language to use, etc.. so that the code behaves as 
> >> intended. 
> >> 
> >> On Wed, Jan 23, 2019 at 12:32 PM K H  wrote: 
> >> Hello Or, 
> >> 
> >> The language is not "Pretty Big". 
> >> 
> >> You should be using "Beginning Student with List Abbreviations". 
> >> 
> >> The DrRacket metadata lines referred to by John set the correct language. 
> >> In your case you must have changed the language somehow. Or perhaps the 
> >> file needs to be saved before the metadata is acted u

Re: [racket-users] snake game

2019-01-24 Thread orenpa11
Hi
where can I find the  test-engine ?
I would like to copy the code  and  "play" with it.
So I can understand it better .
just copying the code is not helpful because I need to understand it.

Thanks,
Or

On Thursday, January 24, 2019 at 11:54:34 PM UTC+2, Matthias Felleisen 
wrote:
>
>
> Yes there is. Use (require test-engine/racket-tests) 
> at the top and (test) at the bottom. 
>
> But it sounds like you’re copying and pasting homework 
> solutions. Hmph. 
>
>
>
>
> > On Jan 24, 2019, at 3:44 PM, orenpa11 > 
> wrote: 
> > 
> > Hi Matthias , 
> > Unfortunately I need to write the project in pretty big language. 
> > The game is not written in pretty big language as far as I know. 
> > I thought that can copy andycode that was written in any language in 
> racket to pretty big. 
> > Is there a way to transfer code that was written in  "Beginning Student 
> with List Abbreviations" to pretty big ? 
> > 
> > Thanks, 
> > Or 
> > 
> > 
> > 
> > 
> > On Thursday, January 24, 2019 at 9:19:14 PM UTC+2, Matthias Felleisen 
> wrote: 
> > 
> > 
> > Where did you find the snake game? 
> > Where did it say it’s written in Pretty Big? 
> > 
> > We have not used Pretty Big in over a decade in education, 
> > neither does anyone in the Racket edu community proper. 
> > 
> > This community supports people readily wth answers, but 
> > we need to know what you know. 
> > 
> > — Matthias 
> > 
> > 
> > 
> > 
> > > On Jan 24, 2019, at 12:56 PM, orenpa11  wrote: 
> > > 
> > > Hi 
> > > I need to create a project in pertty big . 
> > > why this code is not been supported ? 
> > > 
> > > Thanks, 
> > > Or 
> > > 
> > > On Thursday, January 24, 2019 at 3:29:11 PM UTC+2, Kieron Hardy wrote: 
> > > The language you should be using is "Beginning Student with List 
> Abbreviations". 
> > > 
> > > On Jan 24, 2019, at 4:33 AM, orenpa11  wrote: 
> > > 
> > >> Hi, 
> > >> when I removed the line 
> > >> #reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
> snake-full) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t 
> constructor repeating-decimal #f #t none #f ( 
> > >> 
> > >> And changed the  language to pretty big. 
> > >> I recived this error: 
> > >> Welcome to DrRacket, version 7.1 [3m]. 
> > >> Language: Pretty Big; memory limit: 128 MB. 
> > >> . . check-expect: undefined; 
> > >>  cannot reference an identifier before its definition 
> > >> 
> > >> Any idea ? 
> > >> 
> > >> Thanks, 
> > >> Or 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy 
> wrote: 
> > >> It seems the metadata lines added by DrRacket (mentioned by John) are 
> processed when the a source file is loaded into DrRacket (via the menu 
> option File/Open), but are not processed if the source code is directly 
> copied (e.g. from a browser window) into a DrRacket window and then 
> executed with the 'Run' button. 
> > >> 
> > >> The metadata includes a #reader directive, e.g.: 
> > >> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
> snake-full) ...) 
> > >> 
> > >> This reader directive appears to be silently ignored by DrRacket when 
> the source is 'Run', even though DrRacket shows "#reader" in red (as when 
> an error is detected). The actions taken by DrRacket when 'Run' is pressed 
> seem to depend on the settings in effect when the code is executed, which 
> could be nothing, or throwing a confusing error. 
> > >> 
> > >> The solution for the original poster's issue is as John directs; 
> remove the metadata (i.e. #reader directive) and manually set the language. 
> > >> 
> > >> However, I feel that DrRacket should recognize and act on (and 
> perhaps also remove/hide from view) the metadata if the metadata occurs as 
> from a copy/paste directly into a DrRacket window (e.g. as from a URL). The 
> current behaviour is, I think, a bug and a trap (perhaps showstopping) for 
> a new user experimenting with Racket. 
> > >> 
> > >> Note that the Racket executable seems to process the metadata 
> properly, understanding the language to use, et

Re: [racket-users] snake game

2019-01-25 Thread Matthias Felleisen
hould recognize and act on (and perhaps 
> > >> also remove/hide from view) the metadata if the metadata occurs as from 
> > >> a copy/paste directly into a DrRacket window (e.g. as from a URL). The 
> > >> current behaviour is, I think, a bug and a trap (perhaps showstopping) 
> > >> for a new user experimenting with Racket. 
> > >> 
> > >> Note that the Racket executable seems to process the metadata properly, 
> > >> understanding the language to use, etc.. so that the code behaves as 
> > >> intended. 
> > >> 
> > >> On Wed, Jan 23, 2019 at 12:32 PM K H gmail.com 
> > >> <http://gmail.com/>> wrote: 
> > >> Hello Or, 
> > >> 
> > >> The language is not "Pretty Big". 
> > >> 
> > >> You should be using "Beginning Student with List Abbreviations". 
> > >> 
> > >> The DrRacket metadata lines referred to by John set the correct 
> > >> language. In your case you must have changed the language somehow. Or 
> > >> perhaps the file needs to be saved before the metadata is acted upon. 
> > >> 
> > >> HTH, 
> > >> 
> > >> Kieron. 
> > >> 
> > >> 
> > >> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users 
> > >> googlegroups.com <http://googlegroups.com/>> wrote: 
> > >> Interesting problem; your screenshot shows header text that should not 
> > >> appear in the window, which suggests to me that you copied and pasted 
> > >> the text from somewhere else into a buffer where the language level was 
> > >> already set. It looks to me like you should do the following: 
> > >> 
> > >> 1) Delete the first three lines of the file. 
> > >> 2) Set the language level to “beginner with list abbreviations”. 
> > >> 3) Click “run” 
> > >> 
> > >> John Clements 
> > >> 
> > >> > On Jan 23, 2019, at 10:44 AM, orenpa11 gmail.com 
> > >> > <http://gmail.com/>> wrote: 
> > >> > 
> > >> > Hi David, 
> > >> > Thanks for your swift response ,I simply do not know how to run this 
> > >> > program. 
> > >> > I thought that when I press the run button I should see the snake GUI 
> > >> > . 
> > >> > 
> > >> > Maybe the language is not pretty big ? 
> > >> > Thanks, 
> > >> > Or 
> > >> > 
> > >> > 
> > >> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs 
> > >> > wrote: 
> > >> > What happens when you run it?  Are you getting any error messages? 
> > >> > 
> > >> > On Wed, Jan 23, 2019 at 1:01 PM orenpa11 gmail.com 
> > >> > <http://gmail.com/>> wrote: 
> > >> > > 
> > >> > > Hi 
> > >> > > I am trying to implemet this code of "snake game " 
> > >> > > https://course.ccs.neu.edu/csu211/code/snake-full.ss 
> > >> > > <https://course.ccs.neu.edu/csu211/code/snake-full.ss> 
> > >> > > 
> > >> > > in DrRacket (Pretty big) 
> > >> > >  But when I run it it is not working . 
> > >> > > any Idea ? 
> > >> > > 
> > >> > > Thanks 
> > >> > > Or 
> > >> > > 
> > >> > > -- 
> > >> > > 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...@ <>googlegroups. 
> > >> > > <http://googlegroups.com/>com <http://googlegroups.com/>. 
> > >> > > For more options, visit https://groups.google.com/d/optout 
> > >> > > <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...@ <>googlegroups. 
> > >> > <http://googlegroups.com/>com <http://googlegrou

Re: [racket-users] snake game

2019-01-25 Thread orenpa11
; which could be nothing, or throwing a confusing error. 
>> > >> 
>> > >> The solution for the original poster's issue is as John directs; 
>> remove the metadata (i.e. #reader directive) and manually set the language.
>>  
>> > >> 
>> > >> However, I feel that DrRacket should recognize and act on (and 
>> perhaps also remove/hide from view) the metadata if the metadata occurs as 
>> from a copy/paste directly into a DrRacket window (e.g. as from a URL). The 
>> current behaviour is, I think, a bug and a trap (perhaps showstopping) for 
>> a new user experimenting with Racket. 
>> > >> 
>> > >> Note that the Racket executable seems to process the metadata 
>> properly, understanding the language to use, etc.. so that the code behaves 
>> as intended. 
>> > >> 
>> > >> On Wed, Jan 23, 2019 at 12:32 PM K H  wrote: 
>> > >> Hello Or, 
>> > >> 
>> > >> The language is not "Pretty Big". 
>> > >> 
>> > >> You should be using "Beginning Student with List Abbreviations". 
>> > >> 
>> > >> The DrRacket metadata lines referred to by John set the correct 
>> language. In your case you must have changed the language somehow. Or 
>> perhaps the file needs to be saved before the metadata is acted upon. 
>> > >> 
>> > >> HTH, 
>> > >> 
>> > >> Kieron. 
>> > >> 
>> > >> 
>> > >> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users <
>> racket...@googlegroups.com> wrote: 
>> > >> Interesting problem; your screenshot shows header text that should 
>> not appear in the window, which suggests to me that you copied and pasted 
>> the text from somewhere else into a buffer where the language level was 
>> already set. It looks to me like you should do the following: 
>> > >> 
>> > >> 1) Delete the first three lines of the file. 
>> > >> 2) Set the language level to “beginner with list abbreviations”. 
>> > >> 3) Click “run” 
>> > >> 
>> > >> John Clements 
>> > >> 
>> > >> > On Jan 23, 2019, at 10:44 AM, orenpa11  wrote: 
>> > >> > 
>> > >> > Hi David, 
>> > >> > Thanks for your swift response ,I simply do not know how to run 
>> this program. 
>> > >> > I thought that when I press the run button I should see the snake 
>> GUI . 
>> > >> > 
>> > >> > Maybe the language is not pretty big ? 
>> > >> > Thanks, 
>> > >> > Or 
>> > >> > 
>> > >> > 
>> > >> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. 
>> Storrs wrote: 
>> > >> > What happens when you run it?  Are you getting any error messages?
>>  
>> > >> > 
>> > >> > On Wed, Jan 23, 2019 at 1:01 PM orenpa11  wrote:
>>  
>> > >> > > 
>> > >> > > Hi 
>> > >> > > I am trying to implemet this code of "snake game " 
>> > >> > > https://course.ccs.neu.edu/csu211/code/snake-full.ss 
>> > >> > > 
>> > >> > > in DrRacket (Pretty big) 
>> > >> > >  But when I run it it is not working . 
>> > >> > > any Idea ? 
>> > >> > > 
>> > >> > > Thanks 
>> > >> > > Or 
>> > >> > > 
>> > >> > > -- 
>> > >> > > 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...@googlegroups. 
>> <http://googlegroups.com/>com <http://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...@googlegroups. <http://googlegroups.com/>
>> com <http://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...@googlegroups. <http://googlegroups.com/>
>> com <http://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...@googlegroups. <http://googlegroups.com/>
>> com <http://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...@googlegroups. <http://googlegroups.com/>
>> com <http://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...@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...@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] snake game

2019-01-25 Thread Robby Findler
uted with the 'Run' button.
>>> > >>
>>> > >> The metadata includes a #reader directive, e.g.:
>>> > >> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
>>> > >> snake-full) ...)
>>> > >>
>>> > >> This reader directive appears to be silently ignored by DrRacket when 
>>> > >> the source is 'Run', even though DrRacket shows "#reader" in red (as 
>>> > >> when an error is detected). The actions taken by DrRacket when 'Run' 
>>> > >> is pressed seem to depend on the settings in effect when the code is 
>>> > >> executed, which could be nothing, or throwing a confusing error.
>>> > >>
>>> > >> The solution for the original poster's issue is as John directs; 
>>> > >> remove the metadata (i.e. #reader directive) and manually set the 
>>> > >> language.
>>> > >>
>>> > >> However, I feel that DrRacket should recognize and act on (and perhaps 
>>> > >> also remove/hide from view) the metadata if the metadata occurs as 
>>> > >> from a copy/paste directly into a DrRacket window (e.g. as from a 
>>> > >> URL). The current behaviour is, I think, a bug and a trap (perhaps 
>>> > >> showstopping) for a new user experimenting with Racket.
>>> > >>
>>> > >> Note that the Racket executable seems to process the metadata 
>>> > >> properly, understanding the language to use, etc.. so that the code 
>>> > >> behaves as intended.
>>> > >>
>>> > >> On Wed, Jan 23, 2019 at 12:32 PM K H  wrote:
>>> > >> Hello Or,
>>> > >>
>>> > >> The language is not "Pretty Big".
>>> > >>
>>> > >> You should be using "Beginning Student with List Abbreviations".
>>> > >>
>>> > >> The DrRacket metadata lines referred to by John set the correct 
>>> > >> language. In your case you must have changed the language somehow. Or 
>>> > >> perhaps the file needs to be saved before the metadata is acted upon.
>>> > >>
>>> > >> HTH,
>>> > >>
>>> > >> Kieron.
>>> > >>
>>> > >>
>>> > >> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users 
>>> > >>  wrote:
>>> > >> Interesting problem; your screenshot shows header text that should not 
>>> > >> appear in the window, which suggests to me that you copied and pasted 
>>> > >> the text from somewhere else into a buffer where the language level 
>>> > >> was already set. It looks to me like you should do the following:
>>> > >>
>>> > >> 1) Delete the first three lines of the file.
>>> > >> 2) Set the language level to “beginner with list abbreviations”.
>>> > >> 3) Click “run”
>>> > >>
>>> > >> John Clements
>>> > >>
>>> > >> > On Jan 23, 2019, at 10:44 AM, orenpa11  wrote:
>>> > >> >
>>> > >> > Hi David,
>>> > >> > Thanks for your swift response ,I simply do not know how to run this 
>>> > >> > program.
>>> > >> > I thought that when I press the run button I should see the snake 
>>> > >> > GUI .
>>> > >> >
>>> > >> > Maybe the language is not pretty big ?
>>> > >> > Thanks,
>>> > >> > Or
>>> > >> >
>>> > >> >
>>> > >> > On Wednesday, January 23, 2019 at 8:25:32 PM UTC+2, David K. Storrs 
>>> > >> > wrote:
>>> > >> > What happens when you run it?  Are you getting any error messages?
>>> > >> >
>>> > >> > On Wed, Jan 23, 2019 at 1:01 PM orenpa11  wrote:
>>> > >> > >
>>> > >> > > Hi
>>> > >> > > I am trying to implemet this code of "snake game "
>>> > >> > > https://course.ccs.neu.edu/csu211/code/snake-full.ss
>>> > >> > >
>>> > >> > > in DrRacket (Pretty big)
>>> > >> > >  But when I run it it is not working .
>>> > >> > > any Idea ?
>>> > >> > >
>>> > >> > > Thanks
>>> > >> > > Or
>>> > >> > >
>>> > >> > > --
>>> > >> > > 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...@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...@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...@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...@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...@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...@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...@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.

-- 
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] snake game

2019-01-25 Thread Matthias Felleisen
 Language: Pretty Big; memory limit: 128 MB. 
> >>> > >> . . check-expect: undefined; 
> >>> > >>  cannot reference an identifier before its definition 
> >>> > >> 
> >>> > >> Any idea ? 
> >>> > >> 
> >>> > >> Thanks, 
> >>> > >> Or 
> >>> > >> 
> >>> > >> 
> >>> > >> 
> >>> > >> 
> >>> > >> 
> >>> > >> On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy 
> >>> > >> wrote: 
> >>> > >> It seems the metadata lines added by DrRacket (mentioned by John) 
> >>> > >> are processed when the a source file is loaded into DrRacket (via 
> >>> > >> the menu option File/Open), but are not processed if the source code 
> >>> > >> is directly copied (e.g. from a browser window) into a DrRacket 
> >>> > >> window and then executed with the 'Run' button. 
> >>> > >> 
> >>> > >> The metadata includes a #reader directive, e.g.: 
> >>> > >> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
> >>> > >> snake-full) ...) 
> >>> > >> 
> >>> > >> This reader directive appears to be silently ignored by DrRacket 
> >>> > >> when the source is 'Run', even though DrRacket shows "#reader" in 
> >>> > >> red (as when an error is detected). The actions taken by DrRacket 
> >>> > >> when 'Run' is pressed seem to depend on the settings in effect when 
> >>> > >> the code is executed, which could be nothing, or throwing a 
> >>> > >> confusing error. 
> >>> > >> 
> >>> > >> The solution for the original poster's issue is as John directs; 
> >>> > >> remove the metadata (i.e. #reader directive) and manually set the 
> >>> > >> language. 
> >>> > >> 
> >>> > >> However, I feel that DrRacket should recognize and act on (and 
> >>> > >> perhaps also remove/hide from view) the metadata if the metadata 
> >>> > >> occurs as from a copy/paste directly into a DrRacket window (e.g. as 
> >>> > >> from a URL). The current behaviour is, I think, a bug and a trap 
> >>> > >> (perhaps showstopping) for a new user experimenting with Racket. 
> >>> > >> 
> >>> > >> Note that the Racket executable seems to process the metadata 
> >>> > >> properly, understanding the language to use, etc.. so that the code 
> >>> > >> behaves as intended. 
> >>> > >> 
> >>> > >> On Wed, Jan 23, 2019 at 12:32 PM K H  wrote: 
> >>> > >> Hello Or, 
> >>> > >> 
> >>> > >> The language is not "Pretty Big". 
> >>> > >> 
> >>> > >> You should be using "Beginning Student with List Abbreviations". 
> >>> > >> 
> >>> > >> The DrRacket metadata lines referred to by John set the correct 
> >>> > >> language. In your case you must have changed the language somehow. 
> >>> > >> Or perhaps the file needs to be saved before the metadata is acted 
> >>> > >> upon. 
> >>> > >> 
> >>> > >> HTH, 
> >>> > >> 
> >>> > >> Kieron. 
> >>> > >> 
> >>> > >> 
> >>> > >> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket Users 
> >>> > >>  wrote: 
> >>> > >> Interesting problem; your screenshot shows header text that should 
> >>> > >> not appear in the window, which suggests to me that you copied and 
> >>> > >> pasted the text from somewhere else into a buffer where the language 
> >>> > >> level was already set. It looks to me like you should do the 
> >>> > >> following: 
> >>> > >> 
> >>> > >> 1) Delete the first three lines of the file. 
> >>> > >> 2) Set the language level to “beginner with list abbreviations”. 
> >>> > >> 3) Click “run” 
> >>> 

Re: [racket-users] snake game

2019-01-26 Thread orenpa11
using is "Beginning Student with List 
> Abbreviations". 
> > >>> > > 
> > >>> > > On Jan 24, 2019, at 4:33 AM, orenpa11  wrote: 
> > >>> > > 
> > >>> > >> Hi, 
> > >>> > >> when I removed the line 
> > >>> > >> #reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
> snake-full) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t 
> constructor repeating-decimal #f #t none #f ( 
> > >>> > >> 
> > >>> > >> And changed the  language to pretty big. 
> > >>> > >> I recived this error: 
> > >>> > >> Welcome to DrRacket, version 7.1 [3m]. 
> > >>> > >> Language: Pretty Big; memory limit: 128 MB. 
> > >>> > >> . . check-expect: undefined; 
> > >>> > >>  cannot reference an identifier before its definition 
> > >>> > >> 
> > >>> > >> Any idea ? 
> > >>> > >> 
> > >>> > >> Thanks, 
> > >>> > >> Or 
> > >>> > >> 
> > >>> > >> 
> > >>> > >> 
> > >>> > >> 
> > >>> > >> 
> > >>> > >> On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron 
> Hardy wrote: 
> > >>> > >> It seems the metadata lines added by DrRacket (mentioned by 
> John) are processed when the a source file is loaded into DrRacket (via the 
> menu option File/Open), but are not processed if the source code is 
> directly copied (e.g. from a browser window) into a DrRacket window and 
> then executed with the 'Run' button. 
> > >>> > >> 
> > >>> > >> The metadata includes a #reader directive, e.g.: 
> > >>> > >> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
> snake-full) ...) 
> > >>> > >> 
> > >>> > >> This reader directive appears to be silently ignored by 
> DrRacket when the source is 'Run', even though DrRacket shows "#reader" in 
> red (as when an error is detected). The actions taken by DrRacket when 
> 'Run' is pressed seem to depend on the settings in effect when the code is 
> executed, which could be nothing, or throwing a confusing error. 
> > >>> > >> 
> > >>> > >> The solution for the original poster's issue is as John 
> directs; remove the metadata (i.e. #reader directive) and manually set the 
> language. 
> > >>> > >> 
> > >>> > >> However, I feel that DrRacket should recognize and act on (and 
> perhaps also remove/hide from view) the metadata if the metadata occurs as 
> from a copy/paste directly into a DrRacket window (e.g. as from a URL). The 
> current behaviour is, I think, a bug and a trap (perhaps showstopping) for 
> a new user experimenting with Racket. 
> > >>> > >> 
> > >>> > >> Note that the Racket executable seems to process the metadata 
> properly, understanding the language to use, etc.. so that the code behaves 
> as intended. 
> > >>> > >> 
> > >>> > >> On Wed, Jan 23, 2019 at 12:32 PM K H  
> wrote: 
> > >>> > >> Hello Or, 
> > >>> > >> 
> > >>> > >> The language is not "Pretty Big". 
> > >>> > >> 
> > >>> > >> You should be using "Beginning Student with List 
> Abbreviations". 
> > >>> > >> 
> > >>> > >> The DrRacket metadata lines referred to by John set the correct 
> language. In your case you must have changed the language somehow. Or 
> perhaps the file needs to be saved before the metadata is acted upon. 
> > >>> > >> 
> > >>> > >> HTH, 
> > >>> > >> 
> > >>> > >> Kieron. 
> > >>> > >> 
> > >>> > >> 
> > >>> > >> On Wed, Jan 23, 2019 at 12:17 PM 'John Clements' via Racket 
> Users  wrote: 
> > >>> > >> Interesting problem; your screenshot shows header text that 
> should not appear in the window, which suggests to me that you copied and 
> pasted the text from somewhere else into a buffer where the language level 
> was

Re: [racket-users] snake game

2019-01-26 Thread Matthias Felleisen
> >>> > > 
> > >>> > > Hi 
> > >>> > > I need to create a project in pertty big . 
> > >>> > > why this code is not been supported ? 
> > >>> > > 
> > >>> > > Thanks, 
> > >>> > > Or 
> > >>> > > 
> > >>> > > On Thursday, January 24, 2019 at 3:29:11 PM UTC+2, Kieron Hardy 
> > >>> > > wrote: 
> > >>> > > The language you should be using is "Beginning Student with List 
> > >>> > > Abbreviations". 
> > >>> > > 
> > >>> > > On Jan 24, 2019, at 4:33 AM, orenpa11 > wrote: 
> > >>> > > 
> > >>> > >> Hi, 
> > >>> > >> when I removed the line 
> > >>> > >> #reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
> > >>> > >> snake-full) (read-case-sensitive #t) (teachpacks ()) 
> > >>> > >> (htdp-settings #(#t constructor repeating-decimal #f #t none #f 
> > >>> > >> ( 
> > >>> > >> 
> > >>> > >> And changed the  language to pretty big. 
> > >>> > >> I recived this error: 
> > >>> > >> Welcome to DrRacket, version 7.1 [3m]. 
> > >>> > >> Language: Pretty Big; memory limit: 128 MB. 
> > >>> > >> . . check-expect: undefined; 
> > >>> > >>  cannot reference an identifier before its definition 
> > >>> > >> 
> > >>> > >> Any idea ? 
> > >>> > >> 
> > >>> > >> Thanks, 
> > >>> > >> Or 
> > >>> > >> 
> > >>> > >> 
> > >>> > >> 
> > >>> > >> 
> > >>> > >> 
> > >>> > >> On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy 
> > >>> > >> wrote: 
> > >>> > >> It seems the metadata lines added by DrRacket (mentioned by John) 
> > >>> > >> are processed when the a source file is loaded into DrRacket (via 
> > >>> > >> the menu option File/Open), but are not processed if the source 
> > >>> > >> code is directly copied (e.g. from a browser window) into a 
> > >>> > >> DrRacket window and then executed with the 'Run' button. 
> > >>> > >> 
> > >>> > >> The metadata includes a #reader directive, e.g.: 
> > >>> > >> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
> > >>> > >> snake-full) ...) 
> > >>> > >> 
> > >>> > >> This reader directive appears to be silently ignored by DrRacket 
> > >>> > >> when the source is 'Run', even though DrRacket shows "#reader" in 
> > >>> > >> red (as when an error is detected). The actions taken by DrRacket 
> > >>> > >> when 'Run' is pressed seem to depend on the settings in effect 
> > >>> > >> when the code is executed, which could be nothing, or throwing a 
> > >>> > >> confusing error. 
> > >>> > >> 
> > >>> > >> The solution for the original poster's issue is as John directs; 
> > >>> > >> remove the metadata (i.e. #reader directive) and manually set the 
> > >>> > >> language. 
> > >>> > >> 
> > >>> > >> However, I feel that DrRacket should recognize and act on (and 
> > >>> > >> perhaps also remove/hide from view) the metadata if the metadata 
> > >>> > >> occurs as from a copy/paste directly into a DrRacket window (e.g. 
> > >>> > >> as from a URL). The current behaviour is, I think, a bug and a 
> > >>> > >> trap (perhaps showstopping) for a new user experimenting with 
> > >>> > >> Racket. 
> > >>> > >> 
> > >>> > >> Note that the Racket executable seems to process the metadata 
> > >>> > >> properly, understanding the language to use, etc.. so that the 
> > >>> > >> code behaves as intended. 
> > >>> > >> 
>

Re: [racket-users] snake game

2019-01-28 Thread orenpa11
 
>> > >>> > This community supports people readily wth answers, but 
>> > >>> > we need to know what you know. 
>> > >>> > 
>> > >>> > — Matthias 
>> > >>> > 
>> > >>> > 
>> > >>> > 
>> > >>> > 
>> > >>> > > On Jan 24, 2019, at 12:56 PM, orenpa11  
>> wrote: 
>> > >>> > > 
>> > >>> > > Hi 
>> > >>> > > I need to create a project in pertty big . 
>> > >>> > > why this code is not been supported ? 
>> > >>> > > 
>> > >>> > > Thanks, 
>> > >>> > > Or 
>> > >>> > > 
>> > >>> > > On Thursday, January 24, 2019 at 3:29:11 PM UTC+2, Kieron Hardy 
>> wrote: 
>> > >>> > > The language you should be using is "Beginning Student with 
>> List Abbreviations". 
>> > >>> > > 
>> > >>> > > On Jan 24, 2019, at 4:33 AM, orenpa11  
>> wrote: 
>> > >>> > > 
>> > >>> > >> Hi, 
>> > >>> > >> when I removed the line 
>> > >>> > >> #reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
>> snake-full) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t 
>> constructor repeating-decimal #f #t none #f ( 
>> > >>> > >> 
>> > >>> > >> And changed the  language to pretty big. 
>> > >>> > >> I recived this error: 
>> > >>> > >> Welcome to DrRacket, version 7.1 [3m]. 
>> > >>> > >> Language: Pretty Big; memory limit: 128 MB. 
>> > >>> > >> . . check-expect: undefined; 
>> > >>> > >>  cannot reference an identifier before its definition 
>> > >>> > >> 
>> > >>> > >> Any idea ? 
>> > >>> > >> 
>> > >>> > >> Thanks, 
>> > >>> > >> Or 
>> > >>> > >> 
>> > >>> > >> 
>> > >>> > >> 
>> > >>> > >> 
>> > >>> > >> 
>> > >>> > >> On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron 
>> Hardy wrote: 
>> > >>> > >> It seems the metadata lines added by DrRacket (mentioned by 
>> John) are processed when the a source file is loaded into DrRacket (via the 
>> menu option File/Open), but are not processed if the source code is 
>> directly copied (e.g. from a browser window) into a DrRacket window and 
>> then executed with the 'Run' button. 
>> > >>> > >> 
>> > >>> > >> The metadata includes a #reader directive, e.g.: 
>> > >>> > >> (#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname 
>> snake-full) ...) 
>> > >>> > >> 
>> > >>> > >> This reader directive appears to be silently ignored by 
>> DrRacket when the source is 'Run', even though DrRacket shows "#reader" in 
>> red (as when an error is detected). The actions taken by DrRacket when 
>> 'Run' is pressed seem to depend on the settings in effect when the code is 
>> executed, which could be nothing, or throwing a confusing error. 
>> > >>> > >> 
>> > >>> > >> The solution for the original poster's issue is as John 
>> directs; remove the metadata (i.e. #reader directive) and manually set the 
>> language. 
>> > >>> > >> 
>> > >>> > >> However, I feel that DrRacket should recognize and act on (and 
>> perhaps also remove/hide from view) the metadata if the metadata occurs as 
>> from a copy/paste directly into a DrRacket window (e.g. as from a URL). The 
>> current behaviour is, I think, a bug and a trap (perhaps showstopping) for 
>> a new user experimenting with Racket. 
>> > >>> > >> 
>> > >>> > >> Note that the Racket executable seems to process the metadata 
>> properly, understanding the language to use, etc.. so that the code behaves 
>> as intended. 
>> > >>> > >> 
>> > 

[racket-users] Multipart HTTP requests

2019-01-29 Thread Christopher Lemmer Webber
I'm looking to do multipart HTTP requests in Racket, though it looks
like there's no support at the moment.

I thought I might add a utility using the net/http-client library,
starting with making an adjusted http-conn-send! function.  However, the
http-conn-(host/port/etc) struct accessors aren't made available, so it
appears I can't build a utility that uses the same http-conn struct.

Any thoughts on how I should move forward?  Has anyone else written a
multipart library I don't know about, for instance?

 - cwebb

-- 
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] Racket v7.2

2019-01-30 Thread Jos Koot
Very nice.
Runs fast for my programs.
Thanks, to all who contributed, Jos

On Wed, 30 Jan 2019 at 19:59, Vincent St-Amour <
stamo...@eecs.northwestern.edu> wrote:

> Racket version 7.2 is now available from
>
> http://racket-lang.org/
>
> Racket-on-Chez is done in a useful sense, but we'll wait until it gets
> better before making it the default Racket implementation. For more
> information, see
>
> http://blog.racket-lang.org/2019/01/racket-on-chez-status.html
>
> In addition, the Racket 7.2 release includes the following improvements,
> which apply to both implementations:
>
> - The contract system supports collapsible contracts, which avoid
>   repeated wrappers in certain pathological situations. Thanks to Daniel
>   Feltey.
>
> - Quickscript, a scripting tool for DrRacket, has become part of the
>   standard distribution. Thanks to Laurent Orseau.
>
> - The web server's built-in configuration for serving static files
>   recognizes the ".mjs" extension for JavaScript modules.
>
> - The `data/enumerate` library supports an additional form of
>   subtraction via `but-not/e`, following Yorgey and Foner's ICFP'18
>   paper. Thanks to Max New.
>
> - The `letrec.rkt` example model in Redex has been changed to more
>   closely match Racket, which led to some bug fixes in Racket's
>   implementation of `letrec` and `set!`.
>
> - The racklog library has seen a number of improvements, including fixes
>   to logic variable binding, logic variables containing predicates being
>   applicable, and the introduction of an `%andmap` higher-order predicate.
>
> The following people contributed to this release:
> Akihide Nano, Alex Feldman-Crough, Alexander McLin, Alexander Shopov,
> Alexis King, Alex Knauth, Andrew Kent, Asumu Takikawa, Ben Greenman,
> Bogdan Popa, Caner Derici, Chongkai Zhu, Dan Feltey, Darren Newton, Gan
> Shen, Greg Hendershott, Gustavo Massaccesi, Jay McCarthy, Jens Axel
> Søgaard, John Clements, Jordan Johnson, Kevin Robert Stravers, Leif
> Andersen, Leo Uino, Matt Kraai, Matthew Butterick, Matthew Flatt,
> Matthias Felleisen, Max New, Michael Burge, Mike Sperber, Paul
> C. Anagnostopoulos, Paulo Matos, Philip McGrath, Robby Findler, Ronald
> Garcia, Ryan Culpepper, Ryan Kramer, Sam Tobin-Hochstadt, Shu-Hung You,
> Sorawee Porncharoenwase, Spencer Florence, Stephen Chang, and Vincent
> St-Amour
>
> Feedback Welcome
>
> --
> 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] Racket v7.2

2019-01-31 Thread Christopher Lemmer Webber
Vincent St-Amour writes:

> Racket version 7.2 is now available from
>
> http://racket-lang.org/
>
> Racket-on-Chez is done in a useful sense, but we'll wait until it gets
> better before making it the default Racket implementation. For more
> information, see
>
> http://blog.racket-lang.org/2019/01/racket-on-chez-status.html

So exciting!  What a great time to be in the Racket world.  :)

-- 
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] syntax rewriting bindings

2019-01-31 Thread Luke Whittlesey
I see that there is the local-expand/capture-lifts and
syntax-local-lift-expression for expressions, but is there a way to lift
bindings as well? ... something akin to local-expand/capture-lift-defines
maybe ...

Basically I want to rewrite a syntax so any (MyDefine ...) is lifted into a
definition context. Something like..
(let ()
  (list (begin (MyDefine a 0) 1) a))
.. into ..
(let ()
  (define a 0)
  (list 1 a))

I have a fuzzy idea a solution might involve
syntax-local-make-definition-context, but all my attempts have failed thus
far. Could anybody give me some hints as to how something like this might
be accomplished?

-- 
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] Re: Tensorflow bindings?

2019-02-04 Thread Lehi Toskin
That actually sounds kinda fun. If you make the repo I'll join in.

On Monday, February 4, 2019 at 8:07:58 AM UTC-8, Matt Jadud wrote:
>
> Hi all,
>
> https://www.tensorflow.org/install/lang_c
>
> Would there be interest/value in having FFI bindings for TensorFlow? If I 
> poke it with a stick, are there others who would be willing to contribute 
> to the development of a package that provided those bindings?
>
> I'm getting to the point with a project where I'm going to have to bail 
> out of Racket in order to do some machine learn-y stats work, and I'd 
> rather not have to switch languages just to do the analysis.
>
> Cheers,
> M
>

-- 
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] Re: Tensorflow bindings?

2019-02-04 Thread Greg Trzeciak
Wasn't it a rhetorical question? :)

Although I don't have use for TensorFlow at the moment - I would love to 
have the FFI bindings ready for when I will finally need it.
The AI story in Racket at the moment is not as good is it could 
be: https://github.com/racket/racket/wiki/AI


On Monday, February 4, 2019 at 5:07:58 PM UTC+1, Matt Jadud wrote:
>
> Hi all,
>
> https://www.tensorflow.org/install/lang_c
>
> Would there be interest/value in having FFI bindings for TensorFlow? If I 
> poke it with a stick, are there others who would be willing to contribute 
> to the development of a package that provided those bindings?
>
> I'm getting to the point with a project where I'm going to have to bail 
> out of Racket in order to do some machine learn-y stats work, and I'd 
> rather not have to switch languages just to do the analysis.
>
> Cheers,
> M
>

-- 
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] Tensorflow bindings?

2019-02-04 Thread Neil Van Dyke
I had Racket TensorFlow bindings as a possible-TODO for me, but I don't 
yet know ML tools I'll use, and what APIs/layers I'll prefer atop tools 
that offer more than one.


(One of the reasons to play with ML in Python initially: almost 
everything has Python APIs, at the moment, and some of the most popular 
ML tools are written substantially in Python rather than being a veneer 
of bindings.)


Also, some toolkits might make more sense to call from Racket through 
something other than the current Racket FFI.


(For example, Python ones, or C code you don't want to risk stomping on 
your Racket code, and might not even be open source.  Also, there's also 
a good chance that you're running non-ideal vendor-specific GPU compute 
libraries and drivers right now, though hopefully that will soon improve.)


--
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] Tensorflow bindings?

2019-02-05 Thread Stephen De Gabrielle
Hi all,

Is this relevant?

https://github.com/charlescearl/DeepRacket

Kind regards
Stephen

On Mon, 4 Feb 2019 at 21:39, Neil Van Dyke  wrote:

> I had Racket TensorFlow bindings as a possible-TODO for me, but I don't
> yet know ML tools I'll use, and what APIs/layers I'll prefer atop tools
> that offer more than one.
>
> (One of the reasons to play with ML in Python initially: almost
> everything has Python APIs, at the moment, and some of the most popular
> ML tools are written substantially in Python rather than being a veneer
> of bindings.)
>
> Also, some toolkits might make more sense to call from Racket through
> something other than the current Racket FFI.
>
> (For example, Python ones, or C code you don't want to risk stomping on
> your Racket code, and might not even be open source.  Also, there's also
> a good chance that you're running non-ideal vendor-specific GPU compute
> libraries and drivers right now, though hopefully that will soon improve.)
>
> --
> 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] Guide and reference

2019-02-06 Thread James Geddes
Dear All,

There was a recent discussion on this list about the Racket guides and manuals. 
Without wishing to comment on the suggestions therein, I did want to say what I 
really, really like about the Racket documentation. 

There are two things. The first is that the Reference is — and I know this 
sounds odd — true: when I want to know something, I look it up in the 
Reference, and there I find the truth and the whole truth about the thing. I 
don’t know how this is made to happen, but I find it extraordinarily helpful. 
It’s not an intuitive explanation, or an analogy, or a description in vague 
language: it’s the truth. (And it’s organised very well so I know where to 
look.)

The second thing I like is the concision of the Guide. It is readable, and may 
well contain intuitive explanations and ways to think about things, yet it does 
so with economy.

There are of course things I am still confused about (packages…) but in general 
I’ve not found elsewhere this tasteful combination of clarity and completeness. 
(Well, except RnRS, so maybe my prejudices are showing through.) 

I find other languages point me to books about the language that take too long 
to get a handle on the basics; and exhaustive references that seem to contain 
both more than I want and less than I need.

Thank you to everyone who has worked on the documentation.

James



James Geddes

-- 
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] i18n / translations

2019-02-09 Thread Bogdan Popa


> How are people currently translating their programs?

I was searching for a way to do l10n yesterday[1] and the best I could
find was SRFI 29[2] from srfi-lib.

[1]: 
https://github.com/Bogdanp/racket-webapp-template/commit/7647b2f2f460d1ede4f468e00f4dea62a541ee6e#diff-9978fbdfa51cde9daace605e88cc9c6c
[2]: https://srfi.schemers.org/srfi-29/srfi-29.html

-- 
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] Re: i18n / translations

2019-02-09 Thread Greg Trzeciak
look into: https://github.com/racket/string-constants
for the way DrRacket gets translations/internationalization

On Saturday, February 9, 2019 at 2:56:59 PM UTC+1, cwebber wrote:
>
> How are people currently translating their programs? 
> I expected to see a gettext library or something, but haven't. 
>
> I see that DrRacket is translated, but I did a few simple greps through 
> the DrRacket repo and couldn't figure out how. 
>
> Am I missing something?  Or is this tooling that needs to be written? 
>  - cwebb 
>

-- 
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] Why ChezScheme?

2019-02-09 Thread Alexis King
> On Feb 9, 2019, at 16:49, Hendrik Boom  wrote:
> 
> Just wndering -- What was the original purpose in moving Racket to Chez?

You probably want to read Matthew’s original email on the subject, from about 
two years ago:

https://groups.google.com/d/msg/racket-dev/2BV3ElyfF8Y/4RSd3XbECAAJ

Alexis

-- 
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] Why ChezScheme?

2019-02-09 Thread Hendrik Boom
On Sat, Feb 09, 2019 at 05:00:39PM -0600, Alexis King wrote:
> > On Feb 9, 2019, at 16:49, Hendrik Boom  wrote:
> > 
> > Just wndering -- What was the original purpose in moving Racket to Chez?
> 
> You probably want to read Matthew’s original email on the subject, from about 
> two years ago:
> 
> https://groups.google.com/d/msg/racket-dev/2BV3ElyfF8Y/4RSd3XbECAAJ

Thank you.  This is very clear.

-- hendrik

-- 
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] Molis hai documentation

2019-02-10 Thread Hendrik Boom
The page
https://docs.racket-lang.org/molis-hai/index.html
specifies there are command line parameters, but does not say what they are.

In particular, I'm wondering how to specify:
  the order
  the number of bits of entropy

It does mention the -t flag to specify the source text.

It's not urgent to reply here; just put it into the web page and I'll find 
it when I need it. 

-- hendrik

-- 
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] struct-info

2019-02-12 Thread Shu-Hung You
On Tue, Feb 12, 2019 at 10:04 AM David Storrs  wrote:
>
> Could someone point me to the FM on how to properly use struct-info?
> For the life of me, I cannot get anything except (values #f #t) out of
> it.  I see that:
>
> 1) struct-info only works with struct types that are under the control
> of the current inspector.
>
> 2) You can provide an inspector to a struct declaration, but it will
> be placed under the control of the **parent** of what you passed it,
> not the actual thing you passed it.  This breaks my brain.
>

The inspector used at struct type creation time needs to be controlled
by the current inspector so you can obtain reflective information.
That is, the inspector used at struct type creation time is a
sub(-sub-sub-...) inspector of the current inspector.

#lang racket/base

(require racket/struct-info)

(define old-insp (current-inspector))
(define insp (make-inspector))

(current-inspector insp)
(struct S (field1 field2))
(current-inspector old-insp)

(define s
  (S 5 'hi))

(struct-info s) ;;=> ok

(current-inspector insp)
(struct-info s) ;;=> #f #t


> --
> 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] struct-info

2019-02-12 Thread David Storrs
On Tue, Feb 12, 2019 at 11:43 AM Shu-Hung You
 wrote:
>
> On Tue, Feb 12, 2019 at 10:04 AM David Storrs  wrote:
> >
> > Could someone point me to the FM on how to properly use struct-info?
> > For the life of me, I cannot get anything except (values #f #t) out of
> > it.  I see that:
> >
> > 1) struct-info only works with struct types that are under the control
> > of the current inspector.
> >
> > 2) You can provide an inspector to a struct declaration, but it will
> > be placed under the control of the **parent** of what you passed it,
> > not the actual thing you passed it.  This breaks my brain.
> >
>
> The inspector used at struct type creation time needs to be controlled
> by the current inspector so you can obtain reflective information.
> That is, the inspector used at struct type creation time is a
> sub(-sub-sub-...) inspector of the current inspector.
>
> #lang racket/base
>
> (require racket/struct-info)
>
> (define old-insp (current-inspector))
> (define insp (make-inspector))
>
> (current-inspector insp)
> (struct S (field1 field2))
> (current-inspector old-insp)
>
> (define s
>   (S 5 'hi))
>
> (struct-info s) ;;=> ok
>
> (current-inspector insp)
> (struct-info s) ;;=> #f #t

Thank you for the explanation.  Can I ask why the heck it works this
way?  This seems to be explicitly designed for maximal surprise and
minimal usefulness.


>
>
> > --
> > 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] struct-info

2019-02-12 Thread jackhfirth

>
> Thank you for the explanation.  Can I ask why the heck it works this 
> way?  This seems to be explicitly designed for maximal surprise and 
> minimal usefulness. 
>

It works that way so that, by default, modules can't inspect, modify, or 
otherwise muck around with structs defined by other modules. Opaque structs 
(that is, structs that aren't transparent and aren't prefab) aren't really 
meant to be used like "plain old data objects" with fields and accessors, 
they're more like building blocks for abstract data types. A module that 
defines an opaque struct type is expected to be responsible for exporting 
to other modules all the functions that are necessary for using that type. 
Anything not explicitly exported by the module is not allowed, even through 
reflective operations like struct-info. The exception to this rule is when 
some entity *above* the modules is controlling them all, such as a 
debugger, an IDE, or a server running client-supplied code. In these cases, 
the controlling code has the option to make a child inspector and run all 
the modules under that child inspector, giving the controlling code access 
to all struct types through the parent inspector. This kind of setup can be 
nested arbitrarily deep.

This is nice for defining abstract types, but it can be pretty inconvenient 
for defining plain old aggregated data types that just have a bundle of 
fields. When defining those types as structs, consider using the 
#:transparent option. This means "use no inspector at all" (roughly) and 
lets `struct-info` Just Work (TM) without any inspector wrangling. The 
downside is that other modules may be able to break your type's invariants 
and possibly circumvent your contracts.

-- 
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] struct-info

2019-02-12 Thread David Storrs
On Tue, Feb 12, 2019 at 4:46 PM  wrote:
>>
>> Thank you for the explanation.  Can I ask why the heck it works this
>> way?  This seems to be explicitly designed for maximal surprise and
>> minimal usefulness.
>
>
> It works that way so that, by default, modules can't inspect, modify, or 
> otherwise muck around with structs defined by other modules. Opaque structs 
> (that is, structs that aren't transparent and aren't prefab) aren't really 
> meant to be used like "plain old data objects" with fields and accessors, 
> they're more like building blocks for abstract data types. A module that 
> defines an opaque struct type is expected to be responsible for exporting to 
> other modules all the functions that are necessary for using that type. 
> Anything not explicitly exported by the module is not allowed, even through 
> reflective operations like struct-info. The exception to this rule is when 
> some entity above the modules is controlling them all, such as a debugger, an 
> IDE, or a server running client-supplied code. In these cases, the 
> controlling code has the option to make a child inspector and run all the 
> modules under that child inspector, giving the controlling code access to all 
> struct types through the parent inspector. This kind of setup can be nested 
> arbitrarily deep.

I see.  That makes sense.  I think it would be worth expanding the
documentation on that; I'm happy to provide a suggestion later
tonight, but I will need to do it through email instead of via pull
request.  I have long since given up on being able to find anything in
the Racket github in order to provide patches.  It's simply too
unintuitive and time-intensive to find the relevant section in
multiple repositories where the documentation is in randomly-named
fragments scattered across multiple directories instead of being
individual files with guessable names.


>
> This is nice for defining abstract types, but it can be pretty inconvenient 
> for defining plain old aggregated data types that just have a bundle of 
> fields. When defining those types as structs, consider using the 
> #:transparent option. This means "use no inspector at all" (roughly) and lets 
> `struct-info` Just Work (TM) without any inspector wrangling. The downside is 
> that other modules may be able to break your type's invariants and possibly 
> circumvent your contracts.

That's what I expected, but it doesn't seem to work:

> (struct person (name age) #:transparent)
> (struct-info person)
#f
#t

What am I missing?

-- 
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] struct-info

2019-02-12 Thread jackhfirth

>
> This is nice for defining abstract types, but it can be pretty 
>> inconvenient for defining plain old aggregated data types that just have a 
>> bundle of fields. When defining those types as structs, consider using the 
>> #:transparent option. This means "use no inspector at all" (roughly) and 
>> lets `struct-info` Just Work (TM) without any inspector wrangling. The 
>> downside is that other modules may be able to break your type's invariants 
>> and possibly circumvent your contracts. 
>
>
> That's what I expected, but it doesn't seem to work: 
>
> > (struct person (name age) #:transparent) 
> > (struct-info person) 
> #f 
> #t 
>
> What am I missing?
>

I was stumped on this for a while, but then realized the problem:

> (struct-info person)
#f
#t
> (struct-info (person "Alyssa P. Hacker" 42))
#
#f

-- 
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] struct-info

2019-02-12 Thread Shu-Hung You
On Tue, Feb 12, 2019 at 3:55 PM David Storrs  wrote:
>
> On Tue, Feb 12, 2019 at 4:46 PM  wrote:
> >>
> >> Thank you for the explanation.  Can I ask why the heck it works this
> >> way?  This seems to be explicitly designed for maximal surprise and
> >> minimal usefulness.
> >
> >
> > It works that way so that, by default, modules can't inspect, modify, or 
> > otherwise muck around with structs defined by other modules. Opaque structs 
> > (that is, structs that aren't transparent and aren't prefab) aren't really 
> > meant to be used like "plain old data objects" with fields and accessors, 
> > they're more like building blocks for abstract data types. A module that 
> > defines an opaque struct type is expected to be responsible for exporting 
> > to other modules all the functions that are necessary for using that type. 
> > Anything not explicitly exported by the module is not allowed, even through 
> > reflective operations like struct-info. The exception to this rule is when 
> > some entity above the modules is controlling them all, such as a debugger, 
> > an IDE, or a server running client-supplied code. In these cases, the 
> > controlling code has the option to make a child inspector and run all the 
> > modules under that child inspector, giving the controlling code access to 
> > all struct types through the parent inspector. This kind of setup can be 
> > nested arbitrarily deep.
>
> I see.  That makes sense.  I think it would be worth expanding the
> documentation on that; I'm happy to provide a suggestion later
> tonight, but I will need to do it through email instead of via pull
> request.  I have long since given up on being able to find anything in
> the Racket github in order to provide patches.  It's simply too
> unintuitive and time-intensive to find the relevant section in
> multiple repositories where the documentation is in randomly-named
> fragments scattered across multiple directories instead of being
> individual files with guessable names.
>
>
> >
> > This is nice for defining abstract types, but it can be pretty inconvenient 
> > for defining plain old aggregated data types that just have a bundle of 
> > fields. When defining those types as structs, consider using the 
> > #:transparent option. This means "use no inspector at all" (roughly) and 
> > lets `struct-info` Just Work (TM) without any inspector wrangling. The 
> > downside is that other modules may be able to break your type's invariants 
> > and possibly circumvent your contracts.
>
> That's what I expected, but it doesn't seem to work:
>
> > (struct person (name age) #:transparent)
> > (struct-info person)
> #f
> #t
>
> What am I missing?
>

It takes an instance of person.

(struct-info (person "Me" 3.14))

FWIW if you already have the struct type descriptor (which is what
struct-info returns), you can directly call struct-type-info.

(struct-type-info
 (let-values ([(desc skip?) (struct-info (person "Me" 3.14))])
   desc))

;; struct:person is introduced by the (struct person ...) form
(struct-type-info struct:person)

> --
> 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] struct-info

2019-02-12 Thread David Storrs
On Tue, Feb 12, 2019 at 5:03 PM  wrote:
>>>
>>> This is nice for defining abstract types, but it can be pretty inconvenient 
>>> for defining plain old aggregated data types that just have a bundle of 
>>> fields. When defining those types as structs, consider using the 
>>> #:transparent option. This means "use no inspector at all" (roughly) and 
>>> lets `struct-info` Just Work (TM) without any inspector wrangling. The 
>>> downside is that other modules may be able to break your type's invariants 
>>> and possibly circumvent your contracts.
>>
>>
>> That's what I expected, but it doesn't seem to work:
>>
>> > (struct person (name age) #:transparent)
>> > (struct-info person)
>> #f
>> #t
>>
>> What am I missing?
>
>
> I was stumped on this for a while, but then realized the problem:
>
> > (struct-info person)
> #f
> #t
> > (struct-info (person "Alyssa P. Hacker" 42))
> #
> #f

Ah, I see.  Thanks, I wouldn't have guessed that an instance of a
struct satisfied `struct-type?`

On the other hand, it seems relatively easy to break these
protections.  Is there a way to prevent that?

; file test1.rkt
#lang racket
(struct person (name age))
(provide person)
;; end of test1.rkt


; file test2.rkt
#lang racket

(require "test1.rkt"
 (for-syntax racket
 syntax/parse
 syntax/parse/experimental/template
 syntax/parse/class/struct-id))

(define p (person 'bob 19))
(displayln "required ctor only of a struct defined in another file.
Can create, is opaque:")
p
(displayln "struct-info returns (values #f #t) since the struct isn't
inspectable here:")
(struct-info p)
(define-syntax struct-funcs (syntax-parser [(_ s:struct-id) (template
(list s.constructor-id s.accessor-id ...))]))
(define lst (struct-funcs person))
(displayln "show list of constructor and accessors that we retrieved
via macro:")
lst
(displayln "Fetch name ('bob) by way of accessor returned through macro:")
((second lst) p)
; Uncommenting the following will cause compilation to fail, since
person-name was not exported
;(person-name p)
;;  end of test2.rkt


;; command line:
$ racket test2.rkt
required ctor only of a struct defined in another file. Can create, is opaque:
#
struct-info returns (values #f #t) since the struct isn't inspectable here:
#f
#t
show list of constructor and accessors that we retrieved via macro:
'(# # #)
Fetch name ('bob) by way of accessor returned through macro:
'bob

-- 
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] struct-info

2019-02-12 Thread Matthias Felleisen



> On Feb 12, 2019, at 5:28 PM, David Storrs  wrote:
> 
> On Tue, Feb 12, 2019 at 5:03 PM  wrote:
>>>> 
>>>> This is nice for defining abstract types, but it can be pretty 
>>>> inconvenient for defining plain old aggregated data types that just have a 
>>>> bundle of fields. When defining those types as structs, consider using the 
>>>> #:transparent option. This means "use no inspector at all" (roughly) and 
>>>> lets `struct-info` Just Work (TM) without any inspector wrangling. The 
>>>> downside is that other modules may be able to break your type's invariants 
>>>> and possibly circumvent your contracts.
>>> 
>>> 
>>> That's what I expected, but it doesn't seem to work:
>>> 
>>>> (struct person (name age) #:transparent)
>>>> (struct-info person)
>>> #f
>>> #t
>>> 
>>> What am I missing?
>> 
>> 
>> I was stumped on this for a while, but then realized the problem:
>> 
>>> (struct-info person)
>> #f
>> #t
>>> (struct-info (person "Alyssa P. Hacker" 42))
>> #
>> #f
> 
> Ah, I see.  Thanks, I wouldn't have guessed that an instance of a
> struct satisfied `struct-type?`
> 
> On the other hand, it seems relatively easy to break these
> protections.  Is there a way to prevent that?
> 
> ; file test1.rkt
> #lang racket
> (struct person (name age))
> (provide person)



The line above exports two pieces: the constructor and compile-time information 
about the structure, including the functions as you saw. If you want to protect 
your invariants, you replace this provide with something like 

   (provide (contract-out (person (-> string natural-number/c person?

See end for a simpler way to test such things. 



> ;; end of test1.rkt
> 
> 
> ; file test2.rkt
> #lang racket
> 
> (require "test1.rkt"
> (for-syntax racket
> syntax/parse
> syntax/parse/experimental/template
> syntax/parse/class/struct-id))
> 
> (define p (person 'bob 19))
> (displayln "required ctor only of a struct defined in another file.
> Can create, is opaque:")
> p
> (displayln "struct-info returns (values #f #t) since the struct isn't
> inspectable here:")
> (struct-info p)
> (define-syntax struct-funcs (syntax-parser [(_ s:struct-id) (template
> (list s.constructor-id s.accessor-id ...))]))
> (define lst (struct-funcs person))
> (displayln "show list of constructor and accessors that we retrieved
> via macro:")
> lst
> (displayln "Fetch name ('bob) by way of accessor returned through macro:")
> ((second lst) p)
> ; Uncommenting the following will cause compilation to fail, since
> person-name was not exported
> ;(person-name p)
> ;;  end of test2.rkt
> 
> 
> ;; command line:
> $ racket test2.rkt
> required ctor only of a struct defined in another file. Can create, is opaque:
> #
> struct-info returns (values #f #t) since the struct isn't inspectable here:
> #f
> #t
> show list of constructor and accessors that we retrieved via macro:
> '(# # #)
> Fetch name ('bob) by way of accessor returned through macro:
> 'bob
> 
> -




#lang racket

(module test1 racket
  (provide (contract-out (person (-> string natural-number/c person?
  (struct person (name age)))

(module test2 racket 
  (require (submod ".." test1)
   (for-syntax racket
   syntax/parse
   syntax/parse/experimental/template
   syntax/parse/class/struct-id))

  (define p (person 'bob 19))
  (displayln "required ctor only of a struct defined in another file. Can 
create, is opaque:")
  p
  
  (displayln "struct-info returns (values #f #t) since the struct isn't 
inspectable here:")
  (struct-info p)

  (define-syntax struct-funcs (syntax-parser [(_ s:struct-id) (template (list 
s.constructor-id s.accessor-id ...))]))
  (define lst (struct-funcs person))
  (displayln "show list of constructor and accessors that we retrieved via 
macro:")
  lst
  
  (displayln "Fetch name ('bob) by way of accessor returned through macro:")
  ((second lst) p)

  ; Uncommenting the following will cause compilation to fail, since
  ; person-name
  )

-- 
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] struct-info

2019-02-12 Thread David Storrs
Thanks Matthias, that makes sense.

On Tue, Feb 12, 2019 at 8:50 PM Matthias Felleisen
 wrote:
>
>
>
> > On Feb 12, 2019, at 5:28 PM, David Storrs  wrote:
> >
> > On Tue, Feb 12, 2019 at 5:03 PM  wrote:
> >>>>
> >>>> This is nice for defining abstract types, but it can be pretty 
> >>>> inconvenient for defining plain old aggregated data types that just have 
> >>>> a bundle of fields. When defining those types as structs, consider using 
> >>>> the #:transparent option. This means "use no inspector at all" (roughly) 
> >>>> and lets `struct-info` Just Work (TM) without any inspector wrangling. 
> >>>> The downside is that other modules may be able to break your type's 
> >>>> invariants and possibly circumvent your contracts.
> >>>
> >>>
> >>> That's what I expected, but it doesn't seem to work:
> >>>
> >>>> (struct person (name age) #:transparent)
> >>>> (struct-info person)
> >>> #f
> >>> #t
> >>>
> >>> What am I missing?
> >>
> >>
> >> I was stumped on this for a while, but then realized the problem:
> >>
> >>> (struct-info person)
> >> #f
> >> #t
> >>> (struct-info (person "Alyssa P. Hacker" 42))
> >> #
> >> #f
> >
> > Ah, I see.  Thanks, I wouldn't have guessed that an instance of a
> > struct satisfied `struct-type?`
> >
> > On the other hand, it seems relatively easy to break these
> > protections.  Is there a way to prevent that?
> >
> > ; file test1.rkt
> > #lang racket
> > (struct person (name age))
> > (provide person)
>
>
>
> The line above exports two pieces: the constructor and compile-time 
> information about the structure, including the functions as you saw. If you 
> want to protect your invariants, you replace this provide with something like
>
>(provide (contract-out (person (-> string natural-number/c person?
>
> See end for a simpler way to test such things.
>
>
>
> > ;; end of test1.rkt
> >
> >
> > ; file test2.rkt
> > #lang racket
> >
> > (require "test1.rkt"
> > (for-syntax racket
> > syntax/parse
> > syntax/parse/experimental/template
> > syntax/parse/class/struct-id))
> >
> > (define p (person 'bob 19))
> > (displayln "required ctor only of a struct defined in another file.
> > Can create, is opaque:")
> > p
> > (displayln "struct-info returns (values #f #t) since the struct isn't
> > inspectable here:")
> > (struct-info p)
> > (define-syntax struct-funcs (syntax-parser [(_ s:struct-id) (template
> > (list s.constructor-id s.accessor-id ...))]))
> > (define lst (struct-funcs person))
> > (displayln "show list of constructor and accessors that we retrieved
> > via macro:")
> > lst
> > (displayln "Fetch name ('bob) by way of accessor returned through macro:")
> > ((second lst) p)
> > ; Uncommenting the following will cause compilation to fail, since
> > person-name was not exported
> > ;(person-name p)
> > ;;  end of test2.rkt
> >
> >
> > ;; command line:
> > $ racket test2.rkt
> > required ctor only of a struct defined in another file. Can create, is 
> > opaque:
> > #
> > struct-info returns (values #f #t) since the struct isn't inspectable here:
> > #f
> > #t
> > show list of constructor and accessors that we retrieved via macro:
> > '(# # #)
> > Fetch name ('bob) by way of accessor returned through macro:
> > 'bob
> >
> > -
>
>
>
>
> #lang racket
>
> (module test1 racket
>   (provide (contract-out (person (-> string natural-number/c person?
>   (struct person (name age)))
>
> (module test2 racket
>   (require (submod ".." test1)
>(for-syntax racket
>    syntax/parse
>syntax/parse/experimental/template
>    syntax/parse/class/struct-id))
>
>   (define p (person 'bob 19))
>   (displayln "required ctor only of a struct defined in another file. Can 
> create, is opaque:")
>   p
>
>   (displayln "struct-info returns (values #f #t) since the struct isn't 
> inspectable here:")
>   (struct-info p)
>
>   (define-syntax struct-funcs (syntax-parser [(_ s:struct-id) (template (list 
> s.constructor-id s.accessor-id ...))]))
>   (define lst (struct-funcs person))
>   (displayln "show list of constructor and accessors that we retrieved via 
> macro:")
>   lst
>
>   (displayln "Fetch name ('bob) by way of accessor returned through macro:")
>   ((second lst) p)
>
>   ; Uncommenting the following will cause compilation to fail, since
>   ; person-name
>   )
>

-- 
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] performance, json

2019-02-22 Thread 'John Clements&#x27; via Racket Users
n


> On Feb 22, 2019, at 9:47 AM, Brian Craft  wrote:
> 
> I'm doing a few performance tests, just to get an idea of racket performance. 
> The following result surprised me a bit. Parsing 1M strings from a json 
> array, like
> 
> (define samples (time (read-json (open-input-file "test.json"
> 
> running with 'racket test.rkt'
> 
> Comparing to js, java, and clojure:
> 
> js 0.128s
> java 0.130s
> clojure 1.3s
> racket 10s
> 
> This is pretty slow. Is this typical? Are there other steps I should be 
> taking, for performance?
> 
> -- 
> 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] performance, json

2019-02-22 Thread Greg Trzeciak

There is http://docs.racket-lang.org/tjson/index.html available (haven't 
checked how similar the code is though)

On Friday, February 22, 2019 at 7:36:23 PM UTC+1, johnbclements wrote:
>
>
>
> … and my guess is that the JS performance would be similar, if the json 
> reader in JS was written in JS. I think there are probably a lot of 
> provably-unneeded checks, and you could probably get rid of the 
> byte-at-a-time reading. 
>
> It would be interesting to see how much faster (if at all) it is to run 
> the TR version of this code. 
>
> John 
>
>
>
>

-- 
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] performance, json

2019-02-22 Thread Matthew Flatt
I think the bigger bottleneck is the main parsing loop, which uses
`regexp-try-match` even more. Although `regexp-try-match` is
convenient, it's much slower than using `peek-char` directly to check
for one character. I'll experiment with improvements there.

At 22 Feb 2019 13:36:20 -0500, "'John Clements' via Racket Users" wrote:
> I’m not that surprised :).
> 
> My guess is that our json reader could be sped up quite a bit. This looks 
> like 
> the heart of the read-json implementation:
> 
> (define (read-json* who i jsnull)
>   ;; Follows the specification (eg, at json.org) -- no extensions.
>   ;;
>   (define (err fmt . args)
> (define-values [l c p] (port-next-location i))
> (raise-read-error (format "~a: ~a" who (apply format fmt args))
>   (object-name i) l c p #f))
>   (define (skip-whitespace) (regexp-match? #px#"^\\s*" i))
>   ;;
>   ;; Reading a string *could* have been nearly trivial using the racket
>   ;; reader, except that it won't handle a "\/"...
>   (define (read-string)
> (define result (open-output-bytes))
> (let loop ()
>   (define esc
> (let loop ()
>   (define c (read-byte i))
>   (cond
> [(eof-object? c) (err "unterminated string")]
> [(= c 34) #f]   ;; 34 = "
> [(= c 92) (read-bytes 1 i)] ;; 92 = \
> [else (write-byte c result) (loop)])))
>   (cond
> [(not esc) (bytes->string/utf-8 (get-output-bytes result))]
> [(case esc
>[(#"b") #"\b"]
>[(#"n") #"\n"]
>[(#"r") #"\r"]
>[(#"f") #"\f"]
>[(#"t") #"\t"]
>[(#"\\") #"\\"]
>[(#"\"") #"\""]
>[(#"/") #"/"]
>[else #f])
>  => (λ (m) (write-bytes m result) (loop))]
> [(equal? esc #"u")
>  (let* ([e (or (regexp-try-match #px#"^[a-fA-F0-9]{4}" i)
>(err "bad string \\u escape"))]
> [e (string->number (bytes->string/utf-8 (car e)) 16)])
>(define e*
>  (if (<= #xD800 e #xDFFF)
>  ;; it's the first part of a UTF-16 surrogate pair
>  (let* ([e2 (or (regexp-try-match 
> #px#"^u([a-fA-F0-9]{4})" 
> i)
> (err "bad string \\u escape, ~a"
>  "missing second half of a UTF16 pair"))]
> [e2 (string->number (bytes->string/utf-8 (cadr e2)) 
> 16)])
>(if (<= #xDC00 e2 #xDFFF)
>(+ (arithmetic-shift (- e #xD800) 10) (- e2 #xDC00) 
> #x1)
>(err "bad string \\u escape, ~a"
> "bad second half of a UTF16 pair")))
>  e)) ; single \u escape
>(write-string (string (integer->char e*)) result)
>(loop))]
> [else (err "bad string escape: \"~a\"" esc)])))
>   ;;
>   (define (read-list what end-rx read-one)
> (skip-whitespace)
> (if (regexp-try-match end-rx i)
> '()
> (let loop ([l (list (read-one))])
>   (skip-whitespace)
>   (cond [(regexp-try-match end-rx i) (reverse l)]
> [(regexp-try-match #rx#"^," i) (loop (cons (read-one) l))]
> [else (err "error while parsing a json ~a" what)]
>   ;;
>   (define (read-hash)
> (define (read-pair)
>   (define k (read-json))
>   (unless (string? k) (err "non-string value used for json object key"))
>   (skip-whitespace)
>   (unless (regexp-try-match #rx#"^:" i)
> (err "error while parsing a json object pair"))
>   (list (string->symbol k) (read-json)))
> (apply hasheq (apply append (read-list 'object #rx#"^}" read-pair
>   ;;
>   (define (read-json [top? #f])
> (skip-whitespace)
> (cond
>   [(and top? (eof-object? (peek-char i))) eof]
>   [(regexp-try-match #px#"^true\\b"  i) #t]
>   [(regexp-try-match #px#"^false\\b" i) #f]
>   [(regexp-try-match #px#"^null\\b"  i) jsnull]
>   [(regexp-try-match
> #rx#"^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?" i)
>=> (λ (bs) (string->number (bytes->str

Re: [racket-users] performance, json

2019-02-22 Thread Jon Zeppieri
On a related (but not too related) note: is there an efficient way to skip
multiple bytes in an input stream? It looks like there are two choices:
  - You can read the bytes you want to skip, but that implies either
allocating a useless byte array or keeping one around for this very purpose.
  - You can use (I think?) port-commit-peeked, bit given the API, it seems
like that was designed with a particular (and more complicated) use in mind.


On Fri, Feb 22, 2019 at 3:35 PM Matthew Flatt  wrote:

> I think the bigger bottleneck is the main parsing loop, which uses
> `regexp-try-match` even more. Although `regexp-try-match` is
> convenient, it's much slower than using `peek-char` directly to check
> for one character. I'll experiment with improvements there.
>
> At 22 Feb 2019 13:36:20 -0500, "'John Clements' via Racket Users" wrote:
> > I’m not that surprised :).
> >
> > My guess is that our json reader could be sped up quite a bit. This
> looks like
> > the heart of the read-json implementation:
> >
> > (define (read-json* who i jsnull)
> >   ;; Follows the specification (eg, at json.org) -- no extensions.
> >   ;;
> >   (define (err fmt . args)
> > (define-values [l c p] (port-next-location i))
> > (raise-read-error (format "~a: ~a" who (apply format fmt args))
> >   (object-name i) l c p #f))
> >   (define (skip-whitespace) (regexp-match? #px#"^\\s*" i))
> >   ;;
> >   ;; Reading a string *could* have been nearly trivial using the racket
> >   ;; reader, except that it won't handle a "\/"...
> >   (define (read-string)
> > (define result (open-output-bytes))
> > (let loop ()
> >   (define esc
> > (let loop ()
> >   (define c (read-byte i))
> >   (cond
> > [(eof-object? c) (err "unterminated string")]
> > [(= c 34) #f]   ;; 34 = "
> > [(= c 92) (read-bytes 1 i)] ;; 92 = \
> > [else (write-byte c result) (loop)])))
> >   (cond
> > [(not esc) (bytes->string/utf-8 (get-output-bytes result))]
> > [(case esc
> >[(#"b") #"\b"]
> >[(#"n") #"\n"]
> >[(#"r") #"\r"]
> >[(#"f") #"\f"]
> >[(#"t") #"\t"]
> >[(#"\\") #"\\"]
> >[(#"\"") #"\""]
> >[(#"/") #"/"]
> >[else #f])
> >  => (λ (m) (write-bytes m result) (loop))]
> > [(equal? esc #"u")
> >  (let* ([e (or (regexp-try-match #px#"^[a-fA-F0-9]{4}" i)
> >(err "bad string \\u escape"))]
> > [e (string->number (bytes->string/utf-8 (car e)) 16)])
> >(define e*
> >  (if (<= #xD800 e #xDFFF)
> >  ;; it's the first part of a UTF-16 surrogate pair
> >  (let* ([e2 (or (regexp-try-match
> #px#"^u([a-fA-F0-9]{4})"
> > i)
> > (err "bad string \\u escape, ~a"
> >  "missing second half of a UTF16
> pair"))]
> > [e2 (string->number (bytes->string/utf-8 (cadr
> e2))
> > 16)])
> >(if (<= #xDC00 e2 #xDFFF)
> >(+ (arithmetic-shift (- e #xD800) 10) (- e2
> #xDC00)
> > #x1)
> >(err "bad string \\u escape, ~a"
> > "bad second half of a UTF16 pair")))
> >  e)) ; single \u escape
> >(write-string (string (integer->char e*)) result)
> >(loop))]
> > [else (err "bad string escape: \"~a\"" esc)])))
> >   ;;
> >   (define (read-list what end-rx read-one)
> > (skip-whitespace)
> > (if (regexp-try-match end-rx i)
> > '()
> > (let loop ([l (list (read-one))])
> >   (skip-whitespace)
> >   (cond [(regexp-try-match end-rx i) (reverse l)]
> > [(regexp-try-match #rx#"^," i) (loop (cons (read-one)
> l))]
> > [else (err "error while parsing a json ~a" what)]
> >   ;;
> >   (define (read-hash)
> > (define (read-pair)
> >   (define k (r

Re: [racket-users] performance, json

2019-02-22 Thread WarGrey Gyoudmon Ju
I have tried my best to find the "best practice" to do Racket IO.

Here are some tips I found in writing CSV reader:
https://github.com/wargrey/schema/blob/master/digitama/exchange/csv/reader/port.rkt
With a MacBook Pro 15, 2013, it takes 3.5s to read a 70MB file.

I agreed that `read-char` is the first choice, but `peek-char` may be slow
somehow.
Instead, just read the `peek`ing chars and pass it or them as the leading
ones to the parsing routine.
This strategy may require a re-design of your parsing workflow
since every subroutine should accept another input argument and return one
more value.


On Sat, Feb 23, 2019 at 5:34 AM Jon Zeppieri  wrote:

> On a related (but not too related) note: is there an efficient way to skip
> multiple bytes in an input stream? It looks like there are two choices:
>   - You can read the bytes you want to skip, but that implies either
> allocating a useless byte array or keeping one around for this very purpose.
>   - You can use (I think?) port-commit-peeked, bit given the API, it seems
> like that was designed with a particular (and more complicated) use in mind.
>
>
> On Fri, Feb 22, 2019 at 3:35 PM Matthew Flatt  wrote:
>
>> I think the bigger bottleneck is the main parsing loop, which uses
>> `regexp-try-match` even more. Although `regexp-try-match` is
>> convenient, it's much slower than using `peek-char` directly to check
>> for one character. I'll experiment with improvements there.
>>
>> At 22 Feb 2019 13:36:20 -0500, "'John Clements' via Racket Users" wrote:
>> > I’m not that surprised :).
>> >
>> > My guess is that our json reader could be sped up quite a bit. This
>> looks like
>> > the heart of the read-json implementation:
>> >
>> > (define (read-json* who i jsnull)
>> >   ;; Follows the specification (eg, at json.org) -- no extensions.
>> >   ;;
>> >   (define (err fmt . args)
>> > (define-values [l c p] (port-next-location i))
>> > (raise-read-error (format "~a: ~a" who (apply format fmt args))
>> >   (object-name i) l c p #f))
>> >   (define (skip-whitespace) (regexp-match? #px#"^\\s*" i))
>> >   ;;
>> >   ;; Reading a string *could* have been nearly trivial using the racket
>> >   ;; reader, except that it won't handle a "\/"...
>> >   (define (read-string)
>> > (define result (open-output-bytes))
>> > (let loop ()
>> >   (define esc
>> > (let loop ()
>> >   (define c (read-byte i))
>> >   (cond
>> > [(eof-object? c) (err "unterminated string")]
>> > [(= c 34) #f]   ;; 34 = "
>> > [(= c 92) (read-bytes 1 i)] ;; 92 = \
>> > [else (write-byte c result) (loop)])))
>> >   (cond
>> > [(not esc) (bytes->string/utf-8 (get-output-bytes result))]
>> > [(case esc
>> >[(#"b") #"\b"]
>> >[(#"n") #"\n"]
>> >[(#"r") #"\r"]
>> >[(#"f") #"\f"]
>> >[(#"t") #"\t"]
>> >[(#"\\") #"\\"]
>> >[(#"\"") #"\""]
>> >[(#"/") #"/"]
>> >[else #f])
>> >  => (λ (m) (write-bytes m result) (loop))]
>> > [(equal? esc #"u")
>> >  (let* ([e (or (regexp-try-match #px#"^[a-fA-F0-9]{4}" i)
>> >(err "bad string \\u escape"))]
>> > [e (string->number (bytes->string/utf-8 (car e)) 16)])
>> >(define e*
>> >  (if (<= #xD800 e #xDFFF)
>> >  ;; it's the first part of a UTF-16 surrogate pair
>> >  (let* ([e2 (or (regexp-try-match
>> #px#"^u([a-fA-F0-9]{4})"
>> > i)
>> > (err "bad string \\u escape, ~a"
>> >  "missing second half of a UTF16
>> pair"))]
>> > [e2 (string->number (bytes->string/utf-8 (cadr
>> e2))
>> > 16)])
>> >(if (<= #xDC00 e2 #xDFFF)
>> >(+ (arithmetic-shift (- e #xD800) 10) (- e2
>> #xDC00)
>> > #x1)
>> >  

[racket-users] type annotation example

2019-02-25 Thread Brian Craft
Doing a cut & paste from the typed racket docs, I'm getting a compile 
error. Input file:

#lang typed/racket
(require typed/racket/base)

(: fn (-> String Symbol))
(define (fn str) 'foo)


'fn' taken from this page:

https://docs.racket-lang.org/ts-guide/more.html#%28part._when-annotations~3f%29


Running with 'racket foo', gives me
Type Checker: ->: bad syntax
  in: (-> String Symbol)


What am I doing wrong?

-- 
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] lightning talk ideas?

2019-02-25 Thread Ryan Kramer
Thinking about evangelism... I go to a functional programming meetup and we 
usually do "lightning talks" which are described as:

"Sticking with our short talk/demo format, we will once again have 3 - 5 
> slots available for you to show what you're working on, share something you 
> learned, or demo some cool code.
>
> The presentation should aim to be 5 - 15 minutes, with a hard time limit 
> of 20 minutes. Please post a comment with a brief description of what you'd 
> like to present. Anything FP-related is fair game!
>
> I'd really like to encourage as many members as possible to participate. 
> Even if you're just learning something, you can still present. It will help 
> you learn it more deeply by sharing and explaining."
>

I've given two, with a 3rd one planned:
1) you can customize #%app and that's pretty cool
2) define/contract made me realize static typing isn't as important as I've 
always thought
3) scribble is awesome (seriously, does any language have a better code 
documentation tool?)

Obviously there are many great things about Racket, but it can be hard to 
think of a talk that
1) targets FPers who may not have scheme experience
2) can be explained quickly
3) leaves the audience thinking "that's cool, maybe I should take a look at 
Racket"

Any ideas?

-- 
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] R6RS history

2019-02-26 Thread Sam Tobin-Hochstadt
I think a genuinely detailed accounting of this has to wait for a
conversation over beer, but:

2003: New Scheme Standard proposed at the Scheme Workshop
2006: First draft of R6RS released
2007: R6RS Ratified by community vote after extensive discussion and revision
2009: A new Scheme Standard steering committee elected by a community
vote. The new committee reflected opposition to the R6RS.

Subsequent to this, new editors have produced various versions of the
R7RS, which do not aim to be direct successors to the R6RS.

You can see extensive material about this here: http://www.r6rs.org/history.html

Sam

On Tue, Feb 26, 2019 at 3:08 PM Jack Firth  wrote:
>
> What exactly is the history surrounding scheme, racket, and r6rs? I've gotten 
> vague impressions of serious scheme community conflicts around that time but 
> nothing specific. Does anyone have a timeline of important events related to 
> that?
>
> --
> 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] R6RS history

2019-02-26 Thread Matthias Felleisen



Let me inject some comments that make it a bit more obvious what’s happening 
here: 


> On Feb 26, 2019, at 3:33 PM, Sam Tobin-Hochstadt  wrote:
> 

RnRS meetings from 1984 thru 2003 adhere to the “unanimity rule” originating 
from the MIT group. 

In 2001, I created and ran “Scheme and Functional Programming” (SFP), a first 
annual Scheme workshop that also subsumed “Scheme Report” meetings. 


> 2003: New Scheme Standard proposed at the Scheme Workshop

At the 2003 Boston SFP, I proposed going to a majority rule so that the Scheme 
standard could grow into a useful language after a long long day, with many 
people gone. The motion passed. 

> 2006: First draft of R6RS released
> 2007: R6RS Ratified by community vote after extensive discussion and revision

I wrote an essay entitled “The R6RS is Perfect”. The certification vote 
succeeded with just a few votes more than needed (60% or 66% or something like 
that). 


> 2009: A new Scheme Standard steering committee elected by a community
> vote. The new committee reflected opposition to the R6RS.

(as in “community vote” by another Scheme workshop) 


We, the Racketeers, didn’t want to be in their way so we wrote this: 

 https://racket-lang.org/new-name.html

History is history. The future you can change, unless Gödel is right about 
Einstein’s equations and it’s practical. 

— 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] R6RS history

2019-02-27 Thread Will Jukes
This question has been burning me up as well.

On Tue, Feb 26, 2019 at 4:16 PM Matthias Felleisen 
wrote:

>
>
> Let me inject some comments that make it a bit more obvious what’s
> happening here:
>
>
> > On Feb 26, 2019, at 3:33 PM, Sam Tobin-Hochstadt 
> wrote:
> >
>
> RnRS meetings from 1984 thru 2003 adhere to the “unanimity rule”
> originating from the MIT group.
>
> In 2001, I created and ran “Scheme and Functional Programming” (SFP), a
> first annual Scheme workshop that also subsumed “Scheme Report” meetings.
>
>
> > 2003: New Scheme Standard proposed at the Scheme Workshop
>
> At the 2003 Boston SFP, I proposed going to a majority rule so that the
> Scheme standard could grow into a useful language after a long long day,
> with many people gone. The motion passed.
>
> > 2006: First draft of R6RS released
> > 2007: R6RS Ratified by community vote after extensive discussion and
> revision
>
> I wrote an essay entitled “The R6RS is Perfect”. The certification vote
> succeeded with just a few votes more than needed (60% or 66% or something
> like that).
>
>
> > 2009: A new Scheme Standard steering committee elected by a community
> > vote. The new committee reflected opposition to the R6RS.
>
> (as in “community vote” by another Scheme workshop)
>
>
> We, the Racketeers, didn’t want to be in their way so we wrote this:
>
>  https://racket-lang.org/new-name.html
>
> History is history. The future you can change, unless Gödel is right about
> Einstein’s equations and it’s practical.
>
> — 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.
>

-- 
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] R6RS history

2019-02-27 Thread Arthur Nunes-Harwitt

Dear Matthias,

  Would you be willing to share your thoughts about the history of 
denotational versus operational semantics in the report?


  Thanks.

==
Arthur Nunes-Harwitt
Computer Science Department, Rochester Institute of Technology
Room 70-3509
585-475-4916
==

"I don't know what the language of the future will be
called, but it will look like LISP."

This email is confidential and intended for the named recipient(s). In
the event the email is received by someone other than the recipient,
please notify the sender at a...@cs.rit.edu.

On Tue, 26 Feb 2019, Matthias Felleisen wrote:




Let me inject some comments that make it a bit more obvious what’s happening 
here:



On Feb 26, 2019, at 3:33 PM, Sam Tobin-Hochstadt  wrote:



RnRS meetings from 1984 thru 2003 adhere to the “unanimity rule” originating 
from the MIT group.

In 2001, I created and ran “Scheme and Functional Programming” (SFP), a first 
annual Scheme workshop that also subsumed “Scheme Report” meetings.



2003: New Scheme Standard proposed at the Scheme Workshop


At the 2003 Boston SFP, I proposed going to a majority rule so that the Scheme 
standard could grow into a useful language after a long long day, with many 
people gone. The motion passed.


2006: First draft of R6RS released
2007: R6RS Ratified by community vote after extensive discussion and revision


I wrote an essay entitled “The R6RS is Perfect”. The certification vote 
succeeded with just a few votes more than needed (60% or 66% or something like 
that).



2009: A new Scheme Standard steering committee elected by a community
vote. The new committee reflected opposition to the R6RS.


(as in “community vote” by another Scheme workshop)


We, the Racketeers, didn’t want to be in their way so we wrote this:

https://racket-lang.org/new-name.html

History is history. The future you can change, unless Gödel is right about 
Einstein’s equations and it’s practical.

— 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.



--
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] R6RS history

2019-02-28 Thread Matthias Felleisen



> On Feb 27, 2019, at 1:42 PM, Arthur Nunes-Harwitt  wrote:
> 
> Dear Matthias,
> 
>  Would you be willing to share your thoughts about the history of 
> denotational versus operational semantics in the report?


[[ This is probably totally off topic for the list. ]]

Denotational semantics emerged as the dominant form in the 70s and 80s, 
especially in the functional/Lisp-y community, because it could express 
everything and the function from Syntax to Meaning (Scott domains) looked like 
an interpreter, which everybody (“”) knows how to read and possibly write. 

BUT, 

1. you typically want to use your semantics for something (e.g. a proof that 
what you wrote down has certain properties) 
2. you want your semantics to have some resemblance to the design principles 
(here, “Scheme as a lambda calculus …”) 

The 1980s showed that using den. sem. for many common goals was hard (e.g. type 
soundness proofs of ML; see Dams and Tofte’s work). In 1991, I worked with a 
student (Andrew Wright) to explain how these proofs could be done more easily 
with a form of operational semantics (an actual lambda calculus element) that I 
developed for my dissertation. 

The cool thing was that this new form of semantics looked as simple as the 
original lambda calculus, handled assignments and continuations just fine, and 
possessed the same mathematical properties as the original lambda calculus 
(Church-Rosser, Curry-Feys). 

By the time R6RS rolled around, Robby and his students had developed the Redex 
language far enough that we could use it to model all of Scheme, first R5RS and 
then R6RS (minus macros). By supplying an executable operational model, we 
hoped implementors could use it as an independent source of truth for their own 
work. We definitely have for many special corners of Racket and time and again 
Matthew finds a discrepancy between our models and the implementation. 
Sometimes we don’t trust the implementation and extend the model to cover this 
corner just to see whether two rather different ways of looking at things help 
us find the right way of doing things. 

If you’re curious, see https://www2.ccs.neu.edu/racket/pubs/#popl12-kfff for 
other examples. 


-- 
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] performance, json

2019-02-28 Thread Brian Craft
I added some type annotations & tried it. The result is 16s, substantially 
slower.

Haven't tried tjson, yet. I'm not actually even that interested in json, it 
was just something at-hand to try.

>From this thread, it sounds like there's some knowledge about racket 
performance that isn't yet in the docs. Are there any other resources on 
performance?

On Friday, February 22, 2019 at 10:36:23 AM UTC-8, johnbclements wrote:
>
>
> It would be interesting to see how much faster (if at all) it is to run 
> the TR version of this code. 
>
> John 
>
>
> > On Feb 22, 2019, at 9:47 AM, Brian Craft  > wrote: 
> > 
> > I'm doing a few performance tests, just to get an idea of racket 
> performance. The following result surprised me a bit. Parsing 1M strings 
> from a json array, like 
> > 
> > (define samples (time (read-json (open-input-file "test.json" 
> > 
> > running with 'racket test.rkt' 
> > 
> > Comparing to js, java, and clojure: 
> > 
> > js 0.128s 
> > java 0.130s 
> > clojure 1.3s 
> > racket 10s 
> > 
> > This is pretty slow. Is this typical? Are there other steps I should be 
> taking, for performance? 
> > 
> > -- 
> > 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...@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] apologies for duplicates

2019-03-01 Thread George Neuner



Something weird going on with my mail.  It appears an unfinished draft 
message replying to Curtis Dutton was sent several times over the course 
of about 10 minutes.  I don't know how this happened, but I apologize 
for accidentally spamming everyone.


George

--
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] performance, json

2019-03-02 Thread Matthew Flatt
At Fri, 22 Feb 2019 16:34:24 -0500, Jon Zeppieri wrote:
> On a related (but not too related) note: is there an efficient way to skip
> multiple bytes in an input stream? It looks like there are two choices:
>   - You can read the bytes you want to skip, but that implies either
> allocating a useless byte array or keeping one around for this very purpose.
>   - You can use (I think?) port-commit-peeked, bit given the API, it seems
> like that was designed with a particular (and more complicated) use in mind.

I've run into this a few times, too. Assuming that `file-position`
doesn't apply, having a buffer for discarded byes is the best approach
that I know. To make it faster, I think we'd have to build a
`discard-bytes` function into the I/O layer.

-- 
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] Breaks and events

2019-03-07 Thread Jack Firth
Question for synchronizable event experts: why is there no `break-evt`? The
existence of `sync/enable-break` suggests to me that it is possible to have
mutually exclusive choice between synchronizing on an event or raising a
break. And we have an analogous construct for `sync/timeout` in the form of
`alarm-evt`. Is there something about breaks that makes this idea
impossible?

-- 
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] Avoiding tail-indentation

2019-03-11 Thread Hendrik Boom
On Mon, Mar 11, 2019 at 01:17:08PM -0400, Greg Hendershott wrote:
> To be fair:
> 
> As a new user, it's possible to have the intuition that `define` is
> just a way to avoid indentation -- that it "writes a `let` for you,
> from the point of the define to 'the end of the enclosing scope'".

Racket needs a way to avoid trouble with tail-indentation, just as it 
avoids trouble with tail-recursion.

Years ago I used a lisp that used / to indicate a final sublist:
(a a a
/bbb bbb bbb
/def
)
meant the same as 
(a a a
  (bbb bbb bbb
(def
)))
It was very convenient and allowed let and if to nest gracefully.

Are there any spcial characters or the like left in Racket that could 
be used for this purpose?

-- hendrik

-- 
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] Re: Licence guidance

2019-03-12 Thread 'Joel Dueck&#x27; via Racket Users
Most of my projects are like Stephen's (a) scenario. 
I typically want a non-copyleft/permissive license for these.
In such cases I have usually followed the FSF's advice and used Apache 2.0. 
However...

Recently I read the following blog post by Kyle Mitchell, a practicing IP 
lawyer: 
  Deprecation Notice: MIT and BSD. 
https://writing.kemitchell.com/2019/03/09/Deprecation-Notice.html

Kyle and a few other coding/IP-law types recently formed Blue Oak Council 
to provide guidance specifically on permissive (non-copyleft) open source 
licenses.
As part of this they have designed their own "model" permissive open source 
license: 
  https://blueoakcouncil.org/license/1.0.0

I know it's extremely new, but (though not a lawyer myself) I find the 
rationale behind their plain-English model license appealing.
I'll be strongly considering it in the future. I thought it was worth 
including in this thread.

It was discussed on HN a few days ago, with some additional comments from 
the author:
  https://news.ycombinator.com/item?id=19347797

On Monday, September 24, 2018 at 5:04:10 AM UTC-5, Stephen De Gabrielle 
wrote:
>
> Hi,
>
> I sometimes see Racket packages on PLaneT or Github, but lack a licence. 
>
> I don’t feel I can redistribute or fork abandoned code if it lacks a 
> licence. (I can give an example of an 11yo abandoned project that I’d love 
> to fork but can’t because it lacks a licence)
>
> With that in mind- what licences should be used when making code available 
> on the package repository/github in the following situations:
>
> a) general purpose library that I am happy for the broader community of 
> evelopers to use without restraint - but is unlikely to ever meet to be 
> included in Racket e.g. I have an number checksum validator (UK NHS ID 
> number) 
> - is dual licence Apache/MIT appropriate? or is it completely up to me.
>
> b) library, tool or DrRacket plugin that may(or may not) become part of 
> the Racket distribution
> - is dual licence Apache/MIT appropriate or should it also be LGPL?
>
> c) anything else?
>
> Kind regards,
>
> Stephen
>
>
> -- 
> Kind regards,
> Stephen
> --
> Ealing (London), UK
>

-- 
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] Writing scribble?

2019-03-13 Thread Matthias Felleisen


esc-b, esc-f 



> On Mar 13, 2019, at 2:24 PM, Matt Jadud  wrote:
> 
> Hi all,
> 
> I assume people use DrRacket to write Scribblings.
> 
> I'll be writing text, and want to move back one word. On the Mac, most of the 
> time I can hit Option-LeftArrow, and I go back one word.
> 
> I DrRacket, this takes me back an expression, which in Scribble is a whole 
> paragraph.
> 
> Are there shortcuts for moving around Scribble documents that I don't know? 
> Do people use other tools to write Scribblings?
> 
> Cheers,
> Matt 
> 
> -- 
> 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] Writing scribble?

2019-03-13 Thread Robby Findler
It is control-left and control-right to go by words in DrRacket. If
you go to Edit|Keybindings|Show Active Keybindings and type "word"
you'll see those and the ones Matthias mentioned and some other
word-related keystrokes.

Robby

On Wed, Mar 13, 2019 at 1:24 PM Matt Jadud  wrote:
>
> Hi all,
>
> I assume people use DrRacket to write Scribblings.
>
> I'll be writing text, and want to move back one word. On the Mac, most of the 
> time I can hit Option-LeftArrow, and I go back one word.
>
> I DrRacket, this takes me back an expression, which in Scribble is a whole 
> paragraph.
>
> Are there shortcuts for moving around Scribble documents that I don't know? 
> Do people use other tools to write Scribblings?
>
> Cheers,
> Matt
>
> --
> 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] Writing scribble?

2019-03-13 Thread Matt Jadud
I was going to say... is ESC-B some kind of shortcut from one of those
"text editors" I hear people talk about? ;) (I should have remembered that
DrR has bindings for many Emacs shortcuts...)

Also, thanks for the reminder about the prefs/bindings; this is essentially
the first time I've spent significant time poking at Scribble, and the
shortcuts that are useful are different, so they're in my unlearned-space.
I appreciate the pointers.

Cheers,
M


On Wed, Mar 13, 2019 at 8:16 PM Robby Findler 
wrote:

> It is control-left and control-right to go by words in DrRacket. If
> you go to Edit|Keybindings|Show Active Keybindings and type "word"
> you'll see those and the ones Matthias mentioned and some other
> word-related keystrokes.
>
> Robby
>
> On Wed, Mar 13, 2019 at 1:24 PM Matt Jadud  wrote:
> >
> > Hi all,
> >
> > I assume people use DrRacket to write Scribblings.
> >
> > I'll be writing text, and want to move back one word. On the Mac, most
> of the time I can hit Option-LeftArrow, and I go back one word.
> >
> > I DrRacket, this takes me back an expression, which in Scribble is a
> whole paragraph.
> >
> > Are there shortcuts for moving around Scribble documents that I don't
> know? Do people use other tools to write Scribblings?
> >
> > Cheers,
> > Matt
> >
> > --
> > 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] Writing scribble?

2019-03-15 Thread David Storrs
An alternative is to write it in whatever editor you like (Emacs) and then
either use DrRacket to render it to scribble or do it directly from the
command line:

$ scribble ./my_scribble_file.scrbl

This will generate "./my_scribble_file.html", which you can then view in a
browser.  If you regenerate it, just hit "refresh" on the browser to see
the changes.

On Wed, Mar 13, 2019 at 8:21 PM Matt Jadud  wrote:

> I was going to say... is ESC-B some kind of shortcut from one of those
> "text editors" I hear people talk about? ;) (I should have remembered that
> DrR has bindings for many Emacs shortcuts...)
>
> Also, thanks for the reminder about the prefs/bindings; this is
> essentially the first time I've spent significant time poking at Scribble,
> and the shortcuts that are useful are different, so they're in my
> unlearned-space. I appreciate the pointers.
>
> Cheers,
> M
>
>
> On Wed, Mar 13, 2019 at 8:16 PM Robby Findler 
> wrote:
>
>> It is control-left and control-right to go by words in DrRacket. If
>> you go to Edit|Keybindings|Show Active Keybindings and type "word"
>> you'll see those and the ones Matthias mentioned and some other
>> word-related keystrokes.
>>
>> Robby
>>
>> On Wed, Mar 13, 2019 at 1:24 PM Matt Jadud  wrote:
>> >
>> > Hi all,
>> >
>> > I assume people use DrRacket to write Scribblings.
>> >
>> > I'll be writing text, and want to move back one word. On the Mac, most
>> of the time I can hit Option-LeftArrow, and I go back one word.
>> >
>> > I DrRacket, this takes me back an expression, which in Scribble is a
>> whole paragraph.
>> >
>> > Are there shortcuts for moving around Scribble documents that I don't
>> know? Do people use other tools to write Scribblings?
>> >
>> > Cheers,
>> > Matt
>> >
>> > --
>> > 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.
>

-- 
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] printing decimals

2019-03-15 Thread Jon Zeppieri
https://docs.racket-lang.org/reference/strings.html?q=~r#%28def._%28%28lib._racket%2Fformat..rkt%29._~7er%29%29

On Fri, Mar 15, 2019 at 1:57 PM  wrote:

> Hi all,
>
> I've been looking through the docs for a way to print decimals to a
> defined precision.
>
> I can get close to what I want using something like ~a and giving it a set
> width without having to build a function to do so. I mean I can build a
> function to do as its just a bit of string manip but it feels really odd
> that there doesn't seem to be a built in way to do so even though we try to
> keep all the decimals in fractional notation to maintain precision as long
> as possible in racket.
>
> any ideas anyone or am I just being blind and its right there in the docs
> somewhere?
>
> thanks,
> Scott
>
> --
> 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] printing decimals

2019-03-15 Thread sdgudeman
sigh good greif I was being blind its all of a page or so below ~a 
thank you Jon

On Friday, March 15, 2019 at 12:58:58 PM UTC-5, Jon Zeppieri wrote:
>
>
> https://docs.racket-lang.org/reference/strings.html?q=~r#%28def._%28%28lib._racket%2Fformat..rkt%29._~7er%29%29
>
> On Fri, Mar 15, 2019 at 1:57 PM > wrote:
>
>> Hi all,
>>
>> I've been looking through the docs for a way to print decimals to a 
>> defined precision.
>>
>> I can get close to what I want using something like ~a and giving it a 
>> set width without having to build a function to do so. I mean I can build a 
>> function to do as its just a bit of string manip but it feels really odd 
>> that there doesn't seem to be a built in way to do so even though we try to 
>> keep all the decimals in fractional notation to maintain precision as long 
>> as possible in racket.
>>
>> any ideas anyone or am I just being blind and its right there in the docs 
>> somewhere?
>>
>> thanks,
>> Scott
>>
>> -- 
>> 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...@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] printing decimals

2019-03-15 Thread Laurent
You're probably looking for `real->decimal-string`.

Also take a look at ~r instead of ~a, as the former is only for numbers.

On Fri, Mar 15, 2019 at 5:57 PM  wrote:

> Hi all,
>
> I've been looking through the docs for a way to print decimals to a
> defined precision.
>
> I can get close to what I want using something like ~a and giving it a set
> width without having to build a function to do so. I mean I can build a
> function to do as its just a bit of string manip but it feels really odd
> that there doesn't seem to be a built in way to do so even though we try to
> keep all the decimals in fractional notation to maintain precision as long
> as possible in racket.
>
> any ideas anyone or am I just being blind and its right there in the docs
> somewhere?
>
> thanks,
> Scott
>
> --
> 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] Guards and R7RS

2019-03-18 Thread jmhuffle
Dear Racket users of the #!r7rs modules,

 It seems to me that there is an error with R7RS' "guard" special form. The 
reference manual reads that "raise-continuable" is called with a raised object 
not handled by a "guard" special form. But, if I try:

(with-exception-handler (lambda (x) 'gotcha) 
 (lambda () (guard (y) (raise 2019

I got an error. The same if "raise" is replaced by "raise-continuable" in the 
previous expression. Unless I miss some points?

 Thanks in advance for your answers,

J.-M. Hufflen

-- 
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] Re: printing decimals

2019-03-19 Thread Sanjeev Sharma
SRFI 57, the function cat

differs from ~r in several areas,  but looks like a decent alternative 

On Friday, March 15, 2019 at 1:57:03 PM UTC-4, sdgu...@gmail.com wrote:
>
> Hi all,
>
> I've been looking through the docs for a way to print decimals to a 
> defined precision.
>
> I can get close to what I want using something like ~a and giving it a set 
> width without having to build a function to do so. I mean I can build a 
> function to do as its just a bit of string manip but it feels really odd 
> that there doesn't seem to be a built in way to do so even though we try to 
> keep all the decimals in fractional notation to maintain precision as long 
> as possible in racket.
>
> any ideas anyone or am I just being blind and its right there in the docs 
> somewhere?
>
> thanks,
> Scott
>

-- 
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] Re: printing decimals

2019-03-19 Thread Sanjeev Sharma
WHOPS ... SRFI/54 

On Friday, March 15, 2019 at 1:57:03 PM UTC-4, sdgu...@gmail.com wrote:
>
> Hi all,
>
> I've been looking through the docs for a way to print decimals to a 
> defined precision.
>
> I can get close to what I want using something like ~a and giving it a set 
> width without having to build a function to do so. I mean I can build a 
> function to do as its just a bit of string manip but it feels really odd 
> that there doesn't seem to be a built in way to do so even though we try to 
> keep all the decimals in fractional notation to maintain precision as long 
> as possible in racket.
>
> any ideas anyone or am I just being blind and its right there in the docs 
> somewhere?
>
> thanks,
> Scott
>

-- 
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] SQL DB tooling

2019-03-22 Thread Aidan Gauland
I see that Racket has a couple of nice libraries for talking to SQL
databases <https://docs.racket-lang.org/db/> and
<https://docs.racket-lang.org/sql/>, but I have been unable to find any
equivalent to the so-called "migrations" capability of DB libraries from
other languages (see
<http://sequel.jeremyevans.net/rdoc/files/doc/migration_rdoc.html> and
<https://hexdocs.pm/phoenix/ecto.html>  for examples).  Is there
anything like this for Racket, or even some language-agnostic, CLI tool
that does the same thing?

Thanks,
Aidan Gauland

-- 
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] Interning custom types?

2019-03-23 Thread jackhfirth
If I wanted to make my own interned data type, how hard would that be? I 
have a datatype representing an immutable sorted set of keywords and I want 
to guarantee that total memory use for these sets depends only on the 
number of unique combinations of keywords created by a program.

-- 
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] Emacs scribble-mode

2019-03-31 Thread Alex Harsanyi
I started writing Scribble documentation more often lately and Emacs has no 
good support for editing such documents.  For me the main feature that I 
would like is indentation, like it is done in other programming modes.   I 
found a `racket-mode` on GitHub, but it only supports some basic syntax 
highlighting and nothing else.

In any case, I started implementing a scribble mode with aims of supporting 
indentation, document navigation and some more advanced syntax 
highlighting.  At this point it supports indentation and some basic code 
navigation (beginning/end of defun), but I indent to improve it as I use it 
for Scribble editing (unless there is a better package that I don't know 
about?)

If you are also interested in Scribble support for Emacs, you can check out 
the source here:

https://github.com/alex-hhh/racket-mode/blob/master/scribble-mode.el

Best Regards,
Alex.


-- 
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] Emitting structured logs

2019-03-31 Thread Darren Newton
I'm currently working on an application that uses structured logs (JSON) 
instead of the traditional string formatted logs. 
I currently have a log message handler based on some work Greg Hendershott 
put together:

```
(define (handle-log-message receiver)
  (λ (out)
(match (sync receiver)
  [(vector event-level event-message event-value name)
   (displayln
(jsexpr->string
 (hasheq 'timestamp (date->string (current-date) #t)
 'level ((compose string-upcase symbol->string)
 event-level)
 'msg (regexp-replace #rx"(^[a-z]*): " event-message "")
 'name (symbol->string name)))
out)])))
```

When I setup a log-writer this works well with simple logs like

```
(log-app-info "START")
```

Which will emit a log entry such as:

```
{"msg":"START","level":"INFO","name":"log-name","timestamp":"2019-03-30T18:27:29"}
```

However, I would like to pass a jsexpr? to the logger, such as `(log-app-info 
(hasheq 'tags '("a" "b" "c")))`
to get a log entry such as:

```
{"msg": {"tags": ["a", "b", 
"c"]},"level":"INFO","name":"log-name","timestamp":"2019-03-30T18:27:29"}
```

This is pretty common when working with AWS and other log services and is 
something I do at work with a Python lib 
(https://www.structlog.org/en/stable/)

As far as I can tell, the log procs only accept strings. Would l need to 
convert my log message into a JSON string, then in the log handler 
convert it back into a jsexpr? and then back into a string? If that is the 
case is it possible to wrap the the `(log--)` procs
in a macro to automate this?

Thanks in advance for any tips

-- 
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] [ANN] Algebraic Racket

2019-03-31 Thread Eric Griffis
I am pleased to announce Algebraic Racket, an extension for algebraic
structures in untyped Racket.

https://github.com/dedbox/racket-algebraic

Algebraic structures provide the operational under-pinnings for algebraic
data types. What's missing is the static typing constraints.

The initial release provides a #lang algebraic/racket/base that extends
#lang racket/base with:

1. First class, lexically scoped, naturally ordered data constructors.

  > (data Maybe (Just Nothing))
  > (define maybe
  (function*
[(n _ Nothing) n]
[(_ f (Just x)) (f x)]))
  > (maybe #f values (Just 123))
  123
  > (maybe #f values Nothing)
  #f

2. A consistent destructuring syntax for functions and macros.

  > (define fib
  (function
[n #:if (< n 2) 1]
[n (+ (fib (- n 1))
  (fib (- n 2)))]))
  > (map fib (build-list 7 values))
  '(1 1 2 3 5 8 13)

  > (define-syntax m-fib
  (macro
[n:nat #:if (< (var n) 2) 1]
[n:nat (+ (m-fib #,(- (var n) 1))
  (m-fib #,(- (var n) 2)))]))
  > (list (m-fib 0) (m-fib 1) (m-fib 2)
  (m-fib 3) (m-fib 4) (m-fib 5) (m-fib 6))
  '(1 1 2 3 5 8 13)

The package is fully documented. The documentation includes the first of
three tutorials in a series on building interpreters with Algebraic
Racket.

Algebraic Racket is the first major milestone in a larger effort to
produce a complete language-oriented toolkit for integrating algebraic
structure into more sophisticated designs.

The project aims to:

  1. Implement and document the forms, functions, and syntax classes
 comprising Algebraic Racket for maximum potential reuse.

  2. Support the development of modular type systems and other
 language-facing components as libraries.

Pull requests of any size are welcome. For major changes, please start a
conversation on racket-users or open an issue to discuss what you would
like to change.

-- 
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] Stack trace

2019-05-02 Thread 'John Clements&#x27; via Racket Users
Well, I see two things going on here.

First, this example is an interesting one, because there’s no stack trace to 
display; the (/ 1 n) is the only “frame” left on the “stack”, because the call 
to sub2 has already returned, and the body of “reciprocal” is in tail position 
with respect to the call. If you add a “(+ 1 …)” around the reciprocal call, 
then there’s a stack to display…

…except that you still won’t see an arrow in BSL, because that’s a #lang racket 
thing. That is: if you change the language to “Use language defined in source”, 
and insert #lang racket at the beginning, and add a (+ 1 …) around the 
reciprocal, and run the program, you’ll see an arrow from the (/ 1 n) to the (+ 
1 …) context as I believe you expected.

I think the pedagogically correct answer here is that the arrows that you see 
in racket aren’t really the “right thing” for an educational setting. Instead, 
I think I might suggest using the stepper, instead. (Me? Biased?) In this case, 
I think I would jump to the end of the evaluation, and then step backward to 
see where the error came from.

I also think that there’s probably value in the “tree-cer” approach that 
Krishnamurthi et al. have been working on[*] for Pyret, which shows the 
evaluation of a term as a single large tree, allowing you to inspect each call 
and the arguments that were passed to each call.

John

[*] I thought of it independently, but they thought of it first, and actually 
implemented it. :)


> On May 2, 2019, at 4:02 PM, Mark Engelberg  wrote:
> 
> Working with a student in DrRacket for the first time in a while.
> 
> I notice that in BSL, an error in a function does not tell you what input to 
> the function caused the error, nor does it show the stack trace by drawing 
> arrows in the definitions window the way I remember.
> 
> When did this behavior change? Is there a way to turn on better error 
> reporting and stack traces?
> 
> Example:
> 
> (define (reciprocal n)
>   (/ 1 n))
> 
> (define (sub2 n)
>   (- n 2))
> 
> (define a (reciprocal (sub2 2)))
> 
> 
> 
> -- 
> 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] Stack trace

2019-05-03 Thread Mark Engelberg
If you open up the details of BSL and select to enable tracing, and run my
example, you do indeed see a stack trace in a panel on the right:
 (sub2 2)
 (reciprocal 0)

However, there are clearly some limitations to this tracing mechanism, when
my student tried to enable tracing on his big-bang program, running the
program caused the whole thing to blow up with the error:
syntax-original?: expects a syntax, given '...signature-syntax.rkt:58:42

Is this a bug in the tracing mechanism, or a known limitation?

The stepper works great for simple expressions to build understanding of
evaluation processes, but for a larger big-bang program, where the
underlying model has potentially been changed by multiple tick and handler
functions, it offers little assistance for determining what the model is at
the time of error, and how it got that way.

If tracing is not easily available in BSL, my ideal would be that every
error prints out not only the function/line where the error occurred, but
also the input(s) to the function which triggered the error.  (Example: a
function containing a cond, and every branch tests as false, so it reports
an error -- but it currently doesn't tell you what the input was which
caused all the cases to fall through).  Even without a full stacktrace,
that would be incredibly useful. It gives you something to reason about,
something to build a failing test case which you can then try to fix.
Any preferences or settings that can be tweaked to achieve something like
this? I showed my student how to build an else case with (error x) to print
the value of input x if all the cases fall through, but would prefer a more
automatic approach.

--Mark


On Thu, May 2, 2019 at 4:15 PM John Clements 
wrote:

> Well, I see two things going on here.
>
> First, this example is an interesting one, because there’s no stack trace
> to display; the (/ 1 n) is the only “frame” left on the “stack”, because
> the call to sub2 has already returned, and the body of “reciprocal” is in
> tail position with respect to the call. If you add a “(+ 1 …)” around the
> reciprocal call, then there’s a stack to display…
>
> …except that you still won’t see an arrow in BSL, because that’s a #lang
> racket thing. That is: if you change the language to “Use language defined
> in source”, and insert #lang racket at the beginning, and add a (+ 1 …)
> around the reciprocal, and run the program, you’ll see an arrow from the (/
> 1 n) to the (+ 1 …) context as I believe you expected.
>
> I think the pedagogically correct answer here is that the arrows that you
> see in racket aren’t really the “right thing” for an educational setting.
> Instead, I think I might suggest using the stepper, instead. (Me? Biased?)
> In this case, I think I would jump to the end of the evaluation, and then
> step backward to see where the error came from.
>
> I also think that there’s probably value in the “tree-cer” approach that
> Krishnamurthi et al. have been working on[*] for Pyret, which shows the
> evaluation of a term as a single large tree, allowing you to inspect each
> call and the arguments that were passed to each call.
>
> John
>
> [*] I thought of it independently, but they thought of it first, and
> actually implemented it. :)
>
>
> > On May 2, 2019, at 4:02 PM, Mark Engelberg 
> wrote:
> >
> > Working with a student in DrRacket for the first time in a while.
> >
> > I notice that in BSL, an error in a function does not tell you what
> input to the function caused the error, nor does it show the stack trace by
> drawing arrows in the definitions window the way I remember.
> >
> > When did this behavior change? Is there a way to turn on better error
> reporting and stack traces?
> >
> > Example:
> >
> > (define (reciprocal n)
> >   (/ 1 n))
> >
> > (define (sub2 n)
> >   (- n 2))
> >
> > (define a (reciprocal (sub2 2)))
> >
> >
> >
> > --
> > 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] Stack trace

2019-05-04 Thread Matthias Felleisen


> On May 3, 2019, at 4:17 AM, Mark Engelberg  wrote:
> 
> f tracing is not easily available in BSL, my ideal would be that every error 
> prints out not only the function/line where the error occurred, but also the 
> input(s) to the function which triggered the error.  (Example: a function 
> containing a cond, and every branch tests as false, so it reports an error -- 
> but it currently doesn't tell you what the input was which caused all the 
> cases to fall through).  Even without a full stacktrace, that would be 
> incredibly useful. It gives you something to reason about, something to build 
> a failing test case which you can then try to fix. Any preferences or 
> settings that can be tweaked to achieve something like this? I showed my 
> student how to build an else case with (error x) to print the value of input 
> x if all the cases fall through, but would prefer a more automatic approach.


Hi Mark, 

I think this is a good idea. and we should be able to implement this, but I am 
not sure yet that we can do it w/o abandoning PITCH (proper implementation of 
tail-calls, extra H). Perhaps function calls could store their inputs in the 
continuation marks that John’s stepper places on the stack and a re-defined 
error could retrieve them from there. 

Having these arguments, students could then formulate test cases and thus debug 
their functions. 

For now, I think adding the ‘else’ case with error is the best idea (of course, 
not doable if there’ no ‘else’). 

— Matthias

p.s. But please do teach your students the design recipe so that they have a 
test suite available no matter what. 

-- 
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] Stack trace

2019-05-06 Thread Sam Tobin-Hochstadt
If you record, say, the 100 most recent function calls and their
arguments, then you should be able to maintain proper space use as
well as provide as much information as needed.

Sam

On Sat, May 4, 2019 at 5:45 PM Matthias Felleisen
 wrote:
>
>
>
> On May 3, 2019, at 4:17 AM, Mark Engelberg  wrote:
>
> f tracing is not easily available in BSL, my ideal would be that every error 
> prints out not only the function/line where the error occurred, but also the 
> input(s) to the function which triggered the error.  (Example: a function 
> containing a cond, and every branch tests as false, so it reports an error -- 
> but it currently doesn't tell you what the input was which caused all the 
> cases to fall through).  Even without a full stacktrace, that would be 
> incredibly useful. It gives you something to reason about, something to build 
> a failing test case which you can then try to fix. Any preferences or 
> settings that can be tweaked to achieve something like this? I showed my 
> student how to build an else case with (error x) to print the value of input 
> x if all the cases fall through, but would prefer a more automatic approach.
>
>
>
> Hi Mark,
>
> I think this is a good idea. and we should be able to implement this, but I 
> am not sure yet that we can do it w/o abandoning PITCH (proper implementation 
> of tail-calls, extra H). Perhaps function calls could store their inputs in 
> the continuation marks that John’s stepper places on the stack and a 
> re-defined error could retrieve them from there.
>
> Having these arguments, students could then formulate test cases and thus 
> debug their functions.
>
> For now, I think adding the ‘else’ case with error is the best idea (of 
> course, not doable if there’ no ‘else’).
>
> — Matthias
>
> p.s. But please do teach your students the design recipe so that they have a 
> test suite available no matter what.
>
> --
> 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] bugs.racket-lang.org down?

2019-05-08 Thread Jordan Johnson
Hi all,

I’m unsuccessful in connecting to bugs.racket-lang.org, and 
downforeveryoneorjustme.com also reports it being down. Is the web server there 
not running for some reason?

Best,
Jordan

-- 
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/ED6E726A-3884-4E9E-8902-525B0EE8335E%40fellowhuman.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket v7.3

2019-05-16 Thread Laurent
Thank you all for the new release!

On Wed, May 15, 2019 at 7:05 PM 'John Clements' via Racket Users <
racket-users@googlegroups.com> wrote:

> - Racket's IO system has been refactored to improve performance
>  and simplify internal design.
>

Is it mild overall performance improvement, or are there cases where there
can be a big boost? (Like "previous bottlenecks have become highways" kind
of improvement)

-- 
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/CABNTSaEotkhQ_yK8n60fkFgkOmULX061eoj-LmDfhSBopA4h1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: [racket-users] Racket v7.3

2019-05-16 Thread Dexter Lagan
A huge thanks to everybody who worked on Racket. 

 

  IO improvements will surely make everybody’s life a little better in my team 
and the whole studio. We’re relying on large (200MB text files), and numerous 
(in the 100,000’s) file reads and writes daily. We’re converting shell scripts 
to Racket and I recon it’s hard to beat some GNU command’s optimizations. I 
have been tempted to try Rust but a) it’s not guaranteed to perform better for 
pure IO, and b) I’d rather code it directly in macro-asm if it meant better 
speed. But so far, Racket’s performance has been more than adequate for our 
tasks, and thanks to this I can do it all in Racket. That puts a big, gleeful 
smile on my face.

 

From: racket-users@googlegroups.com  On Behalf 
Of Laurent
Sent: 16 May, 2019 3:28 PM
To: John Clements 
Cc: Racket Users 
Subject: Re: [racket-users] Racket v7.3.

 

Thank you all for the new release!

 

On Wed, May 15, 2019 at 7:05 PM 'John Clements' via Racket Users 
mailto:racket-users@googlegroups.com> > wrote:

- Racket's IO system has been refactored to improve performance
 and simplify internal design.

 

Is it mild overall performance improvement, or are there cases where there can 
be a big boost? (Like "previous bottlenecks have become highways" kind of 
improvement)

 

 

-- 
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 
<mailto:racket-users+unsubscr...@googlegroups.com> .
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABNTSaEotkhQ_yK8n60fkFgkOmULX061eoj-LmDfhSBopA4h1Q%40mail.gmail.com
 
<https://groups.google.com/d/msgid/racket-users/CABNTSaEotkhQ_yK8n60fkFgkOmULX061eoj-LmDfhSBopA4h1Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
 .
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/011301d50c07%244f52f9c0%24edf8ed40%24%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket v7.3

2019-05-16 Thread Piyush Katariya
I am also keen to know the IO perf optimization results in real world.

Dexter, if possible can you give us some approximate throughput or latency 
numbers when you switch to v7.3 

-- 
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/a2edb6b8-e792-42be-bfc9-63e78ef38e95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket v7.3

2019-05-16 Thread Dexter Lagan
  I’ll compare file write times as soon as we’re done testing the tool I’m 
working on.

Cheers

Dex

> On May 16, 2019, at 10:03 PM, Piyush Katariya  
> wrote:
> 
> I am also keen to know the IO perf optimization results in real world.
> 
> Dexter, if possible can you give us some approximate throughput or latency 
> numbers when you switch to v7.3 
> -- 
> 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/a2edb6b8-e792-42be-bfc9-63e78ef38e95%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/3D57811B-57E4-48CB-AAF9-1A307F70E888%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket v7.3

2019-05-16 Thread Matthew Flatt
At Thu, 16 May 2019 15:28:10 +0100, Laurent wrote:
> On Wed, May 15, 2019 at 7:05 PM 'John Clements' via Racket Users <
> racket-users@googlegroups.com> wrote:
> > - Racket's IO system has been refactored to improve performance
> >  and simplify internal design.
> >
> 
> Is it mild overall performance improvement, or are there cases where there
> can be a big boost? (Like "previous bottlenecks have become highways" kind
> of improvement)

Number parsing in `read` or `string->number` should be faster, but the
main I/O refactoring and improvements were specific to Racket-on-Chez.

In the long run, this new I/O implementation might replace the current
one in the traditional Racket implementation, but I don't know how much
of a performance different it would be.

(I recommended dropping this bullet from the announcement, since the
main changes were mainly for Racket-on-Chez. But I guess that
recommendation was too buried or got lost.)

-- 
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/5cde00d0.1c69fb81.5743b.16ffSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] exact 3j-symbols

2019-05-18 Thread Jos Koot
To whom is interested,

I have initiated a new repository:
https://github.com/joskoot/3j-symbol.
It contains a procedure for the exact computation of the signs
and the squares of 3j-symbols using the Racah formula.
Documentation is included as a scribble/manual module.
To do: add more tests.
Comments are welcome, of course.
May be a candidate for math/number-theory?

Jos

-- 
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/5ce01819.1c69fb81.99909.8a86%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


<    5   6   7   8   9   10   11   12   13   14   >