Re: [racket-users] Readtable - allowing pipes (bars) in operator

2017-08-11 Thread Martin Janiczek
Damn, you're right:

---

martin@janiczek ~ $ cat test.rkt
#lang racket

(parameterize ([read-accept-bar-quote #f])
  (let* ([input "(|| a b)"]
 [result (read (open-input-string input))])
(begin
  (println result)
  (println (first result))
  (println (symbol? (first result))


martin@janiczek ~ $ racket test.rkt
'(|| a b)
'||
#t

martin@janiczek ~ $

---

I don't know what I did wrong before. Thank you!

On Friday, August 11, 2017 at 3:26:20 PM UTC+2, Matthew Flatt wrote:
> Setting `read-accept-bar-quote` to #f should do what you want. Can you
> say more about how you tried to use it --- maybe providing a program
> that doesn't behave the way you expect?
> 
> At Fri, 11 Aug 2017 00:46:17 -0700 (PDT), Martin Janiczek wrote:
> > Hello everybody,
> > 
> > is there a way to tell the `(read)` function not to interpret `|` as an 
> > "copy 
> > this verbatim" delimiter?
> > 
> > What I want to do is:
> > (read "(|| a b)") ;=> '(|| a b)
> > (read "(<| a b)") ;=> '(<| a b)
> > etc. - allow `|` as a symbol.
> > 
> > I know about readtables - dabbled with them before and they seem like the 
> > right tool for the job. But in this case, my last attempt was:
> > 
> > (make-readtable (current-readtable)
> >   #\|
> >   'terminating-macro
> >   read-as-symbol)
> > 
> > and I couldn't get the `read-as-symbol` function right. Also experimented 
> > with 
> > `read-accept-bar-quote` parameter but no dice.
> > 
> > Any help/pointers?

-- 
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] Readtable - allowing pipes (bars) in operator

2017-08-11 Thread Matthew Flatt
Setting `read-accept-bar-quote` to #f should do what you want. Can you
say more about how you tried to use it --- maybe providing a program
that doesn't behave the way you expect?

At Fri, 11 Aug 2017 00:46:17 -0700 (PDT), Martin Janiczek wrote:
> Hello everybody,
> 
> is there a way to tell the `(read)` function not to interpret `|` as an "copy 
> this verbatim" delimiter?
> 
> What I want to do is:
> (read "(|| a b)") ;=> '(|| a b)
> (read "(<| a b)") ;=> '(<| a b)
> etc. - allow `|` as a symbol.
> 
> I know about readtables - dabbled with them before and they seem like the 
> right tool for the job. But in this case, my last attempt was:
> 
> (make-readtable (current-readtable)
>   #\|
>   'terminating-macro
>   read-as-symbol)
> 
> and I couldn't get the `read-as-symbol` function right. Also experimented 
> with 
> `read-accept-bar-quote` parameter but no dice.
> 
> Any help/pointers?

-- 
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] Readtable - allowing pipes (bars) in operator

2017-08-11 Thread Martin Janiczek
Hello everybody,

is there a way to tell the `(read)` function not to interpret `|` as an "copy 
this verbatim" delimiter?

What I want to do is:
(read "(|| a b)") ;=> '(|| a b)
(read "(<| a b)") ;=> '(<| a b)
etc. - allow `|` as a symbol.

I know about readtables - dabbled with them before and they seem like the right 
tool for the job. But in this case, my last attempt was:

(make-readtable (current-readtable)
  #\|
  'terminating-macro
  read-as-symbol)

and I couldn't get the `read-as-symbol` function right. Also experimented with 
`read-accept-bar-quote` parameter but no dice.

Any help/pointers?

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