[racket-users] Cubic bezier curves in racket gui

2018-04-28 Thread
Hi,

I'm using racket gui interfaces. I want to use cubic bezier curves in it. 
Please add functions for cubic bezier curves. I know Qt supports cubic 
bezier curves. SVG and canvas also support them.

Haruo

-- 
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] let-syntax example?

2018-04-04 Thread
Sorry, David. I missed your post.

-- 
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] let-syntax example?

2018-04-04 Thread
Thank you, Vincent. I did not know "Fear of Macros".

Haruo

-- 
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] let-syntax example?

2018-04-04 Thread
Additional question.

I have read Let-Over-Lambda almost all.
What is the best introduction of racket syntax?

Haruo

-- 
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: Simple loop control

2018-04-02 Thread
Thank you, Laurent.

I mind the performance of in-range, but it seems to be no problem.

#lang racket

(time (for ([i (in-range 1)])
(for ([j (in-range 1000)])
  (void

(time (do ([i 0 (+ i 1)]) ([= i 1])
(do ([j 0 (+ j 1)]) ([= j 1000])
  (void

cpu time: 110 real time: 106 gc time: 0
cpu time: 109 real time: 111 gc time: 0

-- 
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] Simple loop control

2018-04-01 Thread
Hi, everyone.

I want to write loops simpler.

> (do ([i 1 (add1 i)]) ([= i 10]) (display i))
123456789
> (for-each (lambda (i) (display i)) (range 1 10))
123456789

In Common Lisp, I like the extended loop like "for" of C-language.

[3]> (loop for i from 1 below 10 do (print i))

1
2
3
4
5
6
7
8
9
NIL

Please tell me the best solution.

Haruo

-- 
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: Implementation of threading macros

2018-04-01 Thread
Thanks for your advice, Alex. I'll be used to require point-free package.

-- 
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: Understanding 'curry'

2018-03-31 Thread
Curry is from functional languages(Haskell, OCaml, F#, ...).
Curry is the one of abbreviation of labmda.

But, curry is NOT usable for racket's threading macros.

#lang racket
(require threading)
(require 2htdp/image)

(~> (star-polygon 20 20 3 "solid" "navy")
(overlay/align/offset "right" "bottom"
  (circle 30 "solid" "cornflowerblue")
  -10 -10 _)
(overlay/align/offset "right" "top"
  (circle 30 "solid" "orchid")
  0 10 _)
(overlay/align/offset "left" "bottom"
  (circle 30 "solid" "khaki")
  10 0 _)
(overlay/align/offset "left" "top"
  (circle 30 "solid" "green yellow")
  0 0 _))

-- 
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: Implementation of threading macros

2018-03-31 Thread
I want to be close this issue but I cannot close by my response. Please 
post any message.

-- 
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: Implementation of threading macros

2018-03-31 Thread
I see. I understand that racket's threading macros are NOT SIMPLE 
IMPLEMENTATIONS.
Racket's threading macros can reduce lambda object creations.

#lang racket
(require threading)

(define (add2 x) (+ x 2))
(~> 1 add2) ; ok
(~> 1 ((lambda (x) (+ x 2)) _)) ; ng -> ok
(~> 1 ((curry + 2) _)) ; ng -> ok

(define adder%
  (class object%
(super-new)
(init-field x)
(define/public (incr) (lambda (y) (+ x y)

(define adder (new adder% [x 2]))
(send adder incr) ; ok
(~> 1 ((send adder incr) _)) ; ng -> ok

-- 
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] Implementation of threading macros

2018-03-31 Thread
Hi, everyone.

I think that racket threading macros can mix with expressions(lambda, 
curry, class, ...), but not in fact.

#lang racket
(require threading)

(define (add2 x) (+ x 2))
(~> 1 add2) ; ok
(~> 1 (lambda (x) (+ x 2))) ; ng
(~> 1 (curry + 2)) ; ng

(define adder%
  (class object%
(super-new)
(init-field x)
(define/public (incr) (lambda (y) (+ x y)

(define adder (new adder% [x 2]))
(send adder incr) ; ok
(~> 1 (send adder incr)) ; ng

Thanks,
Haruo

-- 
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: Understanding 'curry'

2018-03-31 Thread
I'm sorry for my mistake.

[Wrong] Thread Macro
[Right] Threading Macro

Threading macros are provided by Racket Package System
and its documentation is included in Racket Document.

-- 
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: Understanding 'curry'

2018-03-31 Thread
It's very very easy. The "curry" is from functional languages(Haskell, 
OCaml, F#, ...).

The concept of curry is powerful when the following function form:
(function-name option-argument input-argument)

For example, we think about 2htdp/image.

#lang racket
(require 2htdp/image)

(overlay/align/offset
  "left" "top"
  (circle 30 "solid" "green yellow")
  0 0
  (overlay/align/offset
"left" "bottom"
(circle 30 "solid" "khaki")
10 0
(overlay/align/offset
  "right" "top"
  (circle 30 "solid" "orchid")
  0 10
  (overlay/align/offset
"right" "bottom"
(circle 30 "solid" "cornflowerblue")
-10 -10
(star-polygon 20 20 3 "solid" "navy")

In Lisp Programming, it prefer to indent radically. Therefore, we introduce 
the "thread macro".

; thread macro (function)
(define (~> init . procs)
  (foldl (lambda (proc arg) (proc arg))
 init
 procs))

(~> (star-polygon 20 20 3 "solid" "navy")
(lambda (image)
  (overlay/align/offset "right" "bottom"
(circle 30 "solid" "cornflowerblue")
-10 -10
image))
(lambda (image)
  (overlay/align/offset "right" "top"
(circle 30 "solid" "orchid")
0 10
image))
(lambda (image)
  (overlay/align/offset "left" "bottom"
(circle 30 "solid" "khaki")
10 0
image))
(lambda (image)
  (overlay/align/offset "left" "top"
(circle 30 "solid" "green yellow")
0 0
image)))

For more simple discription, we use curry instead of lambda.

(~> (star-polygon 20 20 3 "solid" "navy")
(curry overlay/align/offset "right" "bottom"
(circle 30 "solid" "cornflowerblue")
-10 -10)
(curry overlay/align/offset "right" "top"
(circle 30 "solid" "orchid")
0 10)
(curry overlay/align/offset "left" "bottom"
(circle 30 "solid" "khaki")
10 0)
(curry overlay/align/offset "left" "top"
(circle 30 "solid" "green yellow")
0 0))

Thanks,
Haruo

-- 
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: Embedding image files in a executable file

2018-03-28 Thread
It fails the following case, too:

[foo.rkt]
#lang racket
(require 2htdp/universe)
(define foo-image [ [Insert] - [Insert Image...] in DrRacket ])
(void
  (big-bang 0
(on-draw (lambda (s) foo-image

The file "foo.rkt" is runnable.
But, the compiled executable "foo.exe" displays the following error message:

write: cannot marshal value that is embedded in compiled code
  value: (object:image-snip% ...)

-- 
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] Embedding image files in a executable file

2018-03-28 Thread
Hi, everyone.

I'm making a simple game. I want to embed some image files in ONLY-ONE 
executable file.
I need it for a simple distribution.

Do you think that it displays the error message "no image files" when you 
execute the application?

For example,

[image.rkt]
#lang racket
(provide foo-image)
(define foo-image [ [Insert] - [Insert Image...] in DrRacket ])

[tmp.rkt]
#lang racket
(require "image.rkt")

The error message like the follows occurs when I run tmp.rkt:

write: cannot marshal value that is embedded in compiled code
value: (object:image-snip% ...)

Thanks,
Haruo Wakakusa

-- 
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] Behavior of image-color? function

2018-03-27 Thread
Hi, everyone.

I'm using 2htdp/image and I wonder the color description.

DrRacket version 6.12

> (require 2htdp/image)
> (image-color? "red") ; will #t
#t
> (image-color? 1) ; will #f
#f
> (image-color? (color 0 0 0 0)) ; will #t
#t
> (image-color? "pale") ; I don't know about this.
#t
> (image-color? "racket") ; will #f
#t
> (image-color? "#00") ; I don't know about this.
#t

And, look at the uploaded picture.
Please match the behavior between the rectangle and image-color? functions.

Thanks,
Haruo Wakakusa

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