Re: [racket-users] Scribble: line comment swallows paragraph break

2015-09-18 Thread Eli Barzilay
On Thu, Sep 17, 2015 at 2:29 PM, Ben Lerner  wrote:
> Yes, in that case.  I meant more the following:
>
> #lang at-exp racket
> '@stuff{
> Hello@; John
>
>   World
> }
>
> which currently produces '(stuff "Hello" "\n" "  " "World").

This sounds like it could be a more surprising behavior than just
swallowing a single newline.  But there's really no right or wrong --
note that this kind of behavior would have made it go even farther than
what the OP wanted...

-- 
((x=>x(x))(x=>x(x)))   Eli Barzilay:
http://barzilay.org/   Maze is Life!

-- 
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] 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.


Re: [racket-users] Building for Android

2015-09-18 Thread Matthew Flatt
Try adding

 XFORM_SKIP_PROC

to the end of line 2241 of

 plt/racket/src/racket/src/hash.c


The problem must be that __builtin_popcount() expands to something that
the "xform" tool doesn't recognize. I'll investigate, but the
`XFORM_SKIP_PROC` annotation might be a good way to go, anyway. Then
again, there's a good chance that you'll run into another of these
problems.

At Fri, 18 Sep 2015 22:01:29 +, John Carmack wrote:
> 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/com
> piler/private/xfor...:8:2: xform
> 
>
> /Users/johncarmack/racket-master/racket/src/build/racket/gc2/xform-collects/xfo
> rm/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.

-- 
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] Building for Android

2015-09-18 Thread Matthew Flatt
On closer inspection, I think the problem is that you're using Racket
v6.2.1 to cross-compile. The cross-compilation setup currently needs a
Racket of the same version, since it will use that Racket to generate
bytecode, etc.

So, first build for the host platform in a different "build" directory
(no need to install), and then refer to the `racket3m` generated from
that step in `--enable-racket=` for the cross-compile.

At Fri, 18 Sep 2015 22:01:29 +, John Carmack wrote:
> 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/com
> piler/private/xfor...:8:2: xform
> 
>
> /Users/johncarmack/racket-master/racket/src/build/racket/gc2/xform-collects/xfo
> rm/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.

-- 
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] Datalog questions

2015-09-18 Thread Jay McCarthy
On Thu, Sep 17, 2015 at 4:07 PM, Eduardo Bellani  wrote:
>
> Hello Jay,
>
> Thanks, I've figured out the raco incantation beforehand. I should've
> read more about the docs before asking.
>
> One other question that slipped my mind before, about wildcards. Let's
> take this example again:
>
>
>  (define *db* (make-theory))
>
>  (datalog *db*
>   ;; shareholders
>   (! (shareholder "Jorge"person))
>   (! (shareholder "Bob"  person))
>   (! (shareholder "Googly"   company))
>   (! (shareholder "Megasoft" company))
>   ;; ownership
>   (! (owns-a-share "Jorge"  "Construction SA" 60.8))
>   (! (owns-a-share "Bob""Construction SA" 39.2))
>   (! (owns-a-share "Bob""WAKA SA" 100 ))
>   (! (owns-a-share "Googly" "Toys SA" 100 )))
>
>
>  (let ((majority? (λ (percent)
> (> percent 50
>(datalog *db*
> (! (:- (major-stockholder COMPANY)
>(shareholder SHAREHOLDER _) ;; <- I don't care about this 
> attribute
>(owns-a-share SHAREHOLDER COMPANY PERCENT)
>(majority? PERCENT :- #t)
>
> This is throwing this error:
>
>  _: wildcard not allowed as an expression
>
> Any idea of what I'm doing wrong?

_ is this: 
http://docs.racket-lang.org/reference/stx-patterns.html?q=_#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29.__%29%29

Since it is an identifier, with a binding, then Datalog tries to
insert the value into the query and fails because you can't use _ as
an expression.

To do what you want in Datalog, you should just use a variable and not
constrained it anywhere else, so

(shareholder SHAREHOLDER IGNORED)

Jay

> Thanks again.
>
> Jay McCarthy writes:
>
>> I would do "raco pkg update --clone datalog" from "$PLTHOME/extra-pkgs"
>>
>> Jay
>>
>> On Thu, Sep 17, 2015 at 2:05 PM, Eduardo Bellani  wrote:
>>>
>>> Hello Jay, thanks for your time.
>>>
>>> I'll try the update asap. One question to anyone, what would the the
>>> canonical way of fetching such an update in racket's package system?
>>>
>>>
>>>
>>> Jay McCarthy writes:
>>>
 On Wed, Sep 16, 2015 at 2:50 PM, Eduardo Bellani  
 wrote:
> Hello list
>
> I'm trying to use racket's implementation of datalog as a query language
> for a small database (5 gb). I'm running into some problems that I'd
> appreciate your help with:
>
> * Is there support for negating a subgoal? E.g: [1]
>
>  Get the names of employees who do not work on any project.
>  temp1(S) :- works_on(S,_,_).
>  answer(F,M,L) :- employee(F,M,L,S,_,_,_,_,_,_), not temp1(S).

 No, but I have no objection to someone adding this. I believe it will
 require a different evaluation technique (bottom-up vs the present
 top-down) to run efficiently.

> * Is there support for other comparison operators outside {=, !=}? E.g.
>
> (datalog *db*
>  ;; shareholders
>  (! (shareholder "Jorge"person))
>  (! (shareholder "Bob"  person))
>  (! (shareholder "Googly"   company))
>  (! (shareholder "Megasoft" company))
>  ;; ownership
>  (! (owns-a-share "Jorge"  "Construction SA" 60.8))
>  (! (owns-a-share "Bob""Construction SA" 39.2))
>  (! (owns-a-share "Bob""WAKA SA" 100 ))
>  (! (owns-a-share "Googly" "Toys SA" 100 )))
>
>
> (let ((majority? (λ (percent)
>(> percent 50
>   (datalog *db*
>(! (:- (major-stockholder COMPANY)
>   (shareholder SHAREHOLDER person)
>   (owns-a-share SHAREHOLDER COMPANY PERCENT)
>   (majority? PERCENT :- TEMP)
>   (= TEMP true)

 You could write (majority? PERCENT :- #t)

 Here's a tiny example

 #lang racket/base
 (require datalog)

 (datalog (make-theory)
  (! (number 0))
  (! (number 1))
  (! (number 2))
  (! (number 3))
  (! (:- (awesome N)
 (number N)
 (even? N :- #t)))
  (? (awesome N)))

> * A syntax extension difficulty, not very much related to datalog per
>   se. I have this syntax extension:
>
>
> (define-syntax (->relations stx)
>   ;; point here being getting true relations (sets) out of the results
>   (syntax-case stx ()
> [(_ rel-name rel-size)
>  (with-syntax ([rel-vars (for/list ([x (in-range (syntax->datum 
> #'rel-size))])
>(gensym 'X))])
>#`(map (λ (dic)
> (list->set
>  (map (λ (rel-var)
> (hash-ref dic 

Re: [racket-users] Re: typed/racket + rackunit = trouble

2015-09-18 Thread Anthony Carrico
On 09/18/2015 08:18 AM, Robby Findler wrote:
> On Thu, Sep 17, 2015 at 11:24 PM, Anthony Carrico  
> wrote:
>> I get that it wants the freedom, I'm just not sure it currently has the
>> freedom.
> 
> I believe it currently does not have that freedom. My messages were
> meant to describe how I think eq? should be treated.

Sounds like work, but I welcome our new equal? overlord.

-- 
Anthony Carrico

-- 
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: typed/racket + rackunit = trouble

2015-09-18 Thread Robby Findler
On Thu, Sep 17, 2015 at 11:35 PM, Anthony Carrico  wrote:
> On 09/17/2015 11:03 PM, Anthony Carrico wrote:
>> Really what I'm trying to say is that the language implementation
>> wants the freedom to adjust your program without having to be
>> constrained by eq tests that you might do. One example of this is
>> contracts. I might wish to be accept a function you give me, put a
>> contract on it, and give it back to you. This shouldn't really be
>> detectable if the contract doesn't fail. But it is, because of eq?.
>> Similarly, a compiler might want to change around exactly when it
>> allocates those cons cells (doing more sharing sometimes to reduce
>> memory footprint) but it can't because this is detectable via eq?, so
>> it isn't a behavior preserving transformation.
>
> Both these examples seem fine. Nobody expects procedures to be
> comparable, and cons cells are immutable, so the docs say eq? isn't
> suitable anyway (my bug report notwithstanding).

I agree that an interesting other approach is to make eq? have some
well-defined behavior for mutable objects that amounts to "if I mutate
one, does the other one change". This will, however, mean that eq? is
not just a simple pointer equality check in the runtime system (well,
unless other changes are made in other parts of the runtime system
that I don't know how to do). So I don't think that's the best choice
(still making choices between things that are alternative futures for
Racket here, not talking about the current set of promises).

Robby

-- 
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: typed/racket + rackunit = trouble

2015-09-18 Thread Robby Findler
On Thu, Sep 17, 2015 at 11:24 PM, Anthony Carrico  wrote:
> But, here is an update:
>
> #lang typed/racket
>
> (require typed/rackunit)
> (define foo (mcons 1 1))
> (eq? foo foo)
> (check-eq? foo foo)
>
> And this is still broken.

This might be a bug. I'll defer to the TR maintainers on that.

>> Really what I'm trying to say is that the language implementation
>> wants the freedom to adjust your program without having to be
>> constrained by eq tests that you might do.
>
> I get that it wants the freedom, I'm just not sure it currently has the
> freedom.

I believe it currently does not have that freedom. My messages were
meant to describe how I think eq? should be treated. The docs provide
stronger guarantees which, as you discovering, we don't quite live up
to. In particular, we don't currently have all of the implementation
technology we need to properly deny it that freedom. (Which sounds
strange, but we are balancing a lot of things here, and one of the is
TR's soundness, which currently has higher priority.)

> The docs say, "The eq? operator compares two values, returning #t when
> the values refer to the same object. This form of equality is suitable
> for comparing objects that support imperative update".
>
> If this is no longer true, it implies that weak hash tables are broken
> (they could arbitrarily drop entries), and that worries me.

I think this sentence is dodgy. It doesn't actually give you any
guarantees. The guarantee that you want is probably more of the form
"if there is only a single allocation point for a given object then
eq? should return #t when given it as both arguments" with some kind
of suitable definition of "allocation point" that doesn't include
flowing across a TR boundary. That's not precise either, but is
probably heading in the right direction.

> Secondly, isn't equality the wrong word if a #t result means something
> and #f doesn't?

This is the direction I would like to think about for eq?. That is, I
see eq? as having value for performance reasons, but for no other
reason. So, when you do an eq? test, you should always be
shortcircuiting some more complex computation. If you get a #f back,
then you are obligated to take the long way 'round, but if you get #t,
then you "learned something" that lets you avoid more computation.

And in an effort to be more clear: this is not currently what's
promised by Racket. This is more what I think we should try out and
see if we can make work.

>I suppose the issue is with the phrase "same object".



>>> As an example, I'm writing a toy sets-of-scopes expander. Scopes could
>>> be Natural, or whatever, but I'm wrapping them in a struct so I can use
>>> them to key weak tables. I can see other some other kind of language
>>> support as a replacement, like an Identity type, or some kind of Graph
>>> type where nodes not connected to a root are garbage (making local that
>>> formerly global feature of the heap).
>>
>> I think weak tables are a separate issue. You mean eq tables, right?
>
> I did mean "make-weak-hash". It is desirable to couple the garbage
> collection of binding table entries with the garbage collection of
> scopes. I was using weak hash tables to map scope objects to binding
> table partitions. mflatt achieves this by storing those partitions
> directly inside the scope objects, avoiding a weak table. There are
> costs and benefits of the two options.
>
> Anyway, if we are allowed to use weak tables for memory management, then
> we require a stable notion of identity. I agree that object identity is
> ugly, so I'd trade it for an efficient, immutable, persistent, graph
> datatype which allowed nodes to be collected when unreferenced from a
> root :).

That would be cool!

Robby

-- 
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] Scribble: line comment swallows paragraph break

2015-09-18 Thread Eli Barzilay
On Thu, Sep 17, 2015 at 11:30 AM, Matthew Flatt  wrote:
>
> I imagine that Eli adopted that feature of @-expressions from TeX.

Yes -- and it's also similar to a few other comment behaviors, like m4's
`dnl`.  But it sounds like it would be good to qualify the "similar to
% in tex" comment in the docs given the weird thing it does with
paragraph breaks...

-- 
((x=>x(x))(x=>x(x)))   Eli Barzilay:
http://barzilay.org/   Maze is Life!

-- 
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] Call for Contributions: BOB 2016 - Berlin, Feb 19, 2016

2015-09-18 Thread Mike Sperber
 BOB Conference 2016
 "What happens when we use what's best for a change?"
  http://bobkonf.de/2016/en/cfp.html
 Berlin, February 19
Call for Contributions
  Deadline: October 30, 2015

You drive advanced software engineering methods, implement ambitious
architectures and are open to cutting-edge innovation? Attend this
conference, meet people that share your goals, and get to know the
best software tools and technologies available today. We strive to
offer a day full of new experiences and impressions that you can
use to immediately improve your daily life as a software developer.

If you share our vision and want to contribute, submit a proposal for
a talk or tutorial!

Topics
--

We are looking for talks about best-of-breed software technology,
e.g.:

- functional programming
- reactive programming
- persistent data structures and databases
- types
- formal methods for correctness and robustness
- ... everything really that isn't mainstream, but you think should be.

Presenters should provide the audience with information that is
practically useful for software developers.  This could take the form
of e.g.:

- experience reports
- introductory talks on technical background
- demos and how-tos

Requirements


We accept proposals for presentations of 45 minutes (40 minutes talk +
5 minutes questions), as well as 90 minute tutorials for beginners.
The language of presentation should be either English or German. 

Your proposal should include (in your presentation language of choice):

- an abstract of max. 1500 characters.
- a short bio/cv
- contact information (including at least email address)
- a list of 3-5 concrete ideas of how your work can be applied in a developer's 
daily life
- additional material (websites, blogs, slides, videos of past
  presentations, …)

Submit here:

https://docs.google.com/forms/d/1IrCa3ilxMrO2h1G1WC4ywoxdz8wohxaPW3dfiB0cq-8/viewform?usp=send_form

Organisation


- submit your proposal here
  
https://docs.google.com/forms/d/1IrCa3ilxMrO2h1G1WC4ywoxdz8wohxaPW3dfiB0cq-8/viewform?usp=send_form
- direct questions to `bobkonf at active minus group dot de`
- proposal deadline: **October 30, 2015**
- notification: November 15, 2015
- program: December 1, 2015

NOTE: The conference fee will be waived for presenters, but travel
  expenses will not be covered.

Program Committee
-

(more information here: http://bobkonf.de/2016/programmkomitee.html)

- Matthias Fischmann, zerobuzz UG
- Matthias Neubauer, SICK AG
- Nicole Rauch, Softwareentwicklung und Entwicklungscoaching
- Michael Sperber, Active Group
- Stefan Wehr, factis research

Scientific Advisory Board
-

- Annette Bieniusa, TU Kaiserslautern
- Peter Thiemann, Uni Freiburg

-- 
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.