Re: [racket] Small Inline Visualizations In DrRacket's REPL

2012-05-10 Thread Laurent
On Fri, May 11, 2012 at 7:00 AM, Ray Racine wrote: > Laurent, > > I just converted it to typed racket, otherwise essentially the same. > https://gist.github.com/2657613 > > 'rounded has a pixel issue for me.in emacs. Probably a font thing. > 'normal and 'double look great. > Yes, I have some is

Re: [racket] Small Inline Visualizations In DrRacket's REPL

2012-05-10 Thread Ray Racine
Laurent, I just converted it to typed racket, otherwise essentially the same. https://gist.github.com/2657613 'rounded has a pixel issue for me.in emacs. Probably a font thing. 'normal and 'double look great. Are you doing some PGM code in Racket? Thanks, Ray On Thu, May 10, 2012 at 2:13 AM,

Re: [racket] `def' ?

2012-05-10 Thread Michael W
Yes! Hear, hear! Having to explicitly write all the references out and get their types right is a pain point for me. Maybe it's encouraged by the design recipe, but sometimes I get jealous of languages like Clojure, which (from what I understand) would let me write something like this: ;; initials

[racket] Trying to produce list of files, not subdirectories in a specified directory. Works from one module but not from a calling module.

2012-05-10 Thread Eli Barzilay
(This is a reply to a bug report, I think that a mailing-list reply is more fitting in this case since you might have more questions.) 1. Your files depend on a particular `DG' collection -- it's usually best to avoid such things when you submit bug reports. 2. There is no need to do (require

Re: [racket] Custom Key Bindings - Post Your File

2012-05-10 Thread Robby Findler
:) When we're happy with its stability, we'll just make it on by default, so no searching will be required. Robby On Thu, May 10, 2012 at 8:32 PM, Ray Racine wrote: > Ah ha.   Mouse over little red dot in lower right hand corner.  Enable from > pop up. > > > On Thu, May 10, 2012 at 9:22 PM, Ray

Re: [racket] Custom Key Bindings - Post Your File

2012-05-10 Thread Ray Racine
Ah ha. Mouse over little red dot in lower right hand corner. Enable from pop up. On Thu, May 10, 2012 at 9:22 PM, Ray Racine wrote: > I'm caught in a bit of Catch-22. From the doc. > > If you are most familiar with Emacs-style key bindings (especially on > windows or some linux installation

[racket] tall DrRacket

2012-05-10 Thread Neil Van Dyke
I don't know whether others have done this before, but I'm pleased to report that DrRacket works fine at 1920 pixels tall. http://i.imgur.com/jViJj.jpg I should be able to fit more lines of code than the photo shows, since the font is larger than I prefer. This is not apropos of the discussi

Re: [racket] Custom Key Bindings - Post Your File

2012-05-10 Thread Ray Racine
I'm caught in a bit of Catch-22. From the doc. If you are most familiar with Emacs-style key bindings (especially on windows or some linux installations where the control key is, by default, for the menu shortcuts), you should uncheck the Enable keybindings in menus preference. Many of the keybi

Re: [racket] Custom Key Bindings - Post Your File

2012-05-10 Thread Robby Findler
FWIW, run and reindent are already menu-key based shortcuts (r and i respectively) so they should be available already (unless you're on windows and you've disabled menu keyboard shortcuts). For reindent you can hit tab, and DrRacket re-indents the line you're on or the selection (if it is more tha

Re: [racket] `def' ?

2012-05-10 Thread Greg Hendershott
;; Instead of needing to write... (define a 1) (define b 2) (define c 3) ;; ...it would be clean to write... (def a 1 b 2 c 3) ;; ...which is even cleaner than the `let' that `define' replaces. ;; Plus, having it act like `match-define' would be handy: (def a 1 b 2 (list x

Re: [racket] Custom Key Bindings - Post Your File

2012-05-10 Thread Ray Racine
BTW I am aware of the out-of-box emacs bindings support in DrRacket. http://docs.racket-lang.org/drracket/Keyboard_Shortcuts.html?q=keybindings#(idx._(gentag._151._(lib._scribblings/drracket/drracket..scrbl))) On Thu, May 10, 2012 at 7:38 PM, Ray Racine wrote: > I'm attempting this weekend to m

Re: [racket] XREPL on Windows

2012-05-10 Thread Eli Barzilay
Earlier today, John Clements wrote: > Apologies in advance: I'm talking about something I know *almost* > nothing about, but it appears that these days, "git" for windows > ships with something that looks like a pretty complete "bash". Is > this a viable alternative to cygwin, or are there a whole

Re: [racket] `def' ?

2012-05-10 Thread Eli Barzilay
Four hours ago, Matthias Felleisen wrote: > > I will assert something about readability: > > Racket programs look heavy when compared with Haskell programs. > > This is probably true for Python instead of Haskell, too. It is also > true for ML. I conjecture that part of that heaviness comes f

[racket] Custom Key Bindings - Post Your File

2012-05-10 Thread Ray Racine
I'm attempting this weekend to make the leap from my beloved Emacs and Geiser to DrRacket.Was wondering if anyone has a cool set of custom keybindings they'd like to share. Some I'd like to get my hands on are: 1. binding for reindent / reindent all. 2. binding for Check Syntax button equivale

Re: [racket] `def' ?

2012-05-10 Thread Nikita B. Zuev
Looks like pattern matching would be nice here... still a little more verbose )) (define initials (match person ((vector (id fname lname) _) (string (string-ref fname 0) (string-ref lname 0 > > Thanks for the nice illustration. It would be > > (define initials >  (string (string-r

Re: [racket] `def' ?

2012-05-10 Thread Ray Racine
Give '{' yada '}' definable language semantics in the sense of #lang yada. Similar to SML-NJ Quote/Antiquote but leveraging Rackets more robust built-in language support. So a source file could be. == #lang racket #lang {{ formula }} (define x 3) (define y 2) (define z {{ log (x + y) }

Re: [racket] `def' ?

2012-05-10 Thread Matthias Felleisen
Thanks for the nice illustration. It would be (define initials (string (string-ref (id-firstname (vector-ref person i)) 0) (string-ref (id-lastname (vector-ref person i)) 0))) but even with that we don't get the density of some path expression: (define initials (string (@ person i

Re: [racket] `def' ?

2012-05-10 Thread Justin Zamora
In my experience, the heaviness of Racket doesn't come from words like "define", etc. It comes in certain categories of programs that deal extensively with strings, vectors, and structured data. For example, initials = person[i].firstname[0] + person[i].lastname[0] This is very readable and use

Re: [racket] A little improvement

2012-05-10 Thread Matthias Felleisen
If this is about sequencing regexp's listen to everyone else who replied. If this is about sequencing a bunch of functional manipulations, try this: #lang racket ;; this would be in a library (define-syntax let** (syntax-rules () [(_ tmp body) body] [(_ tmp a b ... body) (let ([tm

Re: [racket] A little improvement

2012-05-10 Thread Laurent
I find it more appropriate in a dictionary: (define (fix2 str) (for/fold ([str (string-upcase str)]) ([(k v) (in-dict '((" / " . "_") (" " . "_") ("%" . "") ("-" . "_")))]) (regexp-replace* k str v))) Laurent On

Re: [racket] A little improvement

2012-05-10 Thread Vincent St-Amour
Using list comprehensions: (define (fix str) (for/fold ([str str]) ([old '(" / " " " "%" "-")] [new '("_" "_" "" "_")]) (regexp-replace* old str new))) Vincent At Thu, 10 May 2012 15:49:26 -0500, Grant Rettke wrote: > > Using this to help out with a task at wor

Re: [racket] A little improvement

2012-05-10 Thread Danny Yoo
> #lang racket > > (define (fix str) >  (define tmp str) >  (set! tmp (regexp-replace* " / " tmp "_")) >  (set! tmp (regexp-replace* " " tmp "_")) >  (set! tmp (regexp-replace* "%" tmp "")) >  (set! tmp (regexp-replace* "-" tmp "_")) >  (string-upcase tmp)) The several uses of regexp-replace* can

Re: [racket] A little improvement

2012-05-10 Thread Eli Barzilay
10 minutes ago, Grant Rettke wrote: > Using this to help out with a task at work > > #lang racket > > (define (fix str) > (define tmp str) > (set! tmp (regexp-replace* " / " tmp "_")) > (set! tmp (regexp-replace* " " tmp "_")) > (set! tmp (regexp-replace* "%" tmp "")) > (set! tmp (regex

[racket] A little improvement

2012-05-10 Thread Grant Rettke
Using this to help out with a task at work #lang racket (define (fix str) (define tmp str) (set! tmp (regexp-replace* " / " tmp "_")) (set! tmp (regexp-replace* " " tmp "_")) (set! tmp (regexp-replace* "%" tmp "")) (set! tmp (regexp-replace* "-" tmp "_")) (string-upcase tmp)) Is ther

Re: [racket] `def' ?

2012-05-10 Thread John Clements
On May 10, 2012, at 1:00 PM, Matthias Felleisen wrote: > > I will assert something about readability: > > Racket programs look heavy when compared with Haskell programs. > > This is probably true for Python instead of Haskell, too. It is also true for > ML. I conjecture that part of that he

Re: [racket] Snips displaying pdfs

2012-05-10 Thread Jens Axel
Den 08/05/2012 kl. 15.31 skrev Michael W : > Hm. What I meant was, is there a way to do that without > rasterization? I intended to use this for rendering posters, > where a 3MB 2000dpi image is less desirable than a few > line-drawing commands. It would be lovely to be able to rotate > and sc

Re: [racket] `def' ?

2012-05-10 Thread Nikita B. Zuev
Yes, you have a point, it can become misleading. `define' and `lambda' are not as long as `call-with-current-continuation' so alias is not a must have. 2012/5/10 ozzloy-racket-users : > am i the only one that thinks not having abbreviated names for anything is > good? > i like not having "def".  e

Re: [racket] `def' ?

2012-05-10 Thread Luke Vilnis
Sorry for putting words in your mouth - on a second reading, you were quite clear on that point. On Thu, May 10, 2012 at 3:49 PM, ozzloy-racket-users < ozzloy+users_racket-lang_...@gmail.com> wrote: > i didn't assert that word length has nothing to do with readability, just > that word frequency

Re: [racket] `def' ?

2012-05-10 Thread Matthias Felleisen
I will assert something about readability: Racket programs look heavy when compared with Haskell programs. This is probably true for Python instead of Haskell, too. It is also true for ML. I conjecture that part of that heaviness comes from wide lines, long names, deep nesting. Who knows. I

Re: [racket] `def' ?

2012-05-10 Thread Pierpaolo Bernardi
On Thu, May 10, 2012 at 9:26 PM, ozzloy-racket-users wrote: > am i the only one that thinks not having abbreviated names for anything is > good? no. > i like not having "def".  especially if it's going to be redundant. > i see this as a slippery slope i don't want to go down. > it annoys me when

Re: [racket] `def' ?

2012-05-10 Thread ozzloy-racket-users
i didn't assert that word length has nothing to do with readability, just that word frequency has more impact on reading time than word length. On Thu, May 10, 2012 at 3:39 PM, Luke Vilnis wrote: > I can only speak for myself but I think it's a bit much to assert that > word length has nothing t

Re: [racket] `def' ?

2012-05-10 Thread Luke Vilnis
I can only speak for myself but I think it's a bit much to assert that word length has nothing to do with readability. Heck, maybe that's even true for you, but not for everyone. I have certainly felt it to be an issue. If the "define" keyword was 50 letters long it would definitely have an impact

Re: [racket] `def' ?

2012-05-10 Thread Grant Rettke
You are not the only one. On Thu, May 10, 2012 at 2:26 PM, ozzloy-racket-users wrote: > am i the only one that thinks not having abbreviated names for anything is > good? > i like not having "def".  especially if it's going to be redundant. > i see this as a slippery slope i don't want to go down

Re: [racket] `def' ?

2012-05-10 Thread ozzloy-racket-users
am i the only one that thinks not having abbreviated names for anything is good? i like not having "def". especially if it's going to be redundant. i see this as a slippery slope i don't want to go down. it annoys me when switching to other languages to have to ask: which way of shortening "functi

Re: [racket] `def' ?

2012-05-10 Thread Grant Rettke
There is always pretty mode in Emacs. On Thu, May 10, 2012 at 1:45 PM, Ray Racine wrote: > FYI for those who may not know.  Racket supports λ as an alias for lambda. >  ctrl-\ in DrRacket. > > > On Thu, May 10, 2012 at 1:59 PM, Nikita B. Zuev wrote: >> >> +1 for `def' as alias for `define'. >> M

Re: [racket] `def' ?

2012-05-10 Thread Ray Racine
FYI for those who may not know. Racket supports λ as an alias for lambda. ctrl-\ in DrRacket. On Thu, May 10, 2012 at 1:59 PM, Nikita B. Zuev wrote: > +1 for `def' as alias for `define'. > May I also suggest `fun' for `lambda' alias? > Three letter names are the best =) > > (well one can alway

Re: [racket] `def' ?

2012-05-10 Thread Nikita B. Zuev
+1 for `def' as alias for `define'. May I also suggest `fun' for `lambda' alias? Three letter names are the best =) (well one can always do it with require rename-in) -- Regards, Nikita B. Zuev Racket Users list: http://lists.racket-lang.org/users

Re: [racket] `def' ?

2012-05-10 Thread Neil Van Dyke
Luke Vilnis wrote at 05/10/2012 12:58 PM: [...] along with (imo) sexier looking code samples to show to prospective Racketeers is worth it.[...] Separate from whether "def" is a good idea, I think we might be better off forgetting about sexy examples for a while. We tend to get our 'sexy' co

Re: [racket] `def' ?

2012-05-10 Thread Luke Vilnis
Unfortunately I don't think you can combine def with destructuring, because then you can't use it for functions afaik. I think two forms is necessary. On Thu, May 10, 2012 at 1:20 PM, Greg Hendershott wrote: > To combine what Neil and Luke said, maybe one new thing `def' could do > is include de

Re: [racket] `def' ?

2012-05-10 Thread Greg Hendershott
To combine what Neil and Luke said, maybe one new thing `def' could do is include destructuring. In other words it's really an alias for `match-define'. And (match-define x 1) is the same as (define x 1) correct? I'd also like to see a syntax if possible that lets you (as with `let') do m

Re: [racket] `def' ?

2012-05-10 Thread Laurent
Btw, for me, probably as for others, the problem is not really to type `define', since I have a keybinding shortcut for that, but that it takes too much visual space when my eye should rather not be lost in too much information on the screen so as to focus on the important parts of the code. Person

Re: [racket] `def' ?

2012-05-10 Thread Luke Vilnis
+1000 to "def" idea I think the super verbose keywords can be an impediment to code readability. The increase in signal-to-noise, along with (imo) sexier looking code samples to show to prospective Racketeers is worth it. As silly as it might sound, when I started out, Scheme's notoriously long ke

Re: [racket] `def' ?

2012-05-10 Thread Ray Racine
+1 on formalizing "def" as an official alias in Racket. Once, I recall δ used to work and I rather liked it, however 'def' as official is a winner. On Thu, May 10, 2012 at 11:54 AM, Greg Hendershott < greghendersh...@gmail.com> wrote: > Should `def' be added as an alias for `define'? > > Possibl

Re: [racket] `def' ?

2012-05-10 Thread Neil Van Dyke
Making new names for key things is a good time to revisit what those things look like and mean. I have no major requests for changes to "define", but perhaps someone else does. (I do, however, have a major request for the "let" family, but not a lot of time at the moment to advocate it, unles

Re: [racket] `def' ?

2012-05-10 Thread Hendrik Boom
On Thu, May 10, 2012 at 10:15:21AM -0600, Jon Rafkind wrote: > "Maybe we can eventually make language a complete impediment to > understanding." > > http://www.strangehorizons.com/2006/20060313/verbing_weirds_language.gif I think it may have been Peter Ingerman or Peter Naur who first said, deca

Re: [racket] `def' ?

2012-05-10 Thread Laurent
On Thu, May 10, 2012 at 5:54 PM, Greg Hendershott wrote: > Should `def' be added as an alias for `define'? > > Possible reasons why: > 1. Most frequently used. > http://lists.racket-lang.org/dev/archive/2012-May/009429.html > 2. Name shortening seems to be a current theme. > 3. The new style guid

Re: [racket] left boundary problem

2012-05-10 Thread Roelof Wobben
Op 10-5-2012 18:08, Matthias Felleisen schreef: On May 10, 2012, at 11:01 AM, Roelof Wobben wrote: p 10-5-2012 15:33, Matthias Felleisen schreef: Exercise 1: eliminate all constants from function definition. (define kat (circle 39 'solid 'red)) (define workspace (empty-scene 1000 200)) (defi

Re: [racket] `def' ?

2012-05-10 Thread Jon Rafkind
"Maybe we can eventually make language a complete impediment to understanding." http://www.strangehorizons.com/2006/20060313/verbing_weirds_language.gif On 05/10/2012 09:54 AM, Greg Hendershott wrote: > Should `def' be added as an alias for `define'? > > Possible reasons why: > 1. Most frequently

Re: [racket] `def' ?

2012-05-10 Thread Greg Hendershott
I agree. I was trying to be fair and consider the case against. [Hey, I was a philosophy major. As Steve Martin said, you learn just enough to mess you up for the rest of your life. Or according to recent XKCD , I learned that "2 + lightbulb = sailboat". :)] On Thu, May 10,

Re: [racket] left boundary problem

2012-05-10 Thread Matthias Felleisen
On May 10, 2012, at 11:01 AM, Roelof Wobben wrote: > p 10-5-2012 15:33, Matthias Felleisen schreef: >> >> >> Exercise 1: eliminate all constants from function definition. > > (define kat (circle 39 'solid 'red)) > (define workspace (empty-scene 1000 200)) > (define lengte (image-width workspac

Re: [racket] `def' ?

2012-05-10 Thread Matthias Felleisen
On May 10, 2012, at 11:54 AM, Greg Hendershott wrote: > It smells too much like Clojure? (Although I suppose you could > argue `define' smells like classic Scheme.) Just because other languages got there first doesn't mean we should reject the idea :-) Racket Users list

Re: [racket] `def' ?

2012-05-10 Thread Pierpaolo Bernardi
On Thu, May 10, 2012 at 5:54 PM, Greg Hendershott wrote: > Should `def' be added as an alias for `define'? > > Possible reasons why: > 2. Name shortening seems to be a current theme. MALA TEMPORA CVRRVNT Racket Users list: http://lists.racket-lang.org/users

[racket] `def' ?

2012-05-10 Thread Greg Hendershott
Should `def' be added as an alias for `define'? Possible reasons why: 1. Most frequently used. http://lists.racket-lang.org/dev/archive/2012-May/009429.html 2. Name shortening seems to be a current theme. 3. The new style guide prefers `define' over `let'. Re 3 I like the less-indented benefit of

Re: [racket] XREPL on Windows

2012-05-10 Thread Greg Hendershott
> Apologies in advance: I'm talking about something I know *almost* nothing > about, but it appears that these days, "git" for windows ships with something > that looks like a pretty complete "bash". Is this a viable alternative to > cygwin, or are there a whole bunch of pieces that I don't know

Re: [racket] question about dc% and scale

2012-05-10 Thread Robby Findler
Oh, sorry. Robby On Thu, May 10, 2012 at 10:04 AM, Matthew Flatt wrote: > Although pixel alignment can be confusing, I think this one is just a > bug. > > The `draw-rectangle' method tries to adjust the width of an outline so > that in the simple case --- a width 0 or 1 pen in unsmoothed or alig

Re: [racket] question about dc% and scale

2012-05-10 Thread Garrett Mitchener
Okay, yes, using a dc-path% seems to work as intended. Thanks! -- Garrett Mitchener On Thu, May 10, 2012 at 11:04 AM, Matthew Flatt wrote: > Although pixel alignment can be confusing, I think this one is just a > bug. > > The `draw-rectangle' method tries to adjust the width of an outline so >

Re: [racket] question about dc% and scale

2012-05-10 Thread Matthew Flatt
Although pixel alignment can be confusing, I think this one is just a bug. The `draw-rectangle' method tries to adjust the width of an outline so that in the simple case --- a width 0 or 1 pen in unsmoothed or aligned mode with a bitmap target --- the rectangle outline is the given width and heigh

Re: [racket] question about dc% and scale

2012-05-10 Thread Robby Findler
The problem is that the coordinates are "between" the pixels. There is an explanation of this in the context of another library, but the issues are the same: http://docs.racket-lang.org/teachpack/2htdpimage.html?q=2htdp/image#%28part._nitty-gritty%29 hth, Robby On Thu, May 10, 2012 at 8:29 AM,

Re: [racket] Typed Racket Performance Optimization

2012-05-10 Thread Hendrik Boom
On Thu, May 10, 2012 at 08:55:06AM -0400, Ray Racine wrote: > It was late... but the penny dropped this morning. Consider the domain of > log (x) for x<0. Where log a multivalued function, and none of the values are real. Acually, the logarithm function complex numbers is multivalued even when

Re: [racket] left boundary problem

2012-05-10 Thread Matthias Felleisen
I have reformatted your code for readability. Please check whether tests are really complementary. Exercise 1: eliminate all constants from function definition. Exercise 2: clearly separate all constants that are freely definable (image of kat) from those that depend on these (size of kat an

[racket] question about dc% and scale

2012-05-10 Thread Garrett Mitchener
Hi, I'm learning the racket GUI package, and I ran into something that doesn't make sense to me: #lang racket/gui (define black-pen (new pen% [width 1] [color "black"])) (define blue-brush (new brush% [color "blue"])) (define (draw-test-2 dc) (send dc scale 10 10) (

[racket] Apache Thrift bindings for Racket?

2012-05-10 Thread Grant Rettke
Hi, Anyone used Apache Thrift http://thrift.apache.org/ with Racket? Would anyone find it useful? Best wishes, Grant -- http://www.wisdomandwonder.com/ ACM, AMA, COG, IEEE Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Typed Racket Performance Optimization

2012-05-10 Thread Ray Racine
It was late... but the penny dropped this morning. Consider the domain of log (x) for x<0. On Thu, May 10, 2012 at 8:38 AM, Vincent St-Amour wrote: > As Neil said, `fllog' is guaranteed to return floats. > > If you want to know for which input types `log' has a return type of > `Float', you can

Re: [racket] Typed Racket Performance Optimization

2012-05-10 Thread Vincent St-Amour
As Neil said, `fllog' is guaranteed to return floats. If you want to know for which input types `log' has a return type of `Float', you can use `:query-result-type' at the TR REPL. -> (:query-result-type log Float) (case-> (Nonnegative-Flonum -> Float) (Float-Zero -> Negative-Float)) If

[racket] left boundary problem

2012-05-10 Thread Roelof Wobben
Hello, I have to make a programm which displays a cat. When the cat is at the left or rigth end an disapear it has to turn the direction. So I have come to this : (define kat .) (define workspace (empty-scene 1000 200)) (define lengte (image-width workspace)) (define lengte2 (/ (image-width k