[racket-users] Busy waiting?

2015-09-18 Thread John Carmack
On Android, racket seems to be busy waiting instead of blocking.

I started out with just a read from a socket, and noticed continuous CPU 
utilization.

I added an explicit blocking sync before the read, and it reported that it was 
blocked in the sync most of the time, but it was still using a full CPU core:

  (define evt (peek-bytes-evt 1 0 #f in))
  (define start (current-inexact-milliseconds))
  (sync evt)
  (define end (current-inexact-milliseconds))
  (printf "blocked ~a ms\n" (- end start))

I then added a (sleep 1.0) statement, which cut the framerate as expected, but 
it was still using a full core.


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

2015-09-18 Thread John Carmack
I’m trying to build for Android from OS-X.  I used:

../configure --host=arm-linux-androideabi 
--enable-sysroot="/Users/johncarmack/android-ndk-r10c/platforms/android-19/arch-arm"
 --enable-racket="/Applications/Racket\ v6.2.1/bin/racket"

It builds for a while, but eventually errors with:


env XFORM_USE_PRECOMP=xsrc/precomp.h /Applications/Racket\ v6.2.1/bin/racket  
-cqu ../../../racket/gc2/xform.rkt --setup . --depends --cpp 
"arm-linux-androideabi-gcc -E -I./.. -I../../../racket/gc2/../include -g -O2 
--sysroot=/Users/johncarmack/android-ndk-r10c/platforms/android-19/arch-arm   
-DUSE_SENORA_GC   -DMZ_NO_ICONV "  --keep-lines -o xsrc/hash.c 
../../../racket/gc2/../src/hash.c

Error [GCING] 2244 in ../../../racket/gc2/../src/hash.c: Function hamt_popcount 
declared __xform_nongcing__, but includes a function call.

xform: Errors converting

  context...:

   
/Users/johncarmack/racket-master/racket/src/build/racket/gc2/xform-collects/compiler/private/xfor...:8:2:
 xform

   
/Users/johncarmack/racket-master/racket/src/build/racket/gc2/xform-collects/xform/xform-mod.rkt:
 [running body]

   /Users/johncarmack/racket-master/racket/src/racket/gc2/xform.rkt: [running 
body]

make[4]: *** [xsrc/hash.c] Error 1

make[3]: *** [all] Error 2

make[2]: *** [3m] Error 2

make[1]: *** [3m] Error 2

make: *** [all] Error 2


Any suggestions?  Android 5.0 won’t run the executable Matthew Flatt built 
because it isn’t compiled with PIE.  Building with platform 19 should get this 
by default if I can get it working.

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

2015-09-15 Thread John Carmack
Yes, after racket –l setup, things are very fast to start up on the phones now. 
 In fact, it is so much faster to start than Chibi, that is a reason to switch 
all by itself.

Thanks, everyone!


From: William Hatch [mailto:willgha...@gmail.com]
Sent: Tuesday, September 15, 2015 10:40 AM
To: Matthew Flatt; John Carmack
Cc: Racket Users
Subject: Re: [racket-users] Startup times

In my arch Linux chroot environment on my nexus 4 a hello world program in 
racket/base runs in .37 seconds, and strace reports 95% of time spent in read.

So I bet you'll get something in that ballpark after raco setup.
On September 14, 2015 7:47:20 PM MDT, Matthew Flatt 
mailto:mfl...@cs.utah.edu>> wrote:

Unfortunately, `raco make` may go wrong if its own implementation is
not compiled.

You probably want `raco setup` or (equivalently) `racket -l setup`,
which should be fast if it's just a matter of updating file timestamps.

At Mon, 14 Sep 2015 20:20:39 -0500, Robby Findler wrote:

 If you run "raco make -v cmdline2.rkt" you will see output if .zo
 compilation is happening.

 Robby


 On Mon, Sep 14, 2015 at 8:16 PM, John Carmack 
mailto:jo...@oculus.com>> wrote:

 No strace on Android, unfortunately.



 From: Marc Burns [mailto:m4bu...@uwaterloo.ca]
 Sent: Monday, September 14, 2015 8:10 PM
 To: John Carmack
 Cc: Racket

Users
 Subject: Re: [racket-users] Startup times



 Here’s the result of `strace -c -f -- racket -l racket/base` for Racket
 
6.1.1.8<https://urldefense.proofpoint.com/v1/url?u=http://6.1.1.8&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=Kjg6LltY9QjkipKooaVldA%3D%3D%0A&m=Wy0opR%2FC6i4dGkOl4%2BWs595vJLpUEmCUZ7CcgVkP6bA%3D%0A&s=08b1c16bc2f60178f10b9d43947854d7462783fd52571acd4ab28bdd9b8dfb5b>
 on my Linux workstation:



 % time seconds  usecs/call callserrors syscall

 -- --- --- - - 

  99.080.004000 571 7   nanosleep

   0.920.37   0   236   read

   0.000.00   0   10323 open

   0.000.00   079   close

 …



 Does it look similar on the Note 4?



 On Sep 14, 2015, at 9:00 PM, Marc Burns 
mailto:m4bu...@uwaterloo.ca>> wrote:



 Set the environment variable PLTSTDERR=debug to get more verbose output.



 Startup involves traversing all the

bytecode files that comprise the base
 environment. How fast is filesystem access on the Note 4 compared to PC? You
 could use strace to find the latency on different system calls made during
 startup.



 On Sep 14, 2015, at 8:55 PM, John Carmack 
mailto:jo...@oculus.com>> wrote:



 I am experimenting with running racket natively on Android to compare with
 my current embedded Chibi scheme implementation.  It would be convenient to
 just leave racket as a separate process and communicate over sockets/pipes
 so it exactly mimics my remote development case.



 The startup time to run a trivial console program is very long.  A one line
 program with #lang racket/base takes over seven seconds:



 root@trlte:/mnt/shell/emulated/0/Oculus/racket/bin # time ./racket
 cmdline2.rkt

 cmdline2.rkt
 <

 line 1

 line 2

 line

3

 line 4

 line 5

 line 6

 line 7

 line 8

 line 9

 0m7.96s real 0m7.04s user 0m0.65s system



 My first test, which still had the default #lang racket, took almost a
 minute to start:



 root@trlte:/mnt/shell/emulated/0/Oculus/racket/bin # time ./racket
 cmdline.rkt

 cmdline.rkt
 <

 line 1

 line 2

 line 3

 line 4

 line 5

 line 6

 line 7

 line 8

 line 9

 0m54.16s real 0m48.68s user 0m4.83s system



 On a PC, it only takes a fraction of a second.  This was on a Note 4, which
 should not be 100x slower than a PC.  Could it not be using the compiled
 library bytecode somehow?  I didn’t see any command line options for verbose
 output on startup, is there any way to force

some extra information?





 --
 You received this message because you are subscribed to the Google Groups
 "Racket Users" group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
racket-users+unsubscr...@googlegroups.com<mailto:racket-users+unsubscr...@googlegroups.com>.
 For more options, visit 
https://groups.google.com/d/optout<https://urldefense.proofpoint.com/v1/url?u=https://groups.google.com/d/optout&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=Kjg6LltY9QjkipKooaVldA%3D%3D%0A&m=Wy0opR%2FC6i4dGkOl4%2BWs595vJLpUEmCUZ7CcgVkP6bA%3D%0A&s=e40b7e5080913f127034118928b791013810604ba97c5729a465cfac8a6810dc>.





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

RE: [racket-users] Startup times

2015-09-14 Thread John Carmack
No strace on Android, unfortunately.

From: Marc Burns [mailto:m4bu...@uwaterloo.ca]
Sent: Monday, September 14, 2015 8:10 PM
To: John Carmack
Cc: Racket Users
Subject: Re: [racket-users] Startup times

Here’s the result of `strace -c -f -- racket -l racket/base` for Racket 6.1.1.8 
on my Linux workstation:

% time seconds  usecs/call callserrors syscall
-- --- --- - - 
 99.080.004000 571 7   nanosleep
  0.920.37   0   236   read
  0.000.00   0   10323 open
  0.000.00   079   close
…

Does it look similar on the Note 4?

On Sep 14, 2015, at 9:00 PM, Marc Burns 
mailto:m4bu...@uwaterloo.ca>> wrote:

Set the environment variable PLTSTDERR=debug to get more verbose output.

Startup involves traversing all the bytecode files that comprise the base 
environment. How fast is filesystem access on the Note 4 compared to PC? You 
could use strace to find the latency on different system calls made during 
startup.

On Sep 14, 2015, at 8:55 PM, John Carmack 
mailto:jo...@oculus.com>> wrote:

I am experimenting with running racket natively on Android to compare with my 
current embedded Chibi scheme implementation.  It would be convenient to just 
leave racket as a separate process and communicate over sockets/pipes so it 
exactly mimics my remote development case.

The startup time to run a trivial console program is very long.  A one line 
program with #lang racket/base takes over seven seconds:

root@trlte:/mnt/shell/emulated/0/Oculus/racket/bin # time ./racket cmdline2.rkt
cmdline2.rkt <
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
0m7.96s real 0m7.04s user 0m0.65s system

My first test, which still had the default #lang racket, took almost a minute 
to start:

root@trlte:/mnt/shell/emulated/0/Oculus/racket/bin # time ./racket cmdline.rkt
cmdline.rkt  <
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
0m54.16s real 0m48.68s user 0m4.83s system

On a PC, it only takes a fraction of a second.  This was on a Note 4, which 
should not be 100x slower than a PC.  Could it not be using the compiled 
library bytecode somehow?  I didn’t see any command line options for verbose 
output on startup, is there any way to force some extra information?


--
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
racket-users+unsubscr...@googlegroups.com<mailto:racket-users+unsubscr...@googlegroups.com>.
For more options, visit 
https://groups.google.com/d/optout<https://urldefense.proofpoint.com/v1/url?u=https://groups.google.com/d/optout&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=Kjg6LltY9QjkipKooaVldA%3D%3D%0A&m=9t0L95%2F3lRhPTANqB552UQS%2F%2BzE07Cf79TI1XR2YjPs%3D%0A&s=501f0d92de153954c39b1f1e37b2591fc1ba37351c9af1cbdb30e4081c2ea384>.


--
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
racket-users+unsubscr...@googlegroups.com<mailto:racket-users+unsubscr...@googlegroups.com>.
For more options, visit 
https://groups.google.com/d/optout<https://urldefense.proofpoint.com/v1/url?u=https://groups.google.com/d/optout&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=Kjg6LltY9QjkipKooaVldA%3D%3D%0A&m=9t0L95%2F3lRhPTANqB552UQS%2F%2BzE07Cf79TI1XR2YjPs%3D%0A&s=501f0d92de153954c39b1f1e37b2591fc1ba37351c9af1cbdb30e4081c2ea384>.

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

2015-09-14 Thread John Carmack
I am experimenting with running racket natively on Android to compare with my 
current embedded Chibi scheme implementation.  It would be convenient to just 
leave racket as a separate process and communicate over sockets/pipes so it 
exactly mimics my remote development case.

The startup time to run a trivial console program is very long.  A one line 
program with #lang racket/base takes over seven seconds:

root@trlte:/mnt/shell/emulated/0/Oculus/racket/bin # time ./racket cmdline2.rkt
cmdline2.rkt <
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
0m7.96s real 0m7.04s user 0m0.65s system

My first test, which still had the default #lang racket, took almost a minute 
to start:

root@trlte:/mnt/shell/emulated/0/Oculus/racket/bin # time ./racket cmdline.rkt
cmdline.rkt  <
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
0m54.16s real 0m48.68s user 0m4.83s system

On a PC, it only takes a fraction of a second.  This was on a Note 4, which 
should not be 100x slower than a PC.  Could it not be using the compiled 
library bytecode somehow?  I didn't see any command line options for verbose 
output on startup, is there any way to force some extra information?

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

2015-09-14 Thread John Carmack
Is there a deep reason why defines aren't allowed in the branches of an if, but 
are for cond / while / unless?

Wrapping code in (let() ...) instead of (begin ...) works fine, but it is a 
strange quirk to explain to someone else.

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


RE: [racket-users] 2htdp/universe performance

2015-08-25 Thread John Carmack
That was the first thing I tried, and it got substantially slower.  Of the 
three ways to create large bitmaps, one of them was fast on MacOS, and all of 
them are slow on Windows.  Using a 4096x768 bitmap is clearly not going down a 
fully hardware accelerated path.

From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Stephen Bloch
Sent: Tuesday, August 25, 2015 6:10 AM
To: racket-users@googlegroups.com
Subject: [racket-users] 2htdp/universe performance

John Carmack writes:
The performance problems were related to the larger scrolling worlds. The H2DP 
versions got slower the more clouds were in the maps.

If the background is basically static but scrolling, you might get a 
substantial performance improvement by

(define background (freeze ))

and using that variable henceforth.  (The “freeze” function renders an image 
expression to a bitmap once and for all, trading memory for time.)  If not the 
WHOLE background is basically static, but you have a lot of repeated elements 
(say, a bunch of identical clouds), you can

(define cloud (freeze ))

and use that variable instead of the big expression henceforth.  There’s no 
harm in doing both, e.g.

(define background (freeze … cloud … cloud … cloud … ))

although this won’t buy you any additional performance.

The idea that you functionally compose images like this:
 ...
Which draws image1 on top of image2 on top of image 3, which is backwards from 
the "painters order" that would draw image 3, then image 2, then image 1.

This imperative, side-effect-ing code is a little less clear to a beginner with 
the OOP and DC concepts, but It better represents what actually happens, and it 
is much easier to modify the code without worrying about the nesting.

It’s not clear to me that the imperative style “better represents what actually 
happens,” nor that this matters.

However, there is a big win associated with the functional approach: it forces 
model-view separation from the beginning.  Model-view separation is how almost 
all GUI programs are written, and failures to follow it cause a lot of the 
display bugs in GUI programs.  Students who learn an imperative-first approach 
to GUI invariably end up writing display handlers that modify the model, or 
mouse handlers that draw to the display, causing the aforementioned display 
bugs.

Stephen Bloch
sbloch1...@gmail.com<mailto:sbloch1...@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<mailto:racket-users+unsubscr...@googlegroups.com>.
For more options, visit 
https://groups.google.com/d/optout<https://urldefense.proofpoint.com/v1/url?u=https://groups.google.com/d/optout&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=Kjg6LltY9QjkipKooaVldA%3D%3D%0A&m=K7ydo0ZPjv7m8zxvDGYN7qMNIVTK9hTRK44h6w1AzV4%3D%0A&s=1102dd791cbf03a04b142170144b798ed07a688b2e0e8dbb393ead3d538b74d6>.

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


[racket-users] RE: My son's game in Racket

2015-08-24 Thread John Carmack
I would love it if he found it endlessly fascinating and spent all day 
programming on his own, but he does need a bit of a push from mom and dad.  He 
enjoys it, but given the choice, he would still rather play games than make 
them :-)

He reacted very positively to the initial "intro to racket with pictures", 
which was a contributing factor to settling on Racket.  Java / C# work seemed 
to feel more like homework, but changing numbers and colors in the REPL had him 
smiling and excited.

-Original Message-
From: François Beausoleil [mailto:francois.beausol...@gmail.com] 
Sent: Monday, August 24, 2015 2:41 PM
To: Racket Users
Cc: John Carmack
Subject: Re: My son's game in Racket

Le lundi 24 août 2015 12:28:07 UTC-4, John Carmack a écrit :
> We “released” my 10 year old son’s game that was done in Racket:
> www.1k3c.com
> 
>  
> 
> I’m still taking a little heat from my wife for using an obscure 
> language instead of something mainstream that is broadly used in industry, 
> but I have nothing but good things to say about using Racket and DrRacket for 
> a beginning programmer,  and highly recommend it.
> 
>  
> 
> I can’t recommend 2htdp/universe for this sort of thing, though.  I 
> had to drop to the native GUI bitmaps for performance reasons, hack around 
> the lifecycle to support a separate editor window, and I still don’t know how 
> to make the Quit  menu item actually exit the app on the Mac version.
> 
>  
> 
> I completely understand the reasoning for the way 2htdp/universe is 
> built, and saying that a “real” project should use the grown-up APIs is fine, 
> but the evolution from making a little animation to controlling it somehow to 
> fleshing it  out into a game is so natural that recommending a fairly big 
> rewrite is unfortunate.
> 
>  
> 
> I’m a big booster of functional programming, but I’m not sure that the 
> functional drawing paradigm ever really sank in while my son was working with 
> it, rather it felt like you just drew everything backwards with missing 
> parenthesis at  the end.  I suspect that using the standard imperative GUI 
> drawing code will make perfect sense to him.
> 
>  
> 
> I’m not sure yet if we are going to migrate to the regular GUI code for 
> upcoming work, or jump all the way to OpenGL so he can learn the joys of “Why 
> is the screen all black?”
> 
>  

Hello John,

Thanks for sharing. Played a few levels and had fun :)

I have a 10 year old daughter. Did your son show interest in programming or did 
you initiate him yourself? I remember I started when I was 10 years old as 
well. I'd like to introduce my daughter to programming too, and was wondering 
when the right time would be. I tried Logo last year, but after 5 minutes, she 
didn't see any interest in it.

Have a great day!
François Beausoleil

-- 
You received this message because you are subscribed to the Google 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] Re: My son's game in Racket

2015-08-24 Thread John Carmack
The idea that you functionally compose images like this:

(place-image image-1 x y 
(place-image image-2 x y
(place-image image-3 x y)))

Which draws image1 on top of image2 on top of image 3, which is backwards from 
the "painters order" that would draw image 3, then image 2, then image 1.

This imperative, side-effect-ing code is a little less clear to a beginner with 
the OOP and DC concepts, but It better represents what actually happens, and it 
is much easier to modify the code without worrying about the nesting.

(send dc draw-bitmap imag3 x y)
(send dc draw-bitmap imag2 x y)
(send dc draw-bitmap imag1 x y)
 
-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of David Grenier
Sent: Monday, August 24, 2015 1:14 PM
To: Racket Users
Cc: John Carmack
Subject: [racket-users] Re: My son's game in Racket

On Monday, August 24, 2015 at 12:28:07 PM UTC-4, John Carmack wrote:
> We “released” my 10 year old son’s game that was done in Racket:
> www.1k3c.com
> 
>  
> 
> I’m still taking a little heat from my wife for using an obscure 
> language instead of something mainstream that is broadly used in industry, 
> but I have nothing but good things to say about using Racket and DrRacket for 
> a beginning programmer,  and highly recommend it.
> 
>  
> 
> I can’t recommend 2htdp/universe for this sort of thing, though.  I 
> had to drop to the native GUI bitmaps for performance reasons, hack around 
> the lifecycle to support a separate editor window, and I still don’t know how 
> to make the Quit  menu item actually exit the app on the Mac version.
> 
>  
> 
> I completely understand the reasoning for the way 2htdp/universe is 
> built, and saying that a “real” project should use the grown-up APIs is fine, 
> but the evolution from making a little animation to controlling it somehow to 
> fleshing it  out into a game is so natural that recommending a fairly big 
> rewrite is unfortunate.
> 
>  
> 
> I’m a big booster of functional programming, but I’m not sure that the 
> functional drawing paradigm ever really sank in while my son was working with 
> it, rather it felt like you just drew everything backwards with missing 
> parenthesis at  the end.  I suspect that using the standard imperative GUI 
> drawing code will make perfect sense to him.
> 
>  
> 
> I’m not sure yet if we are going to migrate to the regular GUI code for 
> upcoming work, or jump all the way to OpenGL so he can learn the joys of “Why 
> is the screen all black?”
> 
>  

Not clear what was meant both times you wrote "backwards" are you referring to 
the lisp-style function call? Something that could be alleviated by say F#'s 
pipe forward operator?

let (|>) a f = f a

or Clojure's -> macro?

--
You received this message because you are subscribed to the Google 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://urldefense.proofpoint.com/v1/url?u=https://groups.google.com/d/optout&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=Kjg6LltY9QjkipKooaVldA%3D%3D%0A&m=HArZE0M9OqU4wspKLzQzG6N5gO9ncSxPP9qVzkUgoVU%3D%0A&s=b451faca736dc42c554f148983e7279865ef32be9ddf2df75f5c88c15dd34a73.

-- 
You received this message because you are subscribed to the Google 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] My son's game in Racket

2015-08-24 Thread John Carmack
The performance problems were related to the larger scrolling worlds.  The H2DP 
versions got slower the more clouds were in the maps.  As an aside, what drove 
the 20-something fps tic rate for H2DP, versus 30 for an every-other-vsync 
update?

He is already through Algebra 2, so he gets functions.  He didn't have any 
difficulty applying the functional image model, but when you have 20 lines of 
text drawing composed together, it really looks like you are just drawing 
things one after another, but backwards.  The cases where it has value, like 
building a character up out of multiple things, then placing it somewhere in 
the world, tend to be the minority of operations compared to just drawing 
independent elements on the screen.

My wife managed programmers for years, and she has opinions about pragmatic 
developers, which usually involve Java or C++.  I tend to think that worrying 
about our 10 year old's future career prospects is a bit premature, and want to 
focus on developing abstract programming skills. :-)

Unity/C# can be incredibly rewarding, but the entire ecosystem almost drives 
you away from programming as a beginner -- find the right script on the asset 
store and figure out how to configure it in the editor, rather than reinventing 
the wheel and writing it yourself.

One of the non-obvious things that I think is beneficial with DrRacket is that 
it has an approachable complexity level.  Dropping a newbie into Eclipse or 
MonoDevelop makes them feel like they are walking around in a byzantine museum, 
afraid to touch things, while DrRacket feels closer to old-school personal 
computers where you felt like you were in command of the machine.



-Original Message-
From: Matthias Felleisen [mailto:matth...@ccs.neu.edu] 
Sent: Monday, August 24, 2015 12:18 PM
To: John Carmack
Cc: Racket Users
Subject: Re: [racket-users] My son's game in Racket

Thanks for sharing. You can let Ryan know that he has his first grandma user, 
and in that mode, I managed to get a few extra lives. 

A couple of comments: 

-- In the past, some teachers have shared similar 'world/universe' games with 
me with similar performance. 
-- If your son is in middle school, he should see "pre-algebra" soon, and you 
may wish to revisit the initial drafts of the game then. 
 You can show directly how "pre-algebra" applies and how the game is 
basically written in pre-algebra. 
-- Learning FP and the connection to math may work better if you actually use 
the design recipe from HtDP [2e]. 
 I know of a child who worked through this book between the ages of 8 and 
12 and had a grand time with math and programming then. 
-- And finally, I am curious about your wife's comment. 
 What's so objectionable to learning fundamentals first and commercial 
things when you need to go professional? 
 Your son used C#/Unity last year. Was it much easier? 

I have acknowledged the lack of a growth path from 'world' to a performant 
model in the past, and I will continue to admit the problem. 

-- Matthias




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


[racket-users] My son's game in Racket

2015-08-24 Thread John Carmack
We "released" my 10 year old son's game that was done in Racket: 
www.1k3c.com

I'm still taking a little heat from my wife for using an obscure language 
instead of something mainstream that is broadly used in industry, but I have 
nothing but good things to say about using Racket and DrRacket for a beginning 
programmer, and highly recommend it.

I can't recommend 2htdp/universe for this sort of thing, though.  I had to drop 
to the native GUI bitmaps for performance reasons, hack around the lifecycle to 
support a separate editor window, and I still don't know how to make the Quit 
menu item actually exit the app on the Mac version.

I completely understand the reasoning for the way 2htdp/universe is built, and 
saying that a "real" project should use the grown-up APIs is fine, but the 
evolution from making a little animation to controlling it somehow to fleshing 
it out into a game is so natural that recommending a fairly big rewrite is 
unfortunate.

I'm a big booster of functional programming, but I'm not sure that the 
functional drawing paradigm ever really sank in while my son was working with 
it, rather it felt like you just drew everything backwards with missing 
parenthesis at the end.  I suspect that using the standard imperative GUI 
drawing code will make perfect sense to him.

I'm not sure yet if we are going to migrate to the regular GUI code for 
upcoming work, or jump all the way to OpenGL so he can learn the joys of "Why 
is the screen all black?"

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

2015-08-10 Thread John Carmack
We are just getting ready to "release" my son's little Racket game, but after 
doing all the development on OS-X, I find that the windows performance is 
terrible.  In hindsight, we should have just used bitmap / dc drawing directly, 
but it grew out of playing with HTDP / Realm of Racket examples.

It is a scrolling game, with a 4096 x 640 bitmap drawn into a 1280 x 640 window.

It started out with the map just being a big image composed with place-image 
for each solid object, but that got incrementally slower for every block in the 
map.  Freezing the image made it even slower.

On the mac at least, I found that if I manually created a bitmap and draw the 
objects into it with (send dc draw-bitmap ...) then it would draw quickly, but 
only if I used (send hidden-canvas make-bitmap ...) to create the bitmap.  
Using (make-platform-butmap ...) or (make-screen-bitmap ...) both resulted in 
slow performance.

On windows, it seems I always get slow performance.

A simple testbed program that just draws the bitmap to a window with (send dc 
draw-bitmap ...) is fast, but the (place-image ...) of the bitmap in the 
2htdp/universe program is slow, and it does seem to get slower with increasing 
bitmap size.

Any suggestions to save us from having to rewrite all the drawing code?

-- 
You received this message because you are subscribed to the Google 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] continuing after a user break

2015-07-27 Thread John Carmack
Any chance that could make it in as a DrRacket feature?  Seems likely to have 
moderately broad utility.

Out of curiosity, what programming environment do the core Racket devs use when 
programming Racket?  I quite like DrRacket for my projects that are only a few 
files, but it doesn't seem to be aimed at large scale work.

-Original Message-
From: Matthew Flatt [mailto:mfl...@cs.utah.edu] 
Sent: Monday, July 27, 2015 2:43 PM
To: John Carmack
Cc: Racket Users
Subject: Re: [racket-users] continuing after a user break

At Mon, 27 Jul 2015 19:32:32 +0000, John Carmack wrote:
> Is it possible to continue execution after a ^b user break in DrRacket 
> (not debugging)?  It would often be useful to be able to ^b, print 
> some global state, set some flags, and continue running.

The `exn:break` exception record includes a `continuation` field. An exception 
handler can apply that continuation to resume from the point of the break.

A significant limitation is that the handler has to be installed with 
`call-with-continuation-handler` or `uncaught-exception-handler`. If any 
`with-handlers` is in effect, it will catch any continuation and escape to the 
`with-handlers` form, at which point the continuation in `exn:break` cannot be 
applied (because it's an escape-only continuation).



#lang racket

(let ([orig (uncaught-exception-handler)])
  (uncaught-exception-handler
   (lambda (exn)
 (if (exn:break? exn)
 (begin
   (printf "continuing...\n")
   ((exn:break-continuation exn)))
 (orig exn)
   
(let loop () (loop))

-- 
You received this message because you are subscribed to the Google 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] continuing after a user break

2015-07-27 Thread John Carmack
Is it possible to continue execution after a ^b user break in DrRacket (not 
debugging)?  It would often be useful to be able to ^b, print some global 
state, set some flags, and continue running.

-- 
You received this message because you are subscribed to the Google 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] Prebuilt Android NDK racket?

2015-07-25 Thread John Carmack
Anyone got one handy?  Lazily attempting to avoid the day of frustration that 
usually comes from touching anyone else's NDK project...


-- 
You received this message because you are subscribed to the Google 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] What limits would you put on racket?

2015-07-24 Thread John Carmack
Half-life was written in C on my Quake 1 codebase.

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Hendrik Boom
Sent: Thursday, July 23, 2015 7:15 PM
To: Racket Users
Subject: Re: [racket-users] What limits would you put on racket?

On Thu, Jul 23, 2015 at 07:48:38PM -0400, Neil Van Dyke wrote:
> 
> * 3D action games.  I haven't yet tried this one yet with Racket, and 
> it *might* be doable even with the current stock VM, but I anticipate 
> GC pauses being an issue to get past.  I'm not going to write a 3D 
> game engine in CL, neither, and, realistically, I'd probably end up 
> doing the performance/realtime-sensitive parts in C or C++ (or 
> something that compiles to C/C++, or to LLVM), plus whatever is 
> appropriate to offload to the GPU.

I've heard that half-life waswritten in a versino of Lisp.
But the battles in half-life tend to be short, so they explicitly called the 
garbage collector between battles. 

-- hendrik

--
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit 
https://urldefense.proofpoint.com/v1/url?u=https://groups.google.com/d/optout&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=Kjg6LltY9QjkipKooaVldA%3D%3D%0A&m=77tyOJbc%2BjZ2ASCooTvHV0Qeswwty9IwC%2B8aP9XX%2B6U%3D%0A&s=2c6a633611ab51194051c3be6053626c69f05d4a7dd534c78dd5f3a565f5806a.

-- 
You received this message because you are subscribed to the Google 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] API design 2 -- variadic styles

2015-07-06 Thread John Carmack
A primary goal of the scripting work is that it should be easy to do easy 
things.  You shouldn't have to specify all the options if you just want to play 
a sound or show a picture, but you should still be able to get at them when you 
need them.

For the case of a sound effect, all of the following data may be specified:

Wav file - URI to a .wav file with audio samples.
Volume - Scale factor for the wav samples.
Position - 3D point for HRTF spatialized audio processing.
Looping - Flag to cause the wav file to loop continuously.
Name - An identifier to allow the parameters on a playing sound to be updated 
later.
Time - Absolute time for the sound to start, necessary for synced background 
audio in drop-in multiplayer servers and glitch free transitioning between wav 
files.

There are four broad strategies for exposing all that.

Multiple functions for different sets of parameters:
(+sound wav-string)
(+sound-positioned Wav-string position-vec3)
(+named-sound wav-string position-vec3 sound-name)
(+sound-update sound-name new-position-vec3)

This has a combinatorial explosion problem.

Optional parameter count with implicit type by position, C++ style:
(+sound wav-string position-vec3 name-int volume-float looping-bool time-float)

Need to define special values for parameters that are essentially skipped - 
POSITION_NONE, NAME_NONE, etc, since it is possible to want to set later values 
without all the preceding ones.  Not very self-documenting, and not feasible 
for large numbers of options like GPU state.

Keyword delimited parameters, command line parsing style:
(+sound 'wav wav-string 'position position-vec3 'name name-int 'volume 
volume-float 'looping looping-bool 'time time-float)

A typo in an option symbol name will not be detected at compile time if done as 
a function, but I guess that is a good argument for a macro.

Option functions:
(+sound (opt-wav wav-string) (opt-position position-vec3) (opt-name name-int) 
(opt-volume volume-float) (opt-looping looping-bool) (opt-time time-float))

Simple to do transformations or validation on the inputs, but the most verbose.
Bad option names will be detected at compile time, but you could still compile, 
say, graphics options into a sound command, which would have been detected with 
the keyword delimited parameters.

In some cases, parameters can be inferred by type.  For sounds, a parameter 
that is a string is the wav, a float is the volume, a bool is looping, a vec3 
is position, an int is name.  That is sheer luck - other commands would very 
likely have multiple parameters with common types, and even here there would be 
an ambiguity with time.  Still, it would be possible to go type-system-happy 
and explicitly have types for everything.  I suppose that would syntactically 
degenerate to option functions.

It is tempting to use flags that are just signaled by their presence - just add 
'looping instead of 'looping #t or (looping #t), but that can be awkward when 
the state of a flag is programmatically evaluated.

Currently I am using a hybrid form, where the first parameter is an implicit 
type (and second parameter for gfx commands), and all following parameters are 
evaluated and appended as options.

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

2015-07-03 Thread John Carmack
I tried $ first, but it scans so close to an S that it hurt readability.

-Original Message-
From: Greg Hendershott [mailto:greghendersh...@gmail.com] 
Sent: Friday, July 03, 2015 11:53 AM
To: John Carmack
Cc: racket-users@googlegroups.com
Subject: Re: [racket-users] API function naming

One idea is to use $ as prefix.

It probably connotes "command" among Unix-y folks, at least.

(Although I've seen $ used as a prefix in e.g. combinator libraries like 
Parsack, I don't think it has any universal meaning like that which would make 
it seem weird for your purposes?)


On Fri, Jul 3, 2015 at 12:41 PM, Greg Hendershott  
wrote:
> I'd avoid @ because it's used for "at-expressions", e.g. #lang 
> scribble or even simply #lang at-exp racket.
>
>
> On Fri, Jul 3, 2015 at 12:32 PM, John Carmack  wrote:
>> I am using a “cmd-name!” naming format for functions that are adding 
>> to the command list that will be communicated to the host program.
>>
>>
>>
>> (cmd-sound! WAV-FILE)
>>
>> (cmd-set-position! pos yaw-radians)
>>
>> Etc.
>>
>>
>>
>> I am considering using a terser naming convention, perhaps “@name”, 
>> so you would have:
>>
>> (@sound WAV-FILE)
>>
>> (@set-position pos yaw-radians)
>>
>> Etc.
>>
>>
>>
>> I would argue that while they do mutate global state by sticking 
>> something on a list, the list is never looked at except at the very 
>> end of the frame to hand it over to the host system, so they are more 
>> like a display / log function that a global state hazard, and having 
>> a syntax cue for functions that are going to impact the sensory presentation 
>> may be useful.
>>
>>
>>
>> Thoughts?  What symbols have the least historic baggage?
>>
>>
>>
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google 
>> 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://urldefense.proofpoint.com/v1/url?u=https://groups.google.com/d/optout&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=Kjg6LltY9QjkipKooaVldA%3D%3D%0A&m=3sT2b8Ee4ORHnImx7YLz8vXTDIljXVXZTGVhfs2xyPM%3D%0A&s=999028754ff1a2cbad33512421e2e5c7c1f27b6448cbb0ea4ca14c43f84d4ff5.

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

2015-07-03 Thread John Carmack
I am using a "cmd-name!" naming format for functions that are adding to the 
command list that will be communicated to the host program.

(cmd-sound! WAV-FILE)
(cmd-set-position! pos yaw-radians)
Etc.

I am considering using a terser naming convention, perhaps "@name", so you 
would have:
(@sound WAV-FILE)
(@set-position pos yaw-radians)
Etc.

I would argue that while they do mutate global state by sticking something on a 
list, the list is never looked at except at the very end of the frame to hand 
it over to the host system, so they are more like a display / log function that 
a global state hazard, and having a syntax cue for functions that are going to 
impact the sensory presentation may be useful.

Thoughts?  What symbols have the least historic baggage?



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

2015-07-01 Thread John Carmack
While I got tagged as a "technical idealist" for a long time, in reality I am 
deeply pragmatic.  I fantasize about building a "crystalline pyramid of 
comprehensible mutually-interlocking concepts", but I know the folly of it.  I 
have a not-so-large number of hours that I can possibly devote to this before 
it needs to stand on its own and provide real value to other developers, which 
means that it needs to be built on, and leverage, existing systems, warts and 
all.

S-expressions actually are one of the core wins from my use of lisp so far -- 
embracing read/write (and the associated bandwidth cost) as a wire protocol 
over yet another hand crafted binary format has been a significant win 
(however, the flexibility of the win seems to fight with static typing, perhaps 
at  a fundamental level, in my limited typed-racket experience so far -- a good 
topic for discussion?).

Most users of this particular system will not interact with OpenGL at all, they 
will just move pre-built models around the world, play sound effects, start 
movie clips, etc.  The fact that I could easily add the ability to hack on 
shader code, and soon geometry generation, is a huge pragmatic win.

I really do want to hear suggestions, do you have some concrete directions that 
you think would be useful?

I'm only three weeks into this project.  Give me a little more time to change 
the world. :-) 

-Original Message-
From: Gabriel Laddel [mailto:gabrielvalethlad...@gmail.com] 
Sent: Wednesday, July 01, 2015 8:18 AM
To: racket-users@googlegroups.com
Cc: John Carmack; us...@racket-lang.org
Subject: Re: [racket-users] Gear VR

*Sigh*

While I'm happy to see John Carmack using a Lisp, you're missing the point. If 
you offer Lisp as a "scripting language" you'll fail to show off why *exactly* 
it's better. S-expressions shine because they save you from the entirely 
mechanical task of parsing. There are emergent properties of this notational 
scheme that are also lovely in their own right e.g., macros & extensibility via 
incremental compilation, but all of this originates in the notation.

If you build up a scripting language in which you pass around shader strings 
and whatever random formats happen into your program, you're going to destroy 
the underlying "lispyness" because anyone who wants to make a change to the 
implementation will have to understand the format in its entirety, or be forced 
to guess at the semantics implied by so-and-so syntax - at which point, what 
has Lisp gotten me? Sure, you'll have macros for the "high level language", but 
they're not magic. The reason that e.g., the Symbolics Lisp machine is so 
fondly remembered was because of the "crystalline pyramid of comprehensible 
mutually-interlocking concepts" 
(https://urldefense.proofpoint.com/v1/url?u=http://www.loper-os.org/?p%3D42&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=Kjg6LltY9QjkipKooaVldA%3D%3D%0A&m=CwjU98OYOwj9cQ%2BK9b9GLWnR0Hnu8XBOyQG4zDiRCZw%3D%0A&s=5510a782e7801c2475be1390700d6531f0ffc308991efe43038561bb13d9c163)
 which allowed a user not intimately familiar with the machine or its 
architecture to make meaningful changes.

"Lisping" without addressing the underling problems of OpenGL etc. is an absurd 
exercise. Even if this stunt were to make you personally a billon dollars, 
you'll end up unable to buy anything interesting because everyone's time is 
being spent ferrying around magic strings (where we are today).

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

2015-06-29 Thread John Carmack
Is there an explicit strategy for the use of / in function names, "overlay/xy", 
"scale/xy" and so on?



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

2015-06-25 Thread John Carmack
>An imperative API makes functional abstraction harder. What are the main 
>selling points for Scheme/Racket now?

I am a big believer in functional programming (and static types) for large 
projects, but there is an undeniable bit of awkwardness compared to just 
imperatively poking things for small projects.  That is one of the wins for 
Scheme -- I can make it super-easy to get easy things working, but it isn't 
just a "scripting language" unsuitable for large scale development.  I am going 
to have to sort out my Racket / Chibi module strategy sometime soon, though.

As far as language choice goes, I don't claim to have broadly evaluated every 
possibility and chosen the optimal one.

Java or C# would have been more familiar to a broader base of game industry 
developers, but I really didn't want to drag in all the bulk of a JVM / .NET 
system, and a class focused world view seems less suited for the smaller 
scripting tasks.

Javascript would have been more familiar to a broader base of web industry 
developers, but I have basically no experience with javascript, and little 
desire to explore it (which is admittedly a fault of mine).

S-expression reading and writing is a strong factor for network communication, 
and I like the fact that there are available options for Scheme to interpret / 
compile / compile-to-C.  I can see valid use cases for all of them, and I'm not 
sure how important each will be.

The bottom line is that I have been enjoying myself working with Racket / 
Scheme this year, and I have evidence that it has been objectively productive 
for me, so I'm going out on a bit of a limb and placing a bet on it.

>Initial impression: 7 years after starting to program in Racket, it still 
>surprises me how easy it is to do something
>useful in just a few lines of code.

A big goal here is to make the authored code very clear and simple.  I may yet 
get to a single #lang vr  declaration that gets rid of the 
boilerplate at the top and bottom of the file and flips the right switches to 
make Racket closer to R7RS.

There are sets of creative-types that are learning how to put things together 
in Unity to accomplish fairly simple media related tasks.  I think I can make 
it easier for them with very domain specific helper libraries and a little bit 
of scheme.

>Seems like the first thing anyone does when using the OpenGL API is write 
>something like `cmd-quad!`.

I am probably also going to make something similar to the old immediate mode 
APIs for building up static geometry meshes at init time.  The design usage  is 
to reference pre-processed models loaded from the net, but there will still be 
cases where you want to algorithmically build something like a camera-specific 
projection screen.

>In case the problems importing SRFI 1 were just finding the proper 
>incantation, it should be this:
>
>   (import (srfi :1))

I was having pair / mpair issues with the r6rs.


>If you're at all interested in a matrix/vector library whose operations have < 
>4 ulps error (provided floating-point arithmetic is correctly
>rounded) and transforming normals even when the affine matrix is 
>noninvertible, check out
>
>   https://github.com/ntoronto/pict3d/tree/master/pict3d/private/math
>
>particularly the files "fl3.rkt", "fl4.rkt" and "flt3-unboxed-ops.rkt". 
>(Warnings: it's rather undocumented, there's a prevalent 
>`call/data-type-values` pattern that I haven't taken the time to get rid of 
>yet, and it >relies on some (easily copied) math/flonum macros.)

I'll take a look.  I am mostly mimicking the math operations we have in our C++ 
codebase now, and I expect that I will make C versions of at least the 
expensive matrix multiply / matrix invert operations to accelerate the embedded 
Scheme code.

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

2015-06-23 Thread John Carmack
Here is the overview of the work that I recently sent out internally.

I started out with a pure-functional scripting interface, but it very rapidly 
became imperative, and it is in heavy flux.  The sample scripts do capture the 
general "flavor" that I want this to have -- I think it will be easy enough to 
get interesting things happening that it will still tempt people who might be a 
little hostile to working in a Lisp.

--

Here is the first preview of the general purpose VR scripting environment I 
have been working on.  There isn’t anything exciting to look at, but if you 
squint real hard you can see where it might be going.  After I get a bit 
farther along, we can build a PC version as well for cross platform support.

Motivation:

Doing VR GUI development in the native apps is unpleasant – you can gut it out 
in C++ with our current interfaces, but the iteration times and code structure 
don’t make it a lot of fun.

In-editor prototyping is nice in Unity, but actual on-device testing cycle 
times are terrible, and you wind up with all the bulk of Unity and poor access 
to the native VR features like TimeWarp layers.

With app signing, we have no way for developers to casually share work with 
each other or limited communities.

My solution is to support development of VR applications in a scripting 
language with several modes:

“Web like”, where the script is downloaded from the net for each execution and 
run by a single signed app that we provide (NetHMD).  Fully specified by an 
app-scheme URI, this allows VR experiences to be launched directly from web 
pages or app-links on Facebook, which I think is VERY powerful – read about how 
great something is while browsing on your phone, then just click the link and 
get the “insert into HMD” dialog and jump right there.  VR scripts can link to 
other VR scripts without leaving VR.  There is no direct monetization here, but 
IAP can eventually be supported.

“App like”, where the script is bundled into a conventional apk to be 
distributed through the store, and the scripting is simply used as a more 
effective development environment for some classes of applications.

“Remote development”, where the script is actually executed in an IDE on a PC, 
communicating with NetHMD over a TCP connection.  This allows sub-second 
code-change to VR change iteration cycles, and the use of a debugger.  There 
might also be a use for a related mode where a central server directly drives 
one or more clients.

Where it will win first:

My “reference application” is the linking of multiple panoramic photos with 
text and audio annotations.  This is a completely obvious application that is 
not performance sensitive, and even a non-programmer could copy-paste-modify 
the simple script for this to make a high quality experience.

Once I hook up an ExoPlayer interface, this will completely subsume what I 
wanted to accomplish with “experience files” – the addition of static prop 
models to panoramic video, linking between different videos, merging of models 
or panoramas with videos that aren’t fully panoramic (GoPro, etc), and so on.

Once I hook up the Social interfaces, this will make it much easier to build 
trivial “activities” for multi-user experiences – board games, card games, etc.

It is already a big help for basic graphics development work – being able to 
just position a few quads with a custom shader and iterate on the shader 
programming remotely without rebuilding is a huge win.

Implementation:

This will be controversial, and I will have a longer discussion about it, but I 
chose Scheme (a Lisp) for the scripting language.  If this all works out, we 
can eventually make C# and Javascript versions, but I have a bunch of reasons 
for going this way first.  I am using Racket http://racket-lang.org/ for the PC 
development environment, and Chibi Scheme for the embedded interpreter on 
Android.  Download Racket and walk through their quick-intro-with-pictures to 
get a feel for the language and you should be able to hack on the sample 
scripts I have been writing pretty quickly.  Note that Racket is a very 
extended Scheme targeted at desktop apps, the embedded version is just the 
basic standard.

All texture / model / sound resources are loaded and cached from network URI.  
For testing, you can just paste in any URI from a Google image search, which is 
convenient.  For an actual project development, dropbox should work fine.

I am favoring ease of development over performance, and it definitely won’t be 
suitable for a lot of tasks, but everything we have done with first party apps 
so far should be at least a candidate for development in this style once it is 
mature.

Everything is super-rough right now, and I keep thinking “one more day of work 
will clean it up better for people to look at”, but it is past time I at least 
get this on everyone’s radar.



Running it will load a default home script,

[racket-users] Gear VR

2015-06-23 Thread John Carmack
The intersection of Gear VR owners and Racket users may consist of just me at 
the moment, but if anyone else here is interested in discussing the work I am 
doing with driving VR by Racket/Scheme, I would welcome the input.  Would that 
be an appropriate topic on the 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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Closing big-bang windows

2015-06-21 Thread John Carmack
My son's game has a level editor as well as a game loop, and we switch between 
them.  However, each new big-bang call creates a new window, leaving the 
previous ones inert on the screen.  How can we close the windows?


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

2015-06-12 Thread John Carmack
Would it be reasonable to have DrRacket leave the Run option available at all 
times, and force a break if the program is already running?

I find myself doing the ctrl-B ctrl-R sequence very often, or sometimes 
wondering why nothing is happening after my ctrl-R because I didn't notice the 
program was still running.

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

2015-06-11 Thread John Carmack
I appreciate the position, but I do think there is still value in being able to 
optionally carve off all the extra goodness and act like a more primitive 
Scheme to provide compatibility with various embedded options where full Racket 
isn't practical.

DrRacket is a key element of my strategy here - a cross platform IDE with brace 
matching, syntax highlighting, and a debugger makes Scheme a reasonable choice 
for an extension language.  I think I can evangelize this in a way that 
wouldn't be possible if users' first experience was poking at code in Notepad.

If anyone wants to tell me "Racket is easy to embed in an Android app!" I would 
love to hear it, but I'm a little too intimidated to have a crack at it myself, 
versus Chibi or various other small Schemes that are just a few files of C code.


From: Matthias Felleisen [mailto:matth...@ccs.neu.edu]
Sent: Thursday, June 11, 2015 7:05 PM
To: John Carmack
Cc: Racket Users
Subject: Re: [racket-users] Racket modules in R6RS?


Let me rephrase Matthew. Racket is only related to Scheme. See 
http://racket-lang.org/new-name.html for an explanation of our move. Our 
understanding is that the Scheme community wants to move back to a world where 
the language is small while Racket wants to move to a world where programmers 
can easily create programs. -- Matthias





On Jun 11, 2015, at 3:22 PM, John Carmack wrote:


How do you include a racket module in an R6RS program?

I have remote.rkt in the same directory as test.scm.

With R5RS I could do (#%require "remote.rkt"), but that doesn't work, and I 
tried various things in the (import) statement without success.

Are there any plans for an R7RS lang in Racket?  I am trying to write code that 
runs in both DrRacket and Chibi scheme.



--
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
racket-users+unsubscr...@googlegroups.com<mailto:racket-users+unsubscr...@googlegroups.com>.
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] Racket modules in R6RS?

2015-06-11 Thread John Carmack
How do you include a racket module in an R6RS program?

I have remote.rkt in the same directory as test.scm.

With R5RS I could do (#%require "remote.rkt"), but that doesn't work, and I 
tried various things in the (import) statement without success.

Are there any plans for an R7RS lang in Racket?  I am trying to write code that 
runs in both DrRacket and Chibi scheme.


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

2015-06-01 Thread John Carmack
Is there an option to parse all the type annotations, but not do any of the 
checking? Highly interactive tuning sessions could work without type checking, 
then turn it back on for structural work.



> On Jun 1, 2015, at 9:05 PM, Sam Tobin-Hochstadt  wrote:
> 
> Unfortunately, Typed Racket typechecking is pretty slow, and so the
> times you have there are not out of the ordinary. The most significant
> thing that's slow in Typed Racket is type checking numeric operations,
> because both the numbers themselves and the operations have
> complicated types.
> 
> If you can say more about the program in particular, I can maybe
> suggest something that would speed it up, but it's currently a
> combination of expensive-in-principle algorithms and not being
> designed for speed many years ago when I started.
> 
> Sam
> 
>> On Mon, Jun 1, 2015 at 9:06 PM, John Carmack  wrote:
>> I am working on a little project to remotely drive a VR headset with code
>> written in Racket as an attempt to make a significantly faster development
>> environment for certain types of VR apps.  I am worried about what appears
>> to be the compile speed.
>> 
>> 
>> 
>> It takes over three seconds from hitting ctrl-R in DrRacket to executing the
>> first statement of a 350 line typed racket program.  It only uses:
>> 
>> #lang typed/racket/base
>> 
>> (require racket/tcp)
>> 
>> 
>> 
>> That seems to be about twice as slow as a larger untyped racket program
>> using a bunch more stuff, but even that isn’t great:
>> 
>> #lang racket
>> 
>> (require 2htdp/universe)
>> 
>> (require 2htdp/image)
>> 
>> (require 2htdp/planetcute)
>> 
>> (require (only-in racket/gui/base play-sound))
>> 
>> 
>> 
>> Does Run from DrRacket  have a significant time penalty?
>> 
>> Are there any steps I can take to make typed racket compile faster?
>> 
>> In many cases I don’t care much about the execution speed.
>> 
>> 
>> 
>> I would like to think that compiling and running a few hundred lines of code
>> on a modern desktop system should be essentially instant.
>> 
>> 
>> 
>> 
>> 
>> --
>> You received this message because you are subscribed to the Google 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] Iteration speed

2015-06-01 Thread John Carmack
I am working on a little project to remotely drive a VR headset with code 
written in Racket as an attempt to make a significantly faster development 
environment for certain types of VR apps.  I am worried about what appears to 
be the compile speed.

It takes over three seconds from hitting ctrl-R in DrRacket to executing the 
first statement of a 350 line typed racket program.  It only uses:
#lang typed/racket/base
(require racket/tcp)

That seems to be about twice as slow as a larger untyped racket program using a 
bunch more stuff, but even that isn't great:
#lang racket
(require 2htdp/universe)
(require 2htdp/image)
(require 2htdp/planetcute)
(require (only-in racket/gui/base play-sound))

Does Run from DrRacket  have a significant time penalty?
Are there any steps I can take to make typed racket compile faster?
In many cases I don't care much about the execution speed.

I would like to think that compiling and running a few hundred lines of code on 
a modern desktop system should be essentially instant.


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

2015-03-27 Thread John Carmack
I want to be able to build simple (windows) utilities for other team members 
that don't have Racket installed.  The archive-with-dlls option is better than 
nothing, but it would be a whole lot better to have a single statically linked 
exe.  In this case, it is a 13 MB executable, and only 5 MB of dlls.

Are there fundamental challenges to doing that?

What goes in the plt directory of the archive, anyway?  It is an empty 
directory tree for this particular executable.

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


[racket-users] Re: carmack s-expression tweet

2015-03-27 Thread John Carmack
On Friday, March 27, 2015 at 2:45:00 PM UTC-5, Brian Craft wrote:
> Was this a reference to a particular racket lib? And if so, which one?
> 
> https://twitter.com/ID_AA_Carmack/status/577878167542734848

I have a long history of bit packing multiplayer network messages, but for this 
project I am just sending text s-expressions with read and write, and my life 
is much better.  Yes, it is bulkier, but I'm sending binary VoIP data after it, 
so it won't dominate bandwidth, and making software easier to write and more 
reliable is a fine way to spend some of our wealth of resources today.

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

2015-03-18 Thread John Carmack
As Hacker News has brought to your attention, I am indeed enjoying my foray 
into Racket land.  I have three separate efforts:

I am doing the prototyping work for a real time multi-user virtual reality 
service backend in Racket.  I am sort-of assuming this will be ported to 
something else to deploy at scale (and be maintained by others), but I'm 
finding it very productive in this phase, and I'm holding out some hope that it 
might stay in Racket.

I have a specification for a VR related file format that is headed towards 
JSON, but I am seriously considering changing it to s-expressions and embedding 
a trivial (not Racket) Scheme for scripting.

I'm teaching my son with Racket.  He has worked in a few different imperative 
languages prior.

I'm still a total beginner with Lisp family languages, but the fact that I was 
clearly more productive doing the server work (versus C++ or java) was 
noteworthy to me.  I'm still feeling out the exact nature of the advantages -- 
REPL is great, and using s-expressions for transport makes the server trivial 
and isn't too bad on the C++ client side, but I'm still unsure about how 
dynamic typing fits into it.  I do feel a bit like I am driving without a 
seatbelt when I run my code versus a statically typed language  (I plan on 
trying typed Racket).  Dr. Racket and the documentation are both great, and the 
overall design feels quite "sane".

I would be interested in hearing any guidance for high performance servers 
written in Racket.  GC delays in the tens of milliseconds will be problematic 
for at least part of this application, but I could split that part off into a 
separate server and still leave the other part in Racket if necessary.  The 
main benefit is currently development productivity, so obnoxious 
micro-architectural optimizations aren't useful, but broad strategic guidelines 
would be appreciated.



  Racket Users list:
  http://lists.racket-lang.org/users