[racket-users] tail-position in for/list form?

2016-08-17 Thread Jos Koot
Question:

In the definitions window of DrRacket:

#lang racket
(for/list ((x (in-list '(a b c))) (k (in-naturals))) (cons k x))

When I place the cursor on the leftmost parenthesis of the for/list form,
I see a pink arrow to the subexpr (cons k x).
How can (cons k x) possibly be in tail position of the whole for/list form?

All blue binding arrows are as I expect.

(DrRacket, version 6.6 [3m])

Jos

-- 
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] How do you use the 'make-brush' '#:transformation' vector[11] argument?

2016-08-17 Thread spdegabrielle
Thanks 

I just found the documentation for 'get-transformation' which details the 
matrix:

http://docs.racket-lang.org/draw/dc___.html#%28meth._%28%28%28lib._racket%2Fdraw..rkt%29._dc~3c~25~3e%29._get-transformation%29%29
 

...and submitted a pull-request to add the link to 'get-transformation' from 
'make-brush': https://github.com/racket/draw/pull/6

Thanks again, 

Stephen


On Wednesday, August 17, 2016 at 12:08:51 PM UTC+1, Jens Axel Søgaard wrote:
> Hi Stephen,
> 
> 
> There is a brief description on transformations in the documentation for the 
> method get-transformation of dc%.
> 
> 
> 
> Basically the vector part is the coefficients   xx xy yx yy x0 y0  (in that 
> order - I think - 
> maybe xy and yx are swapped) of an affine transformation:
> 
> 
> 
>      xnew = xx*x + xy*y + x0
> 
>      ynew = yx*x + yy*y + y0
> 
> The last five numbers sets origin, scale and rotation. These numbers are
> affected by set-origin, set-scale and set-rotation.
> 
> In MetaPict I decided to stick to the affine transformation and ignore the 
> second part:
> 
> 
> 
> (define (set-transformation dc t)
>   (send dc set-transformation 
>         (vector (trans->vector t)
>                 0  0 ; x and y origin
>                 1  1 ; x and y scale
>                 0))) ; rotation
> 
> 
> The code here defines transformations corresponding to the one used in 
> MetaPost:
> 
> 
> https://github.com/soegaard/metapict/blob/master/metapict/trans.rkt
> 
> 
> 
> /Jens Axel
> 
> 
> 
> 
> 2016-08-17 10:54 GMT+02:00 spdegabrielle :
> Hi,
> 
> 
> 
> How do you use the 'make-brush' '#:transformation' vector[11] argument?
> 
> 
> 
> What should the vector contain?
> 
> 
> 
> http://docs.racket-lang.org/draw/Drawing_Functions.html#%28def._%28%28lib._racket%2Fdraw..rkt%29._make-brush%29%29
> 
> 
> 
> Kind regards,
> 
> 
> 
> Stephen
> 
> 
> 
> --
> 
> 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...@googlegroups.com.
> 
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> 
> 
> -- 
> 
> -- 
> Jens Axel Søgaard

-- 
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: Linux packages?

2016-08-17 Thread Andreas Olsson
The official release for openSuse leap is only 5.3

-- 
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: Linux packages?

2016-08-17 Thread Hendrik Boom
On Tue, Aug 16, 2016 at 10:46:51PM -0700, Andreas Olsson wrote:
> If there was packages for the major dists like fedora, ubuntu and suse on the 
> racket homepage it would be easier for people to get. It would help racket 
> becoming a little more known and used.

Debian has a racket package. Also a racket-doc package, and a 
racket-common package.  (this latter presumably for files that are 
machine-independent).

aptitude install racket

should install it, without haveing to hand-edit sources.list.  Since 
Ubuntu is a Debian derivative, I'd be surprised if it didn't have the 
same.  

-- 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://groups.google.com/d/optout.


Re: [racket-users] How do you use the 'make-brush' '#:transformation' vector[11] argument?

2016-08-17 Thread Jens Axel Søgaard
Hi Stephen,

There is a brief description on transformations in the documentation for
the method get-transformation of dc%.

Basically the vector part is the coefficients   xx xy yx yy x0 y0  (in that
order - I think -
maybe xy and yx are swapped) of an affine transformation:

 xnew = xx*x + xy*y + x0
 ynew = yx*x + yy*y + y0

The last five numbers sets origin, scale and rotation. These numbers are
affected by set-origin, set-scale and set-rotation.

In MetaPict I decided to stick to the affine transformation and ignore the
second part:

(define (set-transformation dc t)
  (send dc set-transformation
(vector (trans->vector t)
0  0 ; x and y origin
1  1 ; x and y scale
0))) ; rotation

The code here defines transformations corresponding to the one used in
MetaPost:

https://github.com/soegaard/metapict/blob/master/metapict/trans.rkt


/Jens Axel


2016-08-17 10:54 GMT+02:00 spdegabrielle :

> Hi,
>
> How do you use the 'make-brush' '#:transformation' vector[11] argument?
>
> What should the vector contain?
>
> http://docs.racket-lang.org/draw/Drawing_Functions.html#%
> 28def._%28%28lib._racket%2Fdraw..rkt%29._make-brush%29%29
>
> Kind regards,
>
> Stephen
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
-- 
Jens Axel Søgaard

-- 
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] How do you use the 'make-brush' '#:transformation' vector[11] argument?

2016-08-17 Thread spdegabrielle
Hi, 

How do you use the 'make-brush' '#:transformation' vector[11] argument?

What should the vector contain? 

http://docs.racket-lang.org/draw/Drawing_Functions.html#%28def._%28%28lib._racket%2Fdraw..rkt%29._make-brush%29%29

Kind regards,

Stephen

-- 
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/db, creating queries from fetched values

2016-08-17 Thread George Neuner


On 8/16/2016 3:57 PM, Kristjan Siimson wrote:
Basically when I said "query" I meant the SQL-language strings, which 
can be copy-pasted and executed independently. Some utilities (Percona 
tools) call it "dry run"; the queries are printed as strings for end 
user verification, and they never reach the database.


For example pt-table-sync in Percona toolkit 
(https://www.percona.com/doc/percona-toolkit/2.2/pt-table-sync.html) 
has --dry-run and --print options. I have a more application-specific 
DBA tool in mind for mitigating issues in a legacy application. Of 
course it's a very specific use case, and as direct queries lend to 
injection attacks, I would be somewhat surprised if it was possible. I 
still have hope that I have overlooked something. :-)


Sorry, there is no built in way to do this.  But it seems like it should 
be pretty easy to roll your own.



The most flexible way to convert ordinary values to text is with the 
*racket/format* library.

https://docs.racket-lang.org/reference/strings.html?q=racket%2Fformat#%28mod-path._racket%2Fformat%29

The SRFI-48 library provides *format* which is similar to C's sprintf().
https://docs.racket-lang.org/srfi/srfi-std/srfi-48.html

For structured types like dates/times there are separate printing 
functions ... you just need to look up the type.   Be aware that SQL 
dates and times are separate from Racket dates and times.  You may need 
to convert types from one to the other to get what you want.

https://docs.racket-lang.org/db/util.html?q=date-%3Esql#%28mod-path._db%2Futil%2Fdatetime%29


For string manipulation Racket has whatever you need.  Simplest is 
probably regex (built in).   Look at *regexp-replaces* for an easy way 
to do multiple string substitutions.

https://docs.racket-lang.org/reference/strings.html
https://docs.racket-lang.org/reference/regexp.html
https://docs.racket-lang.org/reference/regexp.html?q=regex#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._regexp-replaces%29%29


George

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