Re: [racket-users] Does `read-words/line' preserve last newline information?

2016-04-18 Thread Quico Jurado
> `file->lines` produces the contents of the lines, without the
> newlines. So this is as intended. This is also the behavior I would
> have expected from `read-words/line` originally.
> 
> Sam
> 

Hi,

Part 2 of the HtDP2e book, recommends the usage `read-words/line' for 
preserving the organization of the file into lines and words. So it isn't very 
expected that the information from the last empty line wouldn't be preserved.

Now that this question has answered, I guess this thread can be considered as 
closed.

Thanks everyone for your answers. So far I've found the HtDP2e a great book and 
racket a super fun language.


-- 
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] state of known issue: running handin server without x display

2016-04-18 Thread 'John Clements' via Racket Users
Okay, I know this has come up again and again. Indeed, I swear it came up a 
couple of weeks ago, but I can’t seem to find that thread. I’m trying to stop 
running X (& vnc) on my vpses, and just drop back to tmux. It looks like the 
handin server is now the one remaining fly in the ointment, in that it won’t 
start unless it can make a connection to a display:

Unable to init server: Could not connect: Connection refused
Gtk initialization failed for display ":0"
  context...:
   /usr/racket/share/pkgs/gui-lib/mred/private/wx/gtk/queue.rkt: [running body]
   /usr/racket/share/pkgs/gui-lib/mred/private/wx/gtk/init.rkt: [traversing 
imports]
   /usr/racket/share/pkgs/gui-lib/mred/private/wx/platform.rkt: [running body]

After dredging through the code a bit, it looks like the fundamental 
problem—assuming you’re not actually planning on testing student programs that 
use images—is that the handin server transmits the contents of buffers as 
serialized text% objects, and therefore in handin-server/utils.rkt there are a 
whole bunch of calls to racket/gui/base that convert the serialized text% back 
into a real text% and then extract the code from the definitions window.

It seems like the right way (well, *one* right way) to fix this, then, would be 
to install a stub gui/main.rkt in “overridden-collects” that uses a textual 
approximation to extract text from the transmitted documents. Is that right? If 
so, has someone already written this? And if *that’s* so, is there some way 
that I could add a pointer to it to the documentation somehow?

Many thanks,

John




-- 
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] Package catalog - can't connect

2016-04-18 Thread Jordan Johnson
Hi all,

I just downloaded Racket 6.4 onto my VPS (running Debian 6.0), and when I try 
to install packages (with raco pkg), I’m getting failures to connect to the 
server. First this:

ssl-connect: connect failed (error:14077410:SSL 
routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure)
  context...: [stack trace follows]

Also, the catalog URL it shows, 
https://download.racket-lang.org/releases/6.4/catalog/, produces a 404 error 
when I try it in a browser. Don’t know if that’s significant.

I guessed, on the basis of the SSL error message, that the SSL package on my 
server may be part of the problem. It reported what looks like an old version 
(0.9.8o 01 Jun 2010). So I tried downloading a newer version of OpenSSL (1.0.2g 
1 Mar 2016), and now it fails with:

ssl-connect: connect failed (error:14090086:SSL 
routines:ssl3_get_server_certificate:certificate verify failed)
  context…: [stack trace follows]

I haven’t played around enough with OpenSSL to know what’s missing in the 
configuration. So,

1) Does this indeed sound like an OpenSSL problem and not a Racket one?
2) Are there any things I am likely missing, in order to make Racket’s package 
system work?

Thanks,
Jordan

-- 
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] Does `read-words/line' preserve last newline information?

2016-04-18 Thread Sam Tobin-Hochstadt
On Mon, Apr 18, 2016 at 3:40 PM, Matthias Felleisen
 wrote:
>
> On Apr 17, 2016, at 2:10 PM, Quico Jurado  wrote:
>
> one of the responses from Matthias caught my attention where he mentioned
> that he wasn't able to reproduce this on his Mac.
>
>
>
> I tried to reproduce it as if I were a certain kind of student,
> the audience for which these libraries are intended. But,
> I got the setup wrong as Robby conjectured.
>
> The question is whether we should add similar comments to
> the documentation for files->lines etc:
>
>> (file->lines "file1.txt")
> '("first line" "" "third line")
>> (file->lines "file2.txt")
> '("first line" "" "third line")

`file->lines` produces the contents of the lines, without the
newlines. So this is as intended. This is also the behavior I would
have expected from `read-words/line` originally.

Sam

>
> (produced as suggested by Quico).
>
> --
> 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] Re: Hidden a list

2016-04-18 Thread Vincent St-Amour

Looking back at your code, it looks like `set-s-lst` should do more of
its work at compile time, as opposed to run time.

Specifically, it *expands* into code that computes `key-val` (that code
is within an #'). It should instead be computing that list at compile
time, so that `set-s` can actually act on it.

You'd want something like that:

(define-syntax (set-s-lst stx)
  (syntax-case stx ()
[(_ id label lst-val lst-key)
  (let ([key-val (for/list ([key (syntax->list #'lst-key)]
[val (syntax->list #'lst-val)])
   #`(#,key #,val))])
#`(set-s id label #,key-val))]))

Vincent



On Wed, 13 Apr 2016 20:40:54 -0500,
Héctor Mc wrote:
> 
> I understand that struct is not collections of key-value,
> in the code appear in this way for reference, even label.
> The problem that I have is in the macro set-s in the
> formation of the accesors to fields of structure.
> 
> This generates (set-usuario-key! ..) instead of (set-usuario-nom! ..) 
> into with-syntax.
> 
> -- 
> 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] Does `read-words/line' preserve last newline information?

2016-04-18 Thread Matthias Felleisen

> On Apr 17, 2016, at 2:10 PM, Quico Jurado  wrote:
> 
> one of the responses from Matthias caught my attention where he mentioned 
> that he wasn't able to reproduce this on his Mac.


I tried to reproduce it as if I were a certain kind of student, 
the audience for which these libraries are intended. But, 
I got the setup wrong as Robby conjectured. 

The question is whether we should add similar comments to 
the documentation for files->lines etc: 

> (file->lines "file1.txt")
'("first line" "" "third line")
> (file->lines "file2.txt")
'("first line" "" "third line")

(produced as suggested by Quico). 

-- 
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][typed] static-contracts/instantiate.rkt:64:2. car: contract violation.

2016-04-18 Thread WarGrey Gyoudmon Ju
On Mon, Apr 18, 2016 at 4:03 AM, Asumu Takikawa  wrote:

> On 2016-04-18 03:47:45 +0800, WarGrey Gyoudmon Ju wrote:
> >And here is another question. Developing GUI Application involves
> typed
> >class system heavily, which makes the compiling time terribly long (if
> >this is the root cause).
>
> It's possible that typed classes are slowing down typechecking, in
> particular
> typechecking methods can be slow. (I think this is in part because Typed
> Racket has to fold over entire types, and class types can be large)
>
> The typechecker for classes actually has some performance logging (that's
> disabled by default):
>
>
> https://github.com/racket/typed-racket/blob/master/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt#L37
>
> which you could try turning on to see what's slow. (you will have to
> capture
> the log output, e.g., by setting the PLTSTDERR environment variable)
>


> Also if you send me some self-contained code that's particularly slow to
> typecheck I can look into it too.
>
> We don't have a global flag to turn off typechecking right now. I think the
> best thing for us to do is to try to make TR faster.
>

That's worth expecting.

The typed class system as a root cause is no more special other than its
essential complexity, and the long-time-delays occur in these three
situations every compiling:

1. It's glad to see typechecking methods is not the problem, and it's never
longer than one second.

racket: TR class time @ done: 136.580078125
racket: tr-timing: pass2 #false line #false at 124557 last
step: 135 gc: 3 total: 1535
racket: tr-timing: pass2 timon/nefertimon.rkt line 75   at 124557 last
step: 0 gc: 0 total: 1535
racket: tr-timing: Finished pass2   at 124557 last
step: 0 gc: 0 total: 1535
racket: online-check-syntax: TR's tooltip syntaxes; this message is ignored
racket: tr-timing: finished provide generation  at 124667 last
step: 110 gc: 0 total: 1645
racket: tr-timing: finished type checking   at 124667 last
step: 0 gc: 0 total: 1645
racket: tr-timing: Typechecking Doneat 124667 last
step: 0 gc: 0 total: 1645
racket: tr-timing: Removed provides at 124667 last
step: 0 gc: 0 total: 1645
racket: tr-timing: Fixed contract ids   at 124667 last
step: 0 gc: 0 total: 1645

racket: tr-timing: Generated contracts  at 135670 last
step: 11003 gc: 427 total: 12648
racket: tr-timing: Starting optimizer   at 135670 last
step: 0 gc: 0 total: 12648
racket: tr-timing: Optimizedat 135677 last
step: 7 gc: 0 total: 12655
racket: tr-timing: Finished, returning to Racketat 135677 last
step: 0 gc: 0 total: 12655


2. This takes the most time.

module-prefetch: ((submod typed-racket/private/type-contract predicates)
typed-racket/utils/utils typed-racket/utils/any-wrap
typed-racket/utils/struct-type-c typed-racket/utils/opaque-object
typed-racket/utils/evt-contract typed-racket/utils/sealing-contract
typed-racket/utils/promise-not-name-contract
typed-racket/utils/simple-result-arrow racket/sequence
racket/contract/parametric)


3. The optimizer does the most tasks

racket: optimizer: inlining #(flat-contract-predicate
# 870 0
29870 121 #false) size: 9 threshold: 96# in module

pass[1]: compiling /Users/wargrey/Gyoudmon/
zuglag.com/nefertimon/digivice/nefertimon/nefertimon.rkt



Anyway. Thank you, Asumu.

-- 
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] DSL to C code generation with symbolic computations en route

2016-04-18 Thread Vincent St-Amour
For generating C, you may be interested in Fulmar:
http://docs.racket-lang.org/fulmar-doc/index.html

I haven't used it myself, though. Maybe someone from Matt Might's group
could chime in?

Vincent



On Mon, 18 Apr 2016 12:20:22 -0500,
Dmitry Pavlov wrote:
> 
> Dear Racketeers,
> 
> 
> I, as a programmer in the area of numerics, just evolved to the state
> where the following task seem reasonable to work on:
> 
> - I need to take (or invent) some DSL for numerical computations.
> All I need is: variables and functions, vectors, loops,
> arithmetics on numbers and vectors, sin/cos/log/expt and friends,
> and some very trivial linear algebra (3x3 matrices basically).
> 
> - I need to wrote equations in this DSL and convert them to high-speed
> C. While Racket's JIT does a great job, it does lack things that
> modern C compilers have, like OpenMP, SSE/AVX instructions,
> restricted pointers and such. Even without all this, C code is
> 1.5x-2x faster according to my experience.
> 
> - I need to take derivatives of equations that I wrote in my DSL,
> symbolically, and have them converted to C too.
> 
> 
> I suspect I am not the only one who wants that.
> There must be some work already done.
> What would you advise to start with?
> 
> 
> A quick search gave me the following:
> 
> Honu  https://docs.racket-lang.org/honu/
> Magnolisp http://magnolisp.github.io/
> RAI   http://zwizwa.be/rai/
> 
> What do you think is the most appropriate for the task?
> Is there anything else?
> 
> 
> Many thanks in advance
> 
> 
> Regards,
> 
> Dmitry
> 
> -- 
> 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] DSL to C code generation with symbolic computations en route

2016-04-18 Thread Jerzy Karczmarczuk

Dmitry Pavlov wants "adult" numerics in Racket, and he adds:


- I need to take derivatives of equations that I wrote in my DSL,
symbolically, and have them converted to C too.


And then, people (Robby Findler and John Clements) mentioned Siskind. Good.

However, you should know that Jeffrey worked NOT on /symbolic/ 
derivatives, but mainly on the "automatic differentiation" stuff; this 
is numeric, but fast and exact (in the sense: no differential quotient 
approximations). There is plenty of valuable papers written by Jeffrey 
and Barak Pearlmutter... (But some are quite difficult).


If Dmitry is interested in numerical computations, and the "symbolic 
layer" would serve just to code some horrible "C", or similar, then 
please, the automatic differentiation /*is*/ the direction to follow.


Symbolic derivatives used then in numeric computations need a strong 
simplification package, otherwise the computations usually become very 
inefficient.


Jerzy Karczmarczuk



--
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] DSL to C code generation with symbolic computations en route

2016-04-18 Thread Neil Van Dyke
One thing I have wanted to try is a `#lang` for a subset of Racket 
(everything but the most problematic bits), which expands to multiple 
modules with different equivalent implementations: Racket code, strings 
of C code, strings of Java code, strings of JavaScript code, strings of 
code for whatever iOS and Android targets.  Perhaps the language itself 
would end up looking a lot like PreScheme, I'm not yet sure.


The goal is to be able to rapidly write/test/debug in a Racket 
interactive programming environment, and then have the code work on the 
various targets one needs to reach, without having to use all those 
targets' preferred languages directly.


This `#lang` approach is not what I would most prefer (which would be 
the full `#lang racket/base` supported on those different targets, via 
compiler/VM or standards), but it's a different approach with different 
properties, and which might get close-enough, sooner.


Neil V.

--
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] DSL to C code generation with symbolic computations en route

2016-04-18 Thread Robby Findler
Ah, sorry! Yes, Jeff Siskind. Duh.

Robby


On Mon, Apr 18, 2016 at 12:39 PM, 'John Clements' via users-redirect
 wrote:
>
>> On Apr 18, 2016, at 10:29 AM, Robby Findler  
>> wrote:
>>
>> I'm not sure if there is anything in Racketdom that will serve your
>> needs, but if you do end up with the "implement it" plan, do be sure
>> to check out Jeff Siskin's work on program analysis for the purposes
>> of differentiation. He makes some whole-program assumptions (that
>> sound reasonable for you too) and gets great mileage out it.
>
> Only because it might matter for search results: ITYM “Jeff Siskind". The 
> Stalin guy, right?
>
> John
>
>
>
> --
> 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] DSL to C code generation with symbolic computations en route

2016-04-18 Thread 'John Clements' via users-redirect

> On Apr 18, 2016, at 10:29 AM, Robby Findler  
> wrote:
> 
> I'm not sure if there is anything in Racketdom that will serve your
> needs, but if you do end up with the "implement it" plan, do be sure
> to check out Jeff Siskin's work on program analysis for the purposes
> of differentiation. He makes some whole-program assumptions (that
> sound reasonable for you too) and gets great mileage out it.

Only because it might matter for search results: ITYM “Jeff Siskind". The 
Stalin guy, right?

John



-- 
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] DSL to C code generation with symbolic computations en route

2016-04-18 Thread Robby Findler
I'm not sure if there is anything in Racketdom that will serve your
needs, but if you do end up with the "implement it" plan, do be sure
to check out Jeff Siskin's work on program analysis for the purposes
of differentiation. He makes some whole-program assumptions (that
sound reasonable for you too) and gets great mileage out it.

Robby


On Mon, Apr 18, 2016 at 12:20 PM, Dmitry Pavlov  wrote:
> Dear Racketeers,
>
>
> I, as a programmer in the area of numerics, just evolved to the state
> where the following task seem reasonable to work on:
>
> - I need to take (or invent) some DSL for numerical computations.
> All I need is: variables and functions, vectors, loops,
> arithmetics on numbers and vectors, sin/cos/log/expt and friends,
> and some very trivial linear algebra (3x3 matrices basically).
>
> - I need to wrote equations in this DSL and convert them to high-speed
> C. While Racket's JIT does a great job, it does lack things that
> modern C compilers have, like OpenMP, SSE/AVX instructions,
> restricted pointers and such. Even without all this, C code is
> 1.5x-2x faster according to my experience.
>
> - I need to take derivatives of equations that I wrote in my DSL,
> symbolically, and have them converted to C too.
>
>
> I suspect I am not the only one who wants that.
> There must be some work already done.
> What would you advise to start with?
>
>
> A quick search gave me the following:
>
> Honu  https://docs.racket-lang.org/honu/
> Magnolisp http://magnolisp.github.io/
> RAI   http://zwizwa.be/rai/
>
> What do you think is the most appropriate for the task?
> Is there anything else?
>
>
> Many thanks in advance
>
>
> Regards,
>
> Dmitry
>
> --
> 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] DSL to C code generation with symbolic computations en route

2016-04-18 Thread Dmitry Pavlov

Dear Racketeers,


I, as a programmer in the area of numerics, just evolved to the state
where the following task seem reasonable to work on:

- I need to take (or invent) some DSL for numerical computations.
All I need is: variables and functions, vectors, loops,
arithmetics on numbers and vectors, sin/cos/log/expt and friends,
and some very trivial linear algebra (3x3 matrices basically).

- I need to wrote equations in this DSL and convert them to high-speed
C. While Racket's JIT does a great job, it does lack things that
modern C compilers have, like OpenMP, SSE/AVX instructions,
restricted pointers and such. Even without all this, C code is
1.5x-2x faster according to my experience.

- I need to take derivatives of equations that I wrote in my DSL,
symbolically, and have them converted to C too.


I suspect I am not the only one who wants that.
There must be some work already done.
What would you advise to start with?


A quick search gave me the following:

Honu  https://docs.racket-lang.org/honu/
Magnolisp http://magnolisp.github.io/
RAI   http://zwizwa.be/rai/

What do you think is the most appropriate for the task?
Is there anything else?


Many thanks in advance


Regards,

Dmitry

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