Re: [racket-users] Racket in a web page (via Whalesong)

2015-12-30 Thread Greg Trzeciak
Thanks Jens,

I am actually more interested with long term viability of Whalesong than being 
able to run it right now, hence my questions related to bootstrapped version 
(and compiler + expander in Racket). My current understanding is that outside 
of narrow use Whalesong is too risky a bet at least until it becomes 
selfhosted. Please correct me if I am wrong but I am not a compiler person 
rather someone deciding on the future direction of his projects impressed with 
Racket but unsure on the direction and priorities for future Racket.  
I am also writing this post to show there is an interest in Javascript Racket 
(and ClojureScript competitor).

Best wishes

Greg

On Wednesday, December 30, 2015 at 6:48:29 PM UTC+1, Jens Axel Søgaard wrote:
> As far as I know no one is working on updating Whalesong to the latest 
> version of Racket.
> However it is easy to download an older version of Racket where Whalesong 
> works fine.
> 
> 
> FWIW there are two aspects that needs work:
> 
> 
>   - handle (maybe just ignore) the (small) recent changes in the bytecode
>   - figure out how to adapt Whalesong to the new macro expander

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] typed/racket involved in matched (or)

2015-12-30 Thread JCG
That's okay.  I wrote a really fancy workaround, whose API consists of (S).

(: S (-> (Option String) String))
(define (S s)
  (cast S String))

By the way, Typed Racket picked up the second statically discovered bug as I 
keep moving stuff out of untyped modules.  Not surprisingly, neither bug had 
been discovered in usage, but both instances were valid possible uses of the 
system.   So, having to punt with (S) is an excellent tradeoff.

Thanks for continued Racket evolution.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket in a web page (via Whalesong)

2015-12-30 Thread Jens Axel Søgaard
As far as I know no one is working on updating Whalesong to the latest
version of Racket.
However it is easy to download an older version of Racket where Whalesong
works fine.

FWIW there are two aspects that needs work:

  - handle (maybe just ignore) the (small) recent changes in the bytecode
  - figure out how to adapt Whalesong to the new macro expander

-- 
Jens Axel Søgaard

2015-12-30 18:32 GMT+01:00 Greg Trzeciak :

> Is there any update on
>
> > The problem is that the functions  expand  and  compile  are implemented
> in C.
> > This means that it is not possible to run the bytecode-to-JavaScript
> compiler on neither the expander
> > nor the expanded-code-to-bytecode. Two essential components are
> therefore missing before
> > it is possible to bootstrap Racket in Whalesong.
> >
> >
> > The expander was recently reimplemented. Maybe there is hope for an
> expander written in Racket
> > at some point.
>
> Hi
>
> Is there any update on the progress of rewriting compiler and expander in
> Racket. From this RacketCon2014 video:
> https://youtu.be/Uw8m4QF4k1E?t=22m55s
> my understanding is that it is an ogoing process that is currently
> happening.
>
> I didn't find any more recent examples of roadmap and milestones for
> Racket and would gladly satisfy my curiosity.
>
> Also, what other work (assuming compiler and expander done) would be
> required in order to bring Whalesong on par with ClojureScript?
>
> Greg
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
-- 
Jens Axel Søgaard

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket in a web page (via Whalesong)

2015-12-30 Thread Greg Trzeciak
Is there any update on

> The problem is that the functions  expand  and  compile  are implemented in 
> C. 
> This means that it is not possible to run the bytecode-to-JavaScript compiler 
> on neither the expander 
> nor the expanded-code-to-bytecode. Two essential components are therefore 
> missing before
> it is possible to bootstrap Racket in Whalesong.
> 
> 
> The expander was recently reimplemented. Maybe there is hope for an expander 
> written in Racket
> at some point.

Hi

Is there any update on the progress of rewriting compiler and expander in 
Racket. From this RacketCon2014 video: https://youtu.be/Uw8m4QF4k1E?t=22m55s
my understanding is that it is an ogoing process that is currently happening.

I didn't find any more recent examples of roadmap and milestones for Racket and 
would gladly satisfy my curiosity.

Also, what other work (assuming compiler and expander done) would be required 
in order to bring Whalesong on par with ClojureScript?

Greg

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] typed/racket involved in matched (or)

2015-12-30 Thread Sam Tobin-Hochstadt
Unfortunately, the way that `or` patterns work in `match` doesn't allow
Typed Racket to figure out that those are always strings. You could try the
pattern `(list (or "CBOE" "XCBOE") NAME)` for this specific example, but
there isn't a fix in general, aside from not using `or` patterns or using
assert/cast.

Sam

On Wed, Dec 30, 2015 at 12:07 PM JCG  wrote:

> Within typed/racket, the type of NAME below is (U False String).  The type
> of COUNTRY and INDICATOR are simply String.  The values are always String.
> All the (or) based patterns
>
> Any idea about how to have the (or pattern1 pattern2) identify as String?
> I can cast it of course, but prefer not to.
>
>
> (match a-list-of-strings
>
> [(list "COUNTRY" COUNTRY INDICATOR)
>  (trading-economics COUNTRY INDICATOR)]
>
> ...
>
>  [(or (list "CBOE" NAME)
> (list "XCBOE" NAME))
>  #:when (member NAME cboe-record-names)
>  (cboe-series NAME)]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] typed/racket involved in matched (or)

2015-12-30 Thread JCG
Within typed/racket, the type of NAME below is (U False String).  The type of 
COUNTRY and INDICATOR are simply String.  The values are always String.  All 
the (or) based patterns 

Any idea about how to have the (or pattern1 pattern2) identify as String?  I 
can cast it of course, but prefer not to.


(match a-list-of-strings

[(list "COUNTRY" COUNTRY INDICATOR)
 (trading-economics COUNTRY INDICATOR)]

...

 [(or (list "CBOE" NAME)
(list "XCBOE" NAME))
 #:when (member NAME cboe-record-names)
 (cboe-series NAME)]

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Can scribble/lp2 typeset comments within chunks?

2015-12-30 Thread Matthew Flatt
I've adjusted `chunk` to strip away `code:comment`, etc., and so it now
works with `scribble/comment-reader`.

A better approach in the future might be to add a `chunk` variant
that's based on `codeblock` instead of `racketblock`, but I didn't try
that.

At Fri, 18 Dec 2015 12:20:13 -0800, Matthew Butterick wrote:
> First try: seemingly not, because this file does not render to HTML with 
> comments:
> 
> ;;;
> #lang scribble/lp2
> 
> @chunk[<*>
>(define (f x) ; not g
>  ;; amazing computation
>  (* x x))]
> ;;;
> 
> In HTML it becomes this:
> 
> <*> ::=
> (define (f x)
>  
>   (* x x))
> 
> 
> Second try: Docs suggest use of CHUNK + UNSYNTAX [1] but this next try fails 
> with "UNSYNTAX: unbound identifier"
> 
> ;;;
> #lang scribble/lp2
> 
> @CHUNK[<*>
>(define (f x) ; not g
>  @UNSYNTAX{;; amazing computation}
>  (* x x))]
> ;;;
> 
> 
> Third try: also tried scribble/comment-reader [2] but this doesn't work 
> (apparently because `racketblock` knows about `code:comment` but `chunk` does 
> not:
> 
> ;;;
> #lang scribble/lp2
> 
> @#reader scribble/comment-reader
> (chunk <*>
>   (define (f x) ; not g
> ;; amazing computation
> (* x x)))
> ;;;
> 
> [1] 
> http://docs.racket-lang.org/scribble/lp.html?q=CHUNK#%28form._%28%28lib._scribb
> le%2Flp..rkt%29._.C.H.U.N.K%29%29
> 
> [2] 
> http://docs.racket-lang.org/scribble/scribble_manual_code.html?q=comment-reader
> #%28mod-path._scribble%2Fcomment-reader%29
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] how to achieve internal cross-references in scribble/lp2

2015-12-30 Thread Matthew Flatt
With the current implementation of `scribble/lp2`, you could create a
"dummy.rkt" module

  #lang racket/base
  (define foo 'foo)
  (define bar 'bar)
  (provide (all-defined-out))

and use `(require (for-label "dummy.rkt"))` with
`@declare-exporting["dummy.rkt"]` to get hyperlinking.


But I imagine you'd rather not duplicate the definitions in a separate
file. I've adjusted `scribble/lp2` to create the `doc` submodule with
`module*` instead of `module`, so there's some change of referencing
the runnable module from the documentation module.

Still, `@(require (for-label "test.scrbl"))` won't work, because the
module is first expanded as-is, and then ex-expanded in a `doc`
submodule. I haven't yet found a good way of connecting the two. Here's
a hack to try for now:

 @(define-syntax (self-for-label stx)
;; Detect whether we've in the `doc` submodule:
(if (list? (resolved-module-path-name
(variable-reference->resolved-module-path
 (#%variable-reference
(syntax-local-introduce
 #`(begin
(require (for-label (submod "..")))
(declare-exporting #:use-sources
   (,(car
  (resolved-module-path-name
   (variable-reference->resolved-module-path
(#%variable-reference
#'(void)))
 @(self-for-label)

If `foo` and `bar` are meant to be documented as coming from a
particular module, you'll probably want to through out the
`declare-exporting` part and include a direct `defmodule` declaration
in your document, instead.

At Tue, 29 Dec 2015 15:19:13 -0800, Matthew Butterick wrote:
> Bug or insurmountable limitation? In the sample scribble/lp2 file below, the 
> @racket[foo] reference at the end will *not* end up hyperlinked to the 
> documentation for `foo` above it. I infer this is because `foo` and `bar` are 
> treated as unbound identifiers.
> 
> If you add @(require (for-label "test.scrbl")) to the top, you get a 
> loading-cycle error.
> 
> 
> 
> ;;;
> ;;; test.scrbl
> ;;;
> 
> #lang scribble/lp2
> @(require scribble/manual)
> 
> @title[#:style manual-doc-style]{test.scrbl}
> 
> @chunk[<*>
>   (provide foo bar)
>   (define (foo) 42)
>   (define (bar) (foo))]
> 
> @defproc[(foo) any/c] 
> 42.
> 
> @defproc[(bar) any/c] 
> Like @racket[foo].
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.