Re: [racket-users] cons-specific optimizations?

2018-11-27 Thread Vishesh Yadav
I recall reading some 6.x code for RacketScript, and in 6.x world pair
was simply a pair of pointers in C structure[1] and `cons` was again a
primitive function that created those C objects[2]. No special
representation in byte-code [all values are opaque to bytecode (except
ints and floats I think)?]. My impression was it didn't do anything
special with it, at-least explicitly. Things can be different now with
Chez.

[1] 
https://github.com/racket/racket/blob/v6.12/racket/src/racket/include/scheme.h#L347
[2] 
https://github.com/racket/racket/blob/v6.12/racket/src/racket/src/list.c#L1050
On Tue, Nov 27, 2018 at 5:24 PM Milo Turner  wrote:
>
> Hello all,
>
> There's something I have been very curious of lately, about low level aspects 
> of Racket's compiler.
> First of all, I have always considered "cons" to be essentially the same as a 
> struct:
>
> (struct cons [hd tl] #:transparent)
> (define car (procedure-rename cons-hd 'car))
> (define cdr (procedure-rename cons-tl 'cdr))
>
> However I would not be surprised if cons had special treatment in the 
> compiler, runtime, etc.
>
> Is this the case? How frequently does Racket contain special optimizations 
> for cons cells? Does cons have a special representation at runtime or at the 
> bytecode level?
> Thanks.
>
> --
> You received this message because you are subscribed to the Google 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] Speeding up graphics / moving away from 2htdp/image

2017-04-26 Thread Vishesh Yadav
>
>
> BTW: I'm interested in porting to RacketScript. How does the performance
> of the image library equivalent compare with regular Racket?
>
>
It is slower than regular Racket. I did not spend much time comparing it
with Racket, and there is definitively scope for improvement. Let us know
how porting goes.

--Vishesh


> Dan
>
> On 26 Apr. 2017 15:30, "Vishesh Yadav" <vishes...@gmail.com> wrote:
>
> Are you repeatedly generating image for an animation inside an event loop?
>
> Depending on the kind of program `freeze` from 2htdp/image may help if you
> haven't tried already. For example this[1] program renders faster with
> freeze both in RacketScript and 2htdp/image.
>
> [1] http://rapture.twistedplane.com:8080/#example/default
>
> --Vishesh
>
> On Tue, Apr 25, 2017 at 9:09 PM, Daniel Prager <daniel.a.pra...@gmail.com>
> wrote:
>
>> Much as I enjoy making images using 2htdp/image it does get a tad slow as
>> complexity increases.
>>
>> I currently have a program in which I generate images in 2htdp/image and
>> translate them into bitmap%s per racket/gui and render on canvas%'s via a
>> dc.
>>
>> Speed has become sluggish and I'm going to need to move away from
>> 2htdp/image to address this.
>>
>> A typical image is built up out of lots of above, beside, overlay,
>> square, and triangle calls.
>>
>> Does anyone have a "clever" way to do this programatically (rather than a
>> manual re-write with lots of absolute calculations replacing heights and
>> widths)?
>>
>> Many thanks
>>
>> Dan
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

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


Re: [racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-25 Thread Vishesh Yadav
Are you repeatedly generating image for an animation inside an event loop?

Depending on the kind of program `freeze` from 2htdp/image may help if you
haven't tried already. For example this[1] program renders faster with
freeze both in RacketScript and 2htdp/image.

[1] http://rapture.twistedplane.com:8080/#example/default

--Vishesh

On Tue, Apr 25, 2017 at 9:09 PM, Daniel Prager 
wrote:

> Much as I enjoy making images using 2htdp/image it does get a tad slow as
> complexity increases.
>
> I currently have a program in which I generate images in 2htdp/image and
> translate them into bitmap%s per racket/gui and render on canvas%'s via a
> dc.
>
> Speed has become sluggish and I'm going to need to move away from
> 2htdp/image to address this.
>
> A typical image is built up out of lots of above, beside, overlay, square,
> and triangle calls.
>
> Does anyone have a "clever" way to do this programatically (rather than a
> manual re-write with lots of absolute calculations replacing heights and
> widths)?
>
> Many thanks
>
> Dan
>
>
> --
> You received this message because you are subscribed to the Google 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] Client side web applications in Racket

2017-01-22 Thread Vishesh Yadav

Hi Stephen,


- is there a JavaScript MVC framework that is suitable to use with
racketscript? (should I be using react or angular ?)


I can not speak for Angular, but I think React should be suitable. 
You'll have to use ES5 API instead of classes and JSX, and therefore may 
want to build a small layer in between for things to look nicer.



- can I use Racketscrips with racket web applications stuff for the
backend or am I compiling racketscript to nodejs to run on the server?


RacketScript provides a small FFI to interact with JS stuff. You can use 
some NodeJS library, to write server-side code. Our Playground[1] client 
and server is built entirely using RacketScript.


I would also like to add that RacketScript is not entirely Racket. Our 
aim is to preserve Racket semantics as much as possible, but drop 
expensive features. Specifically, RacketScript does not implement proper 
tail calls (we try to convert self-tail calls to loops) and 
continuations. Among other things, we use JS numbers, do not support 
submodules and make fewer runtime checks.


Note that RacketScript is  not ready for production use, and is 
constantly changing. Therefore, we do not recommend it for anything big 
and serious at the moment. Despite that, we encourage developers to try 
RacketScript and share their experiences with us.


--Vishesh

[1] https://github.com/vishesh/racketscript-playground



Thanks again
On Sun, 22 Jan 2017 at 14:11, Jens Axel Søgaard > wrote:

Hi Stephen,

If you want to write real Racket on the client side, your best bet
is to use racketscript.

 https://github.com/vishesh/racketscript

Try it out here:

 http://rapture.twistedplane.com:8080/

Note that tail recursion is not supported.

Urlang as-is will allow you to write JavaScript using S-expression
syntax and
also allow you to write macros using the standard Racket tools such as
syntax-parse.

An example: http://soegaard.github.io/urlang/space-invaders.html

The plan is to use Urlang as backed for a Racket to JavaScript compiler,
but that project [*] is not ready for use yet (I plan to hack on
this during the
summer vacation).

[*]
https://github.com/soegaard/urlang/blob/master/compiler-rjs/compiler.rkt


Whalesong implements full Racket with tco and correct error reporting.
The Whalesong compiler only runs on old versions of Racket and Danny
stopped worked on it years ago.

/Jens Axel



2017-01-22 14:13 GMT+01:00 Stephen De Gabrielle
>:

Hi,

What are my options for doing client side web applications in
Racket ?

I've been getting my head around server side - I can auth a user
and set a cookie - but I'm not sure what my options for client
side web apps:

- Should I be using Whalesong and/or Urlang?
- Is there a right/wrong [WhaleSong | Urlang | JavaScript]
framework?
- Can I write both the front and back end in Racket?
- Is WeScheme a Racket web app?

I'm not sure where to start - the last time I did any
significant JavaScript it was writing a pong game using the
adobe svg plugin!

Any feedback/advice appreciated,

Kind regards,

Stephen

--
Kind regards,
Stephen
--
Bigger than Scheme, cooler than Clojure & more fun than CL.(n=1)
--

--
You received this message because you are subscribed to the
Google 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

--
Kind regards,
Stephen
--
Bigger than Scheme, cooler than Clojure & more fun than CL.(n=1)
--

--
You received this message because you are subscribed to the Google
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.


--
Vishesh

--
You received this message because you are subscribed to the Google 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] HTTP Server and CPU usage

2016-02-20 Thread Vishesh Yadav
It runs on single system thread, so no. Racket threads don't utilize 
multi-cores. However, you can put several processes behind a reverse 
proxy to utilize all your CPU cores. You do have to be careful though if 
you are using continuations for managing state.


On 02/20/2016 05:15 PM, Piyush Katariya wrote:

  Does  HTTP server makes use of all CPU cores of machine  ? if not, how to 
achieve it ?


Thanks,
Piyush



--
Vishesh

--
You received this message because you are subscribed to the Google 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-09-07 Thread Vishesh Yadav

Hi Anton,

There has been some work to make Whalesong self-hosted. I'm not sure if 
it works as I didn't try it. There are some language incompatibilities 
but your Racket code will just work otherwise, notably Big Bang programs.


Whalesong doesn't give you a REPL, but it will show you stacktraces 
corresponding to Racket source.


Vishesh

On 09/07/2015 12:08 AM, Anton Vodonosov wrote:

Hi,

Does anyone use Whalesong to script web pages?

As far as I understand the Racket design, Whalesong is enough to bootstrap full 
Racket in a JS environment. It's a great opportunity. I would like very much to 
have an interactive lisp development where I can develop both server side and 
client side code, and to share code between client and server.

I wish to connect to a web page JS environment interactively (like from SLIME I 
use for with Common Lisp) and control and modify my program without reloading 
the page.

Javascript console in browsers is a substitution, but a poor-man's one, and 
it's only Javascript; it would be grate to have it for lisp.

People are now inventing WebAssembly to simplify porting programmign languages 
to javascript. ClojureScript was just recently made self hosted.

But Whalesong exists for years. Why no-one uses it? Is it not enough to 
bootstrap a Racket compiler?



--
You received this message because you are subscribed to the Google 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] Web framework in racket

2015-05-21 Thread Vishesh Yadav
Hi!

I'm working on racket web server to implement a basic web app. I found myself 
doing lots of low level stuff like cookie handling, session management etc 
almost from scratch. I was thinking to abstract all these stuff into some small 
library maybe, but before that I wanted to ask if there is already some work 
done by someone to avoid redoing all this. Would also be nice to know about 
people's experiences writing web code.

Thanks!
Vishesh

-- 
You received this message because you are subscribed to the Google 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.