Re: [racket-users] ?Unbound identifier in module in: make-temporary-file

2018-05-16 Thread Philip McGrath
On Wed, May 16, 2018 at 4:09 PM, Neil Van Dyke  wrote:

> Sam answered your question.  Here's how one can usually answer the more
> general question...
>
> * The documentation for most Racket modules will usually say what
> `require` form you need to import it, assuming that you are using the
> `racket/base` language.  For example, if you're looking at the
> documentation for `make-temporary-file` in your Web browser, such as with
> the URL:
> https://docs.racket-lang.org/reference/Filesystem.html#(def.
> _((lib._racket%2Ffile..rkt)._make-temporary-file))


In addition to what Neil said, if you hover over "make-temporary-file" in
the blue box, your browser will show a tooltip saying, "Provided from:
racket/file, racket | Package: base", which tells you the same information
as scrolling up without any question as to which section/page of the
documentation has the information on what library the identifier comes from.


> (BTW, for "professional quality" purposes, one should normally use `#lang
> racket/base`, just as in the example you gave, rather than use `#lang
> racket`.  `#lang racket` is for quick throwaway code or for illustrating
> examples, when you don't want to bother saying `require` much, and don't
> mind that it adds dependencies on a lot of modules that you probably don't
> need.)


At the risk of getting slightly off-topic, my perspective on this has been
evolving somewhat. The main advantage of `#lang racket/base` is startup
time (because you avoid loading unneeded libraries), so you definitely want
to use it when you care about that, or when you're writing a reusable
library, since someone who cares about startup time might want to use it.
(Maybe this is what you meant, Neil, by "professional quality".) But there
is good tooling support for taking a module written in `#lang racket` and
refactoring it to use `#lang racket/base`—running `raco check-requires -b
my-module.rkt` will tell you exactly what modules you actually need to
require—so even in those cases I often use `#lang racket` for the initial
stages of development.

Perhaps more controversially, I've also found that, for many things I
write, I find the startup time of `#lang racket` acceptable. As a matter of
style, I like that using `#lang racket` avoids cluttering up my `require`
statement with the same usual things (`racket/contract`, `racket/match`,
`racket/list`, `racket/string`, `(for-syntax racket/base)`, etc.), making
it more obvious what the important dependencies of a given module actually
are. (Of course, another way to do that is to define your own #lang for the
implementation of a given project that provides those common dependencies,
but only the ones you actually need.)

Most topically, I recommend `#lang racket` for beginners: there's plenty to
learn about Racket, and optimizing your `require` statement is probably
something you can ignore for a while.

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


Re: [racket-users] ?Unbound identifier in module in: make-temporary-file

2018-05-16 Thread Neil Van Dyke
Sam answered your question.  Here's how one can usually answer the more 
general question...


* The documentation for most Racket modules will usually say what 
`require` form you need to import it, assuming that you are using the 
`racket/base` language.  For example, if you're looking at the 
documentation for `make-temporary-file` in your Web browser, such as 
with the URL:

https://docs.racket-lang.org/reference/Filesystem.html#(def._((lib._racket%2Ffile..rkt)._make-temporary-file))
then you can usually scroll up, and see the `(require racket/file)`.  
The appropriate `require` is usually in the documentation, since the 
Scribble documentation tool encourages the library author to put it 
there.  (BTW, though you'll notice that, in this particular example, the 
URL itself already says `racket/file`, but that's only because I used a 
direct URL to it; you'll often be looking at things in the documentation 
without a direct URL fragment reference to them.)


* Another way you can sometimes find this information using the 
documentation is in the search results.  For example, if you remember 
how to use `make-temporary-file`, but forget which module it's in, you 
can quickly see the module in the search results, without clicking 
through to the documentation for it.  For example, in the search results 
for:

https://docs.racket-lang.org/search/index.html?q=make-temporary-file
you'll see:
    make-temporary-file  provided from racket/file, racket

Some code editor you use might suggest which modules you need to 
`require`, or even automatically insert `require` forms for you. But 
using that too early can make it a crutch that discourages you from 
getting comfortable with using the documentation. Documentation is one 
of the biggest fundamentals in software engineering.  Try not to rely 
too much on automagical conveniences, to do things that you don't 
already know how to do manually, or that might need your judgment or 
insight.


(BTW, for "professional quality" purposes, one should normally use 
`#lang racket/base`, just as in the example you gave, rather than use 
`#lang racket`.  `#lang racket` is for quick throwaway code or for 
illustrating examples, when you don't want to bother saying `require` 
much, and don't mind that it adds dependencies on a lot of modules that 
you probably don't need.)


--
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] ?Unbound identifier in module in: make-temporary-file

2018-05-16 Thread Sam Tobin-Hochstadt
You need to add `(require racket/file)` (or you can use `#lang racket`
instead of `racket/base`).

Sam

On Wed, May 16, 2018 at 4:05 PM, vlaxcompiler  wrote:
> How to fix this script?
>
> #lang racket/base
> (make-temporary-file "cl_gracket~a.tmp")
>
>
> Welcome to DrRacket, version 6.11 [3m].
> . make-temporary-file: unbound identifier in module in: make-temporary-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.

-- 
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] ?Unbound identifier in module in: make-temporary-file

2018-05-16 Thread vlaxcompiler
How to fix this script?

#lang racket/base
(make-temporary-file "cl_gracket~a.tmp")


Welcome to DrRacket, version 6.11 [3m].
. make-temporary-file: unbound identifier in module in: make-temporary-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.


Re: [racket-users] ssax:make-parser

2018-05-16 Thread Neil Van Dyke
John Clements, et al., thank you for ongoing work on packaging Oleg 
Kiselyov's SXML-related libraries nicely for Racket.  It's not an easy task.


(Background, for the list... Years ago, one of the great masters of 
Scheme, Oleg Kiselyov, did a lot of excellent work on XML in Scheme, 
released the code as open source, and wrote articles about some of it.  
Unfortunately, the modern Racket module system, package system, and API 
documentation conventions weren't available to him at the time.  
Packaging this wealth of Oleg's code after the fact, as if it were 
developed with the benefit of those structures, requires some 
archaeological work and judgment calls, and I really appreciate that 
John tackled this.  Also deserving mention: Kirill Lisovsky and I think 
Dmity Lizorkin did a lot of earlier work to port/package Oleg's 
libraries for multiple Scheme dialects, including for an early version 
of Racket nee PLT Scheme, which got us by for years.)


--
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] ssax:make-parser

2018-05-16 Thread N. Raghavendra
At 2018-05-16T14:56:00-04:00, John Clements wrote:

> Maybe… I’m inclined to respect Ryan’s thinking on this; there are a
> bunch of functions in there that look like they definitely shouldn’t
> be exposed, and couldn’t reasonably be called from outside. In a quick
> scan of the existing quasi-documentation for ssax.rkt, make-parser was
> the only one that looked to me like it might productively be used from
> outside.

Sure, I guess that's for the best.

Raghu.

--
N. Raghavendra , http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/

-- 
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] ssax:make-parser

2018-05-16 Thread 'John Clements' via Racket Users


> On May 16, 2018, at 11:17 AM, N. Raghavendra  wrote:
> 
> At 2018-05-16T13:49:52-04:00, John Clements wrote:
> 
>> It seems like make-parser should probably be provide’d. I’ve pushed a
>> change to make ssax:make-parser a top-level provide.
> 
> Thank you very much.  In fact, it may be a good idea to restore
> 
> (provide (all-from-out "ssax/ssax.rkt”))

Maybe… I’m inclined to respect Ryan’s thinking on this; there are a bunch of 
functions in there that look like they definitely shouldn’t be exposed, and 
couldn’t reasonably be called from outside. In a quick scan of the existing 
quasi-documentation for ssax.rkt, make-parser was the only one that looked to 
me like it might productively be used from outside.

John

> 
>> Would you (N. Raghavendra) be interested in taking the raw
>> pseudo-documentation currently provided for ssax:make-parser and
>> reformatting it into something useful, perhaps with an example? Would
>> you (N. Raghavendra) be interested in taking the raw
>> pseudo-documentation currently provided for ssax:make-parser and
>> reformatting it into something useful, perhaps with an example?
> 
> I'll draft something, and submit a PR to jbclements/sxml on GitHub.
> 
> Raghu.
> 
> --
> N. Raghavendra , http://www.retrotexts.net/
> Harish-Chandra Research Institute, http://www.hri.res.in/
> 
> -- 
> 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] Unicode identifiers

2018-05-16 Thread N. Raghavendra
At 2018-05-16T07:32:43-07:00, Andrew Kent wrote:

> #lang racket/base
>
> (require (for-syntax racket/base racket/string)
>  racket/require)
>
> (require (filtered-in
>   (λ (name)
> (string-replace name "->" "→"))
>  racket))
>
> (string→number "42")

Thank you.  I now have the following in my file:

--
#lang racket/base

(module syntax-transform racket/base
  (require racket/string)
  (provide arrow-beautify)
  (define (arrow-beautify string)
(string-replace string "->" "→")))

(require racket/require (for-syntax 'syntax-transform))

(require (filtered-in arrow-beautify racket))
--

Running this file in Dr Racket, I get

> (string→symbol "map")
'map

I get the same in Emacs/Geiser with `geiser-mode-switch-to-repl-and-enter'
(C-c C-a).

Thanks to everyone who replied!

Raghu.

--
N. Raghavendra , http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/

-- 
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] ssax:make-parser

2018-05-16 Thread N. Raghavendra
At 2018-05-16T13:49:52-04:00, John Clements wrote:

> It seems like make-parser should probably be provide’d. I’ve pushed a
> change to make ssax:make-parser a top-level provide.

Thank you very much.  In fact, it may be a good idea to restore

(provide (all-from-out "ssax/ssax.rkt"))

> Would you (N. Raghavendra) be interested in taking the raw
> pseudo-documentation currently provided for ssax:make-parser and
> reformatting it into something useful, perhaps with an example? Would
> you (N. Raghavendra) be interested in taking the raw
> pseudo-documentation currently provided for ssax:make-parser and
> reformatting it into something useful, perhaps with an example?

I'll draft something, and submit a PR to jbclements/sxml on GitHub.

Raghu.

--
N. Raghavendra , http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/

-- 
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] ssax:make-parser

2018-05-16 Thread 'John Clements' via Racket Users
It seems like make-parser should probably be provide’d. I’ve pushed a change to 
make ssax:make-parser a top-level provide. Would you (N. Raghavendra) be 
interested in taking the raw pseudo-documentation currently provided for 
ssax:make-parser and reformatting it into something useful, perhaps with an 
example?

John Clements


> On May 16, 2018, at 3:11 AM, Ryan Culpepper  wrote:
> 
> On 05/15/2018 11:36 PM, John Clements wrote:
>> Interestingly, it looks like this change is a deliberate one, made by Ryan 
>> Culpepper back in 2011. Here’s the relevant commit:
>> commit 738bf41d106f4ecd9111bbefabfd78bec8dc2202
>> Author: Ryan Culpepper 
>> Date:   Tue Nov 22 02:46:32 2011 -0700
>> bypass ssax/ssax module
>> trim exports from main (breaks backwards compat!)
>> diff --git a/main.rkt b/main.rkt
>> index bf3530d..89f27d3 100644
>> --- a/main.rkt
>> +++ b/main.rkt
>> @@ -27,5 +27,11 @@
>>  (provide (all-from-out "modif.rkt"))
>>  (provide (all-from-out "serializer.rkt"))
>>  -(require "ssax/ssax.rkt")
>> -(provide (all-from-out "ssax/ssax.rkt"))
>> +(require "ssax/multi-parser.rkt"
>> + "ssax/sxpathlib.rkt"
>> + "ssax/SXML-tree-trans.rkt"
>> + "ssax/SSAX-code.rkt")
>> +(provide ssax:multi-parser
>> + (all-from-out "ssax/sxpathlib.rkt")
>> + pre-post-order
>> + ssax:xml->sxml)
>> Ryan, do you know why you put ssax:multi-parser in, but not ssax:make-parser?
> 
> Sorry, I don't remember. My guess is that either leaving it out was just an 
> oversight, or that I thought it was only an internal helper function for 
> something else.
> 
> Ryan
> 
> 
>> Cheers!
>> John
>>> On May 15, 2018, at 6:42 AM, N. Raghavendra  wrote:
>>> 
>>> I was trying out Oleg Kiselyov's example
>>> 
>>> http://okmij.org/ftp/Scheme/remove-markup.scm
>>> 
>>> which illustrates the use of `ssax:make-parser'.  I have a couple of
>>> questions:
>>> 
>>> 1. To call ssax-make-parser, I had to require both sxml and
>>> sxml/ssax/ssax.  Is that the correct way of doing it?
>>> 
>>> 2. It seems an important function, and I was wondering why the sxml
>>> module does not provide it, the way it does ssax:xml->sxml, so that one
>>> doesn't need to further require sxml/ssax/ssax.  I see that sxml
>>> provides ssax:multi-parser.  Is it similar to ssax:make-parser?
>>> 
>>> Thanks,
>>> Raghu.
>>> 
>>> --
>>> N. Raghavendra , http://www.retrotexts.net/
>>> Harish-Chandra Research Institute, http://www.hri.res.in/
>>> 
>>> -- 
>>> 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] Unicode identifiers

2018-05-16 Thread Alexander McLin
Would it be possible to adjust the readtable to replace "→" with "->" ?



On Wednesday, May 16, 2018 at 10:32:43 AM UTC-4, Andrew Kent wrote:
>
> `racket/string` needs to be required _for syntax_ in order to work in the 
> suggested way (because it's bindings are needed at compile time).
>
> The following works for me in a module:
>
> ```
> #lang racket/base
>
> (require (for-syntax racket/base racket/string)
>  racket/require)
>
> (require (filtered-in
>   (λ (name)
> (string-replace name "->" "→"))
>   racket))
>
> (string→number "42")
> ```
>

-- 
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] Unicode identifiers

2018-05-16 Thread Andrew Kent
`racket/string` needs to be required _for syntax_ in order to work in the 
suggested way (because it's bindings are needed at compile time).

The following works for me in a module:

```
#lang racket/base

(require (for-syntax racket/base racket/string)
 racket/require)

(require (filtered-in
  (λ (name)
(string-replace name "->" "→"))
  racket))

(string→number "42")
```

-- 
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] Unicode identifiers

2018-05-16 Thread N. Raghavendra
At 2018-05-16T09:12:18-04:00, Alex Knauth wrote:

> Here is a `transform-right-arrow-in` definition that transforms ->
> into →:
>
> #lang racket
> (require racket/require
>  racket/require-syntax
>  (for-syntax syntax/parse))
>
> (begin-for-syntax
>   ;; String -> String
>   (define (transform-right-arrow name)
> (regexp-replace* #rx"->" name "→")))
>
> (define-require-syntax transform-right-arrow-in
>   (syntax-parser
> [(transform-right-arrow-in require-spec)
>  #'(filtered-in transform-right-arrow require-spec)]))
>
> ;; Using it:
>
> (require (transform-right-arrow-in racket/base))
>
> (symbol→string 'blubber)

Thanks, this works.  However, at this stage of my experience with
Racket, the direct `filtered-in' method suggested by Jens appears
simpler and easier.  As I said in an earlier message, I seem to be using
it wrongly.

Raghu.

-- 
N. Raghavendra , http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/

-- 
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] Unicode identifiers

2018-05-16 Thread N. Raghavendra
At 2018-05-16T12:37:47+02:00, Jens Axel Søgaard wrote:

> (require (filtered-in
>   (lambda (name)
> (and (regexp-match? #rx"^[a-z-]+$" name)
>  (regexp-replace #rx"-" (string-titlecase name)
> "")))
>   racket/base))

Thank you for the reply.  I tried this at the REPL, and got an error:

racket@> (require (filtered-in
   (λ (name)
 (string-replace name "->" "→"))
  racket))

stdin::4186: filtered-in: not a require sub-form ...

racket@> (require racket/require)

racket@> (require (filtered-in
   (λ (name)
 (string-replace name "->" "→"))
   racket))

string-replace: undefined; cannot reference undefined identifier ...

racket@> (require racket/string)

racket@> (require (filtered-in
   (λ (name)
 (string-replace name "->" "→"))
   racket))

string-replace: undefined; cannot reference undefined identifier ...

Wonder what I am doing wrongly.

Raghu.

--
N. Raghavendra , http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/

-- 
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] Unicode identifiers

2018-05-16 Thread David Storrs
On Wed, May 16, 2018 at 6:37 AM, Jens Axel Søgaard 
wrote:

> and it converts the names to “camel case.”
>

Why do you hurt me, Jens?  You always seemed like such a nice person.

-- 
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] Unicode identifiers

2018-05-16 Thread Alex Knauth


> On May 16, 2018, at 6:37 AM, Jens Axel Søgaard  wrote:
> 
> Alternative 1: Use filtered-in to require renamed versions.
> 
> ( <>filtered-in 
> 
>  proc-expr require-spec)
> Applies an arbitrary transformation on the import names (as strings) of 
> require-spec. The proc-expr must evaluate at expansion time to a 
> single-argument procedure, which is applied on each of the names from 
> require-spec. For each name, the procedure must return either a string for 
> the import’s new name or #f to exclude the import.
> 
> 
> For example,
> (require 
> 
>  (filtered-in 
> 
>   (lambda 
> 
>  (name)
> (and 
> 
>  (regexp-match? 
> 
>  #rx"^[a-z-]+$" name)
>  (regexp-replace 
> 
>  #rx"-" (string-titlecase 
> 
>  name) "")))
>   racket/base))
> imports only bindings from racket/base 
>  that match the 
> pattern #rx"^[a-z-]+$", and it converts the names to “camel case.”

> Alternative 1 is best.
> 
> /Jens Axel


Here is a `transform-right-arrow-in` definition that transforms -> into →:

#lang racket
(require racket/require
 racket/require-syntax
 (for-syntax syntax/parse))

(begin-for-syntax
  ;; String -> String
  (define (transform-right-arrow name)
(regexp-replace* #rx"->" name "→")))

(define-require-syntax transform-right-arrow-in
  (syntax-parser
[(transform-right-arrow-in require-spec)
 #'(filtered-in transform-right-arrow require-spec)]))

;; Using it:

(require (transform-right-arrow-in racket/base))

(symbol→string 'blubber)
(string→number "987")
(real→double-flonum 377)
(list→vector (list 144 233 377 610 987 1597))



-- 
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] Unicode identifiers

2018-05-16 Thread Jens Axel Søgaard
Alternative 1: Use filtered-in to require renamed versions.

(filtered-in

 proc-expr require-spec)

Applies an arbitrary transformation on the import names (as strings) of
require-spec. The proc-expr must evaluate at expansion time to a
single-argument procedure, which is applied on each of the names from
require-spec. For each name, the procedure must return either a string for
the import’s new name or #f to exclude the import.

For example,

(require

 (filtered-in

  (lambda

 (name)
(and

 (regexp-match?

 #rx"^[a-z-]+$" name)
 (regexp-replace

 #rx"-" (string-titlecase

 name) "")))
  racket/base))

imports only bindings from racket/base
 that match
the pattern #rx"^[a-z-]+$", and it converts the names to “camel case.”



Alternative 2:

Define your own version of #%top that replaces identifiers with unicode ->
to standard ->.


Alternative 1 is best.

/Jens Axel





2018-05-16 6:15 GMT+02:00 N. Raghavendra :

> I just found that
>
> > (define φoo→β=αρ "Foo→b=ar")
> > φoo→β=αρ
> "Foo→b=ar"
> >(call-with-output-file "/tmp/foo.txt"
>(λ (out)
>(display (xml-remove-markup) out))
>#:exists 'replace)
>
> etc., work.  That's nice.
>
> In general, is it possible to declare, e.g., '→' as equivalent to '->'
> in identifiers?  Then, I can use
>
> > (string→symbol "map")
>
> instead of
>
> > (string->symbol "map")
>
> Thanks,
> Raghu.
>
> --
> N. Raghavendra , http://www.retrotexts.net/
> Harish-Chandra Research Institute, http://www.hri.res.in/
>
> --
> 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.
>



-- 
-- 
Jens Axel Søgaard

-- 
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] ssax:make-parser

2018-05-16 Thread Ryan Culpepper

On 05/15/2018 11:36 PM, John Clements wrote:

Interestingly, it looks like this change is a deliberate one, made by Ryan 
Culpepper back in 2011. Here’s the relevant commit:

commit 738bf41d106f4ecd9111bbefabfd78bec8dc2202
Author: Ryan Culpepper 
Date:   Tue Nov 22 02:46:32 2011 -0700

 bypass ssax/ssax module
 trim exports from main (breaks backwards compat!)

diff --git a/main.rkt b/main.rkt
index bf3530d..89f27d3 100644
--- a/main.rkt
+++ b/main.rkt
@@ -27,5 +27,11 @@
  (provide (all-from-out "modif.rkt"))
  (provide (all-from-out "serializer.rkt"))
  
-(require "ssax/ssax.rkt")

-(provide (all-from-out "ssax/ssax.rkt"))
+(require "ssax/multi-parser.rkt"
+ "ssax/sxpathlib.rkt"
+ "ssax/SXML-tree-trans.rkt"
+ "ssax/SSAX-code.rkt")
+(provide ssax:multi-parser
+ (all-from-out "ssax/sxpathlib.rkt")
+ pre-post-order
+ ssax:xml->sxml)

Ryan, do you know why you put ssax:multi-parser in, but not ssax:make-parser?


Sorry, I don't remember. My guess is that either leaving it out was just 
an oversight, or that I thought it was only an internal helper function 
for something else.


Ryan




Cheers!

John



On May 15, 2018, at 6:42 AM, N. Raghavendra  wrote:

I was trying out Oleg Kiselyov's example

http://okmij.org/ftp/Scheme/remove-markup.scm

which illustrates the use of `ssax:make-parser'.  I have a couple of
questions:

1. To call ssax-make-parser, I had to require both sxml and
sxml/ssax/ssax.  Is that the correct way of doing it?

2. It seems an important function, and I was wondering why the sxml
module does not provide it, the way it does ssax:xml->sxml, so that one
doesn't need to further require sxml/ssax/ssax.  I see that sxml
provides ssax:multi-parser.  Is it similar to ssax:make-parser?

Thanks,
Raghu.

--
N. Raghavendra , http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/

--
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: Unicode identifiers

2018-05-16 Thread vlaxcompiler
Where you found (string→symbol? Grakcet version you have? 

Welcome to DrRacket, version 6.11 [3m].
Language: racket, with debugging; memory limit: 128 MB.
> (string→symbol "map") 
. . string→symbol: undefined;
 cannot reference an identifier before its definition
> 


miercuri, 16 mai 2018, 07:15:43 UTC+3, N. Raghavendra a scris:
>
> I just found that 
>
> > (define φoo→β=αρ "Foo→b=ar") 
> > φoo→β=αρ 
> "Foo→b=ar" 
> >(call-with-output-file "/tmp/foo.txt" 
>(λ (out) 
>(display (xml-remove-markup) out)) 
>#:exists 'replace) 
>
> etc., work.  That's nice. 
>
> In general, is it possible to declare, e.g., '→' as equivalent to '->' 
> in identifiers?  Then, I can use 
>
> > (string→symbol "map") 
>
> instead of 
>
> > (string->symbol "map") 
>
> Thanks, 
> Raghu. 
>
> -- 
> N. Raghavendra , http://www.retrotexts.net/ 
>
> Harish-Chandra  Research 
> Institute, http://www.hri.res.in/ 
>

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