Re: [racket-users] Racket builds for ARM?

2016-10-27 Thread Meino . Cramer
Hi Matthew,

thanks fpr your reply! :)

I received a recipe how to modify the configuration
of the ARMBIAN to pull from "unstable" source.
"Unstable" includes racket 6.6 (and hopfully 6.7
soon) -- I think those "unstable" sources are of
Raspbian... :)
Still downloading/updateingfingers crossed...

Cheers,
Meino



Matthew Flatt  [16-10-28 05:04]:
> If ARMBIAN and Raspbian are compatible, then you could try the Utah
> snapshot site's Raspbian build:
> 
>   http://www.cs.utah.edu/plt/snapshots/
> 
> At Fri, 28 Oct 2016 03:21:49 +0200, meino.cra...@gmx.de wrote:
> > Hi,
> > 
> > after putting Racket on my desktop Linux box and on my tablet
> > (ARCHLinux chroot, x86 CPU) I want to put Racket on my Orange PI
> > PC (which is a Raspberry Pi inspired SoC-Computer). This Orange
> > Pi PC runs a " ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i"
> > The CPU is (according to /proc/cpuingo) a
> > ARMv7 Processor rev 5 (v7l).
> > 
> > ARMBIAN only offers a (according to 'apt search racket')
> > racket/stable 6.1-4 armhf.
> > 
> > Is there any source known, which offers recent builds for this
> > platform?
> > 
> > Thanks a lot for any help!
> > 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.
> 
> -- 
> 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] Racket builds for ARM?

2016-10-27 Thread Matthew Flatt
If ARMBIAN and Raspbian are compatible, then you could try the Utah
snapshot site's Raspbian build:

  http://www.cs.utah.edu/plt/snapshots/

At Fri, 28 Oct 2016 03:21:49 +0200, meino.cra...@gmx.de wrote:
> Hi,
> 
> after putting Racket on my desktop Linux box and on my tablet
> (ARCHLinux chroot, x86 CPU) I want to put Racket on my Orange PI
> PC (which is a Raspberry Pi inspired SoC-Computer). This Orange
> Pi PC runs a " ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i"
> The CPU is (according to /proc/cpuingo) a
> ARMv7 Processor rev 5 (v7l).
> 
> ARMBIAN only offers a (according to 'apt search racket')
> racket/stable 6.1-4 armhf.
> 
> Is there any source known, which offers recent builds for this
> platform?
> 
> Thanks a lot for any help!
> 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.

-- 
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: Racket v6.7

2016-10-27 Thread byrondavies
Thank you, Jay McCarthy, for making it possible to create Racket-based apps for 
Android.  This was a necessity for our Global Learning XPRIZE project, and it's 
working superbly. I really like the capability you provided to develop on the 
Mac platform, test in a Mac-based simulator, and then export the code to an 
Android app.

Byron Davies, CEO
Black Swan Learning
http://blackswanlearning.com

On Wednesday, October 26, 2016 at 4:36:46 PM UTC-7, Vincent St-Amour wrote:
> Racket version 6.7 is now available from
> 
> http://racket-lang.org/
> 
> - Racket supports building graphical applications on Android through the
>   racket-android project: https://github.com/jeapostrophe/racket-android
> 

-- 
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-10-27 Thread Matthew Butterick
None of the below is meant to deter your voyage of discovery! 
Have fun and hack around!

On Oct 27, 2016, at 12:17 PM, lfacc...@jhu.edu wrote:
> I cannot name a single other example of embedded DSL in Racket that
> operates with syntax objects directly. Can you think of something better?


1) Perhaps have a look at the approach used by the `xml` and `html` and `json` 
libraries, which is 1) parse data from string, 2) store data in nested structs, 
3) generate new string from nested-struct thingy.

2) Maybe a metalanguage that embeds at the reader level, and expands certain 
source strings into S-expressions? See http://docs.racket-lang.org/debug/ for 
an example, where the `#R` prefix in source takes on special meaning.

>  ([body
>{#:margin (40px auto)
> #:max-width 650px
> #:line-height 1.6
> #:font-size 18px
> #:color |#444|
> #:padding (0 10px)}]
>   [h1 h2 h3
>   {#:line-height 1.2}])


Notationally, how is this an improvement over regular CSS? And if it's not, why 
not use regular CSS notation, and parse it?


> Furthermore, I implemented some ideas that I borrowed from other CSS
> preprocessors such as SASS/Less. For example, the language supports nested
> declarations and attributes, appropriately unnesting them when generating the
> CSS output.

IMHO, automating piles of repetitive CSS is the best reason to make a library. 
But I have not upgraded my terrible, horrible, no good, very bad `css-tools` 
library into something suitable for public consumption for two reasons:

1) To write a library that actually parses and generates good CSS, I'd have to 
keep up with the CSS spec, and all the browsers, and that gives me the shivers.

2) Most of what I need is basic computational work — variable substitution, 
math operations, string expansions — and I couldn't figure out what a separate 
library would add that I couldn't already do with simple Racket functions 
embedded in a Pollen source file.



-- 
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: Racket builds for ARM?

2016-10-27 Thread Ken MacKenzie
Perhaps not the answer you want, but you could always pull the source from the 
github repo and compile it for arm.

Ken

On Thursday, October 27, 2016 at 9:21:57 PM UTC-4, meino.cramer wrote:
> Hi,
> 
> after putting Racket on my desktop Linux box and on my tablet
> (ARCHLinux chroot, x86 CPU) I want to put Racket on my Orange PI
> PC (which is a Raspberry Pi inspired SoC-Computer). This Orange
> Pi PC runs a " ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i"
> The CPU is (according to /proc/cpuingo) a
> ARMv7 Processor rev 5 (v7l).
> 
> ARMBIAN only offers a (according to 'apt search racket')
> racket/stable 6.1-4 armhf.
> 
> Is there any source known, which offers recent builds for this
> platform?
> 
> Thanks a lot for any help!
> 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] Racket builds for ARM?

2016-10-27 Thread Meino . Cramer
Hi,

after putting Racket on my desktop Linux box and on my tablet
(ARCHLinux chroot, x86 CPU) I want to put Racket on my Orange PI
PC (which is a Raspberry Pi inspired SoC-Computer). This Orange
Pi PC runs a " ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i"
The CPU is (according to /proc/cpuingo) a
ARMv7 Processor rev 5 (v7l).

ARMBIAN only offers a (according to 'apt search racket')
racket/stable 6.1-4 armhf.

Is there any source known, which offers recent builds for this
platform?

Thanks a lot for any help!
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.


Re: [racket-users] macros

2016-10-27 Thread Alexis King
First of all, #lang racket is not Scheme, nor does it claim to be.
However, #lang r5rs does attempt to be Scheme, and it exhibits the same
behavior as #lang racket in this case, so your question is still valid.
I would argue that, in this case, Racket gets it right, and Bigloo and
Kawa are noncomformant.

In both R5RS and R7RS, the way syntax-rules matches “literals” is quite
explicit[1]:

  “[…] an input expression E matches a pattern P if and only if […]
   P is a literal identifier and E is an identifier with the same
   binding […]”

The wording “with the same binding” is important. This means literals
must not be matched by datum (that is, by their name) but by their
lexical binding. When you redefine `else`, you have created a new
binding that is distinct from the binding (or lack thereof) provided by
the Scheme standard library.

The `cond` form is listed as a “derived expression”, and an
implementation of `cond` using `syntax-rules` is provided by the
report[2]. However, it does not appear that Bigloo or Kawa properly
implement the same binding restriction mandated by the standard, so they
are nonconformant.

I also tested two other Schemes, somewhat randomly chosen. Chibi Scheme
exhibits the same incorrect behavior as Bigloo and Kawa, but Larceny has
the same behavior as Racket. It would be interesting to see what other
Schemes do, but the practical takeaway seems to be that this part of the
standard is inconsistently implemented, and you cannot depend on it if
you want to (for whatever reason) write portable Scheme.

[1]: http://docs.racket-lang.org/r5rs/r5rs-std/r5rs-Z-H-7.html#%_sec_4.3.2
[2]: http://docs.racket-lang.org/r5rs/r5rs-std/r5rs-Z-H-10.html#%_sec_7.3

> On Oct 27, 2016, at 15:46, Damien Mattei  wrote:
> 
> Hi,
> 
> why this does not work with DrRacket:
> 
> #lang racket
> (define-syntax then
>  (syntax-rules ()
>((_ ev)  ev)
>((_ ev ...) (begin ev ...
> 
> (define-syntax else
>  (syntax-rules ()
>((_ ev)  ev)
>((_ ev ...) (begin ev ...
> 
> (if #f
>(then 
> 1
> 2
> 3)
>(else
> 3
> 4
> 5))
> 
> (cond (#f 'never)
>  (else 'always))
> 
> . else: bad syntax in: else
> 
> it works with others schemes as in bigloo or kawa:
> 
> --
> Bigloo (4.1a)
> ,--^, 
> `a practical Scheme compiler'  _ ___/ /|/ 
>  
> Sam 26 sep 2015 04:59:46 CEST  ,;'( )__, ) '  
>  
> Inria -- Sophia Antipolis ;;  //   L__.   
>  
> email: big...@lists-sop.inria.fr  '   \/  '   
>  
> url: http://www-sop.inria.fr/indes/fp/Bigloo   ^   ^  
>  
> --
> 
> 
> 1:=> (define-syntax then
>  (syntax-rules ()
>((_ ev)  ev)
>((_ ev ...) (begin ev ...
> #unspecified
> 1:=> (define-syntax else
>  (syntax-rules ()
>((_ ev)  ev)
>((_ ev ...) (begin ev ...
> #unspecified
> 1:=> (if #f
>(then 
> 1
> 2
> 3)
>(else
> 3
> 4
> 5))
> 5
> 1:=> (cond (#f 'never)
>  (else 'always))
> always
> 
> Damien

-- 
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] macros

2016-10-27 Thread Damien Mattei
Hi,

why this does not work with DrRacket:

#lang racket
(define-syntax then
  (syntax-rules ()
((_ ev)  ev)
((_ ev ...) (begin ev ...

(define-syntax else
  (syntax-rules ()
((_ ev)  ev)
((_ ev ...) (begin ev ...

(if #f
(then 
 1
 2
 3)
(else
 3
 4
 5))

(cond (#f 'never)
  (else 'always))

. else: bad syntax in: else

it works with others schemes as in bigloo or kawa:

--
Bigloo (4.1a),--^, 
`a practical Scheme compiler'  _ ___/ /|/  
Sam 26 sep 2015 04:59:46 CEST  ,;'( )__, ) '   
Inria -- Sophia Antipolis ;;  //   L__.
email: big...@lists-sop.inria.fr  '   \/  '
url: http://www-sop.inria.fr/indes/fp/Bigloo   ^   ^   
--


1:=> (define-syntax then
  (syntax-rules ()
((_ ev)  ev)
((_ ev ...) (begin ev ...
#unspecified
1:=> (define-syntax else
  (syntax-rules ()
((_ ev)  ev)
((_ ev ...) (begin ev ...
#unspecified
1:=> (if #f
(then 
 1
 2
 3)
(else
 3
 4
 5))
5
1:=> (cond (#f 'never)
  (else 'always))
always

Damien

-- 
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] Identifier equality of identifiers stashed in preserved syntax properties

2016-10-27 Thread Alexis King
As a small followup to this, I managed to come up with the following
hacky workaround, which seems to be working alright so far.
Specifically, it’s a function that converts arbitrary preservable values
into expressions that evaluate to themselves:

  (define preservable-property->expression
(match-lambda
  [(and (app prefab-struct-key (? values prefab-key))
(app struct->vector (vector _ fields ...)))
   #`(make-prefab-struct
  (quote #,prefab-key)
  #,@(map preservable-property->expression fields))]
  [(? list? lst)
   #`(list #,@(map preservable-property->expression lst))]
  [(cons a b)
   #`(cons #,(preservable-property->expression a)
   #,(preservable-property->expression b))]
  [(? syntax? stx)
   #`(quote-syntax #,stx)]
  [(and (or (? boolean?) (? symbol?) (? number?) (? char?)
(? string?) (? bytes?) (? regexp?))
datum)
   #`(quote #,datum)]
  [other
   (error
'preservable-property->expression
"disallowed value within preserved syntax property\n  value: ~e"
other)]))

(That doesn’t currently handle all cases, like boxes/vectors/hash maps,
but it would be easy enough to extend.)

This is obviously a total hack, but it seems to work alright for this
particular case, and I thought I’d share it in case anyone else runs
into the same problem and this is helpful for them, too.

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

2016-10-27 Thread Greg Trzeciak
Have you looked into Clojure's Garden for a possible inspiration:
https://github.com/noprompt/garden
https://www.youtube.com/watch?v=-jnJGNDoSXc

-- 
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] Bug that causes crash ... how to debug? (Linux, Racket 6.7 but also earlier versions)

2016-10-27 Thread Matthew Flatt
As a first step, try gdb like this:

 $ gdb racket
 (gdb) handle SIGSEGV nostop noprint
 (gdb) run ... [arguments to run your program] ...
 (gdb) where

to get a backtrace. Depending on the output, we should have an idea for
the next step.

At Thu, 27 Oct 2016 20:55:52 +0100, Erich Rast wrote:
> Hi!
> 
> I have a bug that in the Linux version of a mid-sized program (closed
> source) that causes the program to immediately crash and also causes
> DrRacket to immediately crash once the command key is pressed in some
> editor in a tab panel of an open frame. No console output, hard crashes
> to desktop. The bug exists for a while already, since at least Racket
> 6.5, I just didn't have the time to take a look at it yet.
> 
> I cannot give away the source code but was wondering whether there is a
> way to debug this, some external debugger or commandline flag for
> racket that might give me some clue, any clue whatsoever, about what's
> going on.
> 
> Any advice?
> 
> Best,
> 
> Erich
> 
> -- 
> 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] Bug that causes crash ... how to debug? (Linux, Racket 6.7 but also earlier versions)

2016-10-27 Thread Erich Rast
Hi!

I have a bug that in the Linux version of a mid-sized program (closed
source) that causes the program to immediately crash and also causes
DrRacket to immediately crash once the command key is pressed in some
editor in a tab panel of an open frame. No console output, hard crashes
to desktop. The bug exists for a while already, since at least Racket
6.5, I just didn't have the time to take a look at it yet.

I cannot give away the source code but was wondering whether there is a
way to debug this, some external debugger or commandline flag for
racket that might give me some clue, any clue whatsoever, about what's
going on.

Any advice?

Best,

Erich

-- 
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] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
I hope to be a trend setter.  Haven't really introduced myself but I find
racket a great toolset for getting 

Re: [racket-users] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
I agree on the importance of an efficient algorithm.  I do feel knowing
some of the internals of how language or development environment stores and
access values can be part of determining the nature of what is the most
efficient algorithm.  Sometimes flaws in an environment can lead to a
counter intuitive solution being the shortest distance from point A to B.
I could relay a tale of SELECT statements in Unidata for that one.

On Thu, Oct 27, 2016 at 2:57 PM, David Storrs 
wrote:

> You know, it's a very pleasant surprise to me how many messages I've
> recently seen on this list that began "I'm just getting started with
> Racket and"  Great to see that the Racket community is growing.
>
> On Thu, Oct 27, 2016 at 2:42 PM, Jos Koot  wrote:
> > Hi
> >
> > Lisp (and Racket) programmers know the value, Fortran (and assembler)
> programmers the cost.
> > Nowadays the PLTeam is working on effeciency too, I think.
> > But: the most important factor for efficient programming is to select
> efficient algorithms.
> > Two very simple, but notorious examples where you can go wrong in
> efficiency with the algorithm
> > are Fibonacci numbers and binomial coefficients.
> >
> > Nowadays we have lots of primary memory, but long ago, with machines
> with limited primary memory,
> > there was a time that for some computations it was faster to recompute
> than to store to and retrieve from disk.
> > Much depends on the architecture of the computer, which in the old days
> was documented very well,
> > so well that you could predict how data were flowing through the
> processors (even with virtual memory).
> > Nowaday manufactures of computers give less information.
> > For a good estimation of the efficiency of a program
> > you have to know which busses are used, their numbers of bits and their
> frequencies
> > and how well these busses connect to each other.
> > Well, a little bit of nostalgia.
> >
> > MHO, Jos
> >
> > -Original Message-
> > From: racket-users@googlegroups.com [mailto:racket-users@
> googlegroups.com] On Behalf Of Ken MacKenzie
> > Sent: jueves, 27 de octubre de 2016 19:28
> > To: Racket Users
> > Cc: deviloc...@gmail.com
> > Subject: Re: [racket-users] Structs vs Lists
> >
> > Thank you for the information.  Good to know.  Performance isn't the
> first thing I am thinking about, but as I am tinkering and
> > getting running with Racket I like to kind of dig into the underlying
> structure to know the cost of certain operations.
> >
> > Ken
> >
> >> For accessing an arbitrary member, yes. A Racket vector is like, say, a
> C array: it's a contiguous chunk of memory, and you can
> > get at any member of it in constant time.
> >>
> >>
> >> For other purposes? Depends on the purpose. A struct is superior to a
> list for struct-like operations. A list is superior to a
> > struct for list-like operations.
> >>
> >
> > --
> > 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.


[racket-users] Request for comments: An embedded DSL for CSS in Racket

2016-10-27 Thread lfacchi2
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 http://bettermotherfuckingwebsite.com/:

  ([body
{#:margin (40px auto)
 #:max-width 650px
 #:line-height 1.6
 #:font-size 18px
 #:color |#444|
 #:padding (0 10px)}]
   [h1 h2 h3
   {#:line-height 1.2}])

   ;; => body{margin:40px auto;…

Furthermore, I implemented some ideas that I borrowed from other CSS
preprocessors such as SASS/Less. For example, the language supports nested
declarations and attributes, appropriately unnesting them when generating the
CSS output. What I like about embedding this DSL in Racket is that some of the
preprocessors’ features are free. For example, CSS variables and mixins are just
“unquote” in Racket.

I am using this DSL to build my website in Pollen, and so far I am happy with
the results. I am envisioning more principled approach to CSS than concatenating
strings, which other (excellent) projects do. For example, see Typography for
Lawyers at
https://github.com/mbutterick/pollen-tfl/blob/1267be5bd002d4d0fe09aaef89b4089147128841/styles.css.pp.

Is this something that interests you too? How do you think I can make this
project better and more useful to the community?

* * *

Thank you very much for your attention and for the feedback.

-- 
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] Structs vs Lists

2016-10-27 Thread David Storrs
You know, it's a very pleasant surprise to me how many messages I've
recently seen on this list that began "I'm just getting started with
Racket and"  Great to see that the Racket community is growing.

On Thu, Oct 27, 2016 at 2:42 PM, Jos Koot  wrote:
> Hi
>
> Lisp (and Racket) programmers know the value, Fortran (and assembler) 
> programmers the cost.
> Nowadays the PLTeam is working on effeciency too, I think.
> But: the most important factor for efficient programming is to select 
> efficient algorithms.
> Two very simple, but notorious examples where you can go wrong in efficiency 
> with the algorithm
> are Fibonacci numbers and binomial coefficients.
>
> Nowadays we have lots of primary memory, but long ago, with machines with 
> limited primary memory,
> there was a time that for some computations it was faster to recompute than 
> to store to and retrieve from disk.
> Much depends on the architecture of the computer, which in the old days was 
> documented very well,
> so well that you could predict how data were flowing through the processors 
> (even with virtual memory).
> Nowaday manufactures of computers give less information.
> For a good estimation of the efficiency of a program
> you have to know which busses are used, their numbers of bits and their 
> frequencies
> and how well these busses connect to each other.
> Well, a little bit of nostalgia.
>
> MHO, Jos
>
> -Original Message-
> From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
> Behalf Of Ken MacKenzie
> Sent: jueves, 27 de octubre de 2016 19:28
> To: Racket Users
> Cc: deviloc...@gmail.com
> Subject: Re: [racket-users] Structs vs Lists
>
> Thank you for the information.  Good to know.  Performance isn't the first 
> thing I am thinking about, but as I am tinkering and
> getting running with Racket I like to kind of dig into the underlying 
> structure to know the cost of certain operations.
>
> Ken
>
>> For accessing an arbitrary member, yes. A Racket vector is like, say, a C 
>> array: it's a contiguous chunk of memory, and you can
> get at any member of it in constant time.
>>
>>
>> For other purposes? Depends on the purpose. A struct is superior to a list 
>> for struct-like operations. A list is superior to a
> struct for list-like operations.
>>
>
> --
> 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] Structs vs Lists

2016-10-27 Thread Jos Koot
Hi

Lisp (and Racket) programmers know the value, Fortran (and assembler) 
programmers the cost.
Nowadays the PLTeam is working on effeciency too, I think.
But: the most important factor for efficient programming is to select efficient 
algorithms.
Two very simple, but notorious examples where you can go wrong in efficiency 
with the algorithm
are Fibonacci numbers and binomial coefficients.

Nowadays we have lots of primary memory, but long ago, with machines with 
limited primary memory,
there was a time that for some computations it was faster to recompute than to 
store to and retrieve from disk.
Much depends on the architecture of the computer, which in the old days was 
documented very well,
so well that you could predict how data were flowing through the processors 
(even with virtual memory).
Nowaday manufactures of computers give less information.
For a good estimation of the efficiency of a program
you have to know which busses are used, their numbers of bits and their 
frequencies
and how well these busses connect to each other.
Well, a little bit of nostalgia.

MHO, Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Ken MacKenzie
Sent: jueves, 27 de octubre de 2016 19:28
To: Racket Users
Cc: deviloc...@gmail.com
Subject: Re: [racket-users] Structs vs Lists

Thank you for the information.  Good to know.  Performance isn't the first 
thing I am thinking about, but as I am tinkering and
getting running with Racket I like to kind of dig into the underlying structure 
to know the cost of certain operations.

Ken

> For accessing an arbitrary member, yes. A Racket vector is like, say, a C 
> array: it's a contiguous chunk of memory, and you can
get at any member of it in constant time.
> 
> 
> For other purposes? Depends on the purpose. A struct is superior to a list 
> for struct-like operations. A list is superior to a
struct for list-like operations.
>  

-- 
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: Crosscompiling executables

2016-10-27 Thread David Storrs
On Thu, Oct 27, 2016 at 9:12 AM, Matthew Flatt  wrote:
> At Wed, 26 Oct 2016 15:16:03 -0400, David Storrs wrote:
>> On Wed, Oct 26, 2016 at 2:30 PM, Matthew Flatt  wrote:
>> > At Wed, 26 Oct 2016 14:01:15 -0400, David Storrs wrote:
>> >>   What is "-l-" ?  (That's an "ell", right?  Not a 1 / pipe /
>> >> etc.)  I would have expected a space between the -l (--lib) and the
>> >> "-".  Is it a typo?
>> >
>> > Yes, it's an "ell", and not a typo. `-l- raco` is short for `-l raco
>> > --`, where `--` causes any later argument that start with "-" to be
>> > passed on to `raco` instead of treated as a flag to `racket`.
>>
>> Ah, good to know.  Is that a Racket-specific thing or a bit of
>> Unix-ish lore that I've not encountered?  Google is not telling me.
>
> Yes, the convention of abbreviating multiple "-" flags with a single
> "-" is Unix-ish (second bullet):
>
>  https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
>

Yep, I was aware of the "combine single-letter flags" thing, I'd just
never seen it done with '--'.  Thanks!


>> On a separate but related note:  I would like to be able to contribute
>> to the docs, both of core Racket and of various packages.  Is there a
>> clear tutorial anywhere on that?  If so I can take the above and add
>> it to the docs for cross compilation.
>>
>> I know that in general this consists of sending a git pull request,
>> but there are quite a few repositories (https://github.com/racket),
>> and it's not obvious at all where the docs (Guide, Reference, etc)
>> reside.  I've done quite a bit of fruitless exploring and finally
>> given up.
>
> You're right that it's not obvious where to find the source.
>
> Clicking a section title effectively tells you the module path of the
> enclosing document's source, since it tells how to link to a section.
> For example, clicking "6.14 API for Cross-Platform Configuration" shows
>
>   @secref["cross-system" #:doc '(lib "scribblings/raco/raco.scrbl")]
>
> You could use DrRacket's "Open Require Path..." menu to open
> "scribblings/raco/raco.scrbl".
>
> Then, it's still some detective work to figure out that section "6.14"
> would be in the 6th `include-section` which is "setup.scrbl", while the
> path of the source file gives you a hint that it's in the package
> "racket-doc". Finally, "pkgs.racket-lang.org" gives the source of
> "racket-doc" as
>
>git://github.com/racket/racket/?path=pkgs/racket-doc
>
> So, it's in the "racket/racket" repo on GitHub, specifically in the
> "pkgs/racket-doc/scribblings/raco" subdirectory.
>
> In short, a pull request at https://github.com/racket/racket would be
> welcome.
>

Okay, thanks.  I'll go dig around a bit and see if I can get a better
handle on how it all works.

Dave

-- 
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] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
Thank you for the information.  Good to know.  Performance isn't the first 
thing I am thinking about, but as I am tinkering and getting running with 
Racket I like to kind of dig into the underlying structure to know the cost of 
certain operations.

Ken

> For accessing an arbitrary member, yes. A Racket vector is like, say, a C 
> array: it's a contiguous chunk of memory, and you can get at any member of it 
> in constant time.
> 
> 
> For other purposes? Depends on the purpose. A struct is superior to a list 
> for struct-like operations. A list is superior to a struct for list-like 
> operations.
>  

-- 
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] Structs vs Lists

2016-10-27 Thread Jon Zeppieri
On Thu, Oct 27, 2016 at 1:09 PM, Ken MacKenzie  wrote:

> Thank you that makes sense.  Vectors are fixed length so in theory could I
> also say a Vector is possibly more performant than an equivalent list?
>
> Ken
>

For accessing an arbitrary member, yes. A Racket vector is like, say, a C
array: it's a contiguous chunk of memory, and you can get at any member of
it in constant time.

For other purposes? Depends on the purpose. A struct is superior to a list
for struct-like operations. A list is superior to a struct for list-like
operations.

-- 
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] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
Thank you that makes sense.  Vectors are fixed length so in theory could I also 
say a Vector is possibly more performant than an equivalent list?

Ken

On Thursday, October 27, 2016 at 12:58:06 PM UTC-4, Jon Zeppieri wrote:
> On Thu, Oct 27, 2016 at 12:16 PM, Ken MacKenzie  wrote:
> This is a question more about the footprint of each.  Deep down is a Struct 
> really just syntactic sugar over a list.  
> 
> 
> Not in Racket (or in most Lisps these days).
> 
> 
>  As in most things in Lisp from my understanding are all just lists, it is 
> the basic building block of all data.  Is a struct also just a list and the 
> element names enumerations of the fields by position.
> 
> 
> 
> In terms of its representation in memory, a Racket struct is more like a 
> vector than a list.
>  
> 
> 
> Basically I am trying to figure out, without writing a benchmark test, if 
> there is any processing overhead in using a struct instead of a list with 
> enumerated field names.
> 
> 
> 
> It should generally be more efficient to access an arbitrary struct field 
> than an arbitrary list member.
>  
> 
> 
> Ken
> 
> 
> 
> --
> 
> 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.

-- 
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] Structs vs Lists

2016-10-27 Thread Jon Zeppieri
On Thu, Oct 27, 2016 at 12:16 PM, Ken MacKenzie 
wrote:

> This is a question more about the footprint of each.  Deep down is a
> Struct really just syntactic sugar over a list.


Not in Racket (or in most Lisps these days).



> As in most things in Lisp from my understanding are all just lists, it is
> the basic building block of all data.  Is a struct also just a list and the
> element names enumerations of the fields by position.
>

In terms of its representation in memory, a Racket struct is more like a
vector than a list.


>
> Basically I am trying to figure out, without writing a benchmark test, if
> there is any processing overhead in using a struct instead of a list with
> enumerated field names.
>

It should generally be more efficient to access an arbitrary struct field
than an arbitrary list member.


>
> Ken
>
> --
> 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/eval interaction hyperlinks locally bound variables

2016-10-27 Thread Jos Koot
Hi Matthias,
Thanks. I'll look into your suggestion.
For the moment, when I see an unwanted link,
I change the name of the local variable
to one not found in the help desk for any module I import. 
Thanks again, Jos

-Original Message-
From: Matthias Felleisen [mailto:matth...@ccs.neu.edu] 
Sent: jueves, 27 de octubre de 2016 16:46
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] scribble/eval interaction hyperlinks locally bound 
variables


> On Oct 27, 2016, at 5:34 AM, Jos Koot  wrote:
> 
> Consider:
> #lang scribble/manual 
> @(require (for-label racket) scribble/eval)) 
> @interaction[(let ((add1 sub1)) (add1 1))]
> In the produced HTML file the locally bound variable 'add1' 
> is linked (in blue) to the docs of Racket's procedure 'add1'. 
> The same problem with @racket[...]
> I can avoid this by using (for-label (except-in racket add1)) 
> but then the link also disappears in 
> @interaction[(add1 3)].
> This is a silly simplified example, of course, 
> but the problem is the probable chance that one uses a local variable 
> or otherwise shaddows a variable with the same name 
> as an imported variable whose existence one is not aware of.
> Is there a way to avoid hyperlinking of 
> locally bound or otherwise shaddowed variables 
> with the same names as imported variables?
> Thanks, Jos



You could define local things so that they also introduce an anchor and then 
references to the local name get linked. (I failed to
think about this when I wrote HtDP/2e but some of us thought ahead and some of 
our papers use such setups.) 

- Matthias

-- 
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] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
This is a question more about the footprint of each.  Deep down is a Struct 
really just syntactic sugar over a list.  As in most things in Lisp from my 
understanding are all just lists, it is the basic building block of all data.  
Is a struct also just a list and the element names enumerations of the fields 
by position.

Basically I am trying to figure out, without writing a benchmark test, if there 
is any processing overhead in using a struct instead of a list with enumerated 
field names.

Ken

-- 
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: Ubuntu PPA for v6.7

2016-10-27 Thread Ken MacKenzie
As a confirmation was part of my upgrades this morning in trusty.

On Thursday, October 27, 2016 at 11:01:01 AM UTC-4, asumu wrote:
> Hi folks,
> 
> The Ubuntu PPA should now be updated for v6.7:
> 
>   https://launchpad.net/~plt/+archive/ubuntu/racket
> 
> It should be available for precise, trusty, xenial, yakkety, and zesty though
> I've only tested it on yakkety.
> 
> (sorry if you get this e-mail twice, the mailing list ate my first e-mail
>  and put it in the moderation queue I think)
> 
> Cheers,
> Asumu

-- 
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: Racket v6.7

2016-10-27 Thread Vincent St-Amour
This looks like an import conflict.

In 6.7, we added a `vector-sort!` function to `racket/vector`. There was
already one in `rnrs/sorting-6`. So if your program requires both
libraries, you will have a conflict.

You can resolve the conflict by looking for places where you require
`rnrs/sorting-6`, and either adding an `except-in` form to your
`require`, to avoid requiring `vector-sort!`, or maybe even skip using
that library altogether.

Sorry for the trouble.

Vincent




On Thu, 27 Oct 2016 09:31:00 -0500,
Some Dude wrote:
> 
> Great news, especially the integrated Android support.
> 
> However, I get this for one of my programs:
> 
> module: identifier already imported from a different source in:
>   vector-sort!
>   rnrs/sorting-6
>   racket/gui
> 
> But what's worse, it doesn't show where the bug occurs, even though debugging 
> is switched on in the language. (The program uses racket/gui).
> 
> Is there a fix for this? Is this a known problem?

-- 
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] Ubuntu PPA for v6.7

2016-10-27 Thread Asumu Takikawa
Hi folks,

The Ubuntu PPA should now be updated for v6.7:

  https://launchpad.net/~plt/+archive/ubuntu/racket

It should be available for precise, trusty, xenial, yakkety, and zesty though
I've only tested it on yakkety.

(sorry if you get this e-mail twice, the mailing list ate my first e-mail
 and put it in the moderation queue I think)

Cheers,
Asumu

-- 
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/eval interaction hyperlinks locally bound variables

2016-10-27 Thread Matthias Felleisen

> On Oct 27, 2016, at 5:34 AM, Jos Koot  wrote:
> 
> Consider:
> #lang scribble/manual 
> @(require (for-label racket) scribble/eval)) 
> @interaction[(let ((add1 sub1)) (add1 1))]
> In the produced HTML file the locally bound variable 'add1' 
> is linked (in blue) to the docs of Racket's procedure 'add1'. 
> The same problem with @racket[...]
> I can avoid this by using (for-label (except-in racket add1)) 
> but then the link also disappears in 
> @interaction[(add1 3)].
> This is a silly simplified example, of course, 
> but the problem is the probable chance that one uses a local variable 
> or otherwise shaddows a variable with the same name 
> as an imported variable whose existence one is not aware of.
> Is there a way to avoid hyperlinking of 
> locally bound or otherwise shaddowed variables 
> with the same names as imported variables?
> Thanks, Jos



You could define local things so that they also introduce an anchor and then 
references to the local name get linked. (I failed to think about this when I 
wrote HtDP/2e but some of us thought ahead and some of our papers use such 
setups.) 

— Matthias

-- 
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: Racket v6.7

2016-10-27 Thread Some Dude
Great news, especially the integrated Android support.

However, I get this for one of my programs:

module: identifier already imported from a different source in:
  vector-sort!
  rnrs/sorting-6
  racket/gui

But what's worse, it doesn't show where the bug occurs, even though debugging 
is switched on in the language. (The program uses racket/gui).

Is there a fix for this? Is this a known problem?

-- 
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: Crosscompiling executables

2016-10-27 Thread Matthew Flatt
At Wed, 26 Oct 2016 15:16:03 -0400, David Storrs wrote:
> On Wed, Oct 26, 2016 at 2:30 PM, Matthew Flatt  wrote:
> > At Wed, 26 Oct 2016 14:01:15 -0400, David Storrs wrote:
> >>   What is "-l-" ?  (That's an "ell", right?  Not a 1 / pipe /
> >> etc.)  I would have expected a space between the -l (--lib) and the
> >> "-".  Is it a typo?
> >
> > Yes, it's an "ell", and not a typo. `-l- raco` is short for `-l raco
> > --`, where `--` causes any later argument that start with "-" to be
> > passed on to `raco` instead of treated as a flag to `racket`.
> 
> Ah, good to know.  Is that a Racket-specific thing or a bit of
> Unix-ish lore that I've not encountered?  Google is not telling me.

Yes, the convention of abbreviating multiple "-" flags with a single
"-" is Unix-ish (second bullet):

 https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html

> >> 3)  Email someone the new "target" executable which they can run on
> >> their Windows machine.
> >>
> >> Is this right?
> >
> > Yes, although I bet you'll need
> >
> >  racket -G /path/to/windows/etc -X /path/to/windows/collects \
> > -l- raco pkg install -i 
> >
> > to install some packages that "target.rkt" uses, since the unpacked
> > ".tgz" will have only the "base" package.
> 
> Probably this would happen first, right?  Unroll the Windows tgz, then
> install the packages, then do the cross-compilation?

Yes.


> On a separate but related note:  I would like to be able to contribute
> to the docs, both of core Racket and of various packages.  Is there a
> clear tutorial anywhere on that?  If so I can take the above and add
> it to the docs for cross compilation.
> 
> I know that in general this consists of sending a git pull request,
> but there are quite a few repositories (https://github.com/racket),
> and it's not obvious at all where the docs (Guide, Reference, etc)
> reside.  I've done quite a bit of fruitless exploring and finally
> given up.

You're right that it's not obvious where to find the source.

Clicking a section title effectively tells you the module path of the
enclosing document's source, since it tells how to link to a section.
For example, clicking "6.14 API for Cross-Platform Configuration" shows

  @secref["cross-system" #:doc '(lib "scribblings/raco/raco.scrbl")]

You could use DrRacket's "Open Require Path..." menu to open
"scribblings/raco/raco.scrbl".

Then, it's still some detective work to figure out that section "6.14"
would be in the 6th `include-section` which is "setup.scrbl", while the
path of the source file gives you a hint that it's in the package
"racket-doc". Finally, "pkgs.racket-lang.org" gives the source of
"racket-doc" as

   git://github.com/racket/racket/?path=pkgs/racket-doc

So, it's in the "racket/racket" repo on GitHub, specifically in the
"pkgs/racket-doc/scribblings/raco" subdirectory.

In short, a pull request at https://github.com/racket/racket would be
welcome.

-- 
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] git-checkout-credentials

2016-10-27 Thread Philip McGrath
I'm excited by the ability to use authentication-required git repositories
with the package system.

> - The package system supports authentication when installing packages
>   from git, using the `raco pkg config git-checkout-credentials`
>   configuration option.
>
What is the value to be provided for git-checkout-credentials? It doesn't
seem to have made it into the docs yet (or, at least, I haven't found it).
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] scribble/eval interaction hyperlinks locally bound variables

2016-10-27 Thread Jos Koot
Consider:

#lang scribble/manual
@(require (for-label racket) scribble/eval))
@interaction[(let ((add1 sub1)) (add1 1))]

In the produced HTML file the locally bound variable 'add1'
is linked (in blue) to the docs of Racket's procedure 'add1'.
The same problem with @racket[...]

I can avoid this by using (for-label (except-in racket add1))
but then the link also disappears in
@interaction[(add1 3)].

This is a silly simplified example, of course,
but the problem is the probable chance that one uses a local variable
or otherwise shaddows a variable with the same name
as an imported variable whose existence one is not aware of.

Is there a way to avoid hyperlinking of
locally bound or otherwise shaddowed variables
with the same names as imported variables?

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


[racket-users] mass production of definitions

2016-10-27 Thread Linh Chi Nguyen
in case someone finds this useful :)




hi vincent,

how are you?

i would like to ask you this , i'm trying to mass produce definitions, however 
`eval is tricky:

(define l1 (list 'a 'b))
(define l2 (list (list 1 2) (list 3 4)))
(for ([i (in-list l1)] [j (in-list l2)]) (eval `(define i j)))

i have tried (eval (list 'define i j)) and other variants but nothing works.
=.=
can you explain to me a bit about this?

(i have 2 exams this week in order to be accepted into the second year, that's 
why i have gone into hibernation since september y.y)

thank you,

+


Hi Chi,

On Wed, 26 Oct 2016 04:41:16 -0500,
Nguyen Linh Chi wrote:
>
> hi vincent,
>
> how are you?

I'm doing great! Now that I'm done with releasing Racket 6.7, I'm a
little bit less busy. :)


> i would like to ask you this , i'm trying to mass produce definitions,
> however `eval is tricky:
>
> (define l1 (list 'a 'b))
> (define l2 (list (list 1 2) (list 3 4)))
> (for ([i (in-list l1)] [j (in-list l2)]) (eval `(define i j)))
>
> i have tried (eval (list 'define i j)) and other variants but nothing
> works.
> =.=
> can you explain to me a bit about this?

As you say, `eval` is tricky. It's almost never the right tool to use in
Racket. Matthew wrote a great blog post about this:


http://blog.racket-lang.org/2011/10/on-eval-in-dynamic-languages-generally.html

What you're trying to do, really, is to write a program (the loop) that
generates a program (a bunch of definitions). That's exactly what
Racket's macros are for.

As a general intro to macros, and Racket's syntax system in general, I
highly recommend Greg Hendershott's Fear of Macros:

http://www.greghendershott.com/fear-of-macros/

Now, as for the specific example you're interested in, here's how you
would do it with a macro:

(define-syntax-rule (multi-define (var ...) (val ...))
  (begin (define var val) ...))

(multi-define (a b) ((list 1 2) (list 3 4)))

and then you use `a` and `b` as if they were any variables.

What this code does is define a new form, `multi-define`. This new form
expects, first, a sequence of variable names (identifiers) inside
parentheses, then second, a sequence of values to use for their bindings.
Then, this new form *expands* into (that is, creates new code) a series
of definitions (that's what the `...` do. that's actual syntax).

Then, the code uses that new form to define `a` and `b`. Note that the
subforms (like arguments, but for syntactic forms) are just sequences
within parentheses. I.e., they are not list *values*. They exist purely
as syntactic constructs.

Now, what this means is that if you want to *compute* the lists of
variables and values, things get a bit more complicated. You'd need to
do that computation at expansion time. That's absolutely doable, and I'm
happy to discuss it further if that's indeed what you want to do. If so,
I'd recommend you read Greg's guide first, just to get the general idea.


With that said, that was the answer to the question you actually asked.
Now, I'll give you the answer to a slightly different question, whose
answer is simpler, but that may still solve the more general problem
you're having.

Variables are useful because they allow you to use the *name* of
something (e.g., `x`) and get access to its *value* (e.g., `2`, assuming
you had `(define x 2)` somewhere). Now, variables are not the only way
of mapping names (or *keys*) to values. A hash table (i.e., `make-hash`)
gives you that too. You put key-value pairs in the hash table, then
later you can ask for the value that is associated with a certain key.

Of course, they're pros and cons to using variables vs hash tables. So
each of them is appropriate in different contexts. In this case, the
advantage of hash tables that interest you is that they're regular
values, like numbers, or lists. Which means you can create them easily
at runtime, from lists of keys and lists of values (e.g., using
`for/hash`). One disadvantage is that hash tables are just "global"
mappings (i.e., a key will map to one value, no matter what), whereas
variables can have scope, shadowing, etc. This may or may not matter in
your case. Finally, more of a surface difference, you can get the value
of a variable just by writing its name down (e.g., `x`). With a hash
table, you need to get the value explicitly (e.g., `(hash-ref my-table x))`.

In any case, I'd recommend you look into whether hash tables may be able
to solve your problem before diving too deep into macros. Both are
useful, of course, but I'd recommend using the simplest tool that will
do the job, and hash tables are simpler than macros.


> (i have 2 exams this week in order to be accepted into the second year,
> that's why i have gone into hibernation since september y.y)

Oh wow. I remember exams; that was a long time ago. I don't miss them. :)

Good luck!

+++


vincent if you answer this long, prob'ly i should post it on the mailing list ^^

try kungfu &