Re: [racket-users] Re: hashcons

2020-09-14 Thread Hendrik Boom
On Mon, Sep 14, 2020 at 01:11:34AM -0700, Tony Garnock-Jones wrote:
> On Sunday, September 13, 2020 at 12:41:15 AM UTC+2 hen...@topoi.pooq.com 
> wrote:
> 
> > True, but that would require rewriting list, and quasiquote, ans 
> > others like that to use the hashcons. 
> >
> > Not impossible. 
> >
> 
> One potentially useful trick is to write a function `canonicalize` which 
> deeply traverses the structure of its argument, rebuilding it if necessary 
> to produce the canonical representative for each piece of substructure. 
> Then you can `(canonicalize (map f xs))` without having to rewrite `map`, 
> and it takes (asymptotically) the same time as it would if you did alter 
> `map`.
> 
> Another thing to watch out for is that hashconsing via `equal?` can be 
> quite expensive for things like hash tables. I used hashconsing extensively 
> in the first implementation of Syndicate and ended up having to implement 
> my own treaps to get good asymptotic performance with a hashconsed 
> dictionary structure.

I would, ideally, only use hashcons on those cons-cells which had themselves 
been hashconsed, so eq? would suffice.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200914121810.vsbo56odmxf7r4f6%40topoi.pooq.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Hendrik Boom
On Sun, Sep 13, 2020 at 07:50:01AM -0400, Shriram Krishnamurthi wrote:
> It's useful to have this behave like a `#include`. There are settings where
> you want to have a non-Scribble person author things that go "in the
> middle"; you want to think of this as just a more convenient way of writing
> what you'd have written in Scribble.
> 
> I realize there's presumably a closure issue (`section` isn't going to come
> from the including file), and for that you probably want a different
> include form as well.

The main thing I need markdown for is to include nested small bullet points, 
in an explorative mind-mapping style.

The Scribble syntax is too wordy to be convenient.

Just as @paragraph{  } would be inconvenient to mark all the paragraphs in 
ordinary text.

-- 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAJUf2yRcPq3-Gvxy3F95PJhBmiebquEvU3Sz6-y%3D98LFb_Wnvw%40mail.gmail.com.

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


Re: [racket-users] Re: hashcons

2020-09-12 Thread Hendrik Boom
On Sat, Sep 12, 2020 at 01:23:24PM -0700, jackh...@gmail.com wrote:
> Not automatically, but you can make your own wrapper function around cons 
> that interns them using a weak hash table and then you can use that wrapper 
> function everywhere.

True, but that would require rewriting list, and quasiquote, ans 
others like that to use the hashcons.

Not impossible.

-- hendrik

> 
> On Thursday, September 10, 2020 at 7:34:37 PM UTC-7 hen...@topoi.pooq.com 
> wrote:
> 
> > Is there a way to run Racket so that every immuable cons is made with 
> > a hashcons operation; i.e. it makes a new cons scel only if there 
> > isn't already one in memory somewhere with the same car and cdr 
> > values?
> >
> > -- 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/7ed721c9-4ed2-47eb-b8bb-a30a1ed9125fn%40googlegroups.com.

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


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-12 Thread Hendrik Boom
On Sat, Sep 12, 2020 at 06:14:53AM -0700, Shriram Krishnamurthi wrote:
> I need a little help with `decode` vs `decode-flow` in Scribble. (Also, 
> this thread is about a question I wasn't able to find answered anywhere, so 
> hopefully it will lead to a solution that others can also use.)
> 
> Sometimes it's really useful to incorporate Markdown-formatted content into 
> the middle of a Scribble document. (Let's not argue about this, please!) My 
> assumption is that the Markdown document lives in a separate file (I'm not 
> trying to do any clever textual inlining). Thanks to Greg Hendershott, I'm 
> almost there! I use
> 
> https://github.com/greghendershott/markdown
> 
> Here are two versions of the inlining function:
> 
> @(require markdown markdown/scrib scribble/decode)
> 
> @(define (markdown-inline file)
>(decode-flow
>(xexprs->scribble-pres
>  (with-input-from-file file read-markdown
> 
> @(define (markdown-part file)
>(decode
>(xexprs->scribble-pres
>  (with-input-from-file file read-markdown
> 
> As a practical matter, `markdown-part` needs to take lots of extra 
> arguments to create the appropriate part instead of just producing a 
> title-less section. More importantly, you often don't want a separate 
> section: you just want to "splice" the content into the current context.
> 
> `markdown-inline` works great for this purpose, *except* if the included 
> Markdown file contains any sections of its own, e.g.,
> 
> This is text.
> 
> > Lorem ipsum
> 
> # Section
> 
> ## Subsection
> 
> Then I get this error:
> 
> decode-flow: contract violation
> 
>   expected: pre-flow?
> 
>   given: (part-start 0 #f '((part "section")) (style #f '()) '("Section"))
> Any recommendations on how to create a "splicing" version that also 
> respects having sub-sections, or is that impossible? (I've tried pulling 
> out parts of the `part`, etc., but without success.)
> 
> Thanks!
> 
> Shriram
> 
> -- 
> 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/3f0b1012-783d-464a-a0ed-66d3f29f8893n%40googlegroups.com.

This looks very useful.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200912163734.pdin66tp3zzmxa2f%40topoi.pooq.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-11 Thread Hendrik Boom
On Thu, Sep 10, 2020 at 10:27:39AM -0400, George Neuner wrote:
> 
> 
> On 9/10/2020 10:06 AM, Philip McGrath wrote:
> > Also, this is happening over encrypted HTTPS: no one is sniffing the
> > User-Agent header.
> 
> While it may not be the issue here, you need to understand that appliance
> firewalls CAN and routinely DO examine data inside encrypted connections.

Using man-in-the-middle attacks?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/2020093319.dvxfeugmhuyqkx7i%40topoi.pooq.com.


[racket-users] hashcons

2020-09-10 Thread Hendrik Boom
Is there a way to run Racket so that every immuable cons is made with 
a hashcons operation; i.e. it makes a new cons scel only if there 
isn't already one in memory somewhere with the same car and cdr 
values?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200911023429.7ux4r567yrqh7q2l%40topoi.pooq.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-10 Thread Hendrik Boom
On Thu, Sep 10, 2020 at 12:49:25AM -0400, George Neuner wrote:
> 
> I don't know if DrRacket even sends a "user agent" string.

If DrRacket can send a user agent string, so can malware.

So it's not really reliable to filter on the user agent string.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200910113752.ej65fc6clr245yan%40topoi.pooq.com.


Re: [racket-users] Create C functions for embedded Racket CS

2020-09-02 Thread Hendrik Boom
On Wed, Sep 02, 2020 at 02:05:11PM -0700, dotoscat wrote:
> There are a function such scheme_make_prim_w_arity 
> 
> for the CS version? 

> The idea is to use Racket
> as a scripting language for a C program.

That's what guile was designed for.
How does Racket measure up as a scripting language for C?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200902213805.44xhu4mncp7s4wyi%40topoi.pooq.com.


Re: [racket-users] abstraction suggestion?

2020-08-31 Thread Hendrik Boom
On Mon, Aug 31, 2020 at 10:06:42AM -0700, Shriram Krishnamurthi wrote:
> I'm having some trouble abstracting over this code. Any suggestions?
> 
> I have numerous files that follow this boilerplate:
> 
> #lang racket
> 
> (require )
> 
> (provide (rename-out [mod-begin #%module-begin]
>  [ti#%top-interaction]))
> 
> (define-values (namespaces lang-print-names)
>   )
> 
> (define-syntax (multi-runner stx)
>   (syntax-case stx (TEST)
> [(_ (TEST e r ...))
>  #`(test-output 'e (list 'r ...) namespaces)]
> [(_ e)
>  #`(show-output 'e namespaces lang-print-names)]))
> 
> (define-syntax mod-begin
>   (λ (stx)
> (syntax-case stx ()
>   [(_ b ...)
>#'(#%printing-module-begin (multi-runner b) ...)])))
> 
> (define-syntax ti
>   (λ (stx)
> (syntax-case stx ()
>   ([_ . e]
>#'(#%top-interaction . (multi-runner e))
> 
> I've abstract most of the details into `test-output` and `show-output` into 
> . I would ideally like to move as much of what's left as 
> possible into the same file. 
> 
> The key problem is that the MB and TI depend on `multi-runner`, which in 
> turn depends on `namespaces`, which is a name at run time. As long as 
> everything is in the same module, no problem. But when I start to move the 
> boilerplate out…
> 
> Concrete suggestions welcome — I've tried several different things (various 
> forms of abstraction, syntax parameters, etc.) without luck.

Maybe a macro or two?  Perhaps a nonhygienic one?

-- hendrik

> 
> Thanks,
> Shriram
> 
> -- 
> 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/362f807e-3561-4be6-8b4d-937776fea36bn%40googlegroups.com.

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


Re: [racket-users] Proper place to store log file

2020-08-25 Thread Hendrik Boom
On Mon, Aug 24, 2020 at 11:02:35AM -0700, Thomas Del Vecchio wrote:
> Hi everyone!
> 
> I'm currently working on some usage logging for a language we're 
> developing. We need to store a persistent file that is shared across a 
> given device (so that the same log file is used regardless of where you are 
> working). Is there a best place to put this file? I'm looking at 
> find-system-path 
> ,
>  
> but am not sure from the documentation if one of these is best for this 
> purpose.

If the log file is to be system-wide, linux has the directory /var/log

-- hendrik
> 
> One option I'm considering is in `(collection-file-path (build-path 
> "logging" "user-logs.log") "")`, which is just 
> "///logging/user-logs.log", but I'm unsure whether 
> it's safe to store user data there (especially if we are expecting to have 
> package updates).
> 
> Thanks so much!
> Thomas
> 
> -- 
> 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/bd7203d0-db4c-4e56-a19f-fb4cb58c8625n%40googlegroups.com.

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


Re: [racket-users] Re: Application Templates!

2020-08-20 Thread Hendrik Boom
On Wed, Aug 19, 2020 at 09:33:01PM -0700, Alex Harsanyi wrote:
...
...
> I think Racket would benefit by a suite of applications which are small but 
> not trivial and with a source code which is commented in more detail than a 
> regular application.

Every regular application would also benefit from being commented in 
this much detail.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200820131137.z3mazyfs6l23ozdf%40topoi.pooq.com.


Re: [racket-users] Strange behaviour on re-executing an sgl program

2020-08-16 Thread Hendrik Boom
I've done more experimenting.


It now looks as if some resource is leaking away that
  * is not recovered when one run is cancelled, drracket closes the window, and 
another run is started, but
  * is recovered when I close the window before starting another run.


Experimental results:

If I run my more complicated program (I'll call it streets) it fails the second 
time I run it.
If I run sgl-hello-world.rkt (which I'll call 'hello' for short) after streets 
has failed, it fails immediately by producing the large white square.
If I run streets once, and repeatedly run sgl-hello-world.rkt after it, it 
fails after only about 11 runs, producing the large white square.

When starting straightway with hello, and running it repeatedly, oce the large 
white square arrives, it is no longer possible to dismiss the small window by 
clicking on its 'x' cose button in the window frame.  But doing another 'run' 
still does clese the window, and, of coures, creates another with the large 
white square.  And closing drracket still closes all the windows (except, of 
course, the uxterm from which I started drracket)

If I run streets and manually close its graphics window ny clicking on the 'x' 
in the window frame before I click 'run' again, it works properly, repeatedly 
(I tried 7 times).  But if after that I fail to close the window, it fails when 
I press 'run'.

Likewise, if I run hello repeatedly, closing its graphics window explicitly 
each time, it survives at least a hundred reruns.


-- hendrik

On Sun, Aug 16, 2020 at 09:32:19AM -0400, Hendrik Boom wrote:
> I hauled the sgl-hello-world program (attached below) into drrracket, version 
> 7.6, english by PLT.
> 
> I click on 'run'I click on 'run'.
> It creates a small window containing a small white square.
> 
> I click on 'run' again.
> It deetes that window, and creates another small window
> containing a small white square.
> 
> 
> I click on 'run' again. 
> It deetes that window, and creates another small window
> containing a small white square.
> 
> I click on 'run' again. 
> It deetes that window, and creates another small window
> containing a small white square.
> 
> etc.
> 
> After about 35 runs, the new small window instead contains a large white 
> square filling the entire window.
> 
> Evidently, something happens after multiple runs.  Perhaps spme resource 
> is exhausted  Perhaps it's random and might happen after a hundred runs 
> another time?  I don't know.  But I'm having similarly erratic behaviour 
> in a far more complicated program, and this is the simplest version of 
> erraticity I've found so far.
> 
> This code was found on the Racket users mailing list archives.
> 
> -- hendrik
> 
> --
> #lang racket/gui
> 
> ; This code from 
> https://groups.google.com/forum/#!topic/racket-users/-84bgybC3C0
> ; -- hendrik
> 
> (require (lib "gl.ss" "sgl")
>  (lib "gl-vectors.ss" "sgl")
> )
>  
>  
> (define (resize w h)
>   (glViewport 0 0 w h)
>   #t
> )
>  
> (define (draw-opengl)
>   (glClearColor 0.0 0.0 0.0 0.0)
>   (glClear GL_COLOR_BUFFER_BIT)
>   (glColor3d 1.0 1.0 1.0)
>   
>   (glMatrixMode GL_PROJECTION)
>   (glLoadIdentity)
>   (glOrtho 0.0 1.0 0.0 1.0 -1.0 1.0)
>   (glMatrixMode GL_MODELVIEW)
>   (glLoadIdentity)
>  
>   (glBegin GL_QUADS)
>   (glVertex3d 0.25 0.25 0.0)
>   (glVertex3d 0.75 0.25 0.0)
>   (glVertex3d 0.75 0.75 0.0)
>   (glVertex3d 0.25 0.75 0.0)
>   (glEnd)
> )
>  
>  
> (define my-canvas%
>   (class* canvas% ()
> (inherit with-gl-context swap-gl-buffers)
> 
>(define/override (on-paint)
>   (with-gl-context
> (lambda ()
>   (draw-opengl)
>   (swap-gl-buffers)
> )
>   )
> )
> 
> (define/override (on-size width height)
>   (with-gl-context
> (lambda ()
>   (resize width height)
> )
>   )
> )
> 
> (super-instantiate () (style '(gl)))
>   )
> ) 
>  
> (define win (new frame% (label "OpenGl Test") (min-width 200) 
> (min-height 200)))
> (define gl  (new my-canvas% (parent win)))
>  
> (send win show #t)
>  
> 
> 
> ; It should be pretty easy to tweak it.
> 
> ; Hope this helps,
> ; Laurent
> 
> 
> ; - show quoted text -
> 
> ; - show quoted text -
> ; _
> ;  For list-related administrative tasks:
> ;  http://lists.racket-lang.org/listinfo/users
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving ema

[racket-users] Strange behaviour on re-executing an sgl program

2020-08-16 Thread Hendrik Boom
I hauled the sgl-hello-world program (attached below) into drrracket, version 
7.6, english by PLT.

I click on 'run'I click on 'run'.
It creates a small window containing a small white square.

I click on 'run' again.
It deetes that window, and creates another small window
containing a small white square.


I click on 'run' again. 
It deetes that window, and creates another small window
containing a small white square.

I click on 'run' again. 
It deetes that window, and creates another small window
containing a small white square.

etc.

After about 35 runs, the new small window instead contains a large white 
square filling the entire window.

Evidently, something happens after multiple runs.  Perhaps spme resource 
is exhausted  Perhaps it's random and might happen after a hundred runs 
another time?  I don't know.  But I'm having similarly erratic behaviour 
in a far more complicated program, and this is the simplest version of 
erraticity I've found so far.

This code was found on the Racket users mailing list archives.

-- hendrik

--
#lang racket/gui

; This code from 
https://groups.google.com/forum/#!topic/racket-users/-84bgybC3C0
; -- hendrik

(require (lib "gl.ss" "sgl")
 (lib "gl-vectors.ss" "sgl")
)
 
 
(define (resize w h)
  (glViewport 0 0 w h)
  #t
)
 
(define (draw-opengl)
  (glClearColor 0.0 0.0 0.0 0.0)
  (glClear GL_COLOR_BUFFER_BIT)
  (glColor3d 1.0 1.0 1.0)
  
  (glMatrixMode GL_PROJECTION)
  (glLoadIdentity)
  (glOrtho 0.0 1.0 0.0 1.0 -1.0 1.0)
  (glMatrixMode GL_MODELVIEW)
  (glLoadIdentity)
 
  (glBegin GL_QUADS)
  (glVertex3d 0.25 0.25 0.0)
  (glVertex3d 0.75 0.25 0.0)
  (glVertex3d 0.75 0.75 0.0)
  (glVertex3d 0.25 0.75 0.0)
  (glEnd)
)
 
 
(define my-canvas%
  (class* canvas% ()
(inherit with-gl-context swap-gl-buffers)

   (define/override (on-paint)
  (with-gl-context
(lambda ()
  (draw-opengl)
  (swap-gl-buffers)
)
  )
)

(define/override (on-size width height)
  (with-gl-context
(lambda ()
  (resize width height)
)
  )
)

(super-instantiate () (style '(gl)))
  )
) 
 
(define win (new frame% (label "OpenGl Test") (min-width 200) 
(min-height 200)))
(define gl  (new my-canvas% (parent win)))
 
(send win show #t)
 


; It should be pretty easy to tweak it.

; Hope this helps,
; Laurent


; - show quoted text -

; - show quoted text -
; _
;  For list-related administrative tasks:
;  http://lists.racket-lang.org/listinfo/users


-- 
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/20200816133219.ln7ameblw7pvpnxo%40topoi.pooq.com.


Re: [racket-users] slideshow -> google slides?

2020-08-07 Thread Hendrik Boom
On Thu, Aug 06, 2020 at 06:58:28PM -0400, 'John Clements' via Racket Users 
wrote:
> Has anyone here developed a reasonable workflow for exporting slideshow 
> presentations to google slides? It appears that google slides cannot import 
> PDFs or SVGs. It looks like it has support for importing PPT files, 
> unsurprisingly, but AFAIK slideshow won’t export ppt files. I have no idea 
> how nasty the PPT format is.
> 
> Right now I’m looking into PDFelement, a mac program, but I’d love to hear 
> about other options. 

As well as the Open- and Libre-Office I mentioned before, you might try Krita.  
It's 
a artist-grade draw and paint program, and it has a surprising number of tools. 
 
I've heard that it can do vector graphics, but I've never actually tried that, 
so I 
just don't know.

Let us know what turns out to work.  I'm curious.  I've had pdf files that work 
in 
some but not other pdf viewers and even crash my printer, and anything that can 
clean them up would be walcome.  Sometimes just viewing and saving in one is 
enough 
to make it work in others.

-- hendrik

> 
> Thanks!
> 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/7a2b8538-91f9-45e2-9006-5e8047d39973%40mtasv.net.

-- 
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/20200807171246.634xi27lsixjojbe%40topoi.pooq.com.


Re: [racket-users] slideshow -> google slides?

2020-08-07 Thread Hendrik Boom
On Fri, Aug 07, 2020 at 09:58:15AM -0400, David Storrs wrote:
> On Thu, Aug 6, 2020, 10:34 PM Hendrik Boom  wrote:
> 
> > On Thu, Aug 06, 2020 at 06:58:28PM -0400, 'John Clements' via Racket Users
> > wrote:
> > > Has anyone here developed a reasonable workflow for exporting slideshow
> > presentations to google slides? It appears that google slides cannot import
> > PDFs or SVGs. It looks like it has support for importing PPT files,
> > unsurprisingly, but AFAIK slideshow won’t export ppt files. I have no idea
> > how nasty the PPT format is.
> > >
> > > Right now I’m looking into PDFelement, a mac program, but I’d love to
> > hear about other options.
> >
> > Have you tried libreoffice or openoffice?  (They're not the same, so one
> > might work
> > if the other doesn't.)  My wife used to make presentations from one of
> > them a few
> > years ago, and as far as I know, they were powerpoint compatible.
> > Unfortunately
> > she's not around to ask any more.
> >
> > -- hendrik
> >
> 
> I'm very sorry for your loss, Hendrik. My father died in 2019 and it's been
> agonizing, but I didn't live with him on a daily basis. I don't know how
> long it's been for you but I hope you're all right.

It's been just over a year.

I left her laptop on, just in case.

And yes it has stayed on for over a year.

It's a Mac.  And I can't figure out how to use it -- still logged in as her, 
but if 
I try to read the Mac beginners' quide all it does is ask for a password.  I 
can 
get to the Unix shell and use that, but I still have to keep dismissing the 
password 
request.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200807164557.rwyqr4lyvsrflnft%40topoi.pooq.com.


Re: [racket-users] slideshow -> google slides?

2020-08-06 Thread Hendrik Boom
On Thu, Aug 06, 2020 at 06:58:28PM -0400, 'John Clements' via Racket Users 
wrote:
> Has anyone here developed a reasonable workflow for exporting slideshow 
> presentations to google slides? It appears that google slides cannot import 
> PDFs or SVGs. It looks like it has support for importing PPT files, 
> unsurprisingly, but AFAIK slideshow won’t export ppt files. I have no idea 
> how nasty the PPT format is.
> 
> Right now I’m looking into PDFelement, a mac program, but I’d love to hear 
> about other options. 

Have you tried libreoffice or openoffice?  (They're not the same, so one might 
work 
if the other doesn't.)  My wife used to make presentations from one of them a 
few 
years ago, and as far as I know, they were powerpoint compatible.  
Unfortunately 
she's not around to ask any more.

-- hendrik

> 
> Thanks!
> 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/7a2b8538-91f9-45e2-9006-5e8047d39973%40mtasv.net.

-- 
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/20200807023356.ljyhfbzlvdtfbhxl%40topoi.pooq.com.


Re: [racket-users] Advice wanted about new opengl binding

2020-08-03 Thread Hendrik Boom
On Mon, Aug 03, 2020 at 02:01:16PM -0400, Philip McGrath wrote:
> Is this what you're looking for? https://pkgs.racket-lang.org/package/sgl
> 
> -Philip

Yes, looks like it.  Is it messing from the index for some good reason?

I'm not sure how the packaging works.

I end up at https://github.com/racket/sgl/tree/master
where I find multiple files, including main.rkt, sgl.rlt, and gl.rkt.
Am I correct that main.rkt is what I get with (require sgl)
and that gl.rkt is what I get with (require sgl/gl)?

-- hendrik

> 
> 
> On Sun, Aug 2, 2020 at 5:51 PM Hendrik Boom  wrote:
> 
> > Time to rethink everything before I go further.
> >
> > So far I've found several opengl bindings.
> > There's opengl, documented here:
> >https://docs.racket-lang.org/opengl/index.html
> > There are sgl and sgl/gl, documented here:
> >https://docs.racket-lang.org/sgl/index.html
> > and there's a typed opengl hidden with in pict3.
> >
> > But I cannot find sgl and sgl/gl in the index of packages
> > at https://pkgs.racket-lang.org/
> >
> > Shouldn't they be there?
> > Are they there in disguise?
> > Abd where should I look for current source code?
> > The index is pretty good at identifying source code for other packages.
> >
> > -- 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.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/20200802215123.iiqik4wpfusarcw4%40topoi.pooq.com
> > .
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAH3z3gYmn4_5sTUNWuZDcpjL5shJmU2quTtgx72%3DoycOXccp5A%40mail.gmail.com.

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


Re: [racket-users] ask the type of a value (partial solution)

2020-08-03 Thread Hendrik Boom
On Mon, Aug 03, 2020 at 05:06:51PM +0100, Laurent wrote:
> and yet:
> 
> > (for-each
>(λ (x) (printf "~a: ~a\n" (~v x #:min-width 28) (struct->vector x)))
>`(hello "hello" 43110 #f #(h e l l o) #"hello" (h e l l o)
>,(new frame% [label ""])))
> 
> hello   : #(struct:symbol ...)
> "hello" : #(struct:string ...)
> 43110   : #(struct:fixnum-integer ...)
> #f  : #(struct:false ...)
> #(h e l l o): #(struct:vector ...)
> #"hello": #(struct:byte-string ...)
> (h e l l o) : #(struct:pair ...)
> #(struct:object:frame% ...) : #(struct:object:frame% ...)
> 
> ;)

Thank you.

That itself is already useful.
struct->vector combined with printf handles my immediate application.
It told me #(struct:object:image-snip% ...)
As I've been warned, it doesn't tell me much, but the result is a 
useful clue for further investigation.

It turns out to react positively to image?

Still, it would be nice to find out how to get this information more 
directly instead of relying on functions that do much more than 
what I was asking for.

-- hendrik

> 
> 
> On Mon, Aug 3, 2020 at 4:20 PM Alexis King  wrote:
> 
> > In general, the answer is “no,” mostly because it’s not clear in Racket
> > what “the type of a value” means. It’s difficult to come up with a
> > definition that would be useful enough to satisfy your criterion of not
> > “having to guess it first.” Consider: suppose you had a hypothetical
> > `type-of` operation that returned a value’s type:
> >
> > (type-of 'hello) ; => 'symbol
> > (type-of "hello") ; => 'string
> >
> > Now suppose you apply type-of to a value you know nothing about and get
> > back 'widget. Well, you don’t know what a widget is, so that didn’t
> > actually get you any further from where you started: you still don’t know
> > what to do with the value.
> >
> > Furthermore, types are not actually disjoint. You can write a struct
> > definition with properties like prop:procedure and prop:evt, and if a
> > struct has both, should type-of return the struct’s name, 'procedure, or
> > 'evt? It’s not really clear. You might be able to come up with some more
> > sophisticated system with (potentially multiple) inheritance that could
> > capture these relationships, but I can say with confidence that no such
> > system currently exists in Racket.
> >
> > Alexis
> >
> > > On Aug 3, 2020, at 09:19, Hendrik Boom  wrote:
> > >
> > > In plain, untyped Racket:
> > >
> > > It is possible to ask if a value is a symbol with symbol?
> > > It is possible to ask if a value is a string with string?
> > > etc.
> > >
> > > Is there a way to ask the type of a value without having to guess it
> > first?
> > >
> > > -- 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.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/C561F2A9-0C78-4EDA-A401-4FB067D79849%40gmail.com
> > .
> >

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


[racket-users] ask the type of a value

2020-08-03 Thread Hendrik Boom
In plain, untyped Racket:

It is possible to ask if a value is a symbol with symbol?
It is possible to ask if a value is a string with string?
etc.

Is there a way to ask the type of a value without having to guess it first?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200803141931.t4v4nc2e5d4afx6f%40topoi.pooq.com.


Re: [racket-users] pictures in code?

2020-08-03 Thread Hendrik Boom
On Sun, Aug 02, 2020 at 08:58:54PM -0700, Sorawee Porncharoenwase wrote:
> For DrRacket, it's possible via "Insert > Insert Image". It's been used in
> HtDP. See https://htdp.org/2020-8-1/Book/part_prologue.html

Yes!  That's where I saw this many years ago.

Now that's presumably something that works nicely in the DrRacket editor.
When DrRacket saves it into a file, it presumably uses some notation that
won't look like a picture in, say, emacs.
But will it still be recognised as an image if I use Racket to run that file?
Can the image be used as a symbol or a constant or is it some other type 
of object?

-- hendrik

> 
> On Sun, Aug 2, 2020 at 7:07 PM Hendrik Boom  wrote:
> 
> > Is there any way to include pictures in Racket code?
> > Perhaps as constants or as prts of identifiers?
> > The idea is that when editing the program in the Racket editor,
> > the pictures are visible as part of the code,
> > making the code itself more visually self-evident,
> > not as file names to be read from elsewhere.
> >
> > -- 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.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/20200803020710.d2rvz6gojluubt5t%40topoi.pooq.com
> > .
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CADcuegvJCAHQYwO-eCcqKfqwhrd%2BGr4PELie_e0%3DO9b2PJ_QAA%40mail.gmail.com.

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


[racket-users] pictures in code?

2020-08-02 Thread Hendrik Boom
Is there any way to include pictures in Racket code?
Perhaps as constants or as prts of identifiers?
The idea is that when editing the program in the Racket editor,
the pictures are visible as part of the code,
making the code itself more visually self-evident,
not as file names to be read from elsewhere.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200803020710.d2rvz6gojluubt5t%40topoi.pooq.com.


Re: [racket-users] Advice wanted about new opengl binding

2020-08-02 Thread Hendrik Boom
Time to rethink everything before I go further.

So far I've found several opengl bindings.
There's opengl, documented here:
   https://docs.racket-lang.org/opengl/index.html
There are sgl and sgl/gl, documented here:
   https://docs.racket-lang.org/sgl/index.html
and there's a typed opengl hidden with in pict3.

But I cannot find sgl and sgl/gl in the index of packages
at https://pkgs.racket-lang.org/

Shouldn't they be there?
Are they there in disguise?
Abd where should I look for current source code?
The index is pretty good at identifying source code for other packages.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200802215123.iiqik4wpfusarcw4%40topoi.pooq.com.


Re: [racket-users] Advice wanted about new opengl binding

2020-08-01 Thread Hendrik Boom
On Sat, Aug 01, 2020 at 11:48:06AM -0600, Matthew Flatt wrote:
> At Fri, 31 Jul 2020 17:05:27 -0400, Hendrik Boom wrote:
> > For example, there's glGetCompressedTexImageARB.  It receivees a 
> > pointer to an image area and fills it in with a compressed image.
> > According the the Racket C interface, the way to write this 
> > would be:
> > 
> > (define-gl glGetCompressedTexImageARB 2 
> >   ( (target : _int32)
> > (level : _int32) 
> > (img : _pointer/intptr)
> >   -> _void -> img)
> >  (->> exact-integer? exact-integer? gl-pointer?)
> >  check-gl-error)
> 
> If I understand correctly that `target` and `level` provide enough
> information to specify how big `img` should be, then I agree that
> something analogous to
> 
>(_fun
>  (target : _int32)
>  (level : _int32) 
>  (img : _pointer/intptr = (malloc (COMPSIZE target level)))
> -> _void
> -> img)
> 
> is a fine way to wrap the function.
> 
> But when I work at the level of C APIs, I usually prefer this kind of
> interface:
> 
> > But the old binding instead used
> >  ( (target : _int32)
> >(level : _int32)
> >(img : _pointer/intptr)
> >   -> _void)
> > 
> > In other words, it ignored the fact that img is used as an output 
> > parameter.
> 
> Although, when I use this kind of binding, I have to know which
> pointers must already be filled with information when I pass it to the
> function versus which ones will be filled by the function, exposing the
> pointer to to-be-filled memory gives me control over the way that the
> memory. It also avoids having to specify anything about the
> deallocation rules of the result of a binding (e.g., whether it needs
> to be explicitly freed).

This makes it all feel like what the C documentation says about the function.
and you have to use it like C.  And it helps a lot if you can know 
whether the C code retains pointers to the storage area you passed it.
(Which I believe OpenGL does not, being organised entirely for passing 
data to a different processor.  But there could be problems if it the 
data transfer were implemented using DMA asynchronously)

> 
> Still, I can also see the advantage of building allocation into the
> wrapper to make clear that the argument corresponds to to-be-filled
> memory.

Yes.  It's clear.  But if usage is to allocate partucular storage areas 
and use them repeatedly for getting data back from OpenGL, then this 
iplementation is preferred.

> 
> Perhaps it depends on the overall shape of the API. If the API is going
> to be wrapped further to make it more Rackety, then I'd go for less
> wrapping at the immediate FFI bindings. If the API looks fairly Rackety
> with a few tweaks to arguments and results, then I'd favor more
> wrapping in the bindings. I think the old GL binding was in the former
> camp: it first exposed GL functions in as raw as possible form, and
> then wrapped those with a higher-level library.

So for compatibility I should preserve the C-style calls.
Now it gets difficult.  Some functions in the old bindings use what 
seems to be the C-style conventions, and others the Racket-level 
conventions with the two '->' arrows.

I have yet to figure out the conventions it uses.

I do know that the old specfiles from which the Racket binding was 
machine-generated had an explicit keyword identifying output parameters.

The new ones in xml do not.

I'm going to have to investigate firther.

And track down the source code for both the C and Racket versions and 
how they are generated.  So far I've seen one.

And perhaps also the typed OpenGL function withing Pict3D.

This update isn't going to be done for quite a while unless I get some 
inspiration.

It is going to take more thought.  I don't want to create the situation 
like with xml where there are two subtly incompatible implementations 
being used, making it hard to use soem applications together.

(I'm using sxml to read the API definition.  How that's the right 
choice).
> 
> > Now what should I do with this?  As I said there are very many such 
> > functions.  It's not an isolated case.
> > 
> > Are all these glGet functions simply something that never happened to 
> > get used in Racket code so no one noticed the discrepancy?
> > Is there some idiom in Racket programming where all this just works 
> > anyway?
> > Is there some efficency reason for not recognising output parameters?
> > Do they parhaps cause new storage allocation every time they are called?
> 
> I wouldn't say there's any "discrepancy" in `img` being an output
> argument instead of an input argument. This kind of input--output
> distinction doesn't exist at C ABI level, so no d

[racket-users] Advice wanted about new opengl binding

2020-07-31 Thread Hendrik Boom
I need advice from someone with more experience with openGL and/or 
Racket.

I am still working on updating the Racket openGL binding to the current 
openGL spec.

I'm doing this as in the old binding, machine-translating the formal 
part of the openGl standard, which now uses a competely new formalism.

I'm debugging it (for now) by comparing the old Racket include file with 
the new one on the theory that functions that were there a few years ago and 
are still there should have teh same Racket definitions now as then.

Running into a big snag.

There are a *lot* of glGet functions that grab data from the video 
processor and bring it to the CPU.
They give openGL a pointer to a storage area where it should return 
data.

For example, there's glGetCompressedTexImageARB.  It receivees a 
pointer to an image area and fills it in with a compressed image.
According the the Racket C interface, the way to write this 
would be:

(define-gl glGetCompressedTexImageARB 2 
  ( (target : _int32)
(level : _int32) 
(img : _pointer/intptr)
  -> _void -> img)
 (->> exact-integer? exact-integer? gl-pointer?)
 check-gl-error)

(here define-gl is a macro interal to the opengl binding that contains a 
number of input arguments and a contract for the manual as well as the 
actual c interface description, which of course is

  ( (target : _int32)
(level : _int32)
(img : _pointer/intptr) 
  -> _void -> img)

Here the '-> _void' specifies the value returned as function value from 
C, and ->img indicates what the Racket openGL bindig s to return as to 
the Racket calling program.

But the old binding instead used
 ( (target : _int32)
   (level : _int32)
   (img : _pointer/intptr)
  -> _void)

In other words, it ignored the fact that img is used as an output 
parameter.

Now what should I do with this?  As I said there are very many such 
functions.  It's not an isolated case.

Are all these glGet functions simply something that never happened to 
get used in Racket code so no one noticed the discrepancy?
Is there some idiom in Racket programming where all this just works 
anyway?
Is there some efficency reason for not recognising output parameters?
Do they parhaps cause new storage allocation every time they are called?

I would prefer that other Racket code that uses the old binding not have 
to be rewritten for the new.  I'd like the new binding to be both 
correct and compatible insofar as compatibility matters.

And I would very much prefer my binding to follow spec on both the 
openGL front and the Racket front.

Or maybe I should call the new binding something else, like opengl3, 
so that old code can use old bindings and new code the new.
That would be touble for those using old libraries who also want to use 
ew features.

And I've encountered a few cases where I think the old binding is just 
wrong.

I would appreciate advice on these matters from those with more Racket 
or more openGL experience.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200731210527.lrbk4sajudjuivck%40topoi.pooq.com.


Re: [racket-users] Does Racket interpreter exist?

2020-07-29 Thread Hendrik Boom
On Wed, Jul 29, 2020 at 01:56:05AM -0700, zeRusski wrote:
> This is a really cool piece of history! Thank you.
> 
> I'll admit I'm somewhat fuzzy here - it maybe a bit too meta for me or 
> perhaps I don't quite understand what you're trying to say. Isn't 
> interpreting n levels deep also linear in n?

Answer 1.

Let's say, for example, that it takes 10 instructions executed in an 
interpreter to decode, take decisions, and execute an interpreted 
instruction.  (In real life this varies a lot between interpreters and 
between interpreted instructions but let's keep the example simple.)
(and, also to keep things simple, let's say the interpreter in 
interpreting the machine language of the machne it's running on -- 
not an unusual technique in a debugger.)

Then interpreting a program using an interpreter running on hardware 
would take ten times as long as executing the program on the same 
hardware.

And likewise, interpreting the program in an interpreter being 
interpreted by the interpeter running on the hardware would take another 
ten times as lng as just interpreting the program with an interpreter 
running on the hardware.  

Thus 10 x 10, times as slow; this is where the exponential comes in.

> Only difference between the 
> two approaches  I see is that compiler lets you persist the fruits of its 
> labor so you don't have to start from scratch every time. Couldn't you 
> accommodate this with an interpreter (with some effort) although at this 
> point it becomes a compiler I suppose. Definitely fuzzy here.

That is exactly the difference between a compiler and an interpreter.

Answer 2:

Time to muddy the situation.

There are mixed-style language implementations.

If you only execute each piece of code once, interpreters tend to be 
faster.  But if you are to execute code many times, it's faster to 
compile.  It takes time to compile, but you get it back by saving time 
in later executions.

So what thee mixed implementations to is to interpret the code, but 
keeping track how often each piece of code (such as a function) is 
called.

When the count reaches a particular threshold, it pauses interpretation 
and compiles that code, the compiled code to be used thereafter.

There is some time penalty over compilation, because you waste time 
interpreting functions several times before you compile them.
This is offset by not having to compile code that is used only a few 
times.

The time behaviour of this kind of system overall is more like a 
compiler than an interpreter because the code that is executed the most 
does eventually get compiled and the rest gets interpeted only a limited 
number of 
times.

However, if it were to execute a copy of its own code, it would have to 
recompile it, unless it had a mechanism to check if the newly input 
program is the same as one it has already compiled.  This isn't 
impossible, but is not usually done.

> 
> > But when going n levels deep, the total execution time with a compiler 
> > is linear in n, and with an interpreter it's exponential. 

I use this criterion to tell whether a particular implementation is more 
like an interpreter or a compiler.

> >
> > That makes interpreting interpreters impractical when n gets large (even 
> > with n around 3 or 4); whereas compiling compilers can be done even for 
> > larger n. 
> >

Answer 3.

On modern machines, it is also important to keep memory demands low.  
Accessing large amounts of memory regularly tends to push other data our 
of cache, or even out of RAM onto disk.

Conserving storage is a common reason for using interpreted bytecode as 
the target language for a compiler.  The bytecode is usually smaller 
than the machine language.  If the bytecode interpreter is small enough, 
this is a definite win.  Bytecode was first used, as far as I know, on 
machines with small memories -- about 64K RAM total or even less.

Byte-code can also be portable.  You just need to write a (usually 
amall) bytecode interpreter for each new machine.

Of course it's still possible to, at run-time, compile the most-used 
byte-coded functions in to actual machine code to trade memory use for 
execution time.

Answer 4:  An example:

The language FORTH used a *word*-code interpreter instead of a 
byte-code interpreter, each word being two bytes, and containing the 
address of the interpreter's machine-code routine that implemented that 
instruction.

This meant each word representing an instruction could be 
executed in the interpreter by a hardware function call to an 
indirect address.  In fact, user-coded functions could be called the 
same way -- each would be a sequence of addresses preceded by the 
machine code that invokes the word-code interpreter. 

Still very compact on a machine with two-byte addresses.

Utterly impractical on a modern machine with 64-bit addresses, where the 
machine code for an operation can often be smaller than a machine 
address.

-- hendrik 

I hope this set of answers clarifies the 

Re: [racket-users] Does Racket interpreter exist?

2020-07-28 Thread Hendrik Boom
On Mon, Jul 27, 2020 at 11:07:43AM -0700, zeRusski wrote:
> 
> >
> > The best way to distinguish compilers from interpreters is that a 
> > compiler takes a program and produces another program, whereas an 
> > interpreter takes a program (along with some input) and produces an 
> > answer. 
> >
> 
> Doesn't this trivialize the difference a bit too much? Does it really come 
> down to the time you choose to compute? I persist intermediate state - I am 
> a compiler. I do the exact same thing (run off the same "compiler" 
> codebase) but ask for inputs and compute - I am an interpreter.
> 
> I scratched my head a bit and came up with the following: if there is one 
> to one correspondence between target and host language "blocks" (there may 
> be multiple such pairs till you get to machine code) then this is an 
> interpreter. If you do nasty shenanigans in the generated code in the host 
> (semantics altering optimisation passes and what not) then this is a 
> compiler. Latter ought to effect debugging even error reporting quite 
> drastically. This is almost certainly naive and amateur of me. I'm 
> desperately trying to understand why I have the impression that there ought 
> to be a non-trivial difference between the two. That's been my impression 
> from the literature.


There is an important distinction here, and it has to do with resource 
consumption when iterated.

This is most easily explained in the case(s) of a compiler and 
interpreter that are written in the languages they implement.

Clearly you can compile such a compiler using itself, and similarly, 
interpret such an interpreter, and you can do that n levels deep should 
you want to.

But when going n levels deep, the total execution time with a compiler 
is linear in n, and with an interpreter it's exponential.

That makes interpreting interpreters impractical when n gets large (even 
with n around 3 or 4); whereas compiling compilers can be done even for 
larger n.

This is important when the nesting implemntations are not identical.  
This might involve interpreting different languages one in the other.
But it might, very practically, involve compiling different versions of 
the same language in a proess of incremental development.  The Algol 68 
C compiler, for example, went through hundreds of versions, each 
compiling the next one, an each providing better tools for the 
implementer to use.  That would have been practically impossible with a 
self-interpreter.

By the way, one of their tests was to use the compiled compiler to 
compile itself two levels deep and see if the two self-compiled object 
codes were identical.  If not, there was a problem.

Many systems are a mix of compiling and interpreting, such as many 
Scheme implementations.

And ultimately, the actual machine hardware usually interprets machine 
code.

Yes, there are ambiguous corner cases.  Such as some of the Apple macs 
that run previous hardware generations by compiling basic blocks of 
old machine code one by one at run time. Or JIT compilation.  Or running 
Verilog code on a programmable gate array.

Some of these are situations where the self-implementation model just 
doesn't really apply.  Silicon is silicon, and is hardware, and isn't 
interpreted.  It just does what silicon does.

-- hendrik

> 
> I think I had this paper in mind: https://www.jilp.org/vol5/v5paper12.pdf 
> oh wait p4: "we do not have a precise definition for efficient interpreter" 
> ... oh good. Although they do mention some justification for "compiling" to 
> a VM in the following paragraphs that boils down to "avoid the overhead of 
> re-parsing and re-interpreting intermediate representation". I vaguely 
> recall that Lisp in Small Pieces switched to a VM when the "fast 
> interpretation" was introduced.
> 
> I may have confused myself. Badly :(
> 
> I guess I would call Tcl and Picolisp interpreters and Racket and most 
> Scheme implementations of note not at all.
> 
> -- 
> 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/98a4e936-1703-4182-bb85-ce78a8694feao%40googlegroups.com.

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


[racket-users] reading s-expressions from a file

2020-07-17 Thread Hendrik Boom
Yes,  I know the functino for reading s-expressions seems to be (read [in]).

I want a loop that reads S-expressions and does something to each one, until 
there are no more to be found in a file.

Now of course that's absurdly easy to do with a tail-recursice loop.

But I's like it to look like a loop, with (for ...) or (while ...) or 
(loop ...) or something like that.

But I fail to fine any iterators that process a file, such as (in-file 
...)

There's a long list of iterators in 
   https://docs.racket-lang.org/reference/for.html
and in 
   https://docs.racket-lang.org/guide/for.html

An I just looking in the wrong place, or are there really no iterators 
for reading a stream of s-expressions from a file.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200718001905.elzyuu42gje45j7t%40topoi.pooq.com.


[racket-users] Screen readers

2020-07-07 Thread Hendrik Boom
On Tue, Jul 07, 2020 at 11:44:53AM +0200, Jens Axel Søgaard wrote:

> The upside is that using standard elements work with custom themes used
> in the OS. Screen readers for blind also work with standard elements.

Just wondering.  What is available in the way of screen readers on a 
Linux system? 
I have a friend who complains there aren't any decent ones.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200707120918.wmkqjaoivenub5mm%40topoi.pooq.com.


[racket-users] bracket meme

2020-07-06 Thread Hendrik Boom
Found this signature quote:

--
Put not your faith in parenthesis, nor trust in dotted pears, says speech 
therapist.

used by DannyB on Soyent News

Thought it might be amusing here.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200706234107.olppyedipbc6b4ii%40topoi.pooq.com.


Re: [racket-users] Re: note about parsing speed of xml vs sxml?

2020-06-29 Thread Hendrik Boom
On Sun, Jun 28, 2020 at 06:01:27PM -0700, Alex Harsanyi wrote:
> I tested the your string port version and I also wrote a "string-append" 
> version of the xml reader and they are both slower by about 10-15% on my 
> machine, when compared to the current read-xml implementation which uses 
> `list->string`.  It looks like `list->string` is not the bottleneck here.

Odd -- to remove all that storage-allocaation overhead and to find it 
gets slower...

Perhaps the overhead lies in the Scheme interpreter?  Does it allocate 
lots of storage?
Would using chez racket help any?

-- hendrik
> 
> There are some small improvements that can be made from micro 
> optimizations.  For example, I changed `name-char?` to not use 
> `name-start?` but instead check for all chars, and I also changed 
> `lex-name` to construct the list in reverse and use `(list->string (reverse 
> chars))`, plus I reordered the cond condition to check the common case 
> first (that the next character is a name-char? and not a 'special one).  
> However, this resulted in only about 5-10% speed improvement, nowhere near 
> where the 4 time speedup when using `sxml`, as reported by John.
> 
> In the end, it may well be that speeding up `read-xml` can only be done by 
> these types of micro-optimizations.  Another thing I looked into was the 
> "pattern" used for reading: all the `read-xml` code will use the pattern of 
> "peeking" the next character, deciding if it is good, than reading it.  
> This is much slower than just reading the characters directly.  These are 
> the results from just reading in a 14Mb XML file:
> 
> read-char only:  cpu time: 312 real time: 307 gc time: 0
> read-char-or-special only:  cpu time: 750 real time: 741 gc time: 0
> peek-char than read-char:  cpu time: 1234 real time: 1210 gc time: 0
> peek-char-or-special than read-char-or-special:  cpu time: 1688 real 
> time: 1690 gc time: 0
> 
> Using this code:
> 
> (define file-name "your-test-file-here.xml")
> 
> (printf "read-char only~%")
> (collect-garbage 'major)
> (time
>  (call-with-input-file file-name
>(lambda (in)
>  (let loop ([c (read-char in)])
>(if (eof-object? c)
>(void)
>(loop (read-char in)))
> 
> (printf "read-char-or-special only~%")
> (collect-garbage 'major)
> (time
>  (call-with-input-file file-name
>(lambda (in)
>  (let loop ([c (read-char-or-special in)])
>(if (eof-object? c)
>(void)
>(loop (read-char-or-special in)))
> 
> (printf "peek-char than read-char~%")
> (collect-garbage 'major)
> (time
>  (call-with-input-file file-name
>   (lambda (in)
> (let loop ([c (peek-char in)])
>   (if (eof-object? c)
>   (void)
>   (begin
> (void (read-char in))
> (loop (peek-char in
> 
> (printf "peek-char-or-special than read-char-or-special~%")
> (collect-garbage 'major)
> (time
>  (call-with-input-file file-name
>   (lambda (in)
> (let loop ([c (peek-char-or-special in)])
>   (if (eof-object? c)
>   (void)
>   (begin
> (void (read-char-or-special in))
> (loop (peek-char-or-special in
> 
> Alex.
> 
> On Monday, June 29, 2020 at 5:30:43 AM UTC+8 rmculp...@gmail.com wrote:
> 
> > Thanks Alex for pointing out the use of list->string. I've created a PR (
> > https://github.com/racket/racket/pull/3275) that changes that code to use 
> > string ports instead (similar to Hendrik's suggestion, but the string port 
> > handles resizing automatically). Could someone (John?) with some large XML 
> > files lying around try the changes and see if they help?
> >
> > Ryan
> >
> >
> > On Sun, Jun 28, 2020 at 9:56 PM Neil Van Dyke  
> > wrote:
> >
> >> If anyone wants to optimize `read-xml` for particular classes of use, 
> >> without changing the interface, it might be very helpful to run your 
> >> representative tests using the statistical profiler.
> >>
> >> The profiler text report takes a little while of tracing through 
> >> manually to get a feel for how to read and use it, but it can be 
> >> tremendously useful, and is worth learning to do if you need performance.
> >>
> >> After a first pass with that, you might also want to look at how costly 
> >> allocations/GC are, and maybe do some controlled experiments around 
> >> that.  For example, force a few GC cycles, run your workload under 
> >> profiler, check GC time during, and forced time after.  If you're 
> >> dealing with very large graphs coming out of the parser, I don't know 
> >> whether those are enough to matter with the current GC mechanism, but 
> >> maybe also check GC time while you're holding onto large graphs, when 
> >> you release them, and after they've been collected.  At some point, GC 
> >> gets hard for at least me to reason about, but some things make sense, 
> >> and other things you decide when to stop digging. :)  If you record all 
> >> your measurements, you can compare 

Re: [racket-users] Re: note about parsing speed of xml vs sxml?

2020-06-28 Thread Hendrik Boom
On Sun, Jun 28, 2020 at 11:30:27PM +0200, Ryan Culpepper wrote:
> Thanks Alex for pointing out the use of list->string. I've created a PR (
> https://github.com/racket/racket/pull/3275) that changes that code to use
> string ports instead (similar to Hendrik's suggestion, but the string port
> handles resizing automatically). Could someone (John?) with some large XML
> files lying around try the changes and see if they help?

I'm currently using sxml to read the current openGL specification. 
2564178 bytes in one file. 
(a) Is that relevant to your request?
(b) What do I do to have a choice of which sxml to use?
(c) Do I need to figure out using xml as well?
(d) And what do you want the test to do?

-- hendrik

> 
> Ryan
> 
> 
> On Sun, Jun 28, 2020 at 9:56 PM Neil Van Dyke  wrote:
> 
> > If anyone wants to optimize `read-xml` for particular classes of use,
> > without changing the interface, it might be very helpful to run your
> > representative tests using the statistical profiler.
> >
> > The profiler text report takes a little while of tracing through
> > manually to get a feel for how to read and use it, but it can be
> > tremendously useful, and is worth learning to do if you need performance.
> >
> > After a first pass with that, you might also want to look at how costly
> > allocations/GC are, and maybe do some controlled experiments around
> > that.  For example, force a few GC cycles, run your workload under
> > profiler, check GC time during, and forced time after.  If you're
> > dealing with very large graphs coming out of the parser, I don't know
> > whether those are enough to matter with the current GC mechanism, but
> > maybe also check GC time while you're holding onto large graphs, when
> > you release them, and after they've been collected.  At some point, GC
> > gets hard for at least me to reason about, but some things make sense,
> > and other things you decide when to stop digging. :)  If you record all
> > your measurements, you can compare empirically the how different changes
> > to the code affect things, hopefully in representative situations.
> >
> > I went through a lot of these exercises to optimize a large system, and
> > sped up dynamic Web page loads dramatically in the usual case (to the
> > point we were then mainly limited by PostgreSQL query cost, not much by
> > the application code in Scheme, nor our request network I/O),
> > and also greatly reduced the pain of intermittent request latency spikes
> > due to GC.
> >
> > One of the hotspots, I did half a dozen very different implementations,
> > including C extension, and found an old-school pure Scheme
> > implementation was fastest.  I compared the performance of the
> > implementation using something like `shootout`, but there might be
> > better ways now in Racket. https://www.neilvandyke.org/racket/shootout/
> > I also found we could be much faster if we made a change to what the
> > algorithm guarantees, since it was more of a consistency check that
> > turned out to be very expensive and very redundant, due to all the ways
> > that utility code ended up being used.
> >
> > In addition to contrived experiments, I also rigged up a runtime option
> > so that the server would save data from the statistical profiler for
> > each request a Web server handled in production.  Which was tremendously
> > useful, since it gave us real-world examples that were also difficult to
> > synthesize (e.g., complex dynamic queries), and we could go from Web
> > logs and user feedback, to exactly what happened.
> >
> > (In that system I optimized, we used Oleg's SXML tools very heavily
> > throughout the system, plus some bespoke SXML tools for HTML and XML.
> > There was one case in which someone had accidentally used the `xml`
> > module, not knowing it was incompatible with the rest of the system,
> > which caused some strange failures (no static checking) before it was
> > discovered, and we changed that code to use SXML.)
> >
> > --
> > 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/68624c9a-df35-14a3-a912-df806799a7e0%40neilvandyke.org
> > .
> >
> 
> -- 
> 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/CANy33q%3DpZw9EPmZG%2Bdz5cRYMSP17Ofntq9JwFqVVoN8ZhO6POg%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 

Re: [racket-users] Re: note about parsing speed of xml vs sxml?

2020-06-28 Thread Hendrik Boom
On Sat, Jun 27, 2020 at 05:16:34PM -0700, Alex Harsanyi wrote:
> Looking at the source for `read-xml`, it seems to be using `list->string` 
> in several places.  That is, it reads characters one-by-one and constructs 
> a list by appending a character to the end of it, than calls `list->string` 
> to produce the string.  I suspect read-xml could be made faster by using 
> `string-append` in these cases.

So you would be copying and reallocating strings instead of cons-cells?

The way to make that eliminate all that allocation is to implement a 
likely big enough mutable string buffer and insert characters (likely 
one at at time if I read you correctly) without allocating new storage 
each time (unless you've made the buffer too smal; in which case, double 
its size).

Then allocate the right amount of space for a string once and copy 
the buffer into it when the string has been completely read in.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200628190739.tpjrkilrf5eq546w%40topoi.pooq.com.


[racket-users] xml vs sxml?

2020-06-27 Thread Hendrik Boom
On Sat, Jun 27, 2020 at 12:33:02AM -0400, Neil Van Dyke wrote:
> I think anyone using XML or HTML seriously with Racket should probably at
> least be told of the SXML family of tools.  And warned about the
> compatibility problems.
> 
> Though not tell them *everywhere* XML in the docs.  For example, I
> figure a tutorial for Racket Web Server shouldn't distract readers with
> that.
> 
> As you know, :) there are some useful tools using SXML, and Oleg's SSAX
> parser has some different properties than core Racket's XML parser.
> 
> Complication: The incompatibility between SXML and core Racket's
> representations of XML is an unfortunate accident of parallel
> invention, and I think will tend to be confusing to new people.  I once
> tried to address the confusion in the `sxml-intro` documentation package,
> "https://www.neilvandyke.org/racket/sxml-intro/;, and I'm unhappy with the
> result.  The details in my document say more than perhaps anyone will ever
> want to know, and, "optics"-wise, make the situation look worse than it
> actually is in practice.  I think you could do a more graceful job of this.

On the contrary; this is the kind of information I need when choosing 
between the various representations.

But in section 4. Appendix there is one bit of pervasive confusion:
you present several differences, but do not make it clear which way the 
difference goes.  When you say, for example, "The SXML keyword symbols 
may be lowercase", do you mean that SXML itseld allows this to be done 
to its keywords, or that it does not but that xexpr allows its SXML 
keywords to be lower case?

> 
> (Someday, someone might undertake the large task of SXML-ifying all the many
> non-SXML bits of Racket, and incidentally reunite Racket with the rest of
> the Scheme community in that regard.  I started, with one piece, but got
> interrupted. "https://www.neilvandyke.org/racket/rws-html-template/"  :)

>From this, and from the general drift of your sxml-intro, I surmise that 
the intent is for Racket to become fully SXML compliant, and new 
software should be written for SXML, not xexpr, if at all possible.
Is this correct, and is this Racket policy?  If so, it should be stated 
explicitly in the sxml-intro.  A statement like this (if not gainsaid by 
the opposite camp (if any)) would eliminate much of the confusion 
experienced by new users.  It should of course also be said in the xexpr 
documentation.

Finally, I seem to remember that one of the tools mentioned somewhere 
for handling xml turned out not to be findable.  I don't know any more 
if it was mentioned in your document or elsewhere, but it might be worth 
checking that the ones you mention are still available.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200627123304.p437hr3nykhfjs45%40topoi.pooq.com.


Re: [racket-users] Should I stop sending packages to the catalog?

2020-06-19 Thread Hendrik Boom
On Fri, Jun 19, 2020 at 01:09:08PM -0700, Brian Adkins wrote:
> 
> I'm hoping the main scenario I'm concerned about (a bug is introduced in an 
> update of a package) is rare, although that's exactly what motivated Alex 
> to create his system. If it is a rare scenario for me, then I'd like to do 
> the following:
> 
> 1) Develop & test locally while updating packages as needed
> 2) Prior to releasing to production, so *something* that effectively 
> snapshots my environment
> 3) Use the snapshot to deploy to production
> 
> Although I have some ideas about the "something" task, I still have to 
> finalize the procedure and try it out. One option is to simply use a 
> racksnap snapshot. What I'd like to do is to create a personal catalog that 
> represents the packages I currently have installed, but it doesn't appear 
> there's a super easy `raco pkg` command to do that - I still need to 
> research a bit. Either there is a command, or it seems like a relatively 
> straightforward thing to add.

Making a complete copy of everything stored under ~/.racket might make 
enough of a racket system snapshot on a GNU/Linux system.  I have no 
idea what to do on Windows, though.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200619204945.rj6kckxwmsvutag6%40topoi.pooq.com.


Re: [racket-users] Should I stop sending packages to the catalog?

2020-06-19 Thread Hendrik Boom
On Fri, Jun 19, 2020 at 07:54:29AM -0700, Brian Adkins wrote:
> On Friday, June 19, 2020 at 8:09:04 AM UTC-4, Neil Van Dyke wrote:
> >
> > For an important production system, you probably want the source of any 
> > third-party packages on which you depend to be in Git (or another SCM 
> > system) that you control. 
> >
> > You might also want to audit those packages yourself, as well as audit 
> > any new version changes to them, before you push to production. 
> >
> > After you do those things in SCM, depending how you do it, you *might* 
> > find it's more convenient to simply load the third-party code you need 
> > using the module system `require` only, without an additional package 
> > system. 
> >
> 
> While I see some benefits of this approach, I just looked at a typical 
> Rails project of mine, and it has over 160 packages with some packages 
> depending on different versions of other packages, etc., so I think 
> managing all of this myself in git might be overly burdensome. Granted, my 
> current Racket apps have far fewer dependencies, but I expect that may 
> increase over time. 

If you want to avoid problems with software you use changing 
unpredictably, you will have to have use your own copy that does not 
change at all.

I don't see another alternative if your upstream source might change at 
any time.

And you will likely have to vet any chaanges that appear upstream in 
case they actually do fix security-related issues that might already 
be affect you.  It will be up to you to determine the risks of leaving 
your local copy unchanged.

-- 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/32b8f70a-4033-43db-aca3-b30b9023f3a3o%40googlegroups.com.

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


[racket-users] About FEXPRS

2020-06-07 Thread Hendrik Boom
On Sun, Jun 07, 2020 at 08:09:40PM +0800, Siyuan Chen wrote:
...
...
> 
> There is an alternative of Lisp macros called FEXPRs, see
> https://en.wikipedia.org/wiki/Macro_(computer_science)#Early_Lisp_macros
> 
> > Early Lisp macros
> > Before Lisp had macros, it had so-called FEXPRs, function-like operators
> whose inputs were not the values computed by the arguments but rather the
> syntactic forms of the arguments, and whose output were values to be used
> in the computation. In other words, FEXPRs were implemented at the same
> level as EVAL, and provided a window into the meta-evaluation layer. This
> was generally found to be a difficult model to reason about effectively.

This wasn't just a feature for the expert user; it was the way basic 
primitives like 'quote', 'cond', and 'let' were implemented in the 
lisp 1.5 interpreter; the actual interpreting code being written in 
assembler (or Lisp, if it wasn't an utterly necessary primitive).

-- hendrik

> 
> More information, see https://en.wikipedia.org/wiki/Fexpr
...
...

-- 
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/20200607160227.bmwnuh5cg4kvkren%40topoi.pooq.com.


Re: [racket-users] Poor documentation of List*

2020-06-03 Thread Hendrik Boom
On Wed, Jun 03, 2020 at 04:22:41PM +0100, Stephen De Gabrielle wrote:
> Hi Hendrik,
> 
> I can't see the example you mention in
> https://docs.racket-lang.org/ts-reference/type-ref.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fbase-types-extra..rkt%29._.List%2A%29%29
> 
> i'm assuming (List* c) is shorthand for (Pair c null)? I don't know typed
> racket so I've probably got that terribly wrong.

It might be.  But that's normally said as (List c), not List* c)
With your interpretation, List* qould be equivalent to List.

> 
> So while I can't help you with this - I wanted to encourage you to make a
> PR to the documentation if you come up with a fix.

My problem is that I don't know what the documentation is supposed to say.

-- hendrik

> It *used* to be hard to find the file that needs the fix, good steps have
> been made recently to make it easier to identify the documentation source
> file so it is easier to find and make the corrections or additions.
> 
> If you have any trouble let me know and I'll try help - I think I'm
> getting the hang of it.
> 
> Hope you are well
> 
> Kind regards
> 
> Stephen
> 
> ps i use
> https://blog.racket-lang.org/2017/09/tutorial-contributing-to-racket.html &
> lots of kind guidance from other racketeers :0
> pps: if you make a successful pr you get credit in the frankly wonderful
> racket news https://racket-news.com/2020/06/racket-news-issue-32.html
> 
> On Tue, Jun 2, 2020 at 3:13 PM Hendrik Boom  wrote:
> 
> > In the Typed Racket Reference, List* is defined as follows:
> >
> > (List* t t1 ... s)
> >
> > is equivalent to (Pairof t (List* t1 ... s)).
> >
> > Following this definition down, we get
> >
> > (List* a b c)
> >  -> (Pairof a (List* b c))
> >  -> (Pairof a (Pairof b (List* c)))
> >
> > But what's (List* c) ?
> >
> > I see no explanatory examples.
> >
> > -- hendrik
> >
> > P.S.  I'm also unsure what 'bound' is supposed to do in
> >
> > (List t ... trest ... bound)
> >
> > It says "where bound must be an identifier denoting a type variable
> > bound with ..." but I don't undestand what this is referring to.
> >
> > There are no examples of this in the document, just as there are no
> > examples of List*.
> >
> > -- 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.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/20200602141347.3z7igvzbjyikhfn4%40topoi.pooq.com
> > .
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAGHj7-LsML%2BeOnt_BUBWmRM5vU6GtovyaNr-JHOQPzoMCL2NTQ%40mail.gmail.com.

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


[racket-users] Poor documentation of List*

2020-06-02 Thread Hendrik Boom
In the Typed Racket Reference, List* is defined as follows:

(List* t t1 ... s)

is equivalent to (Pairof t (List* t1 ... s)).

Following this definition down, we get

(List* a b c)
 -> (Pairof a (List* b c))
 -> (Pairof a (Pairof b (List* c)))

But what's (List* c) ?

I see no explanatory examples.

-- hendrik

P.S.  I'm also unsure what 'bound' is supposed to do in 

(List t ... trest ... bound)

It says "where bound must be an identifier denoting a type variable 
bound with ..." but I don't undestand what this is referring to.

There are no examples of this in the document, just as there are no 
examples of List*.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200602141347.3z7igvzbjyikhfn4%40topoi.pooq.com.


Re: [racket-users] syntax woe with typed Racket 'let'

2020-06-01 Thread Hendrik Boom
On Mon, Jun 01, 2020 at 10:28:55PM -0500, Shu-Hung You wrote:
> FWIW, because `.` is just cons, the program
> (define (F [X : T1] . [Y : T2]) 'e)
> is being read as:
> (define (F [X : T1] Y : T2) 'e)
> I guess that's the reason for having an extra '*' in the syntax.

Indeed.  It works for untyped Racket, but in typed Racket that notation 
would become quite ambiguous.

-- hendrik

> 
> On Mon, Jun 1, 2020 at 10:16 PM Sam Tobin-Hochstadt
>  wrote:
> >
> > The syntax looks like this:
> >
> > (define (f [x : Number] . [y : String *]) : Number (+ x (length y)))
> >
> > See the documentation for `define` in Typed Racket here:
> > https://docs.racket-lang.org/ts-reference/special-forms.html?q=define#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._define%29%29
> > in particular the `rst` production.
> >
> > Sam
> >
> > On Mon, Jun 1, 2020 at 3:09 PM Hendrik Boom  wrote:
> > >
> > > On Mon, Jun 01, 2020 at 10:58:09AM -0400, Sam Tobin-Hochstadt wrote:
> > > > Do you perhaps have some other binding shadowing the binding of `:`
> > > > from Typed Racket? That produces the error message you get when I try
> > > > it.
> > >
> > > Not intentionally.  I'll have to look carefully for possible candidates.
> > > Or ask DrRacket to jump to a binding occurrence.
> > >
> > > Did that:  It wouldn't find a bining instance while that colon was
> > > there, but complained about the syntax error I was sompaining about.
> > > But when I removed the type specification from the let-clause and
> > > introuced a colon elsewhere in the function as an extra parameter in
> > > another expression, it would find the binding.  It turned out that the
> > > binding occurrence was the colon in the tail-parameter [args : T-Size].
> > >
> > > So I have to ask, what *is* the proper way to indicate that the
> > > function can be called with many more parameters, which are to be
> > > made available as a list?
> > >
> > > Thank you for the hint.
> > >
> > > -- hendrik
> > >
> > > >
> > > > Sam
> > > >
> > > > On Sat, May 30, 2020 at 1:32 PM Hendrik Boom  
> > > > wrote:
> > > > >
> > > > > I'm sorry to keep pestering this list, but I'm out of my depth with 
> > > > > the
> > > > > detailed syntax (and semantics) of typed Racket.  But I'm doggedly
> > > > > ploughing on.
> > > > >
> > > > > I'm having trouble with the 'let' line in the 'pointer-to' function 
> > > > > listed later:
> > > > >
> > > > > (let ([vt : Ffi-type (cast ((inst hash-ref Ffi-type Ffi-type) 
> > > > > type-to-vector type #f) Ffi-type)])
> > > > >
> > > > > Yes, there's an unbalanced parenthesis because this sin't the end of 
> > > > > the let-expression.
> > > > >
> > > > > The error message is
> > > > >
> > > > >  let: expected type-annotated identifier
> > > > >   parsing context:
> > > > >while parsing annotated-binding
> > > > >while parsing optionally type-annotated binding in: (vt : Ffi-type 
> > > > > (cast ((inst hash-ref Ffi-type Ffi-type) type-to-vector type #f) 
> > > > > Ffi-type))
> > > > >
> > > > > I can't see the error.  'vt : Ffi-type' looks like a type-annotated
> > > > > identifier to me.  And it seems to have the right number of 
> > > > > parentheses
> > > > > in front of it, followed by an expression whose vlue is to be bound to
> > > > > 'vt'.
> > > > >
> > > > > Here's the function it's part of:
> > > > >
> > > > >
> > > > > (define (pointer-to [type : T-Type] . [args : T-Size]) : T-Type ; 
> > > > > TODO: rename args to size-args
> > > > >   (if (and (equal? args '(1)) (not (eq? type '_void)))
> > > > > (mode-dependent-type
> > > > >   `(_ptr i ,type) `(_ptr o ,type))
> > > > > (case type
> > > > >   ((_void) '_pointer/intptr)
> > > > >   ((_byte _uint8) (mode-dependent-type
> > > > > '_string*/utf-8
> > > > > (if (null? args)
> > > > >   '_bytes
> > > > >   `(

Re: [racket-users] syntax woe with typed Racket 'let'

2020-06-01 Thread Hendrik Boom
On Mon, Jun 01, 2020 at 10:58:09AM -0400, Sam Tobin-Hochstadt wrote:
> Do you perhaps have some other binding shadowing the binding of `:`
> from Typed Racket? That produces the error message you get when I try
> it.

Not intentionally.  I'll have to look carefully for possible candidates.
Or ask DrRacket to jump to a binding occurrence.

Did that:  It wouldn't find a bining instance while that colon was 
there, but complained about the syntax error I was sompaining about.
But when I removed the type specification from the let-clause and 
introuced a colon elsewhere in the function as an extra parameter in 
another expression, it would find the binding.  It turned out that the 
binding occurrence was the colon in the tail-parameter [args : T-Size].

So I have to ask, what *is* the proper way to indicate that the 
function can be called with many more parameters, which are to be 
made available as a list?

Thank you for the hint.

-- hendrik

> 
> Sam
> 
> On Sat, May 30, 2020 at 1:32 PM Hendrik Boom  wrote:
> >
> > I'm sorry to keep pestering this list, but I'm out of my depth with the
> > detailed syntax (and semantics) of typed Racket.  But I'm doggedly
> > ploughing on.
> >
> > I'm having trouble with the 'let' line in the 'pointer-to' function listed 
> > later:
> >
> > (let ([vt : Ffi-type (cast ((inst hash-ref Ffi-type Ffi-type) 
> > type-to-vector type #f) Ffi-type)])
> >
> > Yes, there's an unbalanced parenthesis because this sin't the end of the 
> > let-expression.
> >
> > The error message is
> >
> >  let: expected type-annotated identifier
> >   parsing context:
> >while parsing annotated-binding
> >while parsing optionally type-annotated binding in: (vt : Ffi-type (cast 
> > ((inst hash-ref Ffi-type Ffi-type) type-to-vector type #f) Ffi-type))
> >
> > I can't see the error.  'vt : Ffi-type' looks like a type-annotated
> > identifier to me.  And it seems to have the right number of parentheses
> > in front of it, followed by an expression whose vlue is to be bound to
> > 'vt'.
> >
> > Here's the function it's part of:
> >
> >
> > (define (pointer-to [type : T-Type] . [args : T-Size]) : T-Type ; TODO: 
> > rename args to size-args
> >   (if (and (equal? args '(1)) (not (eq? type '_void)))
> > (mode-dependent-type
> >   `(_ptr i ,type) `(_ptr o ,type))
> > (case type
> >   ((_void) '_pointer/intptr)
> >   ((_byte _uint8) (mode-dependent-type
> > '_string*/utf-8
> > (if (null? args)
> >   '_bytes
> >   `(_bytes o ,@ args
> >   (else
> > (let ([vt : Ffi-type (cast ((inst hash-ref Ffi-type Ffi-type) 
> > type-to-vector type #f) Ffi-type)])
> >   (if vt
> > (mode-dependent-type
> >   `(,vt i)
> >   (if (null? args)
> > vt
> > `(,vt o ,@ args)))
> > (mode-dependent-type
> >   `(_vector i ,type)
> >   (if (null? args)
> > '_pointer
> > `(_vector o ,type ,@ args)
> >
> > --
> > 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/20200530173230.bsrp5skkc35ot34h%40topoi.pooq.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BYkANXdevMc%3DiSTFaWnpzU-6ofNWF2qJtWyR-f6ES2gLg%40mail.gmail.com.

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


[racket-users] syntax woe with typed Racket 'let'

2020-05-30 Thread Hendrik Boom
I'm sorry to keep pestering this list, but I'm out of my depth with the 
detailed syntax (and semantics) of typed Racket.  But I'm doggedly 
ploughing on.

I'm having trouble with the 'let' line in the 'pointer-to' function listed 
later:

(let ([vt : Ffi-type (cast ((inst hash-ref Ffi-type Ffi-type) type-to-vector 
type #f) Ffi-type)])

Yes, there's an unbalanced parenthesis because this sin't the end of the 
let-expression.

The error message is

 let: expected type-annotated identifier
  parsing context: 
   while parsing annotated-binding
   while parsing optionally type-annotated binding in: (vt : Ffi-type (cast 
((inst hash-ref Ffi-type Ffi-type) type-to-vector type #f) Ffi-type))

I can't see the error.  'vt : Ffi-type' looks like a type-annotated 
identifier to me.  And it seems to have the right number of parentheses 
in front of it, followed by an expression whose vlue is to be bound to 
'vt'.

Here's the function it's part of:


(define (pointer-to [type : T-Type] . [args : T-Size]) : T-Type ; TODO: rename 
args to size-args
  (if (and (equal? args '(1)) (not (eq? type '_void)))
(mode-dependent-type
  `(_ptr i ,type) `(_ptr o ,type))
(case type
  ((_void) '_pointer/intptr)
  ((_byte _uint8) (mode-dependent-type 
'_string*/utf-8 
(if (null? args)
  '_bytes
  `(_bytes o ,@ args
  (else
(let ([vt : Ffi-type (cast ((inst hash-ref Ffi-type Ffi-type) 
type-to-vector type #f) Ffi-type)])
  (if vt
(mode-dependent-type
  `(,vt i)
  (if (null? args) 
vt
`(,vt o ,@ args))) 
(mode-dependent-type
  `(_vector i ,type)
  (if (null? args) 
'_pointer
`(_vector o ,type ,@ args)

-- 
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/20200530173230.bsrp5skkc35ot34h%40topoi.pooq.com.


[racket-users] coding style query

2020-05-27 Thread Hendrik Boom
Is there an accepted convention about how to use a symbol used in a 
program within a comment so it's clear the comment is using it as a 
program symbol and not as an ordinary English word?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200527175636.6f23slgqphlo3sfk%40topoi.pooq.com.


Re: [racket-users] inconvenience in typed Racket

2020-05-22 Thread Hendrik Boom
On Fri, May 22, 2020 at 05:35:04PM -0400, Sam Tobin-Hochstadt wrote:
> The problem is almost certainly that `Any` is not allowed in 
> `Ffi-type`. What's the definition of `Ffi-type`,

Casting rettype to Any did not help; adding Any in as one of the options 
in ffi-type did let it go through.


It's completely obscure to me why inserting Any as an additional 
alternative in Ffi-type works.

But I don't *want* Any to be a valid alternative for Ffi-type anywhere 
else in the program.  It will let too much through.  I'm adding types to 
existing untyped code in an attempt to get some understanding of its 
data structures, and using Any here would not teach me anything.

I suppose I could cast rettype to a union Ffi-type and Any in situ.
Ugly.

 and why does `params`
> have a type that involves `Any`?

Because it has a lot af possiilities and I haven't yet gotten to 
figuring out what's really needed.

I think there's a need to embed untyped expressions in a typed program, 
just as there's a mechanism to do the reverse.

-- hendrik

> 
> Sam
> 
> On Fri, May 22, 2020 at 5:21 PM Hendrik Boom  
> wrote:
> >
> > Here's the code it's complaining about.
> >
> >  `(,@params -> ,rettype)
> >
> > And here's the message:
> >
> > Type Checker: Polymorphic function `qq-append' could not be applied 
> > to arguments: Types: (Listof a) (Listof b) -> (Listof (U a b)) 
> > Arguments: (Listof (List Any ': Any)) (List '-> Ffi-type) Expected 
> > result: Ffi-type
> >  in: (quasiquote ((unquote-splicing params) -> (unquote rettype)))
> >
> > Now what I'm building is a piece of Racket code that is to be 
> > written out into a new source-code file.
> >
> > param is indeed of type (Listof (List Any ': Any)). rettype is 
> > indeed of type (List '-> Ffi-type)
> >
> > And or some reason the type-checker isn't able to realise that I can 
> > really build a valid s-expression out of these components.
> >
> > Now i could hand-expand the quasiquote in to a lot of cons 
> > operations, each presummably surrounded by 'inst' becausee cons is 
> > polymorphic, but this will just make the entire expression 
> > unreadable.
> >
> > I'm almost tempted to write this expression in untyped Racket.
> >
> > But separating this stuff into another module would significantly 
> > demodularize the code -- related code will no longer be together.
> >
> > Racket does have a compact mechanism to embed typed-Racket code in 
> > an untyped program (it's called with-type)
> >
> > But there seems to be no similar way to embed an expression of 
> > untyped code into a typed-racket program.
> >
> > How to get past this impasse?  The majority of my code needs to be 
> > in typed Racket to maintain my sanity while debugging, but the 
> > quasiquoted texts (there are a number of these) need to be readable, 
> > for the same reason.
> >
> > -- 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. To view this discussion 
> > on the web visit 
> > https://groups.google.com/d/msgid/racket-users/20200522212056.m3x54f6dykgs4qyx%40topoi.pooq.com.
> 
> -- You received this message because you are subscribed to the Google 
> Groups "Racket Users" group. To unsubscribe from this group and stop 
> receiving emails from it, send an email to 
> racket-users+unsubscr...@googlegroups.com. To view this discussion on 
> the web visit 
> https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BZah-zmPNKX%3DyttQoQFs7pY9PHc8hYGzkTeKm35YU3MLg%40mail.gmail.com.

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


[racket-users] inconvenience in typed Racket

2020-05-22 Thread Hendrik Boom
Here's the code it's complaining about.

 `(,@params -> ,rettype)

And here's the message:

Type Checker: Polymorphic function `qq-append' could not be applied to 
arguments:
Types: (Listof a) (Listof b) -> (Listof (U a b))
Arguments: (Listof (List Any ': Any)) (List '-> Ffi-type)
Expected result: Ffi-type
 in: (quasiquote ((unquote-splicing params) -> (unquote rettype)))

Now what I'm building is a piece of Racket code that is to be written 
out into a new source-code file. 

param is indeed of type (Listof (List Any ': Any)).
rettype is indeed of type (List '-> Ffi-type)

And or some reason the type-checker isn't able to realise that I can 
really build a valid s-expression out of these components.

Now i could hand-expand the quasiquote in to a lot of cons operations, 
each presummably surrounded by 'inst' becausee cons is polymorphic,
but this will just make the entire expression unreadable.

I'm almost tempted to write this expression in untyped Racket.

But separating this stuff into another module would significantly 
demodularize the code -- related code will no longer be together.

Racket does have a compact mechanism to embed typed-Racket code in an 
untyped program (it's called with-type)

But there seems to be no similar way to embed an expression of untyped 
code into a typed-racket program.

How to get past this impasse?  The majority of my code needs to be in 
typed Racket to maintain my sanity while debugging, but the quasiquoted 
texts (there are a number of these) need to be readable, for the same 
reason.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200522212056.m3x54f6dykgs4qyx%40topoi.pooq.com.


Re: [racket-users] Inference for polymorphic functions not supported?

2020-05-19 Thread Hendrik Boom
On Mon, May 18, 2020 at 04:51:26PM -0400, Sam Tobin-Hochstadt wrote:
> The systematic way to do it is to use `inst`.
> 
> Here's the first example:
> 
> (define hash-list : (Listof (Pair Symbol Natural)) (list))
> ((inst sort (Pair Symbol Natural) String) hash-list string ((p : (Pair Symbol Natural))) (symbol->string (car p))) #:cache-keys?
> #t)
> 
> This program works already, but I wasn't sure what the `y` binding was
> doing in your second example:
> 
> (for*/list : (Listof (Pair Symbol Natural)) ((p : (Pair Symbol
> Natural) (in-list hash-list))
>  (k : Symbol (in-value (car p)))
>  (v : Natural (in-value (cdr p)))
>  #:when (not (= v 1))
>  )
>   (cons k v))

I got this second example to work, but it's still a black art to me.

 (printf "~s~%"
`(define pname-map (hasheqv
 ,@(for*/list : (Listof (List Symbol Natural))
 ((p  : (Pair Symbol Natural)(in-list 
(hash->sorted-list pname-map)))
  (k : Symbol (in-value (car p)))
  (v : Natural (in-value (cdr p)))
  #:when (not (= v 1))
  )
 (list k v) ; TODO: I changed this; 
original used a temporary variable 'y'.
 

I really had to get rid of the y variable.  Even providing an explicit type for 
that 
variable did not work.

It kept complaining about the overloaded function 'cons'.

Presumably I'd have to use inst on the 'cons' function to clear this up 
comprehensibly, 
but 'cons' does not appear explicitly in the code at all.

It's probably embedded in the code generated by quasiquote.  The 'inst' tril 
doesn't 
work very well on code generated by a macro when the macro itself doesn't 
generate 
'inst's.

I do not understand how eliminating the temporary variably 'y' made it all work.

-- hendrik

> 
> Sam
> 
> On Mon, May 18, 2020 at 4:33 PM Hendrik Boom  wrote:
> >
> > I keep getting the messages like
> >
> > Type Checker: Inference for polymorphic keyword functions not supported in: 
> > (sort hash-list string > (symbol->string (car p))) #:cache-keys? #t)
> >
> > or
> >
> > Type Checker: Polymorphic function `cons' could not be applied to arguments:
> > Types: a (Listof a) -> (Listof a)
> >a b -> (Pairof a b)
> > Arguments: (U Exact-Nonnegative-Integer Symbol) (Listof (Pairof Symbol 
> > Nonnegative-Integer))
> > Expected result: (Listof (Pairof Symbol Nonnegative-Integer))
> >  in: (for*/list : (Listof (Pair Symbol Natural)) ((p : (Pair Symbol 
> > Natural) (in-list (hash->sorted-list pname-map))) (k : Symbol (in-value 
> > (car p))) (v : Natural (in-value (cdr p))) #:when (not (= v 1)) (y (list k 
> > v))) y)
> >
> > Is there some systematic way to code this explicitly so it
> > doesn't have to try guesswork? (hich it refuses to do)
> >
> > And is it really unable to figure out that an
> > Exact-Nonnegative-Integer is a Nonnegative-Integer?
> >
> > -- 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.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/20200518203342.4vcvrsrvkmld4tmh%40topoi.pooq.com.

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


Re: [racket-users] Inference for polymorphic functions not supported?

2020-05-18 Thread Hendrik Boom
On Mon, May 18, 2020 at 04:51:26PM -0400, Sam Tobin-Hochstadt wrote:
> The systematic way to do it is to use `inst`.
> 
> Here's the first example:
> 
> (define hash-list : (Listof (Pair Symbol Natural)) (list))
> ((inst sort (Pair Symbol Natural) String) hash-list string ((p : (Pair Symbol Natural))) (symbol->string (car p))) #:cache-keys?
> #t)
> 
> This program works already, but I wasn't sure what the `y` binding was
> doing in your second example:

I don't either.  It was originally someone else's program, which I'm coverting 
to typed 
Racket in order to understand it better.

-- hendrik

> 
> (for*/list : (Listof (Pair Symbol Natural)) ((p : (Pair Symbol
> Natural) (in-list hash-list))
>  (k : Symbol (in-value (car p)))
>  (v : Natural (in-value (cdr p)))
>  #:when (not (= v 1))
>  )
>   (cons k v))
> 
> Sam
> 
> On Mon, May 18, 2020 at 4:33 PM Hendrik Boom  wrote:
> >
> > I keep getting the messages like
> >
> > Type Checker: Inference for polymorphic keyword functions not supported in: 
> > (sort hash-list string > (symbol->string (car p))) #:cache-keys? #t)
> >
> > or
> >
> > Type Checker: Polymorphic function `cons' could not be applied to arguments:
> > Types: a (Listof a) -> (Listof a)
> >a b -> (Pairof a b)
> > Arguments: (U Exact-Nonnegative-Integer Symbol) (Listof (Pairof Symbol 
> > Nonnegative-Integer))
> > Expected result: (Listof (Pairof Symbol Nonnegative-Integer))
> >  in: (for*/list : (Listof (Pair Symbol Natural)) ((p : (Pair Symbol 
> > Natural) (in-list (hash->sorted-list pname-map))) (k : Symbol (in-value 
> > (car p))) (v : Natural (in-value (cdr p))) #:when (not (= v 1)) (y (list k 
> > v))) y)
> >
> > Is there some systematic way to code this explicitly so it
> > doesn't have to try guesswork? (hich it refuses to do)
> >
> > And is it really unable to figure out that an
> > Exact-Nonnegative-Integer is a Nonnegative-Integer?
> >
> > -- 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.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/20200518203342.4vcvrsrvkmld4tmh%40topoi.pooq.com.

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


[racket-users] Inference for polymorphic functions not supported?

2020-05-18 Thread Hendrik Boom
I keep getting the messages like

Type Checker: Inference for polymorphic keyword functions not supported in: 
(sort hash-list stringstring 
(car p))) #:cache-keys? #t)

or

Type Checker: Polymorphic function `cons' could not be applied to arguments:
Types: a (Listof a) -> (Listof a)
   a b -> (Pairof a b)
Arguments: (U Exact-Nonnegative-Integer Symbol) (Listof (Pairof Symbol 
Nonnegative-Integer))
Expected result: (Listof (Pairof Symbol Nonnegative-Integer))
 in: (for*/list : (Listof (Pair Symbol Natural)) ((p : (Pair Symbol Natural) 
(in-list (hash->sorted-list pname-map))) (k : Symbol (in-value (car p))) (v : 
Natural (in-value (cdr p))) #:when (not (= v 1)) (y (list k v))) y)

Is there some systematic way to code this explicitly so it 
doesn't have to try guesswork? (hich it refuses to do)

And is it really unable to figure out that an 
Exact-Nonnegative-Integer is a Nonnegative-Integer? 

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200518203342.4vcvrsrvkmld4tmh%40topoi.pooq.com.


[racket-users] SOLVED BUT needs documentation change: printing structures in typed Racket

2020-05-15 Thread Hendrik Boom
On Fri, May 15, 2020 at 10:07:31AM -0400, Sam Tobin-Hochstadt wrote:
> Generics are not supported yet; you need to use structure type
> properties, like this:
> 
> #lang typed/racket/base
> 
> (: parameter-print : Any Output-Port Any -> Any)
> (define (parameter-print v p b) (fprintf p "hi\n"))
> 
> (struct parameter
>   ([type : String] [name : Symbol] [len : (Option String)] [const? :
> Boolean] [stars : Integer])
>   #:property prop:custom-write  parameter-print)

Thank you.  That worked.

But according to section 2.5 of the typed Racket reference, #:property 
is not one of the allowed options in struct.

Perhaps the documentation needs to be updated/

-- hendrik
 
> 
> On Fri, May 15, 2020 at 8:00 AM Hendrik Boom  wrote:
> >
> > How does one provide a method to print strutures in typed Racket?
> >
> > (struct parameter
> >
> >   ([type : XML] [name : Symbol] [len : (Option String)] [const? : Boolean] 
> > [stars : Integer])
> >   #:methods gen:custom-write [(define write-proc parameter-print)]
> >   )
> >
> > seems not to work.  But something like this did work in untyped Racket.
> > Is there some other way to do this?
> >
> > -- 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.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/20200515120026.ski2o43crgtnsnr3%40topoi.pooq.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BZFMR0evj%2B%3DcoeQaaQ602f7rGj76HtNc7N3bswipH7aEg%40mail.gmail.com.

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


[racket-users] at sign in scribble

2020-05-15 Thread Hendrik Boom
I hae not been able to figure out from the scribble documentation how to 
produce a document containing an at sign.

Just putting the desired at sign into the source file of course doesn't 
work, since the at-reader intercepts 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200515120418.yunluqvjoshcf4lj%40topoi.pooq.com.


[racket-users] printing structures in typed Racket

2020-05-15 Thread Hendrik Boom
How does one provide a method to print strutures in typed Racket?

(struct parameter
 
  ([type : XML] [name : Symbol] [len : (Option String)] [const? : Boolean] 
[stars : Integer])
  #:methods gen:custom-write [(define write-proc parameter-print)]
  )

seems not to work.  But something like this did work in untyped Racket.
Is there some other way to do this?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200515120026.ski2o43crgtnsnr3%40topoi.pooq.com.


Re: [racket-users] Re: Requesting feedback on CSS3 parser and tokenizer

2020-05-12 Thread Hendrik Boom
On Tue, May 12, 2020 at 05:35:59PM -0700, Alex Harsanyi wrote:
> I now very little about web technologies and web development, so this might 
> be a stupid question:  could you explain what types of applications might 
> need a to parse CSS files?  I can only think of one, and that is a web 
> browser.  Are you working towards a web browser in Racket?

I think CSS can also be used in .odt format files.  Not sure, though.
Don't have my .odt manual at hand.
And in .epub files.

-- hendrik

> 
> Alex.
> 
> On Wednesday, May 13, 2020 at 6:37:22 AM UTC+8, Sage Gerard wrote:
> >
> > I'm working to release a CSS3 tokenizer and parser to the catalog 
> > tomorrow. 
> >
> > https://github.com/zyrolasting/css3-syntax
> >
> > The current state lacks tests, so any logic errors should keep me busy for 
> > a little longer. I'm here to ask for bug reports and feedback in the issue 
> > tracker since I had my head in the weeds long enough. 
> 
> -- 
> 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/268eace0-f69e-44d4-b59c-13ef767d1108%40googlegroups.com.

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


[racket-users] SOLVED: Mysterious multiple values in a typed-racket program

2020-05-09 Thread Hendrik Boom
On Sat, May 09, 2020 at 12:24:16PM -0400, Ben Greenman wrote:
> On 5/9/20, Hendrik Boom  wrote:
> > I get the message
> >
> > readspec.rkt:195:8: Type Checker: Expression should produce 3 values, but
> > produces 1 values of types String in: (for/set : (Setof String) (((l :
> > String) (cast (in-lines input-port) (Sequenceof String (cast
> > (string-trim l) String))
> >
> > from the following function:
> >
> > (define (read-manpages [input-port : Input-Port])
> >   (cast (for/set : (Setof String) (([l : String] (cast (in-lines input-port)
> > (Sequenceof String
> >(cast (string-trim l) String))
> > (Setof String)))
> >
> > The expression it is complaining about is the (for/list ..)
> > construction.
> >
> > I'm trying to covert a Racket program to a typed Racket program.
> > As far as I can see, this function reads words, one to a line, from
> > input-port and makes a set of these words.
> >
> > It baffles me where the type checker gets the idea that 3 values are wanted
> >
> > anywhere.
> >
> > I put in a lot of casts just to make sure I knew what types it had to work
> > with.
> >
> > The original code, without types:
> >
> > (define (read-manpages input-port)
> >   (for/set ((l (in-lines input-port)))
> >(string-trim l)))
> >
> > Any ideas?
> 
> Well this is unfortunate.
> 
> `(l : String)` should be `l : String` with no parentheses

Got it. It's confusing whenyuo need the parentheses around a type-binding and 
when you don't. 

-- hendrik

> 
> The code you have looks like this to Typed Racket:
> 
> ```
> (for/set : TYPE
>   (((val0 val1 val2) (in-lines input-port)))
>   LOOP-BODY)
> ```
> 
> -- 
> 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/CAFUu9R7wBS_hbZpXmFR097qxi8F-54rkogEXe6R0Nyqp_iMqDQ%40mail.gmail.com.

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


[racket-users] Mysterious multiple values in a typed-racket program

2020-05-09 Thread Hendrik Boom
I get the message 

readspec.rkt:195:8: Type Checker: Expression should produce 3 values, but 
produces 1 values of types String in: (for/set : (Setof String) (((l : String) 
(cast (in-lines input-port) (Sequenceof String (cast (string-trim l) 
String))

from the following function:

(define (read-manpages [input-port : Input-Port])
  (cast (for/set : (Setof String) (([l : String] (cast (in-lines input-port) 
(Sequenceof String
   (cast (string-trim l) String))
(Setof String)))

The expression it is complaining about is the (for/list ..) construction.

I'm trying to covert a Racket program to a typed Racket program.
As far as I can see, this function reads words, one to a line, from 
input-port and makes a set of these words.

It baffles me where the type checker gets the idea that 3 values are wanted 
anywhere.

I put in a lot of casts just to make sure I knew what types it had to work 
with.

The original code, without types:

(define (read-manpages input-port)
  (for/set ((l (in-lines input-port)))
   (string-trim l)))

Any ideas?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200509153840.ebbxgpzazrhdbldq%40topoi.pooq.com.


Re: [racket-users] for/set

2020-05-08 Thread Hendrik Boom
On Fri, May 08, 2020 at 04:18:24PM -0700, Sorawee Porncharoenwase wrote:
> There’s a search bar in the top left of every doc page.

Somehow I hadn't noticed that.  It's a huge help to know that.

> Typing for/set and
> enter will show you this search result page
> <https://docs.racket-lang.org/search/index.html?q=for%2Fset>. Here, the first
> result
> <https://docs.racket-lang.org/reference/sets.html?q=for%2Fset#%28form._%28%28lib._racket%2Fset..rkt%29._for%2Fset%29%29>
> is what you want.

Excellemt!

-- hendrik


> 
> On Fri, May 8, 2020 at 4:07 PM Hendrik Boom  wrote:
> 
> > Where is for/set documented?  What does it do?
> >
> > It is mentioned in the typed Racket menual, but oly to say it has
> > the same meaning as the unannotated version.
> >
> > -- 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.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/20200508230711.llav2273e2ntzegz%40topoi.pooq.com
> > .
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CADcuegvGez14Nxs9XhgoM_3tNViqWLtbhvikLnN%3D0zH4GEKY%2Bg%40mail.gmail.com.

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


[racket-users] for/set

2020-05-08 Thread Hendrik Boom
Where is for/set documented?  What does it do?

It is mentioned in the typed Racket menual, but oly to say it has 
the same meaning as the unannotated version. 

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200508230711.llav2273e2ntzegz%40topoi.pooq.com.


Re: [racket-users] Finding bound occurrences

2020-05-07 Thread Hendrik Boom
On Thu, May 07, 2020 at 10:27:53AM -0500, Robby Findler wrote:
> Does the file without arrows have a syntax error?
> 
> Robby

That was th problem.  Not in the file itself, which the main file 
for the Racket openGL binding, but in a generated file I included.

I forgot I had modified the include linr for debugging that other 
file.

Thanks.  I'm still learning.

-- hendrik

> 
> 
> On Thu, May 7, 2020 at 9:55 AM Hendrik Boom  wrote:
> 
> > I have several tabs open in DrRacket.
> > On two of them, when I mouse over a symbol, it provides very
> > visible links to binding or bound occurrences
> >
> > On the third, it doesn't.  There is a right-click mey item to jump
> > to the binding occurrence, but no menu item to find next bound
> > occurrence.
> >
> > One difference I've noticed is that that third tab has
> >   #lang racket/base
> > instead of
> >   #lang typed/racket
> > of
> >   #lang racket
> > like the first two tabs.
> >
> > Is this a bug or a feature?  Is there soe way I cn persuade it to
> > show me bound occurrences even in the third tab/
> >
> > -- 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.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/20200507145536.sflodxjyu5n72l3s%40topoi.pooq.com
> > .
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAL3TdONwrREEwFygXtVT%3D8ZPjWauL1uuEAfCfq5LRdFZTHnX7w%40mail.gmail.com.

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


[racket-users] Finding bound occurrences

2020-05-07 Thread Hendrik Boom
I have several tabs open in DrRacket.
On two of them, when I mouse over a symbol, it provides very 
visible links to binding or bound occurrences

On the third, it doesn't.  There is a right-click mey item to jump 
to the binding occurrence, but no menu item to find next bound 
occurrence.

One difference I've noticed is that that third tab has
  #lang racket/base
instead of
  #lang typed/racket
of
  #lang racket
like the first two tabs.

Is this a bug or a feature?  Is there soe way I cn persuade it to 
show me bound occurrences even in the third tab/

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200507145536.sflodxjyu5n72l3s%40topoi.pooq.com.


Re: [racket-users] Should I stop sending packages to the catalog?

2020-05-01 Thread Hendrik Boom
On Fri, May 01, 2020 at 06:12:55AM -0700, Jesse Alama wrote:
> On Thursday, April 30, 2020 at 2:57:45 PM UTC+2, Jay McCarthy wrote:
> >
> >
> > This is simply a social standard though. There is nothing that 
> > technically prevents you from breaking compatibility, except that your 
> > users may be upset. You can post things on the package server that 
> > follows any rules you want, including conflicting with any other 
> > packages.
> >
> 
> I'd like to second this point. There's nothing stopping you from pushing 
> whatever you want to your repo, and hence distributing whatever you want 
> via the package server. I've pushed breaking changes to my packages before, 
> and no one has complained, so I guess I didn't break any part of the 
> interface that they were using. (Or I have no users of my stuff at all, 
> which is certainly possible!)
> 
> I don't know how many packages mention, in their description, that they're 
> experimental, explicitly warning me that the interface is unstable and 
> likely to change. I use 'em anyway because they offer useful functionality. 
> I don't recall being nailed by breaking changes, but perhaps I'm just 
> getting lucky.
> 
> What exactly is the claim, anyway, about the package server not allowing 
> breaking changes? Is it that if you do a breaking change to your package, 
> then it's possible that other people's packages correspondingly break? If 
> so, then I think that's not a very interesting claim. Does the claim at 
> issue just amount to a restatement of the ethos that Jay mentioned about 
> trying to ensure backwards compatibility for a long time?
> 
> (All this said, I'd like to learn more about setting up custom package 
> catalogs, as Alex mentioned, to take matters even more into your own hands.)

Is there a mechanism for, when you know you are making a breaking change 
in a package, at least being warned about other packages that may break 
as a result?

And is there a mechanism for testing those other packages before 
committing your breaking package to the public repository?

-- 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/04ebf61c-54b3-4f58-96aa-f5bdc5f2b457%40googlegroups.com.

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


Re: [racket-users] Reducing parentheses without language damage.

2020-05-01 Thread Hendrik Boom
On Thu, Apr 30, 2020 at 02:40:00PM -0700, Sorawee Porncharoenwase wrote:
> 
> This is Nia's parendown: https://docs.racket-lang.org/parendown/index.html

Just wondering:  Is there a way to write division if Nia's parendown is in 
effect?
There would be no problem with this if it was originally designed into the 
language,
but language add-ons give the probem of syntax-versus-name confliicts.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200501131750.seligwkp7zifoddu%40topoi.pooq.com.


Re: [racket-users] Reducing parentheses without language damage.

2020-04-30 Thread Hendrik Boom
On Thu, Apr 30, 2020 at 02:40:00PM -0700, Sorawee Porncharoenwase wrote:
> >
> > I hate being at the mercy of whatever editor I'm stuck using.
> 
> 
> I agree with this in principle, but in practice, it's really a matter of
> what mainstream editors support. Editors in the past don't universally
> support automatic indentation, and I could imagine a criticism like
> "Indentation sucks, because I hate being at the mercy of whatever editor
> I'm stuck using." But now, automatic indentation is universal, and the
> criticism goes away.
> 
> 
> > I stongly recommend that we get a language with less of a
> > parenthesis problem so that code is readable without having to haul
> > it into a specialised editor.
> >
> 
> Personally, I don't find parenthesis makes code unreadable by itself. The
> rightward drift, in my opinion, is the real problem. I believe that
> `define*` that I proposed at
> https://github.com/racket/rhombus-brainstorming/issues/46 will somewhat
> mitigate the problem.

Yes, rightward drift is one of the problems.  That's why I introduced '/'
in a Lispish language I implemented decades ago.

> 
> In an old List I used '/' for this, so i got expressions like
> >(if a b / if c d / let s t /if s foo bar)

If course this is a different let from the traditional, age-old one.

> >
> 
> Using `/` to reduce parentheses looks nice once it's written down, but my
> concern is that it might not be easily editable. In fact, it ironically
> looks like this notation needs an extra support from editors to consider
> `/` as a delimiter.

Yes, of course.  Whatever you use has to be ecognised as a delimiter.

> 
> To clarify what I mean: non S-exp languages usually have a line as a unit
> of code, so editors need to support "jump to the beginning/end of line"  to
> make editing pleasant. S-exp languages in contrast has a parenthesized
> expression as a unit of code, so editors need to support "jump to a
> matching parenthesis" to make editing pleasant. In your notation, it looks
> like editors need to also support "jump to closest /" to make editing
> pleasant.

In practise, you get things like

( if a (cadr foo)
/ if c
(d u / v w)
/ let s t
/ if s foo bar
)

> 
> Also, does it actually make code more readable? I guess I'm not accustomed
> to it, and might find it easier to read it once I am.

I foud it so.  Especially for large, complicared expressions involving
intermixed let's and if's.

Of course, I also adapted mu Lisp to make better advantage if the "/" syntax.

multiple let's just become tail-nested let's, without rightward drift.

(let a b
/let c a
/let e (f c)
/big expression incolving these
)

> 
> 
> > There must be some # code we could use for this (I believe one
> > has already been mentioned on this list sometime in the past year
> > os so) but this symbol tends to become *so* prevalent that it
> > should ideally feel like a single character with a dostinctieve
> > apearance.
> >
> 
> This is Nia's parendown: https://docs.racket-lang.org/parendown/index.html

That is lovely.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200501014133.hoyw2pksi4lpkebz%40topoi.pooq.com.


Re: [racket-users] Reducing parentheses without language damage.

2020-04-30 Thread Hendrik Boom
On Thu, Apr 30, 2020 at 02:46:00PM -0400, David Storrs wrote:
> On Thu, Apr 30, 2020 at 11:16 AM Hendrik Boom 
> wrote:
> 
> > On Thu, Apr 30, 2020 at 09:36:15AM +0200, Dexter Lagan wrote:
> > >   There’s one thing I noticed: if debugging is disabled, then
> > parenthesis highlighting is also disabled (as well as other visual aids, if
> > I remember well?). The editor also feels faster because of this, but
> > navigating parentheses becomes slightly more tedious without it.
> >
> > And that's exactly the parenthesis problem.  For a language as
> > parenthesis-heavy as Scheme or Lisp, you need a
> > parenthesis-oriented editor.  DrRacket does this very well bu
> > shading the background (but apparently not all the time).  Emacs
> > does it too, in principle, but isn't reaally great at it.
> >
> 
> Not to minimize your experience but I'm speaking up simply as a
> counterpoint:  I haven't had this issue, even without Racket's equivalence
> between () [] and {}.
> 
> Also is there a programming editor that *won't* do parenthesis matching?

Evidently the Racket editor whan debugging is disabled, if  
understand Dexter Lagan correctly.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200430190125.4eibezfdyp3dcuds%40topoi.pooq.com.


[racket-users] Reducing parentheses without language damage.

2020-04-30 Thread Hendrik Boom
On Thu, Apr 30, 2020 at 09:36:15AM +0200, Dexter Lagan wrote:
>   There’s one thing I noticed: if debugging is disabled, then parenthesis 
> highlighting is also disabled (as well as other visual aids, if I remember 
> well?). The editor also feels faster because of this, but navigating 
> parentheses becomes slightly more tedious without it.

And that's exactly the parenthesis problem.  For a language as 
parenthesis-heavy as Scheme or Lisp, you need a 
parenthesis-oriented editor.  DrRacket does this very well bu 
shading the background (but apparently not all the time).  Emacs 
does it too, in principle, but isn't reaally great at it. 

I hate being at the mercy of whatever editor I'm stuck using.

I stongly recommend that we get a language with less of a 
parenthesis problem so that code is readable without having to haul 
it into a specialised editor.

It is possible to do this without creating a hugely complicated and 
unintuitive syntax for the language!  We don't need to savage 
the language to accomplish this!

One thing that greatly mitigates parentheses without affecting the 
semantic of the language or the syntax (much) is the equivalent of 
tail-recursion for parenthesis nesting.  It the last component of a 
list is itself a list, instead of enclosing it in parentheses, you 
just put a prefix in front it it.

In an old List I used '/' for this, so i got expressions like
   (if a b / if c d / let s t /if s foo bar)

Let no longer needs its heavy bracket structure because it's easy 
to chain let's without parenthesis nesting.  Wimilaarly, cond 
itself become unnecessry, and it's easy to chain ifs, lets, and so 
forth.

Of course '/' is already taken in Racket; as is the also natural 
';'.

There must be some # code we could use for this (I believe one 
has already been mentioned on this list sometime in the past year 
os so) but this symbol tends to become *so* prevalent that it 
should ideally feel like a single character with a dostinctieve 
apearance.

Actual parentheses becoma *startlingly* sparser.
And language constructions whose primary purpose seems to be to 
avoid nesting become mostly unnecessary.

(Still stuck with letrec though)

-- hendrik
> 
> Dex
> 
> > On Apr 25, 2020, at 3:25 PM, sleepnova  wrote:
> > 
> > 
> > That may help to reduce misimpression. And plus, maybe append some message 
> > to error message to inform user that they can turn on errortrace if they 
> > need more detailed debugging information, when errortrace doesn't enabled.
> > 
> > To be clarify, what you mentioned is "Preserve errortrace" option, what 
> > about "Debugging" option, is it a must enabled option in a non-debugging 
> > run?
> > 
> > <截圖 2020-04-25 下午9.22.20.png>
> > 
> > 
> > Sorawee Porncharoenwase  於 2020年4月25日 週六 下午8:17寫道:
> >> It could go either way, no? I've also heard a lot of people complaining 
> >> that debugging Racket programs is difficult because the stack trace is not 
> >> useful, and this is because they use the command-line version which 
> >> doesn't have errortrace enabled (by default). 
> >> 
> >> Perhaps what you really are complaining is that the option to 
> >> enable/disable errortrace is not easily discoverable. Would it help if at:
> >> 
> >> 
> >> 
> >> 
> >> the text is changed from `racket, with debugging` to `racket, with 
> >> debugging (slower)`. And the texts are linkified so that when `racket` is 
> >> clicked, it leads you to the non-detailed language setting, and when `with 
> >> debugging (slower)` is clicked, it leads you to the detailed language 
> >> setting?
> >> 
> >> On Sat, Apr 25, 2020 at 3:51 AM Liwei Chou  wrote:
> >>> Thanks Dexter,
> >>> 
> >>> Yes, now I know it’s due to the debugging and tracing configuration. 
> >>> After turn off debugging and profiling, it becomes.
> >>> 
> >>> cpu time: 20 real time: 20 gc time: 0
> >>> 
> >>> If disable Preserve stacktrace also, I got.
> >>> 
> >>> cpu time: 7 real time: 7 gc time: 0
> >>> 
> >>> Which is pretty decent, 16x acceleration.
> >>> 
> >>> It's not a problem for me now. However, this behavior may give some new 
> >>> users the wrong impression that the language may not be very efficient, 
> >>> which may make some people choose not to continue trying it.
> >>> 
> >>> From the perspective of increasing adoption and reducing barriers, it's 
> >>> not a good thing.
> >>> 
> >>> If Racket team can consider making normal run and debug run using 
> >>> different default settings, which conventional development environments 
> >>> usually do, that can easily solve this problem.
> >>> 
> >>> Dexter Lagan於 2020年4月25日星期六 UTC+8下午5時17分31秒寫道:
>  
>  Hi Liwei,
>  
>    I believe disabling debugging and tracing does accelerate the 
>  evaluation quite a bit from inside DrRacket. On my system, it seems to 
>  be running my code at the same speed as the main racket binary.
>  
>  Dex
> >>> 
> >>> -- 
> >>> You received this message because you are subscribed to the Google Groups 
> 

Re: [racket-users] Do I misunderstand set! ?

2020-04-23 Thread Hendrik Boom
On Thu, Apr 23, 2020 at 11:40:44PM -0500, Alexis King wrote:
> > On Apr 23, 2020, at 21:15, Hendrik Boom  wrote:
> > 
> > (fprintf anomaly "resEEEulttyope was ~s~n" resulttype)
> > (fprintf anomaly "set resulttyoe to ~s~n" ty)
> > `(set! resulttype ty)
> > (fprintf anomaly "resEEulttyope now ~s~n" resulttype)
> 
> (Re-sending this because I forgot to CC the list the first time.)
> 
> Assuming it is not some strange artifact of your email client’s formatting, 
> you have a backtick at the beginning of the line your set! expression appears 
> on, so it is quasiquoted and will not do anything.

Yes!  You nailed it!  I didn't even *see* the backtick until you pointed 
it out!  Good thing I reallt copy-pasted it instead of typeing it in. 

> Both DrRacket and racket-mode communicate this information to you in 
> various ways: DrRacket won’t draw binding arrows for set! or 
> resulttype, and I believe racket-mode has similar functionality 
> (albeit displayed in a different way).

Which explains why I wasn't getting binding arrows.  Now I know what to 
look for when that happens.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200424050847.takja5obmnhvk3pl%40topoi.pooq.com.


Re: [racket-users] Do I misunderstand set! ?

2020-04-23 Thread Hendrik Boom
On Thu, Apr 23, 2020 at 05:07:31PM -0400, Philip McGrath wrote:
> I think you are running into the (very confusing!) issue Ben describes
> here: https://groups.google.com/d/msg/racket-users/UD20HadJ9Ec/mDd4x8Y1BwAJ

If so, I'm confused.  That issue seems to deal with modules.
I'm not aware of amy modules hanging around.
The creation of resulttype, the use of resulttype, and the set!ing of
resuttype all happen within one single function.

I'll paste it in below.

-- hendrik
> 
> -Philip
> 
> 
> On Thu, Apr 23, 2020 at 5:00 PM Hendrik Boom  wrote:
> 
> > extract from code:
> >
> >   (fprintf anomaly "resEEEulttyope was ~s~n" resulttype)
> >   (fprintf anomaly "set resulttyoe to ~s~n" ty)
> >  `(set! resulttype ty)
> >   (fprintf anomaly "resEEulttyope now ~s~n" resulttype)
> >
> > Previous creation of resulttype:
> >
> >   (define resulttype : (Option TType) #f) ; TODO: check there's only one
> >
> > Output that appeared on the anomaly file:
> >
> > resEEEulttyope was #f
> > set resulttyoe to _void
> > resEEulttyope now #f
> >
> > I stuck the E's in just to make sure these were the statements really
> > generating that output.
> >
> > If I am correct, the set! should have changed the value of resulttype.
> > I'm doing thie in typed-racket.

And here's the function:

(define (process-command [command : (Listof XML)])
  (fprintf output "~n") ; TODO this line is temporary code
  (define name : (Option Symbol) #f) ; TODO: check there's only one
  (define resulttype : (Option TType) #f) ; TODO: check there's only one
  (define group : (Option XML) #f)
  (define proto : (Option prototype) #f); TODO: check there's only one
  (define params : (Listof parameter)'()) ; list of parameters in reverse order
  (define glxtype : (Option String) #f)
  (define opcode : (Option String) #f)
  (for ([item command])
(match item
  #;[(list 'proto ty (list 'name n))
  `   (set! resulttype
` (if (and (string? ty) (equal? "void" (strip-white ty))) '_void 
ty))
` (fprintf anomaly "resulttype set to ~s~n" resulttype)`
` (set! name (string->symbol (strip-white n)))
   ]
  [(cons 'proto rest)
   (set! proto (process-proto (cast rest (Listof XML
   (match proto
 [(prototype ty n g) ; formerly list n ': t)
  (fprintf anomaly " prottype's type is ~s~n" ty)
  (when name (fprintf anomaly "Too many names ~s ~s~n" name n))
  (set! name n)

  (when resulttype (fprintf anomaly "Too many result types ~s ~s`n" 
resulttype ty))
  (fprintf anomaly "resEEEulttyope was ~s~n" resulttype)
  (fprintf anomaly "set resulttyoe to ~s~n" ty)
 `(set! resulttype ty)
  (fprintf anomaly "resEEulttyope now ~s~n" resulttype)

  (when group (fprintf anomaly "Too many groupss ~s ~s`n" group g))
 `(set! group g) #;(fprintf anomaly "proto had group ~s\n" g)
  ]
 [ _ (fprintf anomaly "; TODO: strange proto in command: ~s~n" command)]
 )] 
  [(cons 'param rest) (set! params (cons (parse-param (cast rest (Listof 
XML))) params))]
  [(list 'glx (list '@ (list 'type (? string? t)) (list 'opcode (? string? 
o
   (set! glxtype t)
   (set! opcode o)
   (fprintf anomaly "; LATER: whatever do i do with item ~s in command 
~s~n" item name)]
  [(list 'alias (list '@ (list 'name name)))
   (fprintf output "; alias for ~a~n" name)]
  [(list 'vecequiv (list '@ (list 'name name)))
   (fprintf anomaly "; LATER vecequiv ~s~n" item)]
   
  [ _ (fprintf anomaly "; TODO: unknown command item ~s~n" item) ]
  ))

  (when (null? name)
  #;(fprintf anomaly "; TODO: no name in command definition~n")
(fprintf anomaly "; TODO: best try:~n #;")
)

  (fprintf output "TODO: debug: Parameter list is ~s from command ~s~n" params 
command)
  (fprintf trace "; DEBUGG ~s~n" (map parameter-type params))
  (define args (params->ctypes params))
  (define results : (Listof (List Symbol ': TType)) (get-output-ctypes args)) ; 
parameters used as output variables
  (fprintf output "got results ~s from args ~s~n" results args)
;  (define rev-regular-type (cons '-> (map (lambda ([a :(List Boolean Symbol ': 
TType)]) (cdr a)) args))) ; <><><><>
  (define rev-regular-type
(cons '-> (map (ann cdr (-> (List Boolean Symbol ': TType) (List Symbol ': 
TType))) args))) ; <><><><>
  (fprintf output " resulttype ~s~n" resulttype)
  (define rev-type ; the type for the C ff

[racket-users] Do I misunderstand set! ?

2020-04-23 Thread Hendrik Boom
extract from code:

  (fprintf anomaly "resEEEulttyope was ~s~n" resulttype)
  (fprintf anomaly "set resulttyoe to ~s~n" ty)
 `(set! resulttype ty)
  (fprintf anomaly "resEEulttyope now ~s~n" resulttype)

Previous creation of resulttype:

  (define resulttype : (Option TType) #f) ; TODO: check there's only one

Output that appeared on the anomaly file:

resEEEulttyope was #f
set resulttyoe to _void
resEEulttyope now #f

I stuck the E's in just to make sure these were the statements really 
generating that output.

If I am correct, the set! should have changed the value of resulttype.
I'm doing thie in typed-racket.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200423210026.3iuntiq3jqyjtpmc%40topoi.pooq.com.


Re: [racket-users] New week, new Racket! What are you folks up to?

2020-04-22 Thread Hendrik Boom
On Sun, Apr 19, 2020 at 10:04:18AM -0700, Stephen De Gabrielle wrote:
> New week, new Racket! What are you folks up to? 

# Related to Racket

## Working on the OpenGl binding.

Still wrestling with Khronos's new XML specification for OpenGL.
I have a somewhat confusing parser that processes sxml's output;

The parser nees at least three representations for types:  XML expressione, 
ctypes for the ffi, and Racket types for the documentation (and, peresumably
someday, for the typed-Racket binding for OpenGL.)

I'm changing the parser from Racket to Typed Racket, gaining much clarity in 
the code.

## But Typed Racket brings its own problems.

For example, take a list of type (Listof Foo).
Check if it in null.
In the branch where it's not null, the tyechecker now knows the list
is of type (Pair Foo (Listof Foo))

Undersome circumstances (which aren't quite clear to me) operations take an 
argument of type (Listof Foo) don't seem to recognise that a
(Pair Foo (Listof Foo)) is also of type (Listof Foo)

IIRC, map is on of these operations.

And why can't Typed Racket error messages contain a line number?  In DrRacket 
it means I can easily fix one error per run.  Although the error areas get 
attention-getting pink backgrounds, they aren't in the same order as the error 
messages, and all pink the backgrounds disappear as soon as I start to fix 
the first error.

* Unrelated to Racket.

I spent a weekend on LudumDare, not managing to produce a game, but 
ending up with a rudimentary terrain generator with rivers, written in 
Javascript mbedded in HTML.  See https://github.com/hendrikboom3/LudumDare46 
for source code; http://topoi.pooq.com/hendrik/ld46/game.html to see a map 
being generated.

I've also enjoyed attending math seminars all over the world; COVID-19 has 
forced then to go online and that means they're easy for me to go to.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200422153344.mlwnrsbyngiqklsu%40topoi.pooq.com.


Re: [racket-users] Typed version of sxml?

2020-04-21 Thread Hendrik Boom
On Tue, Apr 21, 2020 at 05:30:40PM -0400, John Clements wrote:
> Are you asking because you’d like your own code using SXML to be typed, or 
> because you’d like the sxml implementation to be typed? I think another way 
> of asking this is: are you worried about bugs in your code, or about bugs in 
> Oleg’s code?

About bugs in my code.

> I think that rewriting the sxml library into TR would be a lot 
> of work, but developing a TR representation for sxml terms seems quite 
> reasonable;

> of course, you’d pay the price of checking the type every time 
> you crossed the boundary into sxml library code, I suppose.

That's the price I'd prefer not to pay.  I trust Oleg's code.  I don't trust 
mine without the most exhaustive testing program, which normally includes 
static type checking.

-- hendrik

> 
> John
> 
> > On Apr 21, 2020, at 2:18 PM, Hendrik Boom  wrote:
> > 
> > Is there a typed version of sxml?
> > Its data representation would seem to be fairly easy to specify by a few 
> > corecursice define-type's.
> > 
> > I's like to get the result of
> >   (ssax:xml->sxml in '())
> > as a typed value without having to waste time doing an exhaustive  
> > run-time type-check on its output.  Because it *will* be OK.
> > The xml file I'm dealing with is 2564178 bytes.
> > 
> > (I'm glad I have RAM nowadays.  The first Lisp I ever used ran on a 
> > machine with 20.000 digits of memory (approx 10K in today's units).
> > 
> > Failing anything else I suppose I could define
> >  (define-type Xml Any)
> > but that seems kind of feeble.
> > 
> > -- 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.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/20200421211829.uo3ikwfwotr6zcf5%40topoi.pooq.com.
> 
> 
> 

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


[racket-users] Typed version of sxml?

2020-04-21 Thread Hendrik Boom
Is there a typed version of sxml?
Its data representation would seem to be fairly easy to specify by a few 
corecursice define-type's.

I's like to get the result of
   (ssax:xml->sxml in '())
as a typed value without having to waste time doing an exhaustive  
run-time type-check on its output.  Because it *will* be OK.
The xml file I'm dealing with is 2564178 bytes.

(I'm glad I have RAM nowadays.  The first Lisp I ever used ran on a 
machine with 20.000 digits of memory (approx 10K in today's units).

Failing anything else I suppose I could define
  (define-type Xml Any)
but that seems kind of feeble.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200421211829.uo3ikwfwotr6zcf5%40topoi.pooq.com.


Re: [racket-users] hash-ref in typed Racket

2020-04-21 Thread Hendrik Boom
On Tue, Apr 21, 2020 at 10:50:44AM -0400, Sam Tobin-Hochstadt wrote:
> The problem here is with the optional third argument to `hash-ref`.
> Typed Racket only allows `#f` or functions as the third argument.
> Plain Racket allows any non-function value as a default, or a function
> which is called to produce the default. Since "any non-function" is
> not expressible in Typed Racket, it's more restricted here.

I missed that.  Thanks.

> 
> The best option is to wrap the third argument in a thunk: `(lambda () 
> 'other)`.
> 
> As an aside, you probably don't want to use `cast` this extensively in
> your program.

No, I don't.  I hoped it would help, but I was fixing the wrong problem, 
so it didn't .

-- hendrik

> 
> Sam
> 
> On Tue, Apr 21, 2020 at 10:35 AM Hendrik Boom  wrote:
> >
> > In typed Racket I define a hashtable:
> >
> > (: vector-to-contract (HashTable TType CContract))
> >
> > (define vector-to-contract
> >   (make-hash
> >(cast '(
> >(_bytes . bytes?)
> >(_s8vector . s8vector?)
> >(_u16vector . u16vector?)
> >(_s16vector . s16vector?)
> >(_u32vector . u32vector?)
> >(_s32vector . s32vector?)
> >(_u64vector . u64vector?)
> >(_s64vector . s64vector?)
> >(_f32vector . f32vector?)
> >(_f64vector . f64vector?))
> >  (Listof (Pair TType CContract))
> >  )
> >))
> >
> > And then I try to look something up in it:
> >
> > ( hash-ref vector-to-contract (cast '_bytes TType) (cast 'other CContract))
> >
> > and I am informed that I cannot, it seems, look up a value of type
> > TType in a hastable whose type indicates it looks up things of type
> > TType:
> >
> > Type Checker: Polymorphic function `hash-ref' could not be applied to 
> > arguments:
> > Types: HashTableTop a (-> c) -> Any
> >HashTableTop a False -> Any
> >HashTableTop a -> Any
> > Arguments: (HashTable TType CContract) TType CContract
> > Expected result: AnyValues
> >  in: (hash-ref vector-to-contract (cast (quote _bytes) TType) (cast
> > (quote other) CContract))
> >
> >
> > How *does* one use hashtables in typed Racket?
> >
> > -- 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.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/20200421143453.lauuqi3pb4fdgyhh%40topoi.pooq.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BY-pc3Jfg4RgRmAPMqSUxUj8rJsm3np2eq2%2B-J5PWTO4Q%40mail.gmail.com.

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


[racket-users] hash-ref in typed Racket

2020-04-21 Thread Hendrik Boom
In typed Racket I define a hashtable:

(: vector-to-contract (HashTable TType CContract))

(define vector-to-contract
  (make-hash
   (cast '(
   (_bytes . bytes?)
   (_s8vector . s8vector?)
   (_u16vector . u16vector?)
   (_s16vector . s16vector?)
   (_u32vector . u32vector?)
   (_s32vector . s32vector?)
   (_u64vector . u64vector?)
   (_s64vector . s64vector?)
   (_f32vector . f32vector?)
   (_f64vector . f64vector?))
 (Listof (Pair TType CContract))
 )
   ))

And then I try to look something up in it:

( hash-ref vector-to-contract (cast '_bytes TType) (cast 'other CContract))

and I am informed that I cannot, it seems, look up a value of type 
TType in a hastable whose type indicates it looks up things of type 
TType:

Type Checker: Polymorphic function `hash-ref' could not be applied to arguments:
Types: HashTableTop a (-> c) -> Any
   HashTableTop a False -> Any
   HashTableTop a -> Any
Arguments: (HashTable TType CContract) TType CContract
Expected result: AnyValues
 in: (hash-ref vector-to-contract (cast (quote _bytes) TType) (cast 
(quote other) CContract))


How *does* one use hashtables in typed Racket?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200421143453.lauuqi3pb4fdgyhh%40topoi.pooq.com.


Re: [racket-users] printing and reading source code

2020-04-14 Thread Hendrik Boom
On Tue, Apr 14, 2020 at 12:04:22PM -0700, Raoul Schorer wrote:
> Hi,
> 
> The printer and reader doc states that the default printer can write *core* 
> types to be re-read later.
> I am making a kind of "3d IDE" for a custom language using the pict3d lib. 
> I would like to re-use the pict3d types, and prototype with an interpreter 
> that consumes a valid racket datastructure, since my language would not be 
> practical in text format and to avoid writing a lexer/parser.
> 
> Is there a way to dump a program datum containing custom types such as 
> those in pict3d to a file as text, to use as "source code"?
> 
> For example,
> 
> #lang racket
> (require pict3d)
> (define o (open-input-string))
> (write (pos 0 0 0) o)
> (read (open-input-port (get-output-string o)))
> 
> 
> yields: 'origin, that doesn't mean anything out of the pict3d context. So 
> how can I make that work?
> 
> Essentially, I'd like something equivalent to the below (incorrect):
> 
> #lang racket
> (define o (open-output-string))
> (module m racket
>  (require pict3d)
>  (pos 0 0 0))
> (write m o)
> (read (open-input-string (get-output-string o)))
> 
> 
> Is that possible?
> 
> Thanks,
> Raoul

Let me warn you.  Two things that seem to me to be missing from pict3d:
* the ability to paste textures onto objects
* The ability to do intersections on objects
  and excisions of one object from another (eaving a hole)
Maybe I just haven't found these features, but uf you think
you might need them, you should watch out.

Also, a fair amount of the code is written in typed racket.
(I'm not sure how much).  If you pass in a complex pict3d data structure
from outside, it may take substantial time doing the necessary type check.

And although struct declaration has an option to provide a print function 
for the new type (which may well be the deature you seek),
I haven't seen that option being available in typed racket. I'd be 
delighted to be wrong about this.

-- 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/1a126873-2454-4f8c-bc29-e5bb6b6ba42f%40googlegroups.com.

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


[racket-users] OpenGL: (lack of) progress report

2020-04-11 Thread Hendrik Boom
I'm (still) building the up-to-date opengl binding for Racket.

It's substantially more difficut than I thought.

As some of you know, the existing OpenGL binding is generated from files 
supplied by the standards orgaisation Khronos.

Being automatically gnerated, it was quite complete.

However, it is obsolete.  Even the first simple exercises from the
authoritative so-called Red Book can no longer be translated into 
Racket.

I undertook to update it, planning to simply rerun the same code on the 
current version of the Khronos files.

Didn't work, because those files have not been updated.
Instead they have been replaced with new files satisfying the same 
purpose, but in a completely different file format -- xml.

The old code no longer works on the new files.

Since I really wanted to use up-to-date OpenGL, I resolved to write a 
new transpiler, from the new Khronos file format to the same old Racket 
language.

I thought I would just have to replace the parser in the previus opengl 
version.

I expected that debugging would be feasible by comparing the files I 
generate with the files generated by the old opengl package.  Most of 
the content should be identical.

(this last generated bit at least, has turned out to be true!)

I was faced with several challenges:

* Really learning Racket.  Up to now I've just been coding around the 
edges of Racket so to speak.  I like the language.  And despite running 
in an interpreter, that's Ok for computation-intensive graphics work 
because most of the computation gets passed off to a separate processor, 
the GPU.

* Figuring out the poorly documented code in the otherwise excellent 
original version of the transpiler.

* learning OpenGL.  I've used it before, but the arrival of shaders has 
completely turned it inside-out.

* Deciphering the Khronos files.  The XML isn't much of a barrier -- 
Racket's sxml package does the heavy lifting.

However, Khronos's use of xml doesn't have much to do with *any* current 
undersanding of programming language semantics.  Its xml syntax doesn't, 
for example, understand that functions have function types.

Instead, the declaration of a function is split into two separate parts: 
a prototype and some parameters.  The prototype contains the function 
name and its return type, together with a few random extras such as 
asterisks.

An asterisk is there to indicate that the function doesn't return the 
indicated type, but a pointer to it.  But there's no syntactic 
understanding that there's such a thing as a pointer type, and that the 
abstract syntax for a pointer type should contain the thye of the thing 
pointed to.

Similarly, there's no concept of a function type.

It's kind of a transcription of C.

---

So, given all that, I've been flailing around with my code, managing to 
produce a lot of mostly correct binding.

That's, of course, not good enough.

What has happened is that I'm starting to understand the obstacles that 
have to be overcome.

And that's a huge help in figuring out the original versino of the 
transpiler.

My original plan of replacing the parser in the original version is 
starting to seem feasible now.  However, properties of the original 
syntax reach far into the innards of its code generator.

I'm not giving up.  I will proceed.

What I'll likely end up with is some kind of amalgam of the old code and 
parts of the new code I've already written.

There will be success, unless I come down with coronavirus and die 
first.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200411153018.jju2lwh5fsgsmust%40topoi.pooq.com.


[racket-users] typed mutable fields in structures.

2020-04-11 Thread Hendrik Boom
I noticed that in regular Racket, when defining a structure, it is 
possible for each field to be mutable independent of the other fields.

In Typed Racke I find the choice only of making all the fields or none 
of them mutable.

Is this correct, or have I missed something?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200411141747.ijbhuadzsy5r56ge%40topoi.pooq.com.


Re: [racket-users] typing variable length argument lists

2020-04-11 Thread Hendrik Boom
On Fri, Apr 10, 2020 at 08:18:38PM -0400, Jon Zeppieri wrote:
> (define (unique [list : (Listof Any)] [message : String] .
> [messageargs : Any *])
>   ; return the only element of the list, or '() if there is none.
>   ; Produce message if not just one.
>   (if (equal? 1 (length list)) (car list)
>  (begin
>(apply fprintf anomaly message messageargs)
>(if (null? list) list (car list)

Thank you.  That worked.
The change to the apply syntax surprised me.

-- hendrik

> 
> On Fri, Apr 10, 2020 at 7:49 PM Hendrik Boom  wrote:
> >
> > Trying to convert the following to typed Racket:
> >
> > (define (unique list message . messageargs)
> >   ; return the only element of the list, or '() if there is none.
> >   ; Produce message if not just one.
> >   (if (equal? 1 (length list)) (car list)
> >  (begin
> >(apply fprintf (cons anomaly (cons message messageargs)))
> >(if (null? list) list (car list))
> >)
> >  )
> > )
> >
> > It's an error message function tat accepts a list to test.
> > If the test fails it uses fprintf to print a message with the
> > arguments for the ~s items.
> >
> > I got so far, but I don't know what to do with the . messageargs :
> >
> > (define (unique [list (Listof Any)] [message : String] . messageargs)
> >   ; return the only element of the list, or '() if there is none.
> >   ; Produce message if not just one.
> >   (if (equal? 1 (length list)) (car list)
> >  (begin
> >(apply fprintf (cons anomaly (cons message messageargs)))
> >(if (null? list) list (car list))
> >)
> >  )
> > )

-- 
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/20200411134316.yff5tg7kwtglcs62%40topoi.pooq.com.


[racket-users] typing variable length argument lists

2020-04-10 Thread Hendrik Boom
Trying to convert the following to typed Racket:

(define (unique list message . messageargs)
  ; return the only element of the list, or '() if there is none.
  ; Produce message if not just one. 
  (if (equal? 1 (length list)) (car list)
 (begin
   (apply fprintf (cons anomaly (cons message messageargs)))
   (if (null? list) list (car list))
   )
 )
)

It's an error message function tat accepts a list to test.
If the test fails it uses fprintf to print a message with the 
arguments for the ~s items.

I got so far, but I don't know what to do with the . messageargs :

(define (unique [list (Listof Any)] [message : String] . messageargs)
  ; return the only element of the list, or '() if there is none.
  ; Produce message if not just one. 
  (if (equal? 1 (length list)) (car list)
 (begin
   (apply fprintf (cons anomaly (cons message messageargs)))
   (if (null? list) list (car list))
   )
 )
)

-- 
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/20200410234906.5wy5kgzl2qfwd2db%40topoi.pooq.com.


Re: [racket-users] [re: opengl] Is this known Racket syntax?

2020-04-10 Thread Hendrik Boom
On Fri, Apr 10, 2020 at 10:17:12AM -0400, Hendrik Boom wrote:
> On Fri, Apr 10, 2020 at 10:05:34AM -0400, Jay McCarthy wrote:
> > This comes from _fun, which define-gl expands to,
> > 
> > https://docs.racket-lang.org/foreign/foreign_procedures.html#%28form._%28%28lib._ffi%2Funsafe..rkt%29.__fun%29%29
> > 
> > The first -> is a type spec for the C function's return type and the
> > second -> is the output expression that is what the Racket wrapper
> > will return.
> 
> Thank you.  I thought it would be something like that, but it helps a lot
> to have a precise specification, which I found now that you indicated
> where I should look:
> https://docs.racket-lang.org/foreign/foreign_procedures.html
> 
> -- hendrik

This is getting far more complicated than I suspected a while ago when
I naively asked to have the opengl binding updated!

I'm starting to understand why it hadn't been.

I'm debugging by using diff to compare the old generated binding with my
new one.  The only differences should be things that have changed and
things that have been added.

I'm not yet seeing light at the end of the tunnel, but I hope to soon.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200410142645.wevg7oqbmio6nhrk%40topoi.pooq.com.


Re: [racket-users] [re: opengl] Is this known Racket syntax?

2020-04-10 Thread Hendrik Boom
On Fri, Apr 10, 2020 at 10:05:34AM -0400, Jay McCarthy wrote:
> This comes from _fun, which define-gl expands to,
> 
> https://docs.racket-lang.org/foreign/foreign_procedures.html#%28form._%28%28lib._ffi%2Funsafe..rkt%29.__fun%29%29
> 
> The first -> is a type spec for the C function's return type and the
> second -> is the output expression that is what the Racket wrapper
> will return.

Thank you.  I thought it would be something like that, but it helps a lot
to have a precise specification, which I found now that you indicated
where I should look:
https://docs.racket-lang.org/foreign/foreign_procedures.html

-- hendrik
> 
> Jay
> 
> --
> Jay McCarthy
> Associate Professor @ CS @ UMass Lowell
> http://jeapostrophe.github.io
> Vincit qui se vincit.
> 
> On Fri, Apr 10, 2020 at 10:02 AM Hendrik Boom  wrote:
> >
> > I'm building the new opengl binding for Racket, and keep running
> > into surprises.
> >
> > Most of them are straightforward, but tedious, but I run into
> > something strange.  It's a piece of syntax in the original
> > (presumably) corrent, but obsolete, binding -- specifically,
> >  a strange type.
> >
> > I thought I should ask before blundering through with it.
> >
> > Here's the definition for glAreProgramsResidentNV as present in
> > the existing binding:
> >
> >
> > (define-gl glAreProgramsResidentNV 2 ((n : _int32) (programs : (_u32vector 
> > i)) (residences : (_vector o _bool n)) -> (result : _bool) -> (values 
> > result residences)) (->> exact-integer? u32vector? (values boolean? 
> > (vectorof boolean?))) check-gl-error)
> >
> >
> > Now normally the define-gl macro seems to take
> > a number,
> > a type of the function (containing names for the parameters
> > in the style of typed Racket's lambda arguments), and
> > another type to put in the documentation.
> >
> > Now the type of the function here is
> > ((n : _int32) (programs : (_u32vector i)) (residences : (_vector o _bool 
> > n)) -> (result : _bool) -> (values result residences))
> >
> > An ordinary enough looking type except that -> occurs twice.
> >
> > **: Is this a known Racket construct?
> >
> > Or is it something peculiar to define-gl, which I'll just have
> > to figure out as I build the new opengl binding.  It's presumably
> > related to the fact that the 'residences' parameter is for output.
> >
> > -- hendrik
> >
> >
> > In case anyone is interested, here are the relevant
> > machine-readable bits from the nes and the old Khronos API specifications
> >
> >
> > The xml specfile entry for this is:
> >
> > 
> > GLboolean 
> > glAreProgramsResidentNV
> > GLsizei n
> > const GLuint 
> > *programs
> > GLboolean 
> > *residences
> > 
> > 
> >
> >
> > And here's the old specfile entry from the old Khronos opengl standard:
> >
> > AreProgramsResidentNV(n, programs, residences)
> > return  Boolean
> > param   n   SizeI in value
> > param   programsUInt32 in array [n]
> > param   residences  Boolean out array [n]
> > categoryNV_vertex_program
> > dlflags notlistable
> > version 1.2
> > extension   soft WINSOFT NV10
> > glxflagsignore
> > glxvendorpriv   1293
> > offset  578
> >
> >
> > --
> > 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/20200410140217.b4e5xizymwunvyu6%40topoi.pooq.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAJYbDakT1AXhd7zBK%2BHQ%2B5-z6RnkoHj__xxyGAD6vDXt21mWrA%40mail.gmail.com.

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


[racket-users] [re: opengl] Is this known Racket syntax?

2020-04-10 Thread Hendrik Boom
I'm building the new opengl binding for Racket, and keep running
into surprises.

Most of them are straightforward, but tedious, but I run into
something strange.  It's a piece of syntax in the original
(presumably) corrent, but obsolete, binding -- specifically,
 a strange type.

I thought I should ask before blundering through with it.

Here's the definition for glAreProgramsResidentNV as present in
the existing binding:


(define-gl glAreProgramsResidentNV 2 ((n : _int32) (programs : (_u32vector i)) 
(residences : (_vector o _bool n)) -> (result : _bool) -> (values result 
residences)) (->> exact-integer? u32vector? (values boolean? (vectorof 
boolean?))) check-gl-error)


Now normally the define-gl macro seems to take
a number,
a type of the function (containing names for the parameters
in the style of typed Racket's lambda arguments), and
another type to put in the documentation.

Now the type of the function here is
((n : _int32) (programs : (_u32vector i)) (residences : (_vector o _bool n)) -> 
(result : _bool) -> (values result residences))

An ordinary enough looking type except that -> occurs twice.

**: Is this a known Racket construct?

Or is it something peculiar to define-gl, which I'll just have
to figure out as I build the new opengl binding.  It's presumably
related to the fact that the 'residences' parameter is for output.

-- hendrik


In case anyone is interested, here are the relevant
machine-readable bits from the nes and the old Khronos API specifications


The xml specfile entry for this is:


GLboolean 
glAreProgramsResidentNV
GLsizei n
const GLuint 
*programs
GLboolean 
*residences




And here's the old specfile entry from the old Khronos opengl standard:

AreProgramsResidentNV(n, programs, residences)
return  Boolean
param   n   SizeI in value
param   programsUInt32 in array [n]
param   residences  Boolean out array [n]
categoryNV_vertex_program
dlflags notlistable
version 1.2
extension   soft WINSOFT NV10
glxflagsignore
glxvendorpriv   1293
offset  578


-- 
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/20200410140217.b4e5xizymwunvyu6%40topoi.pooq.com.


Re: [racket-users] Examples of sending HTML email w/ Racket?

2020-04-09 Thread Hendrik Boom
On Wed, Apr 08, 2020 at 09:28:11PM -0400, George Neuner wrote:

> 
> There's nothing in Racket for MIME that I'm aware of ... but then multipart
> formatting is needed only for multi-version messages, or for embedding
> non-text data (graphics, etc.) into a message.   Since so many people read
> mail in web browsers, and most offline clients handle HTML, I don't think
> many people even bother with multi-version messages any more.  Sending plain
> HTML is as easy as sending plain text.

But receiving HTML has security issues.  I prefer to avoid it.

I rarely read the HTML parts of multi-version messages.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200409123948.pwrihetsjqxwwwgt%40topoi.pooq.com.


[racket-users] scribble include

2020-04-06 Thread Hendrik Boom
Once again I'm trying to get @(include ...) working in scribble.

The trouble with just using @(include filepath) in scribble is that
the included file is read as racket input instead of syntax and 
semantics instead of wih scribble's syntax.

So I thought to try include/reader instead; it has an extra parameter
that can specify how the other file is to be read.

#lang scribble/base
@(require scribble/reader)
@(require racket/include)
foo
@(include/reader "si1.inc" (make-at-reader))
bar

But this gives me a completely unexpected problem.  It claims 
make-at-reader is an unbound identifier.

If I Use it outside the call to include/reader it's *not* unbound.

The Racket documentation tells me:

   The reader-expr is evaluated at expansion time in the transformer 
   environment.

Is there some way of making this work?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200406222722.2dvly3zgoi46iack%40topoi.pooq.com.


Re: [racket-users] Re: questions about top-level-bind-scope in root-expand-context

2020-03-23 Thread Hendrik Boom
On Mon, Mar 23, 2020 at 05:55:14PM -0400, George Neuner wrote:
> On Mon, 23 Mar 2020 16:57:26 -0400, Hendrik Boom
>  wrote:
> 
> >On Mon, Mar 23, 2020 at 02:46:53PM -0400, George Neuner wrote:
> >> On Mon, 23 Mar 2020 01:45:40 -0700 (PDT), Yongming Shen
> >>  wrote:
> >> 
> >> >I have the following as `module-that-defines-fib`:
> >> >
> >> >  #lang racket
> >> >  (provide fib)
> >> >  (define fib "fib")
> >> >
> >> >And this is the error that I got (using Racket 7.6):
> >> >
> >> >  ; application: not a procedure;
> >> >  ;  expected a procedure that can be applied to arguments
> >> >  ;   given: "fib"
> >> >  ; [,bt for context]
> >> 
> >> 
> >> I've run into this problem before ... I don't recall the official
> >> explanation, but my takeaway was that Racket does not permit you to
> >> directly *export* a value - you have to export a function or macro
> >> that produces the value.
> >
> >That seems like an extremely arbitrary restriction.
> 
> Well, Racket considers exported objects to immutable.  You can export
> a simple value (e.g., "foo" or 42) but it can only be used as a
> constant.  If what you need is a module variable then the only way to
> expose it is via an access function.

That makes sense.

Or I suppose you could build a one-element mtable array and export that.
The you still can't change the variable, but can change teh value inside it.

-- hendrik
> 
> AFAIHS, the OP has not shown us the code which uses the provided
> object, so we really don't know what it was trying to do when the
> error occurred.
> 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/p9bi7fpigiqm3tc3togm4vmontlv5v70ti%404ax.com.

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


Re: [racket-users] Gradual Typed Racket?

2020-03-23 Thread Hendrik Boom
On Mon, Mar 23, 2020 at 12:16:45PM -0400, Ben Greenman wrote:

> 
> Not sure about best practices, but I definitely prefer keeping typed
> and untyped code in separate modules.

It can be veru useful to be able to mix them while in transition from one to 
the other.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200323205915.v6tj5zkzm5qmuyvu%40topoi.pooq.com.


Re: [racket-users] Re: questions about top-level-bind-scope in root-expand-context

2020-03-23 Thread Hendrik Boom
On Mon, Mar 23, 2020 at 02:46:53PM -0400, George Neuner wrote:
> On Mon, 23 Mar 2020 01:45:40 -0700 (PDT), Yongming Shen
>  wrote:
> 
> >Hi Matthew,
> >
> >Thank you for the quick reply!
> >
> >I tried the example you gave for my first question and it resulted in an 
> >error.
> >I have the following as `module-that-defines-fib`:
> >
> >  #lang racket
> >  (provide fib)
> >  (define fib "fib")
> >
> >And this is the error that I got (using Racket 7.6):
> >
> >  ; application: not a procedure;
> >  ;  expected a procedure that can be applied to arguments
> >  ;   given: "fib"
> >  ; [,bt for context]
> 
> 
> I've run into this problem before ... I don't recall the official
> explanation, but my takeaway was that Racket does not permit you to
> directly *export* a value - you have to export a function or macro
> that produces the value.

That seems like an extremely arbitrary restriction.

> 
> E.g., 
>   #lang racket
>   (provide fib)
>   (define (fib) "fib")
> 
> 
> >I think this is because `(define-values (x) ...)` expands `...` without the 
> >top-level-bind-scope, even when expand-context-to-parsed? is #t (according 
> >to expander/expand/top.rkt). Is this a bug?
> >Related to your answer to my second question, `define-syntaxes` similarly 
> >does not add the top-level-bind-scope when expanding `...`. Does this mean 
> >that even for `define-syntaxes`, `...` won't use the top-level-bind-scope 
> >binding(s) after all?
> >
> >A little bit off-topic, in the definition of define-values (in 
> >expander/expand/top.rkt), there is `(define-match m s ...)`, but for 
> >define-syntaxes it is `(define-match m disarmed-s ...)`. Is this difference 
> >significant? Or does define-match not care whether `s` or `disarmed-s` is 
> >used?
> 
> I don't know the internals so I can't evaluate your theory.
> 
> 
> >Thanks,
> >Yongming
> 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/2l0i7flr0to9msl6sg165vptiec0qq26l7%404ax.com.

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


[racket-users] Updating openGL bindings

2020-03-20 Thread Hendrik Boom
I have started updating the opengl bindings for Racket.  The version in the 
package library is for OpenGL 4.2; whereas the current version is 4.6.

Since the current version is automatically generated from files
provided by Khronos, and Khronos has changed the format of these
files, it amounts to a complete rewrite.

Those interested can track progress at https://github.com/hendrikboom3/RacketGL

Don't waste your time trying it out.  It won't work at all now.
If it seems to work, it'll be because you're accidentally using the old version.

Advice and comments are welcome.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200320164000.mxruq2zfw47fv5ps%40topoi.pooq.com.


[racket-users] opengl

2020-03-15 Thread Hendrik Boom
On Sun, Mar 15, 2020 at 02:09:22PM -0400, Hendrik Boom wrote:
> On Sun, Mar 15, 2020 at 10:48:48AM -0700, Eric Griffis wrote:
> > On Sat, Mar 14, 2020 at 10:25 PM Hendrik Boom  
> > wrote:
> > 
> > > By the way, I'm working on updating the opengl package to the current
> > > OpenGL 4.6 spec.  Because a change of format in Khronos's
> > > specfiles, it appears to require a complete rewrite to its
> > > specification translator.
> > 
> > This is good news! Through March, I'll be announcing several graphics
> > packages that could benefit from this directly. Let's try to keep a
> > conversation going.
> 
> I'm the guy behind Rackettown, https://github.com/hendrikboom3/rackettown
> It's an experiment about attribute management in procedurally-generated 
> content, although it looks like a fairly simple building-drawing 
> program.
> 
> I wanted to move to doing it in 3D, and it too a little while to realise 
> I needed to use openGl directly, rather than something like Pict3D.
> 
> I had some difficulty figuring out the arious tutorials, so I went to 
> the current red book (covering opengl 4.6) and discovered that the baby 
> steps used functions that weren't in the Racket binding (though they are 
> present in the openGL on my Linux system.
> 
> So ... I'm redoing the binding, after a fruitless attempt tp find 
> up-to-date versions of the old specfiles.
> 
> I'm hoping to test the new interface generator by comparing its output 
> with the one in the present Racket package.  That will always be a bit 
> awkward, because all the definitions are now in a new order, so a simple 
> diff won't do.  Not to mention checking out the errors that Stephan 
> discovered in the old specfiles.

For the time being I'll be calling my version opengl46.  Because I'll be 
comparing output with the old opengl, I have to have both versions 
around for a while without getting mixed up.

There seems also to be a typed opengl module within pict3d.  It's not 
clear to me how that one is related to the untyped opengl.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200315214304.b6ceyysh255otpln%40topoi.pooq.com.


Re: [racket-users] Re: Code generation performance

2020-03-15 Thread Hendrik Boom
On Sun, Mar 15, 2020 at 10:48:48AM -0700, Eric Griffis wrote:
> On Sat, Mar 14, 2020 at 10:25 PM Hendrik Boom  wrote:
> >
> > There's a port of glm in the Racket package library.
> > Is that the same one?  If not, is it also that huge?
> 
> Same repository, different branch. The master branch, which is a
> couple months old now, implements the matrix and vector types on top
> of a single, list-based, length-agnostic structure type. It's a
> snapshot of the moment I realized the volume of code and run-time
> loops were becoming a problem.
> 
> The new code is in the dev branch. It implements just the vector types
> in a manner similar to generic interfaces while also exposing a
> progression of increasingly type-specific variants. This allows me to
> prototype with a generic API, then eliminate the overhead of dynamic
> dispatch later by switching to more type-specific operations. (If it's
> not obvious, I'm working toward a pluggable type system harness, so
> the compiler can specialize and prune automatically.)
> 
> > By the way, I'm working on updating the opengl package to the current
> > OpenGL 4.6 spec.  Because a change of format in Khronos's
> > specfiles, it appears to require a complete rewrite to its
> > specification translator.
> 
> This is good news! Through March, I'll be announcing several graphics
> packages that could benefit from this directly. Let's try to keep a
> conversation going.

I'm the guy behind Rackettown, https://github.com/hendrikboom3/rackettown
It's an experiment about attribute management in procedurally-generated 
content, although it looks like a fairly simple building-drawing 
program.

I wanted to move to doing it in 3D, and it too a little while to realise 
I needed to use openGl directly, rather than something like Pict3D.

I had some difficulty figuring out the arious tutorials, so I went to 
the current red book (covering opengl 4.6) and discovered that the baby 
steps used functions that weren't in the Racket binding (though they are 
present in the openGL on my Linux system.

So ... I'm redoing the binding, after a fruitless attempt tp find 
up-to-date versions of the old specfiles.

I'm hoping to test the new interface generator by comparing its output 
with the one in the present Racket package.  That will always be a bit 
awkward, because all the definitions are now in a new order, so a simple 
diff won't do.  Not to mention checking out the errors that Stephan 
discovered in the old specfiles.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200315180922.ejb3eu6bsclm4nbf%40topoi.pooq.com.


Re: [racket-users] Re: Code generation performance

2020-03-14 Thread Hendrik Boom
On Sat, Mar 14, 2020 at 03:28:35PM -0700, Eric Griffis wrote:

> 
> I'm pretty sure that's a lot of big files. It's for a port of GLM, a 
> graphics math library that implements (among other things) fixed-length 
> vectors of up to 4 components over 5 distinct scalar types, for a total of 
> 20 distinct type-length combinations with many small variations in their 
> APIs and implementations.

There's a port of glm in the Racket package library.
Is that the same one?  If not, is it also that huge?

By the way, I'm working on updating the opengl package to the current
OpenGL 4.6 spec.  Because a change of format in Khronos's 
specfiles, it appears to require a complete rewrite to its 
specification translator.

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200315052511.2aekyt6wlidmspw6%40topoi.pooq.com.


[racket-users] Need advice on XML representation

2020-03-09 Thread Hendrik Boom
I need a recommendation.
I have a bunch of XML to read in, interpret, process, and to write out as 
corresponding Racket code.
The resulting Racket code will not be XMLis at all.
Searchni, I find mention of SXML, xexprs, and there seems to be an XML package 
as sell.

Which is mode useful, considering likely longevity, support code, compatibility 
with standards, and so forth.

Are any of these amenable producing output while reading input, in case my code 
ever needs to be run on a small computer?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200309140608.5f5tztvwns543tiv%40topoi.pooq.com.


Re: [racket-users] why is glCreateVertexArrays absent?

2020-03-08 Thread Hendrik Boom
On Sun, Mar 08, 2020 at 02:27:56PM -0700, Sorawee Porncharoenwase wrote:
> Have you tried this? https://github.com/dbenoit17/dynamic-ffi

It looks useful.  Thank you.

But I suspect using one of the existing XML readers and either compiling 
them into specfile format or using code from the existing specfile 
reader to produce the right Racket code will likely be more reliable.

I can test it on an older XML files that are close to the specfile in 
the Racket openGL module and looking for discrepancies.

The XML stuff is *very* similar to the existing specfile format.  Just a 
different surface syntax.

-- hendrik

> 
> On Sun, Mar 8, 2020 at 5:52 AM Hendrik Boom  wrote:
> 
> > On Sat, Mar 07, 2020 at 07:32:01AM -0800, Sorawee Porncharoenwase wrote:
> > > I know nothing about OpenGL, but the autogeneration
> > > <https://github.com/stephanh42/RacketGL/blob/master/opengl/readspec.rkt>
> > > seems to read the information from this directory
> > > <https://github.com/stephanh42/RacketGL/tree/master/opengl/specfiles>,
> > > which was last updated 7 years ago (2013). OpenGL 4.5 was released in
> > 2014
> > > <https://www.khronos.org/opengl/wiki/History_of_OpenGL>.
> > >
> > > I’d suggest you to contact the maintainer <https://github.com/stephanh42
> > >
> > > of the package to update it. Note, though, that the maintainer doesn’t
> > seem
> > > to be active in GitHub for almost two years now. In case you can't
> > contact
> > > the maintainer, you might need to fork the package to update it.
> >
> > I woildn't mind forking it, even just locally, but I haave not been able
> > to find current versions of the specfiles it uses.  The README says they
> > originated at http://www.opengl.org/registry/ , but I've been unable to
> > find them there.  For all I know Khronos might no longer be using that
> > form of definition.  Everything serious there appears to be a
> > human-readable pdf now.  Or a C .h file.
> >
> > So far it looks as if I may have to reverse-engineer the specfiles from
> > the .h files.
> >
> > Or maybe I'm just not good at searching.  Google has found me some even
> > more obsolete versions.  I guess I'll keep looking.
> >
> > I suppose I could try patching in the particular function specs I need
> > until I manage to get world from the maintainer.
> >
> > -- hendrik
> >
> > >
> > > On Sat, Mar 7, 2020 at 6:57 AM Hendrik Boom 
> > wrote:
> > >
> > > > Is there any technical reason why glCreateVertexArrays is missing from
> > > > the Racket OpenGL package?
> > > >
> > > > The documentation at https://docs.racket-lang.org/opengl/index.html
> > > > says that "Being automatically-generated means that it is quite
> > complete."
> > > >
> > > > So I would have expected it to be present.
> > > >
> > > > But it is not present either in the implemetation or in the
> > > > documentation ( https://docs.racket-lang.org/opengl/glC___.html )
> > > >
> > > > I do have openGL 4.5 on my system, so it's not because the opengl
> > > > library is too old (which did happen on an older computer).
> > > >
> > > > Would bringing it up-to-date perhaps interfere with the operation of
> > > > other packages?
> > > >
> > > > -- 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.
> > > > To view this discussion on the web visit
> > > >
> > https://groups.google.com/d/msgid/racket-users/20200307145657.gq7xgysyvkz5yn7y%40topoi.pooq.com
> > > > .
> > > >
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> > Groups "Racket Users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> > an email to racket-users+unsubscr...@googlegroups.com.
> > > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/CADcuegsktFyB2iRV0-nV018mFOeO8Fhqe6mbp_4_ksesXX%3DZtQ%40mail.gmail.com
> > .
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Racket Users" group.
> > To 

[racket-users] ANSWER, not solution: why opengl module not up-to-date

2020-03-08 Thread Hendrik Boom
On Sat, Mar 07, 2020 at 07:32:01AM -0800, Sorawee Porncharoenwase wrote:
> I know nothing about OpenGL, but the autogeneration
> <https://github.com/stephanh42/RacketGL/blob/master/opengl/readspec.rkt>
> seems to read the information from this directory
> <https://github.com/stephanh42/RacketGL/tree/master/opengl/specfiles>,
> which was last updated 7 years ago (2013). OpenGL 4.5 was released in 2014
> <https://www.khronos.org/opengl/wiki/History_of_OpenGL>.
> 
> I’d suggest you to contact the maintainer <https://github.com/stephanh42>
> of the package to update it. Note, though, that the maintainer doesn’t seem
> to be active in GitHub for almost two years now. In case you can't contact
> the maintainer, you might need to fork the package to update it.

It turns out there *is* a technical reason why the machine-generated 
opengl binding is not up-to-date.

As stated in 
https://community.khronos.org/t/new-xml-based-api-registry-released/70176
the specfiles are no longer being produced.  Instead, they are providing 
the same information coded as XML.

(I've also seen a few very old comments indicating that the old 
specfiles has serious bogs in them; indeed, setphanh42 had to patch 
those official specfiles before they were usable.)

It looks as if these XML files are used to produce the official C 
header files, so there is a chance they're correct.  And there appears 
to be a python script to produce those headers, so there's hope.

So the entire program converting specfiles to Racket code will have to 
be rewritten.

Or perhaps I just need a compatibility shim to translate the xml into 
specfile format... xml is at least a fairly well-supported notation.

Or maybe their python code can be repurposed.
Will look into it.

-- hendrik
> 
> On Sat, Mar 7, 2020 at 6:57 AM Hendrik Boom  wrote:
> 
> > Is there any technical reason why glCreateVertexArrays is missing from
> > the Racket OpenGL package?
> >
> > The documentation at https://docs.racket-lang.org/opengl/index.html
> > says that "Being automatically-generated means that it is quite complete."
> >
> > So I would have expected it to be present.
> >
> > But it is not present either in the implemetation or in the
> > documentation ( https://docs.racket-lang.org/opengl/glC___.html )
> >
> > I do have openGL 4.5 on my system, so it's not because the opengl
> > library is too old (which did happen on an older computer).
> >
> > Would bringing it up-to-date perhaps interfere with the operation of
> > other packages?
> >
> > -- 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.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/20200307145657.gq7xgysyvkz5yn7y%40topoi.pooq.com
> > .
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CADcuegsktFyB2iRV0-nV018mFOeO8Fhqe6mbp_4_ksesXX%3DZtQ%40mail.gmail.com.

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


Re: [racket-users] why is glCreateVertexArrays absent?

2020-03-08 Thread Hendrik Boom
On Sat, Mar 07, 2020 at 07:32:01AM -0800, Sorawee Porncharoenwase wrote:
> I know nothing about OpenGL, but the autogeneration
> <https://github.com/stephanh42/RacketGL/blob/master/opengl/readspec.rkt>
> seems to read the information from this directory
> <https://github.com/stephanh42/RacketGL/tree/master/opengl/specfiles>,
> which was last updated 7 years ago (2013). OpenGL 4.5 was released in 2014
> <https://www.khronos.org/opengl/wiki/History_of_OpenGL>.
> 
> I’d suggest you to contact the maintainer <https://github.com/stephanh42>
> of the package to update it. Note, though, that the maintainer doesn’t seem
> to be active in GitHub for almost two years now. In case you can't contact
> the maintainer, you might need to fork the package to update it.

I woildn't mind forking it, even just locally, but I haave not been able 
to find current versions of the specfiles it uses.  The README says they 
originated at http://www.opengl.org/registry/ , but I've been unable to 
find them there.  For all I know Khronos might no longer be using that 
form of definition.  Everything serious there appears to be a 
human-readable pdf now.  Or a C .h file.

So far it looks as if I may have to reverse-engineer the specfiles from 
the .h files.

Or maybe I'm just not good at searching.  Google has found me some even 
more obsolete versions.  I guess I'll keep looking.

I suppose I could try patching in the particular function specs I need 
until I manage to get world from the maintainer.

-- hendrik

> 
> On Sat, Mar 7, 2020 at 6:57 AM Hendrik Boom  wrote:
> 
> > Is there any technical reason why glCreateVertexArrays is missing from
> > the Racket OpenGL package?
> >
> > The documentation at https://docs.racket-lang.org/opengl/index.html
> > says that "Being automatically-generated means that it is quite complete."
> >
> > So I would have expected it to be present.
> >
> > But it is not present either in the implemetation or in the
> > documentation ( https://docs.racket-lang.org/opengl/glC___.html )
> >
> > I do have openGL 4.5 on my system, so it's not because the opengl
> > library is too old (which did happen on an older computer).
> >
> > Would bringing it up-to-date perhaps interfere with the operation of
> > other packages?
> >
> > -- 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.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/20200307145657.gq7xgysyvkz5yn7y%40topoi.pooq.com
> > .
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CADcuegsktFyB2iRV0-nV018mFOeO8Fhqe6mbp_4_ksesXX%3DZtQ%40mail.gmail.com.

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


[racket-users] why is glCreateVertexArrays absent?

2020-03-07 Thread Hendrik Boom
Is there any technical reason why glCreateVertexArrays is missing from
the Racket OpenGL package?

The documentation at https://docs.racket-lang.org/opengl/index.html
says that "Being automatically-generated means that it is quite complete."

So I would have expected it to be present.

But it is not present either in the implemetation or in the 
documentation ( https://docs.racket-lang.org/opengl/glC___.html )

I do have openGL 4.5 on my system, so it's not because the opengl 
library is too old (which did happen on an older computer).

Would bringing it up-to-date perhaps interfere with the operation of 
other packages?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200307145657.gq7xgysyvkz5yn7y%40topoi.pooq.com.


Re: [racket-users] bad response from server

2020-03-03 Thread Hendrik Boom
On Mon, Mar 02, 2020 at 12:54:41PM -0700, Matthew Flatt wrote:
> A snapshot catalog only lasts for a limited time, and v7.4.0.1 was a
> very long time ago in snapshot terms.

I see. That's what I suspected.

> 
> So, the short answer is to upgrade to a new snapshot --- or switch to a
> release, which doesn't time out.

And I switched to a release, which was more current than the snapshot,
and it worked, as expected.

-- hendrik
> 
> At Mon, 2 Mar 2020 14:46:25 -0500, Hendrik Boom wrote:
> > When trying to u[dat catalog I get a message
> > 
> > get-all-pkg-details-from-catalogs: bad response from server
> >   url: 
> > https://www.cs.utah.edu/plt/snapshots/20190720-93f4c9226b/catalog/pkgs-all?vers
> > ion=7.4.0.1
> >   response: #f
> > 
> >   (for-loop . #(struct:srcloc 
> > # 299 2 
> > 11021 1759))
> >   (for-loop . #(struct:srcloc 
> > #
> >  
> > 37 4 1350 2495))
> >   (pkg-catalog-update-local13 . #(struct:srcloc 
> > #
> >  
> > 15 0 286 3561))
> >   (#f . #(struct:srcloc 
> > # > first.rkt> 555 3 23822 3167))
> >   (for-loop . #(struct:srcloc 
> > # > ate/catalog-update.rkt> 99 7 3851 437))
> >   (.../more-scheme.rkt:261:28 . #f)
> > 
> > 
> > I'm running using an old nightly build.
> > Does this mean I need to install a new daily build?
> > Or is the regular Racket distribution 
> > already more up-tp-date them 2019 07 20?
> > 
> > -- 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.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/20200302194625.bnkor6si3bkecxsx%
> > 40topoi.pooq.com.

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


[racket-users] bad response from server

2020-03-02 Thread Hendrik Boom
When trying to u[dat catalog I get a message

get-all-pkg-details-from-catalogs: bad response from server
  url: 
https://www.cs.utah.edu/plt/snapshots/20190720-93f4c9226b/catalog/pkgs-all?version=7.4.0.1
  response: #f

  (for-loop . #(struct:srcloc 
# 299 2 
11021 1759))
  (for-loop . #(struct:srcloc 
# 37 
4 1350 2495))
  (pkg-catalog-update-local13 . #(struct:srcloc 
# 15 
0 286 3561))
  (#f . #(struct:srcloc 
#
 555 3 23822 3167))
  (for-loop . #(struct:srcloc 
#
 99 7 3851 437))
  (.../more-scheme.rkt:261:28 . #f)


I'm running using an old nightly build.
Does this mean I need to install a new daily build?
Or is the regular Racket distribution 
already more up-tp-date them 2019 07 20?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200302194625.bnkor6si3bkecxsx%40topoi.pooq.com.


[racket-users] Implementation of paraeters

2020-03-02 Thread Hendrik Boom
How are parameters implemented.  My conceptial model is an association 
list (like in the original Lisp 1.5 manuel) would suffice, but that can 
lead to long searches.

What is actually done in Racket?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200302174453.7lpltlzivo6iids7%40topoi.pooq.com.


Re: [racket-users] Re: quick racket editor survey

2020-02-29 Thread Hendrik Boom
On Sat, Feb 29, 2020 at 07:24:19PM -0500, John Cowan wrote:
> MicroEmacs was based on MINT ("MINT Is Not Trac").  TRAC is a language
> based entirely on macroprocessing, with an implementation written in Perl
> at <http://www.catb.org/retro/trac.shar.gz>.  But there were a lot of other
> differences unrelated to Elisp vs. MINT.

Sounds like there was more than one microEmacs.  Interesting.

-- hendrik

> 
> On Sat, Feb 29, 2020 at 12:56 PM Hendrik Boom 
> wrote:
> 
> > On Sat, Feb 29, 2020 at 12:01:27PM +0100, Stephen De Gabrielle wrote:
> > > Hi james
> > >
> > > * I noticed several people at Racketcon using, not Aquamacs, but another
> > > GUI version of Emacs.  Is there any particular reason to pick one of
> > these
> > > over another?*
> > >
> > > Maybe spacemacs? (I don’t use spacEmacs so I’m only guessing based on the
> > > survey response)
> >
> > No idea.  I haven't even heard of those.
> >
> > I use emacs for everything except Racket.
> >
> > In my life, I've used emacs, zemacs, and microemacs.
> >
> > Of these three, microemaacs was the only independent implementation,
> > based on an language that wasn't a Lisp derivative.  (I think a
> > byte-coded or threaded-coded stack language, but that was a long
> > time ago.
> >
> > -- hendrik
> >
> > >
> > > S.
> > >
> > > On Thu, 27 Feb 2020 at 21:20, James Platt  wrote:
> > >
> > > >
> > > > On Feb 26, 2020, at 10:44 AM, Stephen De Gabrielle wrote:
> > > >
> > > > > At 62 response, sadly the histogram doesn't show how many people use
> > two
> > > > or even three editors.
> > > > > https://www.surveymonkey.com/results/SM-GBD6J7ST7/
> > > >
> > > > I am in transition between DrRacket and Emacs so I checked both of
> > those
> > > > two, myself.  That was after you had posted your Venn diagram.  I was
> > > > mostly using DrRacket before but now I am mostly using Emacs.  I still
> > like
> > > > the features in DrRacket for tracing definitions and use it for that.
> > > > Also, I have two monitors and Gnu Emacs in the terminal does fine for
> > > > splitting the screen on one monitor but not so well across two
> > monitors.
> > > > So, on the occasions where I want another file open on my second
> > monitor, I
> > > > have been using Emacs on the main monitor but DrRacket on the second.
> > I
> > > > probably could use Emacs on multiple monitors if I used one of the Mac
> > > > specific GUI versions.  I noticed several people at Racketcon using,
> > not
> > > > Aquamacs, but another GUI version of Emacs.  Is there any particular
> > reason
> > > > to pick one of these over another?
> > > >
> > > > I also have set up a Racket development environment in Termux on my
> > > > Android tablet.  Since there is no version of DrRacket for Android, I
> > am
> > > > exclusively using Emacs there.  Having said that, I haven't actually
> > done
> > > > any more yet than test it to see that it works.
> > > >
> > > >
> > > > James
> > > >
> > > > --
> > > > 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/46BF6E5F-A613-4FF5-9C9B-C1526B31B54A%40biomantica.com
> > > > .
> > > >
> > > --
> > > 
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> > Groups "Racket Users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> > an email to racket-users+unsubscr...@googlegroups.com.
> > > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/CAGHj7-J35yMXr7jWi-1ifQ5tDh0r6ibfv6UUUMZtZrR%2Bugf3Jw%40mail.gmail.com
> > .
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to racket-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/20200229175601.6tm6chr4c5o2tclh%40topoi.pooq.com
> > .
> >

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


Re: [racket-users] Re: quick racket editor survey

2020-02-29 Thread Hendrik Boom
On Sat, Feb 29, 2020 at 12:01:27PM +0100, Stephen De Gabrielle wrote:
> Hi james
> 
> * I noticed several people at Racketcon using, not Aquamacs, but another
> GUI version of Emacs.  Is there any particular reason to pick one of these
> over another?*
> 
> Maybe spacemacs? (I don’t use spacEmacs so I’m only guessing based on the
> survey response)

No idea.  I haven't even heard of those.

I use emacs for everything except Racket.

In my life, I've used emacs, zemacs, and microemacs.

Of these three, microemaacs was the only independent implementation,
based on an language that wasn't a Lisp derivative.  (I think a 
byte-coded or threaded-coded stack language, but that was a long 
time ago. 

-- hendrik

> 
> S.
> 
> On Thu, 27 Feb 2020 at 21:20, James Platt  wrote:
> 
> >
> > On Feb 26, 2020, at 10:44 AM, Stephen De Gabrielle wrote:
> >
> > > At 62 response, sadly the histogram doesn't show how many people use two
> > or even three editors.
> > > https://www.surveymonkey.com/results/SM-GBD6J7ST7/
> >
> > I am in transition between DrRacket and Emacs so I checked both of those
> > two, myself.  That was after you had posted your Venn diagram.  I was
> > mostly using DrRacket before but now I am mostly using Emacs.  I still like
> > the features in DrRacket for tracing definitions and use it for that.
> > Also, I have two monitors and Gnu Emacs in the terminal does fine for
> > splitting the screen on one monitor but not so well across two monitors.
> > So, on the occasions where I want another file open on my second monitor, I
> > have been using Emacs on the main monitor but DrRacket on the second.  I
> > probably could use Emacs on multiple monitors if I used one of the Mac
> > specific GUI versions.  I noticed several people at Racketcon using, not
> > Aquamacs, but another GUI version of Emacs.  Is there any particular reason
> > to pick one of these over another?
> >
> > I also have set up a Racket development environment in Termux on my
> > Android tablet.  Since there is no version of DrRacket for Android, I am
> > exclusively using Emacs there.  Having said that, I haven't actually done
> > any more yet than test it to see that it works.
> >
> >
> > James
> >
> > --
> > 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/46BF6E5F-A613-4FF5-9C9B-C1526B31B54A%40biomantica.com
> > .
> >
> -- 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAGHj7-J35yMXr7jWi-1ifQ5tDh0r6ibfv6UUUMZtZrR%2Bugf3Jw%40mail.gmail.com.

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


Re: [racket-users] a little bug

2020-02-28 Thread Hendrik Boom
On Fri, Feb 28, 2020 at 07:11:02AM -0600, Robby Findler wrote:
> Oh, sorry-- I misunderstood.
> 
> In v7.5, there will be, in some cases, a source location after you
> dismiss that dialog. In the pre-release builds, that's been improved
> somewhat and source location information is more reliably available.

Excellent.

> That said, there are limitations and it isn't always available.

Of course.  If the entire process gets shut down because of memory
 overrun there isn't much left to report on.

> 
> Thanks for using DrR!

It's the easiest way to use Racket.

-- hendrik

> 
> Robby
> 
> On Fri, Feb 28, 2020 at 6:31 AM Hendrik Boom  wrote:
> >
> > On Fri, Feb 28, 2020 at 06:02:31AM -0600, Robby Findler wrote:
> > > I agree that would be great. In the meantime, the Run button does a better
> > > job with error reporting in various ways, including this one so hopefully
> > > you can try that?
> >
> > That's what I was using.  There was a popup message that wasn't any more
> > informative.
> > It says:
> >
> > - The evaluation thread is no longer running, so
> >   no evaluation can take place until the next
> >   execution.
> >
> >   The program ran out of memory.
> >   [V]Show thid dialog ext time
> > [Increase memory limit to 256 megabytes][OK]
> >
> > I'm mentioning this to indicate a way the drracket uer-interface can be
> > improved, especially for beginners.
> >
> > I'm not asking Racket maintainers to step in and debug my code.
> >
> > (Further analysis (by deleting code until there was almost nothing left)
> > indicates it crashed during processing the #lang line at the start.
> > I have started private correspondence with the language author.)
> >
> > -- hendrik
> > >
> > > Robby
> > >
> > > On Fri, Feb 28, 2020 at 5:45 AM Hendrik Boom  
> > > wrote:
> > >
> > > >
> > > > When Racket detects the out-of-memory condition during "background
> > > > processing", it would be useful i the out-of-memory message were to 
> > > > point
> > > > out which particular piece of source text it was having trouble with.  
> > > > Just
> > > > the line number where the expression started that the REPL was having
> > > > trouble with would be a huge help.
> > > >
> > > > And by the way, if Dr. Racket were to be a she, she would be addressed 
> > > > in
> > > > Quebec as Dre. Racket.
> > > >
> > > > On Friday, 5 February 2016 19:19:46 UTC-5, jon stenerson wrote:
> > > >
> > > >> lol. Don't be sorry.  Speaking of anthropomorphization, I really love 
> > > >> Dr
> > > >> Racket and hope I didn't hurt his feelings (Or is Dr Racket a she?). I
> > > >> employ his services whenever I can. I don't mean to be a whiner; he
> > > >> deserves better than that!
> > > >>
> > > >> Jon
> > > >>
> > > >> On 2/5/2016 3:44 PM, Robby Findler wrote:
> > > >> > Sorry we can't do better. And it is really amazing how I actually
> > > >> > think so anthropomorphically about these things. :) That really was a
> > > >> > literal brain dump.
> > > >> >
> > > >> > Robby
> > > >> >
> > > >> > On Fri, Feb 5, 2016 at 3:53 PM, jon stenerson 
> > > >> wrote:
> > > >> >> Thanks for the explanation. I appreciate it.
> > > >> >>
> > > >> >>
> > > >> >> On 2/5/2016 1:55 PM, Robby Findler wrote:
> > > >> >>> In general, DrRacket does not promise to avoid this situation. Let 
> > > >> >>> me
> > > >> >>> explain a little bit. This program is effectively equivalent to 
> > > >> >>> this
> > > >> >>> one:
> > > >> >>>
> > > >> >>> #lang racket/base
> > > >> >>> (define (run l)
> > > >> >>> (run (cons 'x l)))
> > > >> >>> (run '())
> > > >> >>>
> > > >> >>> (but running at compile time, which is why things happen
> > > >> >>> automatically, but lets leave that aside for now).
> > > >> >>>
> > > >> >>> So when you run that program, DrRacket is asking the operating 
> > > >> >

Re: [racket-users] a little bug

2020-02-28 Thread Hendrik Boom
On Fri, Feb 28, 2020 at 06:02:31AM -0600, Robby Findler wrote:
> I agree that would be great. In the meantime, the Run button does a better
> job with error reporting in various ways, including this one so hopefully
> you can try that?

That's what I was using.  There was a popup message that wasn't any more 
informative.
It says:

- The evaluation thread is no longer running, so
  no evaluation can take place until the next
  execution.

  The program ran out of memory.
  [V]Show thid dialog ext time
[Increase memory limit to 256 megabytes][OK]

I'm mentioning this to indicate a way the drracket uer-interface can be 
improved, especially for beginners.

I'm not asking Racket maintainers to step in and debug my code.

(Further analysis (by deleting code until there was almost nothing left) 
indicates it crashed during processing the #lang line at the start.
I have started private correspondence with the language author.)

-- hendrik
> 
> Robby
> 
> On Fri, Feb 28, 2020 at 5:45 AM Hendrik Boom  wrote:
> 
> >
> > When Racket detects the out-of-memory condition during "background
> > processing", it would be useful i the out-of-memory message were to point
> > out which particular piece of source text it was having trouble with.  Just
> > the line number where the expression started that the REPL was having
> > trouble with would be a huge help.
> >
> > And by the way, if Dr. Racket were to be a she, she would be addressed in
> > Quebec as Dre. Racket.
> >
> > On Friday, 5 February 2016 19:19:46 UTC-5, jon stenerson wrote:
> >
> >> lol. Don't be sorry.  Speaking of anthropomorphization, I really love Dr
> >> Racket and hope I didn't hurt his feelings (Or is Dr Racket a she?). I
> >> employ his services whenever I can. I don't mean to be a whiner; he
> >> deserves better than that!
> >>
> >> Jon
> >>
> >> On 2/5/2016 3:44 PM, Robby Findler wrote:
> >> > Sorry we can't do better. And it is really amazing how I actually
> >> > think so anthropomorphically about these things. :) That really was a
> >> > literal brain dump.
> >> >
> >> > Robby
> >> >
> >> > On Fri, Feb 5, 2016 at 3:53 PM, jon stenerson 
> >> wrote:
> >> >> Thanks for the explanation. I appreciate it.
> >> >>
> >> >>
> >> >> On 2/5/2016 1:55 PM, Robby Findler wrote:
> >> >>> In general, DrRacket does not promise to avoid this situation. Let me
> >> >>> explain a little bit. This program is effectively equivalent to this
> >> >>> one:
> >> >>>
> >> >>> #lang racket/base
> >> >>> (define (run l)
> >> >>> (run (cons 'x l)))
> >> >>> (run '())
> >> >>>
> >> >>> (but running at compile time, which is why things happen
> >> >>> automatically, but lets leave that aside for now).
> >> >>>
> >> >>> So when you run that program, DrRacket is asking the operating system
> >> >>> for all of its memory. At some point, the operating system says
> >> >>> "sorry, no, we're out of memory" and since the program running inside
> >> >>> DrRacket doesn't really care that we're out of memory, the operating
> >> >>> system responds with "die!". And so DrRacket dies.
> >> >>>
> >> >>> There are two ways we try to do better. First: we can set limits on
> >> >>> the memory. But if the limit is set to be higher than the amount of
> >> >>> memory available on the machine, then it is as if the memory limit
> >> >>> isn't set. Also worth noting at this point: the way that DrRacket's
> >> >>> counting of "how much memory" is only loosely related to the way that
> >> >>> your machine's vendor or the OS counts. There are some constant
> >> >>> factors of difference there that depend on things like how the
> >> garbage
> >> >>> collector is configured and how many other programs are running on
> >> >>> your system and what they are doing (like the OS itself likes to have
> >> >>> some of the memory and it (quite reasonably) doesn't want to share
> >> >>> that memory).
> >> >>>
> >> >>> The second way is that the OS will sometimes say "you are about to
> >> >>> cause me to exhaust all of the system's memory and if you do th

Re: [racket-users] a little bug

2020-02-28 Thread Hendrik Boom

When Racket detects the out-of-memory condition during "background 
processing", it would be useful i the out-of-memory message were to point 
out which particular piece of source text it was having trouble with.  Just 
the line number where the expression started that the REPL was having 
trouble with would be a huge help.

And by the way, if Dr. Racket were to be a she, she would be addressed in 
Quebec as Dre. Racket.

On Friday, 5 February 2016 19:19:46 UTC-5, jon stenerson wrote:
>
> lol. Don't be sorry.  Speaking of anthropomorphization, I really love Dr 
> Racket and hope I didn't hurt his feelings (Or is Dr Racket a she?). I 
> employ his services whenever I can. I don't mean to be a whiner; he 
> deserves better than that! 
>
> Jon 
>
> On 2/5/2016 3:44 PM, Robby Findler wrote: 
> > Sorry we can't do better. And it is really amazing how I actually 
> > think so anthropomorphically about these things. :) That really was a 
> > literal brain dump. 
> > 
> > Robby 
> > 
> > On Fri, Feb 5, 2016 at 3:53 PM, jon stenerson  > wrote: 
> >> Thanks for the explanation. I appreciate it. 
> >> 
> >> 
> >> On 2/5/2016 1:55 PM, Robby Findler wrote: 
> >>> In general, DrRacket does not promise to avoid this situation. Let me 
> >>> explain a little bit. This program is effectively equivalent to this 
> >>> one: 
> >>> 
> >>> #lang racket/base 
> >>> (define (run l) 
> >>> (run (cons 'x l))) 
> >>> (run '()) 
> >>> 
> >>> (but running at compile time, which is why things happen 
> >>> automatically, but lets leave that aside for now). 
> >>> 
> >>> So when you run that program, DrRacket is asking the operating system 
> >>> for all of its memory. At some point, the operating system says 
> >>> "sorry, no, we're out of memory" and since the program running inside 
> >>> DrRacket doesn't really care that we're out of memory, the operating 
> >>> system responds with "die!". And so DrRacket dies. 
> >>> 
> >>> There are two ways we try to do better. First: we can set limits on 
> >>> the memory. But if the limit is set to be higher than the amount of 
> >>> memory available on the machine, then it is as if the memory limit 
> >>> isn't set. Also worth noting at this point: the way that DrRacket's 
> >>> counting of "how much memory" is only loosely related to the way that 
> >>> your machine's vendor or the OS counts. There are some constant 
> >>> factors of difference there that depend on things like how the garbage 
> >>> collector is configured and how many other programs are running on 
> >>> your system and what they are doing (like the OS itself likes to have 
> >>> some of the memory and it (quite reasonably) doesn't want to share 
> >>> that memory). 
> >>> 
> >>> The second way is that the OS will sometimes say "you are about to 
> >>> cause me to exhaust all of the system's memory and if you do that, I 
> >>> will kill you" at which point the GC inside Racket responds with 
> >>> "okay, I'll just die first". The main advantage of this is that you 
> >>> get an error message saying "out of memory" from Racket instead of an 
> >>> error message saying "I killed your program" from the OS (which is the 
> >>> message you're getting). It turns out to be remarkably difficult to 
> >>> get this error message to work in all situations. We're better than we 
> >>> used to be at it, but at some level, the best we can do in that case 
> >>> is really just to change the text of the error message. When we're out 
> >>> of memory like that, it's very very hard to recover if the limits are 
> >>> not set up ahead of time (i.e. back to the previous paragraph). 
> >>> 
> >>> I hope this clears up the issue somewhat. 
> >>> 
> >>> In the meantime, I suggest you lower the memory limit for your 
> machine. 
> >>> 
> >>> Robby 
> >>> 
> >>> 
> >>> 
> >>> On Fri, Feb 5, 2016 at 10:53 AM, jon stenerson  > 
> >>> wrote: 
>  Actually you don't even have to run the program. With memory limit 
> set to 
>  1024, just open a file containing the expression and wait. After a 
> minute 
>  or 
>  two DrRacket puts up a MSVC runtime error dialog. 
>  
>  
>  On 2/5/2016 9:39 AM, jon stenerson wrote: 
> > Setting the limit lower helped. Thanks. I did not see that message 
> about 
> > Background Expansion Terminated before. Now I do. 
> > 
> > Jon 
> > 
> > On 2/5/2016 6:55 AM, Robby Findler wrote: 
> >> It took a while for mine for the custodian limit to be reached and 
> for 
> >> the expansion to run out of memory. It may be that the threshhold 
> for 
> >> the memory use is too high on some systems. Maybe the right thing 
> is 
> >> to set the default a bit lower? 
> >> 
> >> Jon: if you open the "Racket" menu you should see a "Limit 
> Memory..." 
> >> menu item. How does DrRacket do if you change the number in there 
> to 
> >> 256 and then paste the program into the definitions window? Do you 
> see 
> >> the red message at the bottom of 

  1   2   3   4   >