[racket-users] BUY CANNABIS PRODUCTS ONLINE FOR CANCER, OTHER TREATMENTS, DEPRESSION, ANXIETY IN USA ,UK AUSTRALIA ICELAND, IRELAND, ITALY ETC https//fresh-cannabis.com

2020-03-30 Thread Tony Fritz
https://fresh-cannabis.com/

WE HAVE HIGH GRADE HYBRID, SATIVA AND INDICA STRAINS.

https//fresh-cannabis.com

Good quality products.
Good and affordable prices.
Fast and Reliable delivery -Tracking Available!
Various shipping option (Overnight and Airmail).
No Prescription Required!
Buy Direct and Save Time and Money!
100% Customer Satisfaction Guaranteed ! -Additional Discounts on Bulk 
Orders


https://fresh-cannabis.com/product/white-widow/
https://fresh-cannabis.com/product/white-fire-og/
https://fresh-cannabis.com/product/white-fire/
https://fresh-cannabis.com/product/tangier-og-wax/
https://fresh-cannabis.com/product/tangier-og-wax-2/
https://fresh-cannabis.com/product/tahoe-wax/
https://fresh-cannabis.com/product/supreme-cart/
https://fresh-cannabis.com/product/super-silva-haze/
https://fresh-cannabis.com/product/star-tonic-oil/
https://fresh-cannabis.com/product/sour-og/
https://fresh-cannabis.com/product/sour-diesel/
https://fresh-cannabis.com/product/skywalker-og-cart/
https://fresh-cannabis.com/product/shitake-muchrooms/
https://fresh-cannabis.com/product/shatter-wax/
https://fresh-cannabis.com/product/royal-border/
https://fresh-cannabis.com/product/royal-afghani-hash/
https://fresh-cannabis.com/product/purple-urkle/
https://fresh-cannabis.com/product/purple-haze/
https://fresh-cannabis.com/product/psilocybin-microdosing-mushroom/
https://fresh-cannabis.com/product/platinum-girl-scout/
https://fresh-cannabis.com/product/pineapple-haze/
https://fresh-cannabis.com/product/pineapple-express/
https://fresh-cannabis.com/product/pineapple-chunk/
https://fresh-cannabis.com/product/pandora-mushroom/
https://fresh-cannabis.com/product/packwood-preprolls/
https://fresh-cannabis.com/product/ok-kush-cart/
https://fresh-cannabis.com/product/og-kush-shatter/
https://fresh-cannabis.com/product/og-kush/
https://fresh-cannabis.com/product/northern-lights/
https://fresh-cannabis.com/product/netherlands-hash/
https://fresh-cannabis.com/product/mr-nice-afghani/
https://fresh-cannabis.com/product/moonrock-prerolls/
https://fresh-cannabis.com/product/moon-rock/
https://fresh-cannabis.com/product/master-kush/
https://fresh-cannabis.com/product/mario-cart/
https://fresh-cannabis.com/product/marble-hash/
https://fresh-cannabis.com/product/mango-kush/
https://fresh-cannabis.com/product/malana-cream-hash/
https://fresh-cannabis.com/product/magic-mushroom/
https://fresh-cannabis.com/product/lsd-wax/
https://fresh-cannabis.com/product/lsd-shatter-oil/
https://fresh-cannabis.com/product/lemon-kush-shatter-2/
https://fresh-cannabis.com/product/lemon-kush-shatter-2/
https://fresh-cannabis.com/product/lemon-haze/

https://fresh-cannabis.com/product/lebanese-hash/
https://fresh-cannabis.com/product/lak-vape/
https://fresh-cannabis.com/product/king-pen/
https://fresh-cannabis.com/product/khalifa-kush-shatter/
https://fresh-cannabis.com/product/khalifa-kush/
https://fresh-cannabis.com/product/jack-hearar/
https://fresh-cannabis.com/product/indiana-charas/
https://fresh-cannabis.com/product/indian-hash/
https://fresh-cannabis.com/product/heavy-hitter/
https://fresh-cannabis.com/product/grow-kits-mushroom/
https://fresh-cannabis.com/product/green-crack/
https://fresh-cannabis.com/product/grape-ape/
https://fresh-cannabis.com/product/grand-daddy-purple/
https://fresh-cannabis.com/product/gorilla-glue-wax/
https://fresh-cannabis.com/product/gorilla-glue-shatter/
https://fresh-cannabis.com/product/gorilla-glue-cart/
https://fresh-cannabis.com/product/gorilla-glue/
https://fresh-cannabis.com/product/girl-scout-cookies-wax/
https://fresh-cannabis.com/product/ghost-train-haze-2/
https://fresh-cannabis.com/product/ghost-train-haze/
https://fresh-cannabis.com/product/gelato/
https://fresh-cannabis.com/product/g-13/
https://fresh-cannabis.com/product/exotic-cart/
https://fresh-cannabis.com/product/durban-poison/
https://fresh-cannabis.com/product/dank-vape/
https://fresh-cannabis.com/product/crimin-muchrooms/
https://fresh-cannabis.com/product/co2-wax/
https://fresh-cannabis.com/product/chemdawgs-shatter/
https://fresh-cannabis.com/product/chemdawg/
https://fresh-cannabis.com/product/chantelle-muchrooms/
https://fresh-cannabis.com/product/cdb-oil/
https://fresh-cannabis.com/product/cannatonic-oil/
https://fresh-cannabis.com/product/butane-wax/
https://fresh-cannabis.com/product/bubble-hash/
https://fresh-cannabis.com/product/bubble-gum-cannabis-oil/
https://fresh-cannabis.com/product/bubba-kush-shatter/
https://fresh-cannabis.com/product/brass-knuckles/
https://fresh-cannabis.com/product/blue-dream-wax/
https://fresh-cannabis.com/product/blue-dream-shatter/
https://fresh-cannabis.com/product/blue-dream/
https://fresh-cannabis.com/product/blue-berry/
https://fresh-cannabis.com/product/bloom-cart/
https://fresh-cannabis.com/product/blackbee/
https://fresh-cannabis.com/product/birthday-cake/
https://fresh-cannabis.com/product/berry-white-g13/
https://fresh-cannabis.com/product/banana-og/

Re: [racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Ben Greenman
On 3/30/20, Siddhartha Kasivajhula  wrote:
> Hi there,
> Is there a standard/recommended way to handle multiple versions of Racket
> in library code?

If you're planning to ship the library as a package, you can also:

1. make 2 versions of the library (maybe as two branches in the same git repo)
2. add a version exception on pkgs.racket-lang.org

https://docs.racket-lang.org/pkg/getting-started.html#(part._.Version_.Exceptions)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFUu9R5D3o2XJXvscJPjDd5ieGJt2-Qwsq4A4eeFL6VUX3tB4Q%40mail.gmail.com.


Re: [racket-users] Switch off type checking via typed/racket/no-check fails on typed big-bang

2020-03-30 Thread Ben Greenman
On 3/25/20, Marc Kaufmann  wrote:
> Hi,
>
> I am trying to switch off type checking on a file so that I can prototype
> faster without the wait for the type checker. However, my code also uses
> typed/2htdp/universe and typed/2htdp/image, and I get an error on
> `big-bang`:
>
>> Type Checker: Macro big-bang from typed module used in untyped code in:
> (big-bang ...
>
> So, is there a to run the program without running the type checker?

No, you'll need a hack-around to avoid the macro issue.

This macro+use might be safe, but in general TR can't be sure that
expanding a macro won't break the typed module.

> Relatedly, is there a way of reloading a *typed* racket file in the REPL (I
> can't get it to work with ,reload-require which just chokes somehow).

I don't know about this

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFUu9R5WDyc2RaR0kH4P%3DGUKVdsP-M7%3DF4R%3DfQiZsMRY4Gd1cg%40mail.gmail.com.


[racket-users] Re: Working with JSON using Typed Racket

2020-03-30 Thread Wesley Bitomski
Hello Ed,

I generally get some mileage out of using custom predicates (those that are 
made with define-predicate) and pattern matching when tearing into JSON 
structures in Typed Racket. Occurrence typing seems to work with if, cond 
and assert, along with match's predicate matcher (? form).

So, something like this I think could less tedious to produce, and does 
exactly what your example does:

(: jsexpr->cd-users-data (JSExpr -> (Option (Listof String
(define (jsexpr->cd-users-data js)
  (define-predicate names-list? (Listof String))
  (match js
[(hash-table ['Type "DTHidden"]
 ['Data (hash-table ['Type "CDUsers"]
['Data (? names-list? users)])])
 users]
[_ #false]))

I hope this is what you were looking for.

On Sunday, March 29, 2020 at 8:39:56 AM UTC-4, e...@disroot.org wrote:
>
> Hi everyone,
>
> Recently I've been experimenting with Typed Racket and trying to gradually 
> type my code base.
> One of the functions that I need to write is to extract a list of strings 
> from a JSON object, if it has following form:
>
> {
>   "Type": "DTHidden",
>   "Data": { "Type": "CDUsers",
> "Data": ["datum1", "datum2"] }
> }
>
> The way I used to structure it in Racket is to have a function 
> `is-cdusers?` with the contract `jsexpr? -> boolean?`, which would check 
> that the JSON object has the right shape; and a separate function 
> `get-cdusers-data` with the contract `is-cdusers? -> listof string?`.
>
> However, after playing a bit with Typed Racket I decided that it was 
> necessary, according to my understanding of occurrence typing, to have a 
> single function `get-cdusers-data` with the type `JSExpr -> (U False 
> (Listof String))`.
> In order to get it to work I ended up writing a long chain of conditionals:
>
>
> (: get-cdusers-data (-> JSExpr (U False (Listof Any
> (define (get-cdusers-data js)
>   (if (and (hash? js)
>(equal? DTHidden (hash-ref js 'Type #f)))
>   (let ([js (hash-ref-def js 'Data [ann #hasheq() JSExpr])])
> (if (and (hash? js)
>  (equal? CdUsers (hash-ref js 'Type #f)))
> (let ([data (hash-ref js 'Data)])
>   (if (hash? data)
>   (let ([x (hash-ref js 'Data #f)])
> (and (list? x) x))
>   #f))
> #f))
>   #f))
>
> Needless to say, this is a bit impractical and error-prone to write.
> Does anyone know if there is a better approach to this?
>
> From my experience with typed languages I would get that the most 
> principle approach is to have an algebraic data type that represents all 
> the underlying data structures, something like
>
> type reply = ... | CDUsers of string list | ...
>
> and then have a single function to converts a JSExpr into that data type.
>
> I was hoping to avoid that, because I do enjoy working with the JSExpr 
> type directly in Racket.
>
> Does anyone have advice/experience with problems like this?
>
> Best wishes,
> -Ed 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/f85a4a4d-0d0a-47e3-909b-2b378def368a%40googlegroups.com.


Re: [racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Siddhartha Kasivajhula
Ah right, that makes sense :)


On Mon, Mar 30, 2020 at 12:29 PM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:

> The problem with shadowing is more than that. Suppose you somehow want to
> shadow add1 by making it add 2 instead.
>
> (define add1 (compose add1 add1))
>
> However, this will not work, resulting in the following error:
>
> add1: undefined;
>  cannot reference an identifier before its definition
>
> because blue add1 refers to red add1, not Racket’s add1.
>
> So you really need to either rename Racket’s add1 to something else, or
> define your add1 with another name. The first approach would be something
> like:
>
> (require (only-in racket [add1 @add1]))
> (define add1 (compose @add1 @add1))
>
> and the second approach would be something like:
>
> (define @add1 (compose add1 add1))
>
>
>
> On Mon, Mar 30, 2020 at 12:17 PM Siddhartha Kasivajhula <
> skasi...@gmail.com> wrote:
>
>> That looks great, thanks! Re: shadowing, I don't plan to re-provide
>> string-append-immutable -- only use it internally within the module, so
>> shadowing should be OK, right?
>> Re: reason to use it - performance. I'm applying the string-append
>> operation in a pairwise way over input sequences, and re-converting to
>> immutable at each step appears to have a measurable cost.
>>
>>
>> On Mon, Mar 30, 2020 at 12:11 PM Sorawee Porncharoenwase <
>> sorawee.pw...@gmail.com> wrote:
>>
>>> Is there any reason to use Racket’s string-append-immutable though? It
>>> might be simpler to just:
>>>
>>> (define string-append-immutable
>>>   (compose string->immutable-string string-append))
>>>
>>> (provide string-append-immutable)
>>>
>>> since you need to define it anyway for the versions prior 7.5.0.14.
>>>
>>> On Mon, Mar 30, 2020 at 12:00 PM Sorawee Porncharoenwase <
>>> sorawee.pw...@gmail.com> wrote:
>>>
 Your code would not work because prior 7.5.0.14, there’s no
 string-append-immutable, so the use of string-append-immutable in the
 else branch will result in an unbound id error.

 Instead, use https://docs.racket-lang.org/version-case/index.html
 which will run the “if” at compile-time, making the "unbound id" go away at
 compile-time.

 Another problem is that when you define string-append (or even
 string-append-immutable), it will shadow Racket’s string-append (or
 string-append-immutable). You might want to do something like this
 instead:

 (define @string-append-immutable ... now you can use 
 string-append-immutable here ...)
 (provide (rename-out [@string-append-immutable string-append-immutable]))



 On Mon, Mar 30, 2020 at 11:49 AM Siddhartha Kasivajhula <
 skasi...@gmail.com> wrote:

> Hi there,
> Is there a standard/recommended way to handle multiple versions of
> Racket in library code?
>
> For instance, this handy utility was added in a recent version of
> Racket:
>
>
> https://docs.racket-lang.org/reference/strings.html?q=strings#%28def._%28%28quote._~23~25kernel%29._string-append-immutable%29%29
>
> I'd like to use it in my library code but that would probably mean
> that users with an older version of Racket wouldn't be able to use the
> library, is that right? I'm tempted to add something like:
>
> (require version/utils)
> (define string-append
>   (if (version   (compose string->immutable-string string-append)
>   string-append-immutable))
>
> ... at the top of the module. Is this advisable? Or is there a better,
> maybe more raco-friendly way?
>
> Thanks,
> -Sid
>
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CACQBWFkRahhtoXKUbpcJ%2BHpYwq5FBU85Ze_NGkEntXX3kTD01g%40mail.gmail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CACQBWFmBpVWY%2B9bUo9uPk38n9f4tJvJg9HRKbv8LCkZ3gM%3D1qQ%40mail.gmail.com.


Re: [racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Sorawee Porncharoenwase
The problem with shadowing is more than that. Suppose you somehow want to
shadow add1 by making it add 2 instead.

(define add1 (compose add1 add1))

However, this will not work, resulting in the following error:

add1: undefined;
 cannot reference an identifier before its definition

because blue add1 refers to red add1, not Racket’s add1.

So you really need to either rename Racket’s add1 to something else, or
define your add1 with another name. The first approach would be something
like:

(require (only-in racket [add1 @add1]))
(define add1 (compose @add1 @add1))

and the second approach would be something like:

(define @add1 (compose add1 add1))



On Mon, Mar 30, 2020 at 12:17 PM Siddhartha Kasivajhula 
wrote:

> That looks great, thanks! Re: shadowing, I don't plan to re-provide
> string-append-immutable -- only use it internally within the module, so
> shadowing should be OK, right?
> Re: reason to use it - performance. I'm applying the string-append
> operation in a pairwise way over input sequences, and re-converting to
> immutable at each step appears to have a measurable cost.
>
>
> On Mon, Mar 30, 2020 at 12:11 PM Sorawee Porncharoenwase <
> sorawee.pw...@gmail.com> wrote:
>
>> Is there any reason to use Racket’s string-append-immutable though? It
>> might be simpler to just:
>>
>> (define string-append-immutable
>>   (compose string->immutable-string string-append))
>>
>> (provide string-append-immutable)
>>
>> since you need to define it anyway for the versions prior 7.5.0.14.
>>
>> On Mon, Mar 30, 2020 at 12:00 PM Sorawee Porncharoenwase <
>> sorawee.pw...@gmail.com> wrote:
>>
>>> Your code would not work because prior 7.5.0.14, there’s no
>>> string-append-immutable, so the use of string-append-immutable in the
>>> else branch will result in an unbound id error.
>>>
>>> Instead, use https://docs.racket-lang.org/version-case/index.html which
>>> will run the “if” at compile-time, making the "unbound id" go away at
>>> compile-time.
>>>
>>> Another problem is that when you define string-append (or even
>>> string-append-immutable), it will shadow Racket’s string-append (or
>>> string-append-immutable). You might want to do something like this
>>> instead:
>>>
>>> (define @string-append-immutable ... now you can use 
>>> string-append-immutable here ...)
>>> (provide (rename-out [@string-append-immutable string-append-immutable]))
>>>
>>>
>>>
>>> On Mon, Mar 30, 2020 at 11:49 AM Siddhartha Kasivajhula <
>>> skasi...@gmail.com> wrote:
>>>
 Hi there,
 Is there a standard/recommended way to handle multiple versions of
 Racket in library code?

 For instance, this handy utility was added in a recent version of
 Racket:


 https://docs.racket-lang.org/reference/strings.html?q=strings#%28def._%28%28quote._~23~25kernel%29._string-append-immutable%29%29

 I'd like to use it in my library code but that would probably mean that
 users with an older version of Racket wouldn't be able to use the library,
 is that right? I'm tempted to add something like:

 (require version/utils)
 (define string-append
   (if (version>>>   (compose string->immutable-string string-append)
   string-append-immutable))

 ... at the top of the module. Is this advisable? Or is there a better,
 maybe more raco-friendly way?

 Thanks,
 -Sid


 --
 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.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/racket-users/CACQBWFkRahhtoXKUbpcJ%2BHpYwq5FBU85Ze_NGkEntXX3kTD01g%40mail.gmail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcueguF6iJkHaYSEBprZjwVxNOxRU3RWV6TuGPPAzHniO6M9g%40mail.gmail.com.


Re: [racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Siddhartha Kasivajhula
That looks great, thanks! Re: shadowing, I don't plan to re-provide
string-append-immutable -- only use it internally within the module, so
shadowing should be OK, right?
Re: reason to use it - performance. I'm applying the string-append
operation in a pairwise way over input sequences, and re-converting to
immutable at each step appears to have a measurable cost.


On Mon, Mar 30, 2020 at 12:11 PM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:

> Is there any reason to use Racket’s string-append-immutable though? It
> might be simpler to just:
>
> (define string-append-immutable
>   (compose string->immutable-string string-append))
>
> (provide string-append-immutable)
>
> since you need to define it anyway for the versions prior 7.5.0.14.
>
> On Mon, Mar 30, 2020 at 12:00 PM Sorawee Porncharoenwase <
> sorawee.pw...@gmail.com> wrote:
>
>> Your code would not work because prior 7.5.0.14, there’s no
>> string-append-immutable, so the use of string-append-immutable in the
>> else branch will result in an unbound id error.
>>
>> Instead, use https://docs.racket-lang.org/version-case/index.html which
>> will run the “if” at compile-time, making the "unbound id" go away at
>> compile-time.
>>
>> Another problem is that when you define string-append (or even
>> string-append-immutable), it will shadow Racket’s string-append (or
>> string-append-immutable). You might want to do something like this
>> instead:
>>
>> (define @string-append-immutable ... now you can use string-append-immutable 
>> here ...)
>> (provide (rename-out [@string-append-immutable string-append-immutable]))
>>
>>
>>
>> On Mon, Mar 30, 2020 at 11:49 AM Siddhartha Kasivajhula <
>> skasi...@gmail.com> wrote:
>>
>>> Hi there,
>>> Is there a standard/recommended way to handle multiple versions of
>>> Racket in library code?
>>>
>>> For instance, this handy utility was added in a recent version of Racket:
>>>
>>>
>>> https://docs.racket-lang.org/reference/strings.html?q=strings#%28def._%28%28quote._~23~25kernel%29._string-append-immutable%29%29
>>>
>>> I'd like to use it in my library code but that would probably mean that
>>> users with an older version of Racket wouldn't be able to use the library,
>>> is that right? I'm tempted to add something like:
>>>
>>> (require version/utils)
>>> (define string-append
>>>   (if (version>>   (compose string->immutable-string string-append)
>>>   string-append-immutable))
>>>
>>> ... at the top of the module. Is this advisable? Or is there a better,
>>> maybe more raco-friendly way?
>>>
>>> Thanks,
>>> -Sid
>>>
>>>
>>> --
>>> 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/racket-users/CACQBWFkRahhtoXKUbpcJ%2BHpYwq5FBU85Ze_NGkEntXX3kTD01g%40mail.gmail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CACQBWFmoT_6rF4Z7poR%3DNVJ5GF2JTec3YCNqdduDi6pMfD%3D5nA%40mail.gmail.com.


Re: [racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Sorawee Porncharoenwase
Is there any reason to use Racket’s string-append-immutable though? It
might be simpler to just:

(define string-append-immutable
  (compose string->immutable-string string-append))

(provide string-append-immutable)

since you need to define it anyway for the versions prior 7.5.0.14.

On Mon, Mar 30, 2020 at 12:00 PM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:

> Your code would not work because prior 7.5.0.14, there’s no
> string-append-immutable, so the use of string-append-immutable in the
> else branch will result in an unbound id error.
>
> Instead, use https://docs.racket-lang.org/version-case/index.html which
> will run the “if” at compile-time, making the "unbound id" go away at
> compile-time.
>
> Another problem is that when you define string-append (or even
> string-append-immutable), it will shadow Racket’s string-append (or
> string-append-immutable). You might want to do something like this
> instead:
>
> (define @string-append-immutable ... now you can use string-append-immutable 
> here ...)
> (provide (rename-out [@string-append-immutable string-append-immutable]))
>
>
>
> On Mon, Mar 30, 2020 at 11:49 AM Siddhartha Kasivajhula <
> skasi...@gmail.com> wrote:
>
>> Hi there,
>> Is there a standard/recommended way to handle multiple versions of Racket
>> in library code?
>>
>> For instance, this handy utility was added in a recent version of Racket:
>>
>>
>> https://docs.racket-lang.org/reference/strings.html?q=strings#%28def._%28%28quote._~23~25kernel%29._string-append-immutable%29%29
>>
>> I'd like to use it in my library code but that would probably mean that
>> users with an older version of Racket wouldn't be able to use the library,
>> is that right? I'm tempted to add something like:
>>
>> (require version/utils)
>> (define string-append
>>   (if (version>   (compose string->immutable-string string-append)
>>   string-append-immutable))
>>
>> ... at the top of the module. Is this advisable? Or is there a better,
>> maybe more raco-friendly way?
>>
>> Thanks,
>> -Sid
>>
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/CACQBWFkRahhtoXKUbpcJ%2BHpYwq5FBU85Ze_NGkEntXX3kTD01g%40mail.gmail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegsPsYRE7JZa6vrAoV2fHKPLM9O9-8ghhTiR5TexyHeRSA%40mail.gmail.com.


Re: [racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Sorawee Porncharoenwase
Your code would not work because prior 7.5.0.14, there’s no
string-append-immutable, so the use of string-append-immutable in the else
branch will result in an unbound id error.

Instead, use https://docs.racket-lang.org/version-case/index.html which
will run the “if” at compile-time, making the "unbound id" go away at
compile-time.

Another problem is that when you define string-append (or even
string-append-immutable), it will shadow Racket’s string-append (or
string-append-immutable). You might want to do something like this instead:

(define @string-append-immutable ... now you can use
string-append-immutable here ...)
(provide (rename-out [@string-append-immutable string-append-immutable]))



On Mon, Mar 30, 2020 at 11:49 AM Siddhartha Kasivajhula 
wrote:

> Hi there,
> Is there a standard/recommended way to handle multiple versions of Racket
> in library code?
>
> For instance, this handy utility was added in a recent version of Racket:
>
>
> https://docs.racket-lang.org/reference/strings.html?q=strings#%28def._%28%28quote._~23~25kernel%29._string-append-immutable%29%29
>
> I'd like to use it in my library code but that would probably mean that
> users with an older version of Racket wouldn't be able to use the library,
> is that right? I'm tempted to add something like:
>
> (require version/utils)
> (define string-append
>   (if (version   (compose string->immutable-string string-append)
>   string-append-immutable))
>
> ... at the top of the module. Is this advisable? Or is there a better,
> maybe more raco-friendly way?
>
> Thanks,
> -Sid
>
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CACQBWFkRahhtoXKUbpcJ%2BHpYwq5FBU85Ze_NGkEntXX3kTD01g%40mail.gmail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegu%2BKY5UNeOXY1WrmVDb1N715ncP49ASOY1SdZPCznKxsw%40mail.gmail.com.


[racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Siddhartha Kasivajhula
Hi there,
Is there a standard/recommended way to handle multiple versions of Racket
in library code?

For instance, this handy utility was added in a recent version of Racket:

https://docs.racket-lang.org/reference/strings.html?q=strings#%28def._%28%28quote._~23~25kernel%29._string-append-immutable%29%29

I'd like to use it in my library code but that would probably mean that
users with an older version of Racket wouldn't be able to use the library,
is that right? I'm tempted to add something like:

(require version/utils)
(define string-append
  (if (versionimmutable-string string-append)
  string-append-immutable))

... at the top of the module. Is this advisable? Or is there a better,
maybe more raco-friendly way?

Thanks,
-Sid

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CACQBWFkRahhtoXKUbpcJ%2BHpYwq5FBU85Ze_NGkEntXX3kTD01g%40mail.gmail.com.


Re: [racket-users] Code Jam

2020-03-30 Thread Sorawee Porncharoenwase
It’s a programming competition by Google.
https://codingcompetitions.withgoogle.com/codejam

Code Jam used to allow participants to use any languages, but they changed
that a couple of years ago. To quote its website:

With the new platform, we have aimed to support the most popular
programming languages used in past Code Jam contests. We currently support
the following, which represent over 97.5% of the submissions in last year’s
Qualification Round: Bash, C, C++, C# (mono), Go, Haskell (ghc), Java 8,
Javascript (nodejs), Python 2, Python 3, PHP, and Ruby.

I don’t think there’s anything anyone (besides Google) can do about it.

On Mon, Mar 30, 2020 at 7:29 AM Andrew Gwozdziewycz 
wrote:

> I am surely not the only one asking “What is code jam?”
>
> On Mar 30, 2020, at 06:52, Gustavo Massaccesi  wrote:
>
> 
> Code Jam is in a few days, but Racket is not available :(.
>
> Anyone know how difficult is to add a new language to the list? (Probably
> for 2021.)
>
> Gustavo
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAPaha9Pg0A1AP5-tc0pWHjHhqkwO-k2U%2BfGMtS57-NKx0P7S7Q%40mail.gmail.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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/F87F32C9-4913-425B-BEDB-919B627AF4C2%40gmail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegsRe9EqLBqh%3Dc8jU6iMJZYTijTCuB4sOdixwCzvmyMwZQ%40mail.gmail.com.


Re: [racket-users] Code Jam

2020-03-30 Thread Andrew Gwozdziewycz
I am surely not the only one asking “What is code jam?”

> On Mar 30, 2020, at 06:52, Gustavo Massaccesi  wrote:
> 
> 
> Code Jam is in a few days, but Racket is not available :(. 
> 
> Anyone know how difficult is to add a new language to the list? (Probably for 
> 2021.)
> 
> Gustavo
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAPaha9Pg0A1AP5-tc0pWHjHhqkwO-k2U%2BfGMtS57-NKx0P7S7Q%40mail.gmail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/F87F32C9-4913-425B-BEDB-919B627AF4C2%40gmail.com.


[racket-users] Code Jam

2020-03-30 Thread Gustavo Massaccesi
Code Jam is in a few days, but Racket is not available :(.

Anyone know how difficult is to add a new language to the list? (Probably
for 2021.)

Gustavo

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAPaha9Pg0A1AP5-tc0pWHjHhqkwO-k2U%2BfGMtS57-NKx0P7S7Q%40mail.gmail.com.


[racket-users] HTDP2E 22.3 Domain-Specific Languages: Configurations

2020-03-30 Thread Aron Zvi
Hey guys

In 22.3 Domain-Specific Languages: Configurations, the book introduces the 
following data example and data definitions for FSM configurations


(define 

 xm0
  '(machine ((initial "red"))
 (action ((state "red") (next "green")))
 (action ((state "green") (next "yellow")))
 (action ((state "yellow") (next "red")

; An XMachine is a nested list of this shape:
;   `(machine ((initial ,FSM-State 
)) [
List-of 
 
X1T ])
; An X1T is a nested list of this shape:
;   `(action ((state ,FSM-State 
) (
next ,FSM-State 
)))
I do no understand the XMachine data definition properly. In the definition 
it appears that it would be a list with 3 elements:

1*. *'machine
2. `((initial ,FSM-State 
))
3. [List-of 
 
X1T ]

However, from the data example (and the fact that it is an Xexpr 
) I know 
that the intention is different and that it is a list of the form:

1. 'machine
2.  `((initial ,FSM-State 
))
3. X1T -1 
... 
X1T -n

where is seems that [List-of 
 
X1T ]is 
expanded and included in the list  ([List-of 

 X1T ] is 
consed 
onto)

Can you please explain how the given  `(machine ((initial ,FSM-State 
)) [
List-of 
 
X1T ]) 
translates 
to this?





-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/26d8c34b-8ca8-4525-847f-25ba5b6124fa%40googlegroups.com.


Re: [racket-users] Embedding Racket CS

2020-03-30 Thread zeRusski
successfully called Racket CS from C. I'll try what you suggest re calling 
C from Racket at some point and report any problems.

Thank you!

On Sunday, 29 March 2020 21:41:46 UTC+1, Matthew Flatt wrote:
>
> At Sun, 29 Mar 2020 13:13:08 -0700 (PDT), zeRusski wrote: 
> > First, CS snapshots in Utah and NW mirrors offer no libracketcs.a so I 
> went 
> > ahead and attempted to build CS from the github master. Sadly its `raco` 
> > tool is unaware of the `ctool` subcommand, so I'm guessing snapshots are 
> > built from your own private fork or something. 
>
> Snapshot builds use the public GitHub repo's master. 
>
> `raco ctool` is provided by the "cext-lib" package. That package is 
> part of "main-distribution", but maybe you installed a subset of 
> packages when building? 
>
> > I then started mixing and 
> > matching stuff from snapshot and freshly built github: 
> > - raco, boot files and headers from the snapshot, 
> > - libracketcs.a from github 
>
> That could work. 
>
> > Linking against `libracketcs.a` however failed with a bunch of 
> > unresolved symbols like e.g. `CFLocaleCopyCurrent` most of them 
> referenced 
> > from `rktio_convert.o`. 
>
> You will need to link to some standard libraries and frameworks on Mac 
> OS: `-framework CoreFoundation`, `-liconv`, and `-lncurses`. 
>
> I didn't try to write this down because it varies so much across 
> platforms, and I expect C programmers to just know. :) But it should be 
> written down or made more automatic. 
>
> > It wouldn't work anyway since `declare_modules` 
> > also failed to resolve and I'm guessing I really need the 
> `libracketcs.a` 
> > from the snapshot for that. 
>
> `declare_modules` should be defined in the file generated by `raco 
> ctool --c-mods`. 
>
> > Another, probably unrelated issue where I'm likely not using the right 
> > incantation is linking in Racket.framework. Even with -F path supplied 
> as 
> > needed `-framework racket` wasn't found. `man ld` for my platform shows 
> it 
> > expects to find (in our case) Racket under Racket.framework so 
> > Racket.framework/Racket but all the frameworks you ship have 
> intermediate 
> > dirs Version/blabla/Racket. I just copied Racket and boot/ under 
> > Racket.framework there to shut the linker up. Am I doing it wrong? 
>
> A better strategy may be to use `install_name_tool` to update the 
> framework reference to be relative to the executable: 
>
>   install_name_tool -change \ 
>   "Racket.framework/Versions/7.6.0.18_CS/Racket" \ 
>   
> "@excutable_path/rel/to/Racket.framework/Versions/7.6.0.18_CS/Racket" \ 
>   path_to_your_executable 
>
> I don't know of a flag to the linker that will do this in the first 
> place. 
>
> > https://www.cs.utah.edu/plt/snapshots/current/doc/inside/cs.html is atm 
> > quite about calling C. Is it possible or at least in the cards? I'd like 
> to 
> > use the API defined in C from Racket. 
>
> Calling C from Racket is mostly left to the FFI documentation: 
>
>   https://docs.racket-lang.org/foreign/index.html 
>
> So, if you link your executable in such a way that `(get-ffi-obj name 
> #f )` can find the functions, then that's all you need. 
>
>
> There's also a way to publish C functions to make them visible at the 
> Chez Scheme level: 
>
>  https://cisco.github.io/ChezScheme/csug9.5/foreign.html#./foreign:s272 
>
> Then you'd have to propagate that to the Racket level somehow --- maybe 
> by using `vm-eval` from `ffi/unsafe/vm` to access Chez Scheme directly 
> on the Racket side. I haven't given that much thought, so far. 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/743f1f10-cf27-4e24-a43e-6cf56c52049c%40googlegroups.com.