Re: [racket] Rosetta: Atomic updates task

2013-06-15 Thread Sam Tobin-Hochstadt
You might find the 'box-cas!' procedure useful for this -- it performs an atomic update on a single box. Sam On Jun 15, 2013 9:16 PM, "Daniel Prager" wrote: > I've added my Racket solution to the Atomic Updates task. See > > http://rosettacode.org/wiki/Atomic_updates > > I'd be interested i

[racket] Rosetta: Atomic updates task

2013-06-15 Thread Daniel Prager
I've added my Racket solution to the Atomic Updates task. See http://rosettacode.org/wiki/Atomic_updates I'd be interested in suggestions on how to improve this solution, especially by drawing on existing facilities in Racket to construct a more elegant approach (or approaches) than the hand

Re: [racket] FFI, string, malloc/free

2013-06-15 Thread Matthew Flatt
With (fun _string -> _void) keep in mind that `_string' means that a Racket-level Unicode string is converted (by UTF-8 encoding) to a newly allocated array of bytes. Nothing that you do to with Racket string affects the memory management of the allocated bytes. The byte string is allocated as

Re: [racket] naughty dog & irrational games

2013-06-15 Thread Sam Tobin-Hochstadt
On Jun 15, 2013 4:45 AM, "Neil Van Dyke" wrote: > > Anyone know whether Naughty Dog used Racket or other Lisp-descended language in development of their new game, "The Last of Us"? Yes, they're still using Racket. A few of the Naughty Dog developers hang out in the #racket IRC channel and have me

Re: [racket] FFI, string, malloc/free

2013-06-15 Thread Hendrik Boom
On Sat, Jun 15, 2013 at 02:15:04PM +0200, Laurent wrote: > On Sat, Jun 15, 2013 at 1:55 PM, Roman Klochkov wrote: > > > What about > > > > (define-lib foo (fun _string -> _void)) > > > > (foo "Test") > > > > ? > > > > Will be the pointer from string "Test" freed? > > > > I *think* Racket will ga

Re: [racket] inherit, inherit/super, and inherit/inner in class syntax

2013-06-15 Thread Eric Tanter
inner is for Beta-style inheritance, which is the dual of the typical way to do inheritance. Instead of having overriding methods that take precedence and can use super to call the base method, the base method has precedence and can call subclass methods using inner. The best is to look at this

Re: [racket] FFI, string, malloc/free

2013-06-15 Thread Laurent
On Sat, Jun 15, 2013 at 1:55 PM, Roman Klochkov wrote: > What about > > (define-lib foo (fun _string -> _void)) > > (foo "Test") > > ? > > Will be the pointer from string "Test" freed? > I *think* Racket will garbage collect the "Test" value when it is not used anymore on the Racket side, but it

Re: [racket] FFI, string, malloc/free

2013-06-15 Thread Roman Klochkov
What about  (define-lib foo (fun _string -> _void)) (foo "Test") ? Will be the pointer from string "Test" freed? And how to make it retain, if I need to save it on the foreign side? Суббота, 15 июня 2013, 13:29 +02:00 от Laurent : >You probably want `register-finalizer': >http://docs.racket

Re: [racket] FFI, string, malloc/free

2013-06-15 Thread Laurent
You probably want `register-finalizer': http://docs.racket-lang.org/foreign/foreign_pointer-funcs.html#%28def._%28%28lib._ffi/unsafe..rkt%29._register-finalizer%29%29 See also: http://docs.racket-lang.org/foreign/Allocation_and_Finalization.html Regarding the default behavior, I think Racket does

[racket] FFI, string, malloc/free

2013-06-15 Thread Клочков Роман
When I describe type (_fun _string -> _string) where can I put, whether these string c-pointers should be freed after function call? Also, what is default behavior? -- Роман Клочков Racket Users list: http://lists.racket-lang.org/users

[racket] naughty dog & irrational games

2013-06-15 Thread Neil Van Dyke
Anyone know whether Naughty Dog used Racket or other Lisp-descended language in development of their new game, "The Last of Us"? (For anyone not exposed to video game industry news, this game is highly acclaimed, and has lots of buzz right now: "http://en.wikipedia.org/wiki/The_Last_of_Us#Rece