Re: [racket-users] Parameterized Redex models

2018-03-14 Thread 'Leandro Facchinetti' via Racket Users

First, thanks for the reply. It’s valuable to have the author of the paper 
from where I draw my example chime in 😀

1) Instead of turning the cache off completely, you could just

invalidate the cache when the parameter changes, i.e. write a `set-k!'

function that updates the parameter and toggles the cache off and back
on (I assume this will clear it out).


I believe the following program proves your assumption wrong:

* * *

#lang racket/base

(require redex/reduction-semantics racket/list)

(define k (make-parameter 0))

(define-language L
 [e ::= any]
 [t ::= [e ...]])

(define-metafunction L
 tick : e _ _ _ t -> t
 [(tick e _ _ _ t) ,(take (cons (term e) (term t)) (k))])

(term (tick a _ _ _ [])) ;; => '()
(parameterize* ([k 1]
   [caching-enabled? #f]
   [caching-enabled? #t])
 (term (tick b _ _ _ []))) ;; => '(b)
(parameterize ([k 1]
  [caching-enabled? #f]
  [caching-enabled? #t])
 (term (tick a _ _ _ []))) ;; => '()

* * *

If the cache was flushed, then we’d see ‘'(a)’ instead of ‘'()’ in the last 
term.

As I pointed out in my original message: cache invalidation continues to be 
one of the *hard problems* in computer science.

3) Move the escaping ellipses to the outermost `begin' form.  This

allows you to write the escape once instead of for each Redex ellipse.

It also means the code within the macro definition looks more like the
original.


That is one step in the right direction. Thanks for the suggestion. But I 
still think macro-defined models are not the right abstraction here.

-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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] Parameterized Redex models

2018-03-14 Thread 'Leandro Facchinetti' via Racket Users


> Yes, it looks like the original cache is just re-installed when re-enabled.
>
> Perhaps there should be an operation provided by Redex to clear away the 
> cache.
>

That’s one my proposals, yes 😀 (see § Solutions on my original message)

-- 
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] Parameterized Redex models

2018-03-14 Thread 'Leandro Facchinetti' via Racket Users


> What if you wrote macros over reduction-relation instead of the exact 
> model? These macros could implement threading and hide it. They would kind 
> of be like monads here. — Matthias 
>

Do you mean something like

(define-parameterized-metafunction (k) L
 tick : e _ _ _ t -> t
 [(tick e _ _ _ t) ,(take (cons (term e) (term t)) k)])

which would expand to

(define-metafunction L
 tick : e _ _ _ t _ -> t
 [(tick e _ _ _ t k) ,(take (cons (term e) (term t)) k)])

?

How would the call sites of the metafunction know it expects the extra 
argument?

-- 
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] Parameterized Redex models

2018-03-14 Thread 'Leandro Facchinetti' via Racket Users


A related question is 
> to ask if maybe the parameter is intended to be so "dyanmic". Maybe 
> you should have to recompile the redex program to change the parameter 
> sometimes because, after all, if runs of the abstract machine with 
> different values of `k` interact with each other, maybe nothing makes 
> sense. 
>

Yes, I agree that runs of the abstract machine with different values of ‘k’ 
should be distinct and disallowed to interact.

One thing I do often is interact with the model in the REPL: “Is ‘k = 1’ 
enough to capture a certain property of this program?” “How about ‘k = 2’?” 
And so forth. It sounds like having to recompile the model to change the 
parameter would not be compatible with this kind of exploration, in which 
case I don’t like the idea.

-- 
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] Parameterized Redex models

2018-03-14 Thread 'Leandro Facchinetti' via Racket Users
Thanks for the clarification, I think I understand your proposal. And I see 
three problems:

1. I believe ‘traces/t’ is the evidence of the issue I brought up 
earlier: How do call sites know the form expects the extra argument? As 
your example demonstrates, call sites need to be explicit about the extra 
argument. This becomes a global transformation in the model, which is 
doable with macro wizardry, but isn’t convenient and doesn’t look like what 
you’d see on a paper.

2. The thing I’m calling ‘metaparameter’ (in your example, ‘ticks’) needs 
to be available for the definition of the reduction relation. Instead of 
‘(--> a b)’, think ‘(--> a b (side-condition (> ticks 10)))’. In your first 
example ‘ticks’ is in scope, but it suffers from the caching problem from 
my original message. In your second example ‘ticks’ isn’t in scope, and 
introducing it would be unhygienic.

3. Most important of all: the ‘metaparameter’ needs to be available through 
several definitions. Maybe the reduction relation calls a metafunction, 
which calls a judgment form, which calls a relation defined with 
‘define-relation’, and they all might or might not depend on the 
‘metaparameter’.

Bonus issue: typesetting this is probably hard.

-- 
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] Parameterized Redex models

2018-03-14 Thread 'Leandro Facchinetti' via Racket Users
Oh, this might help clear things out: you made ‘ticks’ the ‘metaparameter’. 
I suppose you’re alluding to what people call time-stamps or contours. I’m 
not concerned with that in my model, though: I’m happy with having ‘ticks’ 
be explicit in my reduction relation. I’m concerned with the parameter ‘k’ 
that determines the maximum size of ‘ticks^’ in the abstract 
interpreter—that’s the variable I want to turn into a ‘metaparameter’.

-- 
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] Parameterized Redex models

2018-03-15 Thread 'Leandro Facchinetti' via Racket Users
I see how this makes typesetting work. But I’m sorry but I don’t see how 
this program addresses any of my concerns: ‘clock’ is still unavailable to 
when defining ‘go’; and worse, there’s no way to set it from the outside.

-- 
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] Parameterized Redex models

2018-03-15 Thread 'Leandro Facchinetti' via Racket Users
This is going further in the wrong direction 😛

1. The cache for the reduction relation is invalid.

2. There’s no way to parameterize ‘clock’ when calling the reduction 
relation (I think it’d really help to think of ‘k’ instead of ‘clock’).

3. ‘clock’ isn’t available to metafunctions called from the reduction 
relation.

You see, my interest is not to hide side-effects from the definition of the 
reduction relation, but to have implicit parameters in all kinds of 
definitions.

-- 
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] Parameterized Redex models

2018-03-15 Thread 'Leandro Facchinetti' via Racket Users


> > 1. The cache for the reduction relation is invalid. 
>
>
> How so? 



(apply-reduction-relation go (term a)) ;; => (the clock is 96)
(apply-reduction-relation go (term a)) ;; => (the clock is 99)
 
The user hasn’t changed any parameters, but the results are different. The 
second call didn’t go through the cache as it was supposed to.

> 2. There’s no way to parameterize ‘clock’ when calling the reduction 
> relation (I think it’d really help to think of ‘k’ instead of ‘clock’). 
>
>
> That’s what #:initial gives you. 


No, ‘#:initial’ let’s you parameterize ‘clock’ when *defining* the 
reduction relation (‘r-r/tick’), not when *calling* it (‘traces’, 
‘apply-reduction-relation’ and friends).
 

> > 3. ‘clock’ isn’t available to metafunctions called from the reduction 
> relation. 
>
>
> Give me an example. 


Sure. Let the reduction relation depend on the metafunction 
‘my-metafunction’, which uses ‘clock’: 

#lang racket

(require redex)
(require (for-syntax syntax/parse))

(define-syntax (r-r/tick stx)
  (syntax-parse stx
[(_ PL #:domain x #:initial go #:observe o #:update u ((~literal -->) 
lhs rhs) ...)
 #'(let ((clock (go)))
 (reduction-relation
  PL
  #:domain x
  (--> lhs rhs (where _ ,(begin (set! clock (u clock)) (o clock
  ...))]))

; 
-

(define-language X
  (e ::= a b c))

(define-metafunction X
  [(my-metafunction _) clock]) ;; <= ‘clock’ is just a symbol here, not a 
bound (meta-)variable

(define go
  (r-r/tick
   X
   #:domain e
   #:initial (lambda () (random 100))
   #:observe (lambda (clock) (displayln `(the clock is ,clock)))
   #:update  (curry + 3)
   (--> a b)
   (--> b (my-metafunction c))
   (--> c a)))

(traces go (term a))




* * *

The point I’m bringing up is “Parameterized Redex models,” which I don’t 
think is exactly the “state monad.” I guess I could hack my way with the 
state monad if that’s all I had, but it’s too big a hammer because the 
“state” never changes throughout a series of steps. Coming back to the 
original example of ‘tick’, I’m not interested in abstracting time-stamp 
tracking from the abstract machine (CESKₜ); I’m interested in abstracting 
the implicit variable ‘k’ from the *abstract* abstract machine (CESKₜ^). I 
choose ‘k’ before I start the machine, and then it remains constant 
throughout evaluation.

-- 
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] Parameterized Redex models

2018-03-15 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users


> Stepping back a little bit here, if you were to write this down in a 
> way that were to make sense to a reader of a paper, how would you 
> communicate with them how/when this parameter changes? 
>

When defining metafunctions/reduction relations/judgment forms and so on, 
authors generally say something to the effect of “this forms a family of 
analyses parameterized over a choice of ‘k’; we may elide ‘k’ where it’s 
implicit.” Alternatively, sometimes ‘k’ appears as a sub/superscript on the 
metafunction name, for example, ‘firstₖ(list)’. In this case, the role of 
‘k’ as a parameter is more evident, but it’s special, justifying the 
special notation and sometimes even omission.

Then, to parameterize ‘k’, I can show you one example from the same line of 
research I cited in the original message: 

Gilray, Thomas, Steven Lyde, Michael D. Adams, Matthew Might, and David Van 
Horn. 2016. “Pushdown Control-Flow Analysis for Free.” In Proceedings of 
the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming 
Languages, 691–704. POPL ’16. New York, NY, USA: ACM. 
https://doi.org/10.1145/2837614.2837631.



I also have a couple from my own work, which are even more explicit:



 

> I think we've already agreed that one can think of the entire paper 
> and its development having exactly one choice of `k` made at the very 
> beginning, and I think we agree Redex can support that using something 
> like define-term (so you have to click "run" to change the parameter). 


> That clearly has some advantages because you never conflate two parts 
> of the model that come with different values of `k`. That said, it is 
> pretty clunky. 
>


That’s half-way there, yes. But it wouldn’t hurt to have a ‘parameterize’ 
form that percolates a different value through the rest of the model, like 
a dynamically bound variable. Say we’re developing a adaptive analysis that 
tweaks ‘k’ according to some policy: ‘my-policyₖ(…) = firstₖ₊₁(…) if 
condition-holds’. Now all forms called by ‘first’ have access to the new 
‘k+1’.

Aside: I know this special typesetting of ‘k’ can be accomplished with 
rewrite rules for ‘lw’. That’s beyond my concern: I’m interested in being 
able to *elide* ‘k’ when it doesn’t matter.

 

>
> Here is a second idea: what if you did this: 
>
> (define-language L 
>   (k ::= 1) 
>   ...all the other stuff...) 
>
> and we tweaked Redex in some way so that definitions like that could 
> be used not just in pattern positions, but also in term positions 
> (since there is only only possibility for `k`, after all). 
>
> THEN, with that definition we could use define-extended-language and 
> define-extended-metafunction and friends to change the value of `k`. 
> This has its own clunkyness, but it is a clunkyness that we have 
> seriously thought about and for which there are plans to do better 
> (basically designing a module system for Redex). 
>
> Is this a fruitful path to follow? 
>

 Hmmm, clunckyness for clunckyness I think I’d prefer to bite the bullet 
and thread ‘k’ instead of extending all my definitions.

-- 
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] Parameterized Redex models

2018-03-15 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users


> Robby’s message dominates mine but I don’t get why you can’t work your way 
> thru what I provided. 
>

I don’t see the connection between the issue I brought up and what you 
provided. In your program ‘r-r/tick’ is a form to define a reduction 
relation which manages ‘clock’, but then ‘clock’ can’t determine the 
behavior of the reduction relation (and it isn’t cached by Redex). Note 
that ‘r-r/tick’ says ‘(where _ ,(begin (set! clock (u clock)) (o clock)))’, 
which means the outputs of the ‘observer’ are ignored. Now, we could modify 
‘r-r/tick’ to take a pattern ‘p’ and say ‘(where p ,(begin (set! clock (u 
clock)) (o clock)))’. But then we’re getting further and further away from 
my intent: having ‘k’ as an implicit argument to a collection of 
definitions (metafunctions, judgment forms, and so forth), beyond a single 
reduction relation.
 

> HUH? This is something that you control with the initialization function. 
> The REDEX results are the same. It is up to your init function to cache or 
> not cache. 


But if my function doesn’t cache and the reduction relation depends on 
‘clock’ (see previous paragraph), then the Redex results would differ.
 

> > No, ‘#:initial’ let’s you parameterize ‘clock’ when *defining* the 
> reduction relation (‘r-r/tick’), not when *calling* it (‘traces’, 
> ‘apply-reduction-relation’ and friends). 
>
>
> Really? 
>
> (define *foo 0) 
> (define (init) .. *foo ..) 


I assume you’re proposing to pass ‘init’ to ‘#:initial’, and then ‘(set! 
*foo ___)’ to control the reduction relation’s behavior. And that starts to 
look like a dynamically bound variable—better yet, a Racket parameter. 
We’re on the right track: Racket parameters is how we got started, and I’m 
proposing we need them at the Redex level as well 😀
 

> > (define-metafunction X 
> >   [(my-metafunction _) clock]) ;; <= ‘clock’ is just a symbol here, not 
> a bound (meta-)variable 
>
>
> What does this even mean? Racket-Redex is about variables not symbols. 


Right, Racket–Redex is about variables, but ‘clock’ in ‘my-metafunction’ 
 isn’t a variable, it’s literally the symbol ‘'clock’.

* * *

I feel we’re getting into the weeds and having different conversations. Can 
I kindly ask you re-read my original message with a fresh pair of eyes?

By the way: *thank you all* for the conversation thus far, and for building 
Redex in the first place. As usual I’m learning a lot from interacting with 
you.

-- 
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] Parameterized Redex models

2018-03-16 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users


> But I clearly don’t get what you really want so I will abandon this one. 
>
> Good luck — Matthias 
>

Thanks for trying, talking to you is always instructive 😀

For people that hasn’t abandoned this one: I decided to bite the bullet and 
thread the ‘metaparameter’ in my definitions. This will allow me to 
re-enable the cache, and I’m interested in measuring how this impacts 
performance. (I’m not benchmarking these models, I know that isn’t Redex 
purpose, but there are some small programs that are beyond the reach of my 
models because they take too long to complete.) In the process I found a 
case that I can’t express: in my language definition I have a production 
that means “a list of maximum size ‘k’”, which I express with a 
side-condition. There is no way to *thread parameters* into ‘redex-match?’ 
and pattern matching in general, so I have to turn off this verification.

The problem below is a minimal working example to illustrate my use case. 
Either I have to remove the ‘side-condition’ for ‘t’ or turn off the cache:

#lang racket
(require redex)

(define k (make-parameter 0))

(define-language L
  [t ::= (side-condition (name t [_ ...]) (<= (length (term t)) (k)))])

(caching-enabled? #f)

(displayln (redex-match? L t (term []))) ;; => #t
(displayln (redex-match? L t (term [a]))) ;; => #f
(displayln (redex-match? L t (term [a b]))) ;; => #f

(parameterize ([k 1])
  (displayln (redex-match? L t (term []))) ;; => #t
  (displayln (redex-match? L t (term [a]))) ;; => #t
  (displayln (redex-match? L t (term [a b]))) ;; => #f
  )

-- 
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] Parameterized Redex models

2018-03-16 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
As far as I understand, your ‘length-ok’ is implementing in Redex the ‘(<= 
(length ___) ___)’ I had in my ‘side-condition’. But I can’t see how it 
addresses two important features from my original code: (1) ‘k’ is 
parameterizable, and its value influences whether a list is valid or not; 
and (2) the non-terminal ‘t’ could appear in patterns, for example, in a 
metafunction contract. This last one is essential, because using ‘t’ in a 
contract enforces a data structure invariant—‘t’ can’t be longer than 
‘k’—and I can’t trust all callers of my metafunctions to check ‘length-ok’ 
themselves. In some cases, they wouldn’t even be able to do it; for 
example, suppose ‘t’ is part of the ‘domain’ of a ‘reduction-relation’ and 
I use it with ‘apply-reduction-relation*’, then there’s no way to access 
intermediary states and check if they preserve the invariant.

-- 
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] ‘with-limits’ doesn’t stop subprocesses

2018-08-05 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
Hi,

I want to run a subprocess with a timeout. Here’s what I tried:

#lang racket
(require racket/sandbox)

(with-handlers ([exn:fail:resource? (λ (e) (displayln "Timed out"))])
  (with-limits 5 #f (system "sleep 10 && echo Finished")))

This doesn’t work, it prints both “Timed out” after 5 seconds and “Finished” 
after 10 seconds. I wish ‘with-limits’ would stop the underlying process, so 
I’d never see “Finished”. How should I do that?

Thank you.

-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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] Playing the Game with PLT Redex · Second Edition

2018-09-30 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
Hi Racketeers,

I while ago I wrote a short article in which I used PLT Redex to play a game of 
Peg Solitaire. I now present you the extended version of that article:

https://www.leafac.com/prose/playing-the-game-with-plt-redex/ 


The short and to-the-point version still exists in the form of an introduction: 
https://www.leafac.com/prose/playing-the-game-with-plt-redex/introduction 


But now I also dive into a few PLT Redex forms in more detail. I consider this 
to be a better bridge between knowing little about programming-language theory 
and being able to follow more advanced material, for example, the excellent 
SEwPR.

I welcome feedback.

Thank you for your time.

-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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] Criação dinâmica de perguntas

2018-10-02 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
O código que você mostrou primeiro cria uma variável chamada que com valor 
inicial "questao_solve" (uma string). Depois a variável que tem o valor 
mudado para um radio-box% (um objeto). Perceba que questao_solve nunca foi 
uma variável, então tentar mandar a mensagem get-value para ele resulta em erro.

Talvez o que você precise seja uma estrutura de dados (uma lista, um 
dicionário, ou algo do gênero), que contenha todos os questao_solve indexados 
por número.

-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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] The performance of ‘set’ vs. lists+‘remove-duplicates’

2018-12-04 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
I rewrote a codebase that was using ‘set’s to use lists that I 
‘remove-duplicates’ whenever I ‘cons’. The result is orders of magnitude 
faster. Do you have any idea why?

-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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] The performance of ‘set’ vs. lists+‘remove-duplicates’

2018-12-05 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
The sets are about 20 elements in size.

It seems that ‘member’ before ‘cons’ is marginally faster than 
‘remove-duplicates’ after ‘cons’, as one would expect.

But it’s the strangest thing: in some cases switching from sets to lists with 
unique elements changes the meaning of the program! I spent the whole morning 
looking at the same 15 lines of code and I still have no idea why. All data is 
immutable. The sets/lists-with-unique-elements are used to build lists—`(___ 
,my-set ___)—which are then used as keys/values in hashes. I ‘hash-union’ these 
hashes. Nothing unusual.

I’m going to keep investigating…
-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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] The performance of ‘set’ vs. lists+‘remove-duplicates’

2018-12-06 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
In my program, hashes are only 20% faster than sets containing approximately 20 
elements that are S-expressions.

I solved the mystery of why switching to lists with unique elements made things 
faster and in some cases even changed the meaning of the program. I always 
thought that my program would add the elements to the sets in the same order 
every time, so lists with unique elements would be equivalent to sets. It turns 
out that I was wrong. Case closed.
-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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] Weird behavior when a ‘set’ is the result of ‘eval’

2019-01-10 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
Please help me understand the following:

#lang racket
(define s (eval '(begin (require racket/set) (set 1 2)) (make-base-namespace)))
s ;; ⇒ (set 1 2)
(set? s) ;; ⇒ #f (but I expected ‘#t’)

-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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] Weird behavior when a ‘set’ is the result of ‘eval’

2019-01-10 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
Interesting. But what makes sets special? My original program works with 
hashes, for example:

#lang racket
(define h (eval '(begin (require racket/hash) (hash 1 2)) 
(make-base-namespace)))
h ;; ⇒ '#hash((1 . 2))
(hash? h) ;; ⇒ #t (like I expected)


-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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] Weird behavior when a ‘set’ is the result of ‘eval’

2019-01-10 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
👍 Got it. Thanks.
-- 
Leandro Facchinetti 
https://www.leafac.com

-- 
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 Week’s website looks strange now that the registration is open

2019-02-01 Thread &#x27;Leandro Facchinetti&#x27; via Racket Users
> It's decrementing, isn't it? It just says since how long it's open I guess :)

Yes, I mistyped—it’s decrementing.

I think you should be saying “Registration is open «Link for registration»”.

-- 
Leandro Facchinetti 
https://www.leafac.com

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