Re: [racket-users] raco run but (please) dont process the docs

2016-11-13 Thread Meino . Cramer
Asumu Takikawa  [16-10-23 18:12]:
> Hi Meino,
> 
> On 2016-10-23 11:09:48 +0200, meino.cra...@gmx.de wrote:
> > It there any way to tell raco what kind
> > of doc processing is wanted and what don't?
> 
> In addition to Daniel's answer, there is a temporary workaround you can do 
> which
> is to install a package with the --no-setup flag like this:
> 
>   raco pkg install --no-setup 
>   raco setup -D
> 
> the -D flag to setup tells it to avoid building docs.
> 
> Cheers,
> Asumu
> 

Hi Asumu,

before I screw up things: 

Does this also work:

   raco pkg update --no-setup --all 
   raco setup -D


???

Thanks a lot for any help in advance! :)

Cheers,
Meino


-- 
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] filesystem-change-evt and thread-suspend

2016-11-13 Thread Philip McGrath
Hi everyone,

I've been trying to get to know Racket's threads and particularly 
filesystem-change-evt, and I've come to a point of confusion. I thought that a 
filesystem-change-evt's synchronization result was supposed to be the event 
itself, which it is most of the time, but in combination with thread-suspend it 
seems to produce #f, and I'm not sure why.

Here's a tiny example:

> (define t
   (thread (λ ()
   (println (sync (filesystem-change-evt "test"))
> (thread-suspend t)
;; at this point I go and do something like "echo foo >test"
> (thread-resume t)
;; prints #f

Is this supposed to happen?

What's particularly confusing is that the same thing happens (i.e. #f is 
printed) if I instead define t to be:

(thread
   (λ ()
 (println
   (sync (wrap-evt (filesystem-change-evt "test")
   (λ (x) 'my-result))

Does anyone know what's going on?

Thanks,
Philip

-- 
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: Logging and stdout in web-server

2016-11-13 Thread Luke
Does anyone have any tips on how to turn on transparent request logging from 
this question above?

2) How do I insert the transparent request logger in my dispatch-rules so that 
request info will be shown on stdout?

Thanks!

Luke

-- 
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: Logging and stdout in web-server

2016-11-13 Thread Luke
Well, that was ridiculously easy.

Thanks!

Luke

-- 
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] Request for comments: An embedded DSL for CSS in Racket

2016-11-13 Thread WarGrey Gyoudmon Ju
I have been writing my CSS engine.

[sorry this reply might be a little off-topic here]

Long period before, someone in this mailing list asked if their are user
editable configuration file formats that can be used in real world
applications. `info.rkt` might be a choice but it is not designed for the
purpose. Finally I choose the syntax of CSS to achieve the goal because it
is elegant and expressive enough, although I cannot say I like it, it is
the only choice for web front-end guys.

As I have mentioned before, Scribble has already acted as a great and
powerful preprocessor, I think therefore there is no much necessary to
write a CSS front-end with s-exp looking in practice.

At the beginning of the task, I have struggled to work with the syntax
object (yes, it is one of the core essentials that make Racket different),
however it is hard to trace the datatypes of CSS itself (and
case-sensitivity), this is even more painful in Typed Racket. Thus, I think
write my own parser along with datatypes and exn trees is a better choice.

Meanwhile I have finished the engine of CSS syntaxes, grammars and
computation modeling(which is the supplement of what CSS preprocessors do),
and trying to make CSS interact with Racket efficiently. BTW, CSS is not
good architected as a programming language, I am not sure if I would keep
following their specs(I mean the language parts, I don't care the applied
parts), it is becoming too complicated but does not make much sense.

One of the major reasons I started this project is I need an expressive way
to describe (desktop) applications in Racket, maybe in the future I will
release a CSS-based GUI frameworks. Finally I still need to find a more
efficient computation model because this engine is running in the runtime,
after upgrading to Racket 6.7, it's surprisingly slower than before...

On Fri, Oct 28, 2016 at 3:17 AM,  wrote:

> Hi, all.
>
> I am working on an embedded DSL for CSS in Racket. I want to get feedback
> from
> the community regarding the project’s goals and my choice of tools for
> implementing it.
>
>
> LANGUAGE
>
> I want to use Racket to generate CSS for me. I am not interested in a
> “#lang”
> language, but in a DSL that lives embedded in the code. In particular, I
> want
> “quote” and “unquote”. The best I can think of is something like:
>
>   (define main-background-color #'red)
>   (define the-css
> #`([body #:background-color #,main-background-color]))
>   (css-expr->string the-css) ;; => "body{background-color:red;}"
>
> Note the explicit use of syntax objects. They allow for arbitrary “quote”
> and
> “unquote” and preserve source location information, which improves the
> quality
> of error messages. This is the best solution I could find, but I recognize
> it is
> unusual—I cannot name a single other example of embedded DSL in Racket that
> operates with syntax objects directly. Can you think of something better?
>
>
> COMPILER FRONT END
>
> I want good error messages, so I am using “syntax-parse”. I defined the
> concrete
> syntax tree in terms of syntax classes—each production rule on the
> context-free
> grammar for the concrete syntax tree is a “syntax-parse” syntax class. For
> example, the following defines a “stylesheet” as a list of “rules”:
>
>   (define-syntax-class stylesheet
> (pattern (rule:rule ...)))
>
> The abstract syntax tree are typed structs, because I want to benefit from
> the
> correctness guarantees of Typed Racket. For example, the following is a
> struct
> for “stylesheets”:
>
>   (struct stylesheet ([rules : (Listof rule)]) #:transparent)
>
> Then, the parser uses “syntax-parse” with the syntax classes to generate
> the
> typed structs. For example, the following is a parser rule for
> “stylesheets”:
>
>   (define (parse/stylesheet expression)
> (syntax-parse expression
>   [stylesheet:stylesheet
>(extended:stylesheet (map parse/rule
>  (syntax->list #'(stylesheet.rule
> ...]))
>
> With this approach, I get a combination of good parsing error messages and
> typed
> structures to work on the compiler back end. But there is no
> “syntax-parse” in
> Typed Racket, so the parser module must be untyped. The interaction between
> untyped (compiler front end) and typed (compiler back end) modules leads to
> performance penalties. Overall, the whole architecture feels awkward, I
> feel
> like I am fighting the tools. Can you think of a better solution?
>
>
> COMPILER BACK END
>
> I use the typed structures in a module that concatenates strings to form
> CSS. This is the part I am happiest about, but I accept suggestions of more
> principled approaches than carefully constructed calls to “string-append”
> and
> “string-join”.
>
>
> OPINION
>
> My inspiration were the DSLs from http://www.cliki.net/CSS. I could not
> find a
> Racket equivalent. The following is an example of what the language looks
> like,
> recreating the CSS from 

Re: [racket-users] If a thunk is a proc of zero arguments, what is a proc of one argument?

2016-11-13 Thread 'John Clements' via Racket Users

> On Nov 13, 2016, at 06:42, David Storrs  wrote:
> 
> Thanks, all.  Points well taken and I'll go back to writing lambda (x).  I 
> appreciate the pointer to those packages, though.

Minor point; you know that you can type λ directly in DrRacket using 
cmd-backslash, right?

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.


Re: [racket-users] Re: What is the fastest way to find the total free space on the disk?

2016-11-13 Thread WarGrey Gyoudmon Ju
I have written one in my project
this task varies both from OS and filesystem.

https://github.com/digital-world/sakuyamon/blob/master/digitama/posix.c
It works on Solaris/Linux/MacOSX, and collects more sysinfo metrics than
just disk usage.

`ffi_prefab_ksysinfo` is the main struct, and `system_statistics` is the
entrance.
You have to write your own FFI wrapper since currently I am busy in another
project
and that one is bad architected.


On Fri, Nov 4, 2016 at 1:18 AM, David Storrs  wrote:

>
>
> On Thu, Nov 3, 2016 at 12:58 PM, Ethan Estrada 
> wrote:
>
>> On Wednesday, November 2, 2016 at 12:20:12 PM UTC-6, David K. Storrs
>> wrote:
>> > I've been looking through the docs for how to check available disk
>> space.  I looked in the  filesystem and os libraries and I threw keywords
>> at the search tool, but I can't find an answer.
>> >
>> > I'm looking for the equivalent of the Unix / OSX "df" command.  I could
>> shell out and parse the output, I suppose, but that seem unportable and
>> error prone.  Is there a builtin for it?
>>
>> I don't know of anything builtin or in the official package repo to do
>> this. Your best short term bet is probably using the kluge you came up
>> with: shelling out to the "df" command and parsing the output.
>>
>> However, it sounds like this functionality is something that could
>> eventually be abstracted into a module using native system libraries and
>> FFI. It would mostly be a research project to find out which system
>> libraries one would need. If I had more time right now, I'd work on it
>> myself to get more hands on racket experience.
>>
>>
> Okay, good to know.  Thanks!
>
>
>
>> --
>> 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.
>

-- 
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: If a thunk is a proc of zero arguments, what is a proc of one argument?

2016-11-13 Thread Eli Barzilay
On Sun, Nov 13, 2016 at 6:48 AM, Ian Barland  wrote:
> [...]
>
> Also, in this particular case, my chafing at the extra-characters was
> ameliorated by a tip from Eli Barzilay: drop the space after the "λ",
> e.g. `(λ(n) (+ n 1))`.  It's still quite readable, and whittles away
> at the character-savings the other macros are providing.

BTW, for anyone who has a bad rection to the removal of the
holy-space-before-a-"(" -- it's not a random droppage of a character to
get things to be shorter...  It's based on an idea from my thesis, where
the binding name is considered part of the syntax of the term.  So in
that view "(x)" is actually part of the "λ" which clarifies that the
holy space there is not so holy since the "()"s are just a grouping
device and not a proper subform.

-- 
   ((x=>x(x))(x=>x(x)))  Eli Barzilay:
   http://barzilay.org/  Maze is Life!

-- 
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] If a thunk is a proc of zero arguments, what is a proc of one argument?

2016-11-13 Thread David Storrs
Thanks, all.  Points well taken and I'll go back to writing lambda (x).  I
appreciate the pointer to those packages, though.

On Sat, Nov 12, 2016 at 6:21 PM, Hendrik Boom 
wrote:

> On Sat, Nov 12, 2016 at 01:22:42PM -0800, David Storrs wrote:
> > The 'thunk' procedure is really useful and is sprinkled liberally through
> > my code because it saves keystrokes / is clearer than (lambda () ...).  I
> > often find myself writing (lambda (x) ...) for something and wishing that
> > there was an equivalent of 'thunk' for that.
> >
> > Is there?  If not, what would be a good name for it that I could use to
> > create a macro for it?  My current suggestion is 'thwonk', but I figured
> > I'd bounce it off other people first.
>
> Let's say te nake is thonk.
>
> You mean to write (thonk c ...) instead of (lambda (c) ...)?
>
> Just to save a pair of parentheses?  I'd say the real problem is that
> lambda is six letters long.  maybe you want aininfoc operator, like
>(c +> ...)
> But I don't know who you'd get that into a macro.
>
> -- 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.
>

-- 
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] If a thunk is a proc of zero arguments, what is a proc of one argument?

2016-11-13 Thread Hendrik Boom
On Sat, Nov 12, 2016 at 01:22:42PM -0800, David Storrs wrote:
> The 'thunk' procedure is really useful and is sprinkled liberally through
> my code because it saves keystrokes / is clearer than (lambda () ...).  I
> often find myself writing (lambda (x) ...) for something and wishing that
> there was an equivalent of 'thunk' for that.
> 
> Is there?  If not, what would be a good name for it that I could use to
> create a macro for it?  My current suggestion is 'thwonk', but I figured
> I'd bounce it off other people first.

Let's say te nake is thonk.

You mean to write (thonk c ...) instead of (lambda (c) ...)?

Just to save a pair of parentheses?  I'd say the real problem is that 
lambda is six letters long.  maybe you want aininfoc operator, like
   (c +> ...)
But I don't know who you'd get that into a macro.

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

-- 
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: If a thunk is a proc of zero arguments, what is a proc of one argument?

2016-11-13 Thread Ian Barland
> Personally however, I recommend against such a macro ...
> This is the kind of feature where everyone's got their own favorite
syntax for it.
>
+1 on this wisdom, for this particular construct.  I used my own
personalized macro for several years, but finally decided it wasn't worth
the cost of having to re-write bits, whenever I shared/showed code-snippets
with others.  (As a teacher, I might do this more often than you, though.)

Also, in this particular case, my chafing at the extra-characters was
ameliorated by a tip from Eli Barzilay: drop the space after the "λ", e.g.
 `(λ(n) (+ n 1))`.  It's still quite readable, and whittles away at the
character-savings the other macros are providing.


> Here's various examples ... with these packages:
>
@Jack: Thanks for taking the time to include those examples (I wouldn't
have bothered looking up all three, just given the package-names).

--Ian

-- 
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: If a thunk is a proc of zero arguments, what is a proc of one argument?

2016-11-13 Thread Jack Firth
I'm assuming you intend to *use* the argument, in which case this is a trickier 
macro to write than `thunk` because you have to make sure the macro respects 
scope properly. If you wanted a function that accepts one argument and ignores 
it, you can use `const`. Otherwise, you can implement a macro like this with a 
syntax parameter[1]:

(define-syntax-parameter the-arg #f)
(define-syntax-parser func
  [(func body:expr ...)
   #' (lambda (arg)
(syntax-parameterize ([the-arg (make-rename-transformer #'arg)])
  body ...))])

(define add1 (func (+ the-arg 1)))

Personally however, I recommend against such a macro. I find using syntax 
parameters for "keyword"-like (as in what other languages call keywords, not 
the Racket #:keyword syntax) behavior can be much harder to understand than 
simple explicit bindings. I'd only use macros like this when there are 
significant readability gains, or it's impossible to do something otherwise. A 
"break" keyword in looping macros is a good use case.

Instead, you may wish to look at existing packages that provide various 
shorthands for writing anonymous functions. The `afl`[2], `curly-fn`[3], and 
`fancy-app`[4] packages all provide various ways of writing anonymous 
functions. Here's various examples of what an anonymous version of `add1` would 
look like with these packages:

plain racket - (lambda (x) (+ x 1))
afl - #λ(+ % 1)
curly-fn - #{+ % 1}
fancy-app - (+ _ 1)

These packages do not all provide identical feature sets, some are more 
restricted than others. Fancy-app doesn't allow anonymous functions with nested 
expressions, and curly-fn automatically curries the resulting function. This is 
the kind of feature where everyone's got their own favorite syntax for it.

[1] - https://docs.racket-lang.org/reference/stxparam.html?q=syntax-parameter
[2] - http://docs.racket-lang.org/afl/index.html
[3] - http://docs.racket-lang.org/curly-fn/index.html
[4] - https://github.com/samth/fancy-app

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