[racket-users] stream-lazy

2015-07-26 Thread Jos Koot
Hi
 
Modules racket/streams and srfi/41/streams do not export stream-lazy.
Module srfi/41/streams exports stream-lambda and define-stream.
Module racket/streams does not export these.
 
When Phil Bewig was preparing his srfi 41,
I had may discussions with him about providing stream-lazy to the user.
He preferred not to do so and in stead provided stream-lambda and
define-stream.
 
I advocate stream-lambda or stream-lazy to be exported from racket/streams.
Personally I prefer stream-lazy.
The attached example shows why stream-lazy can be useful.
stream-lambda may do as well, because, as the example shows,
stream-lazy can be exposed by means of stream-lambda.
 
Best wishes, Jos Koot
 

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


equal-fringe.rkt
Description: Binary data


[racket-users] TR: Option values

2015-07-26 Thread Jordan Johnson
Hi all,

Writing TR code, I find that the more I use the Option type, the more I want 
something like Haskell’s Maybe monad. Is there any existing tool I’m missing, 
that provides for applying functions to values of type (Option x), by 
propagating failures?

If not, would it be sensible to include such a thing in one of the TR packages 
as a standard TR library?

Unfortunately, I haven’t figured out a way to write a variable-arity version: 
This fails, presumably because TR’s occurrence typing is (quite understandably) 
not able to do much with ormap:

(: maybe-apply (All (a b) ((a * - (Option b)) (Option a) * - (Option b
(define (maybe-apply f . vs)
  (if (ormap not vs) #f (apply f vs)))

Error:
Type Checker: Bad arguments to function in `apply':
Domain: a *
Arguments: (Listof (U False a)) *
 in: (apply f vs)

But even having a trio of unary/binary/ternary versions would be very helpful. 
I’ve put up a tiny and crude library here 
https://github.com/RenaissanceBug/option-bind, but imagine there’s a better 
way to bring it into the racket ecosystem. Thoughts?

Cheers,
jmj

-- 
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] saving a BMP in racket

2015-07-26 Thread 'John Clements' via Racket Users

 On Jul 23, 2015, at 2:47 AM, copycat kangren.c...@gmail.com wrote:
 
 Yes, i can and will try with the old imagemagick bindings.
 
 On Thursday, July 23, 2015 at 6:28:00 AM UTC+8, johnbclements wrote:
 On Jul 20, 2015, at 4:11 AM, copycat kangren.c...@gmail.com wrote:
 
 Hi, not sure if this is considered a bug?
 
 (send model save-file model1.bmp 'bmp)
 
 save-file in bitmap%: kind saving not yet implemented: 'bmp
 
 I found this link, and it's been 2 years since. Is it an update that will 
 take a long time?
 
 http://stackoverflow.com/questions/14987784/how-can-i-save-a-bmp-in-racket
 
 My guess is that no one is currently working on this. I just took a quick 
 1-minute look at the respective wikipedia pages for PNGs and BMPs, and it 
 appears that although in principle BMP can support things that PNG cannot 
 (e.g., arbitrary bit-depth color channels), a PNG is not likely to lose any 
 of the information associated with a racket bitmap%, meaning that generating 
 a PNG and then converting it to a BMP using an external utility should 
 produce the same result as directly creating a BMP. Granted, it’s not as 
 convenient.
 
 Given this, would you consider this issue resolved if the word “yet” was 
 simply removed from the error message?

I’ve reworded this error message and pushed the change; I will cheerfully 
revert it if anyone objects.

John

 
 Best,
 
 John Clements
 
 
 
 -- 
 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.


Fwd: Re: [racket-users] What limits would you put on racket?

2015-07-26 Thread Doug Williams
I also forgot to reply to the list.
-- Forwarded message --
From: Doug Williams m.douglas.willi...@gmail.com
Date: Jul 23, 2015 9:21 AM
Subject: Re: [racket-users] What limits would you put on racket?
To: Sayth Renshaw flebber.c...@gmail.com
Cc:

If you're strictly comparing Racket to other Lisp dialects, I would say
there is never any reason to go to a different Lisp dialect. The main
exception would be if there is some specific, existing capability in a
different language that you require. But, that is not a dialect issue.

I regularly use Racket for complex analysis tasks. The mathematic and
plotting capabilities available are superior  (in my opinion) to other
dialects.

Your mileage may vary.

Doug Williams
On Jul 22, 2015 11:51 PM, Sayth Renshaw flebber.c...@gmail.com wrote:

 Hi

 Just getting reacquainted with Racket going back through HTDP 2nd edition
 and the edx intro course.

 Is there a point where you would say yeah Racket shouldn't go there, it's
 best at A B or C you should go to Chez, Sbcl, CCL etc.

 Sayth

 --
 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] Scribble undefined tags

2015-07-26 Thread Jordan Johnson
On Jul 25, 2015, at 2:48 PM, Matthew Flatt mfl...@cs.utah.edu wrote:
 Do the broken references show up when rendering docs with `raco setup`
 or `raco pkg {install,update}`, or do they show up when running
 `scribble` directly on the .scrbl file?

The former.

 If you're seeing this behavior when using `raco setup` or `raco pkg`,
 then it sounds like a bug. Using collection-based paths instead of
 relative paths may be a good idea (to enable directly running
 `scribble`, for example), but it shouldn't be required.

Good to know.

I’ve cleared out all the undefined tag warnings, but without a complete 
understanding of what’s going on. Some further info:

The code I’m documenting is all in TR.
Some of the undefined-tag warnings I saw resulted from the same identifier 
being imported (with for-label) from multiple modules.

When I discovered the multiple-imports problem, I managed to eliminate most of 
the warnings, but until minutes ago I was stuck with a few yet:

raco setup: 0 running: pkgs/jwt/net/jwt/jwt.scrbl
raco setup: WARNING: undefined tag in pkgs/jwt/net/jwt/jwt.scrbl:
raco setup:  ((lib net/jwt.rkt) decode-jwt)
raco setup:  ((lib net/jwt.rkt) decode/verify)
raco setup:  ((lib net/jwt.rkt) verify-jwt)
raco setup:  ((lib typed/json.rkt) JSExpr)

I’m ignoring the JSExpr one, since I know JSExpr is not in the Scribble docs 
yet. (FWIW, about a month ago I put in a pull request that would add that to 
the TR docs https://github.com/racket/typed-racket/pull/155.)

Here’s the Scribble file:
  https://github.com/RenaissanceBug/racket-jwt/blob/master/net/jwt/jwt.scrbl

Here’s the net/jwt.rkt file referenced above:
  https://github.com/RenaissanceBug/racket-jwt/blob/master/net/jwt.rkt
It pulls in, and then re-provides, the three offending names from this file:
  
https://github.com/RenaissanceBug/racket-jwt/blob/master/net/jwt/encode-decode.rkt
I’ve checked that those names are not being required from any other module by 
the Scribble file.

And then I happened to add this line 
https://github.com/RenaissanceBug/racket-jwt/blob/master/net/jwt/jwt.scrbl#L131,
 and the undefined-tag errors magically went away.

Since there’s no obvious likely connection between that section header and the 
names being (un)defined, my best guess at what happened is that
I discovered the relationship to names imported from two sources, and started 
adjusting my imports
I made some unrelated changes to the Scribble doc
I rebuilt the docs and got only the four errors I pasted above
I removed the remaining double-imports
I rebuilt the docs and saw no change — maybe raco setup wasn’t recompiling the 
.scrbl file because it hadn’t been edited?
I made an unrelated change to jwt.scrbl, causing raco setup to detect jwt.scrbl 
had changed and do something differently
The remaining errors then disappeared

(And when I tried removing the section header again, the errors didn’t return.)

Still, I’ve no idea what exact connection there might be to multiple imports of 
the same name, but AFAICT that was related. I hope this info, vague as it is, 
is still of some help.

Best,
jmj

 
 At Fri, 24 Jul 2015 21:56:45 -0700, Matthew Butterick wrote:
 I’ve always found that it’s more reliable to use fully-qualified package
 names with `for-label`, e.g.
 
 (require (for-label jordan/package))
 
 rather than
 
 (require (for-label main.rkt))
 
 Once upon a time I had similar problems, and noticed that fully-qualified
 names is the habit used in many internal Racket packages. The reasons why
 this works are dimly remembered. I presume it has something to do with the
 fact that all Scribble docs are rendered into the main docs directory for
 your installation, thus breaking local paths that wander outside your
 'scribblings' subdirectory.
 
 On Fri, Jul 24, 2015 at 8:58 AM, Jordan Johnson j...@fellowhuman.com wrote:
 
 Hi all,
 
 I have a file *main.scrbl* in the same directory as a file *main.rkt*. In
 the .scrbl file, I have
 
 (require (for-label main.rkt))
 
 and several *defproc* and *defstruct** forms. For some reason, one of my
 *defstruct** forms works as expected, while all of the other *defstruct** 
 and
 *defproc* forms produce undefined-tag warnings (when I build the docs via
 raco setup), and compile to a red-underlined name in the resulting HTML.
 
 In DrRacket, mousing over the struct names in *main.scrbl*, I see a pink
 arrow with a question mark pointing from the *for-label* line to the
 struct name, and DrRacket correctly reports that the struct name’s binding
 is imported from *main.rkt*.
 
 What might I be missing, that could be causing undefined-tag errors?
 
 Thanks,
 jmj
 
 --
 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 

[racket-users] Slack team for racket

2015-07-26 Thread Jason Yeo
Hi Everyone!

For anyone out there who finds IRC too daunting and difficult to use, there's a 
slack team created just for racketlang at http://racket.slack.com. Get invites 
to the team at http://racket-slack.herokuapp.com.

Cheers,
Jason

-- 
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] must manually delete compiled file for tests/racket/package.rkt ?

2015-07-26 Thread 'John Clements' via users-redirect
I updated my tree today and ran make, and ran into this error:

raco pkg update: packages conflict
  package: compatibility-test
  package: racket-test
  module path: tests/racket/package


I did a little investigating, and sure enough, I can see that while this file 
used to be a part of the racket-test package, it’s now a part of 
compatibility-test. I went into the compiled subdirectory, and manually deleted 
package*.zo, and it looks like things are going fine now, but it seems to me 
that this shouldn’t have happened… should it?

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] must manually delete compiled file for tests/racket/package.rkt ?

2015-07-26 Thread Matthew Flatt
Yes, this is a limitation of `raco pkg` that is on my list to repair.

It happens when a file is removed from a linked package, such as the
packages in pkgs, and only when the corresponding .zo file is not
yet deleted. It's not an actual conflict, because `raco setup` will
soon remove the .zo file, but `raco pkg` doesn't yet take future
action that into account.

At Sun, 26 Jul 2015 18:13:51 -0400, 'John Clements' via users-redirect wrote:
 I updated my tree today and ran make, and ran into this error:
 
 raco pkg update: packages conflict
   package: compatibility-test
   package: racket-test
   module path: tests/racket/package
 
 
 I did a little investigating, and sure enough, I can see that while this file 
 used to be a part of the racket-test package, it’s now a part of 
 compatibility-test. I went into the compiled subdirectory, and manually 
 deleted package*.zo, and it looks like things are going fine now, but it 
 seems 
 to me that this shouldn’t have happened… should it?
 
 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.


[racket-users] UDP bytes?

2015-07-26 Thread Слава ПолноеИмя
Sorry, list, for dumb unprofessional question, but I'm not even amateur 
programmer)
How can I convert string and floats to bytes, that can be passed to udp-send? 
Tried real-floating-point-bytes and string-bytes/utf-8 but it produces not 
compatible output. 
Any best practices of forming udp datagrams in racket exists?

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