Re: [racket-users] DrRackGit & LibGit2

2017-12-07 Thread Stephen De Gabrielle
I should be clear, I ran the libgit2 tests by hard coding the location of
the library and running them manually. I don’t really know what I’m doing
so that was the best I could muddle through.
S.

On Thu, 7 Dec 2017 at 22:28, Stephen De Gabrielle 
wrote:

> Only on macOS, but most tests passed.
> S.
> On Thu, 7 Dec 2017 at 22:15, John Clements 
> wrote:
>
>> Bradley was a student of mine, so I’m interested generally. Have you
>> checked to see whether adding the libgit2 dependency allows the tests to
>> pass?
>>
>> John
>>
>> > On Dec 7, 2017, at 10:27 AM, Stephen De Gabrielle <
>> spdegabrie...@gmail.com> wrote:
>> >
>> >
>> > Hi,
>> > https://pkgs.racket-lang.org/package/Drrackgit
>> > https://github.com/bbusching/drrackgit
>> > https://pkgs.racket-lang.org/package/libgit2
>> > https://github.com/bbusching/libgit2
>> > https://libgit2.github.com/
>> >
>> > I was very excited when I found the DrRackGit tool in the Racket
>> packages, but saddened to find it is currently failing.
>> >
>> > Bradley, the original developer was kind enough to diagnose the issue (
>> it is missing the dependency on the libgit2 library.) and add a compatible
>> licence, but isn’t able to maintain it at the moment.
>> >
>> > Is anyone interested in fixing the libgit2 package?
>> >
>> > Kind regards,
>> >
>> > Stephen
>> >
>> > PS I have built the lib2git library on macOS, but I lack the required
>> experience in FFI and I can’t currently build for Linux or windows.
>> >
>> >
>> >
>> >
>> >
>> >
>> > --
>> > Kind regards,
>> > Stephen
>> > --
>> > Ealing (London), UK
>> >
>> > --
>> > 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.
>>
>>
>>
>> --
> Kind regards,
> Stephen
> --
> Ealing (London), UK
>
-- 
Kind regards,
Stephen
--
Ealing (London), UK

-- 
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] DrRackGit & LibGit2

2017-12-07 Thread 'John Clements' via users-redirect


> On Dec 7, 2017, at 2:34 PM, Stephen De Gabrielle  
> wrote:
> 
> I should be clear, I ran the libgit2 tests by hard coding the location of the 
> library and running them manually. I don’t really know what I’m doing so that 
> was the best I could muddle through.

That doesn’t sound ideal. Probably it’s better to deliver the library with the 
package on macos & windows, & ask user to install using package manager on 
linux. Sounds like entertaining work, and I’ve been meaning to take a look at 
this for quite a while now, but I definitely don’t have any time before next 
Tuesday.

John

> S.
> 
> On Thu, 7 Dec 2017 at 22:28, Stephen De Gabrielle  
> wrote:
> Only on macOS, but most tests passed.
> S.
> On Thu, 7 Dec 2017 at 22:15, John Clements  wrote:
> Bradley was a student of mine, so I’m interested generally. Have you checked 
> to see whether adding the libgit2 dependency allows the tests to pass?
> 
> John
> 
> > On Dec 7, 2017, at 10:27 AM, Stephen De Gabrielle  
> > wrote:
> >
> >
> > Hi,
> > https://pkgs.racket-lang.org/package/Drrackgit
> > https://github.com/bbusching/drrackgit
> > https://pkgs.racket-lang.org/package/libgit2
> > https://github.com/bbusching/libgit2
> > https://libgit2.github.com/
> >
> > I was very excited when I found the DrRackGit tool in the Racket packages, 
> > but saddened to find it is currently failing.
> >
> > Bradley, the original developer was kind enough to diagnose the issue ( it 
> > is missing the dependency on the libgit2 library.) and add a compatible 
> > licence, but isn’t able to maintain it at the moment.
> >
> > Is anyone interested in fixing the libgit2 package?
> >
> > Kind regards,
> >
> > Stephen
> >
> > PS I have built the lib2git library on macOS, but I lack the required 
> > experience in FFI and I can’t currently build for Linux or windows.
> >
> >
> >
> >
> >
> >
> > --
> > Kind regards,
> > Stephen
> > --
> > Ealing (London), UK
> >
> > --
> > 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.
> 
> 
> 
> -- 
> Kind regards,
> Stephen
> --
> Ealing (London), UK
> -- 
> Kind regards,
> Stephen
> --
> Ealing (London), UK



-- 
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] DrRackGit & LibGit2

2017-12-08 Thread Stephen De Gabrielle
HI John,

Thanks for taking the time to look at this - anytime you have is
appreciated.

As I'm not familiar with FFI and I'm not clear what the benefits over git
that lib2git brings on Windows/Linux/Macos I was honestly considering
leaving 'as-is' libgit2 and adding using git as an option in DrRackGit (via
racket/system) on the grounds that users will have git installed anyway.
(I'm pretty sure 'Github desktop' uses git, though it might have changed to
libgit2 in an update)

If you feel FFI/Libgit2 is worth the effort I'll follow you lead - please
don't hesitate to give me any task that will help.

> I definitely don’t have any time before next Tuesday.
Not a problem - I'm enthusiastic but DrRacket isn't my day job either. 😁

Thanks again,

Stephen

---
Welcome to DrRacket, version 6.11 [3m].
Language: racket, with debugging; memory limit: 128 MB.
#
1

repository > libgit2 > git repo path
. FAILURE
name:   check-equal?
location:   test-libgit2.rkt:100:16
actual:
#
expected:
#


config > libgit2 > open level
. ERROR

git_config_open_level: contract violation
  expected: 0
  received: "7: no config file exists for the given level '1'"

45 success(es) 1 failure(s) 1 error(s) 47 test(s) run
2
>


On Thu, Dec 7, 2017 at 10:57 PM, John Clements 
wrote:

>
>
> > On Dec 7, 2017, at 2:34 PM, Stephen De Gabrielle <
> spdegabrie...@gmail.com> wrote:
> >
> > I should be clear, I ran the libgit2 tests by hard coding the location
> of the library and running them manually. I don’t really know what I’m
> doing so that was the best I could muddle through.
>
> That doesn’t sound ideal. Probably it’s better to deliver the library with
> the package on macos & windows, & ask user to install using package manager
> on linux. Sounds like entertaining work, and I’ve been meaning to take a
> look at this for quite a while now, but I definitely don’t have any time
> before next Tuesday.
>
> John
>
> > S.
> >
> > On Thu, 7 Dec 2017 at 22:28, Stephen De Gabrielle <
> spdegabrie...@gmail.com> wrote:
> > Only on macOS, but most tests passed.
> > S.
> > On Thu, 7 Dec 2017 at 22:15, John Clements 
> wrote:
> > Bradley was a student of mine, so I’m interested generally. Have you
> checked to see whether adding the libgit2 dependency allows the tests to
> pass?
> >
> > John
> >
> > > On Dec 7, 2017, at 10:27 AM, Stephen De Gabrielle <
> spdegabrie...@gmail.com> wrote:
> > >
> > >
> > > Hi,
> > > https://pkgs.racket-lang.org/package/Drrackgit
> > > https://github.com/bbusching/drrackgit
> > > https://pkgs.racket-lang.org/package/libgit2
> > > https://github.com/bbusching/libgit2
> > > https://libgit2.github.com/
> > >
> > > I was very excited when I found the DrRackGit tool in the Racket
> packages, but saddened to find it is currently failing.
> > >
> > > Bradley, the original developer was kind enough to diagnose the issue
> ( it is missing the dependency on the libgit2 library.) and add a
> compatible licence, but isn’t able to maintain it at the moment.
> > >
> > > Is anyone interested in fixing the libgit2 package?
> > >
> > > Kind regards,
> > >
> > > Stephen
> > >
> > > PS I have built the lib2git library on macOS, but I lack the required
> experience in FFI and I can’t currently build for Linux or windows.
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Kind regards,
> > > Stephen
> > > --
> > > Ealing (London), UK
> > >
> > > --
> > > 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.
> >
> >
> >
> > --
> > Kind regards,
> > Stephen
> > --
> > Ealing (London), UK
> > --
> > Kind regards,
> > Stephen
> > --
> > Ealing (London), UK
>
>
>
>

-- 
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] scheme-script executable?

2017-12-10 Thread Philip McGrath
This morning I stumbled across Appendix D to R6RS (
http://www.r6rs.org/final/html/r6rs-app/r6rs-app-Z-H-6.html), which
suggests that implementations provide an executable named scheme-script for
the purpose of executing portable scripts. It seems that Racket does not
currently provide such an executable. Should it? (Of course I understand
that Racket is not a Scheme implementation, but it does contain an R6RS
implementation.)

The rationale given in the report seems persuasive to me, having at least a
little bit of experience wrangling Unix-style scripts that try to be
somewhat portable. It seems like just making scheme-script an alias for the
racket executable would be sufficient.

-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] Re: stumped

2017-12-13 Thread Stephen De Gabrielle
Thanks Alex,
Much appreciated!
Stephen
On Thu, 14 Dec 2017 at 04:50, Alex Harsanyi  wrote:

> I built a similar control, although it does not represent directory paths,
> just labels which are stacked vertically. I ended up defining a structure
> to hold the text and width + height of each label and keep these structures
> in a list. In my case, all labels have the same size so converting a mouse
> coordinate to a list index is just arithmetic, but it could be extended to
> support variable width labels and just search the list in linear time to
> convert a mouse coordinate to a list index. The number of items in the
> control should be small enough that linear search should not be a
> disadvantage.
>
> You can find the definition of the control here:
>
> https://github.com/alex-hhh/ActivityLog2/blob/master/rkt/widgets.rkt#L1910
>
> To convert it to variable width labels, the `hover-candiate` function
> would have to be changed (third `cond` option) to do a linear search on the
> label widths. `label-box-dimensions` would also have to change to report
> the actual label width and height for all labels (currently all labels have
> the dimensions of the largest one).
>
> Best Regards,
> Alex.
>
> --
> 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.
>
-- 
Kind regards,
Stephen
--
Ealing (London), UK

-- 
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] Y combinator

2018-01-13 Thread Matthias Felleisen

> On Jan 13, 2018, at 11:53 AM, Hendrik Boom  wrote:
> 
> On Sat, Jan 13, 2018 at 08:14:30AM -0800, Zelphir Kaltstahl wrote:
>> 
>> Anyway, I hope to understand how the Y-combinator works with the help of 
>> "The Little Schemer", which I am reading currently. I am not at that 
>> chapter yet. I am taking my time, first thinking through the stuff and 
>> later typing it into the machine and thinking about it again, sometimes 
>> noticing some detail when I type the code and sometimes making a little 
>> experiment with that code. Already on my way through "The Little Schemer" I 
>> hit some useful procedures, which helped me with a totally unrelated 
>> problem when coding my blog in Racket. So it's definitely useful.
> 
> The Y combinator comes from the original lambda calculus, which was a 
> formal system for computational logic and it elicidated how bound and 
> free variables work.
> 
> But the system had no built-in mechanism for defining a recursive 
> function.
> 
> Instead, the Y-combinator was invented -- a lamnda expression that 
> enable you to make a recursive function essentially by passing the 
> functiion as an argument to itself.  Receiving itself as a parameter, it 
> was capable of calling its parameter, which was itself.
> 
> Have fun deciphering the code.  It took me while, too, way back in the 
> 60's.


TLL/TLS does not dump the code on the reader. It develops it, 
step by step, w/o any mystery. It is still a serious “reading” exercise
for most readers and a rather satisfying one I am told. — Matthias

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Y combinator

2018-01-13 Thread Jason Hemann
I find this
<https://web.archive.org/web/20170813054608/http://mvanier.livejournal.com/2897.html>
(now dead, but archived) blog post on Y both well paced and approachable.

http://mvanier.livejournal.com/2897.html
<https://web.archive.org/web/20170813054608/http://mvanier.livejournal.com/2897.html>

The post's author considers it to be a massively expanded version of Ch 9
from *TLT/TLS.*

I have also suggested Yin Wang's slides on Reinventing the Y-Combinator
<https://www.slideshare.net/yinwang0/reinventing-the-ycombinator>, which
you might find you enjoy.

Best,

JBH



On Sat, Jan 13, 2018 at 11:57 AM, Matthias Felleisen 
wrote:

>
> > On Jan 13, 2018, at 11:53 AM, Hendrik Boom 
> wrote:
> >
> > On Sat, Jan 13, 2018 at 08:14:30AM -0800, Zelphir Kaltstahl wrote:
> >>
> >> Anyway, I hope to understand how the Y-combinator works with the help of
> >> "The Little Schemer", which I am reading currently. I am not at that
> >> chapter yet. I am taking my time, first thinking through the stuff and
> >> later typing it into the machine and thinking about it again, sometimes
> >> noticing some detail when I type the code and sometimes making a little
> >> experiment with that code. Already on my way through "The Little
> Schemer" I
> >> hit some useful procedures, which helped me with a totally unrelated
> >> problem when coding my blog in Racket. So it's definitely useful.
> >
> > The Y combinator comes from the original lambda calculus, which was a
> > formal system for computational logic and it elicidated how bound and
> > free variables work.
> >
> > But the system had no built-in mechanism for defining a recursive
> > function.
> >
> > Instead, the Y-combinator was invented -- a lamnda expression that
> > enable you to make a recursive function essentially by passing the
> > functiion as an argument to itself.  Receiving itself as a parameter, it
> > was capable of calling its parameter, which was itself.
> >
> > Have fun deciphering the code.  It took me while, too, way back in the
> > 60's.
>
>
> TLL/TLS does not dump the code on the reader. It develops it,
> step by step, w/o any mystery. It is still a serious “reading” exercise
> for most readers and a rather satisfying one I am told. — Matthias
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
JBH

-- 
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] Understanding prop:impersonator-of

2018-01-25 Thread Daniel Feltey
I'm trying to understand the use of the prop:impersonator-of struct
property, but the following program doesn't work the way I would have
expected:

#lang racket

(struct our-impersonate-proc (f orig)
 #:property prop:impersonator-of (lambda (x) (displayln 'hi)
(our-impersonate-proc-orig x))
 #:property prop:procedure (struct-field-index f))

(impersonator-of?
  (our-impersonate-proc add1 values)
  values)

The call to impersonator-of? doesn't seem to go through our
prop:impersonator-of at all because we don't 'hi displayed when the program
is run.

Am I misunderstanding the way to use prop:impersonator-of ? I don't fully
understand the documentation, so it's possible this isn't something that
prop:impersonator-of is intended for.

Thanks
Dan

-- 
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] Apparent Datalog error?

2018-01-31 Thread Kevin Forchione
Walking through the datalog  tutorial I got the following transcript:

Welcome to DrRacket, version 6.12 [3m].
Language: datalog, with debugging; memory limit: 512 MB.
> parent(john, douglas).
> parent(john, douglas)?
parent(john, douglas).
> parent(john, evlyn)?

> parent(bob, john).
> parent(A, B)?
parent(john, douglas).
parent(bob, john).
> parent(ebbon, bob).
> parent(john, B)?
parent(john, douglas).
> parent(A, A)?

> ancestor(A, B) :- parent(A, B).
> ancestor(A, B) :-
parent(A, C),
parent(C, B).
> ancestor(A, B)?
ancestor(ebbon, bob).
ancestor(bob, john).
ancestor(john, douglas).
ancestor(bob, douglas).
ancestor(ebbon, john).
> 

It seems that the correct answer should also include ancestor(ebbon, douglas). 
Am I doing something wrong?

-Kevin


-- 
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] Datalog Question

2018-01-31 Thread Jay McCarthy
Something like

kevin(Y) :- foo(x, Y), Y != 3.
kevin(Y)?





On Wed, Jan 31, 2018 at 5:13 PM, Kevin Forchione  wrote:
> Can anyone tell me how I would use the datalog = and != tokens? The 
> documentation says they can separate terms, such as  != . In the 
> program below, how would I create a query for foo(x, ?) where ? is not 3?
>
> #lang datalog
>
> foo(bil, 1).
> foo(bob, 3).
> foo(joe, 2).
>
> I imagine I’d have to create a rule of some sort.
>
> -Kevin
>
> --
> 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.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

-- 
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] raco distribute help

2018-02-01 Thread Deren Dohoda
Hi everyone,

I'm having a hard time understanding the docs for raco exe and raco
distribute.

tl;dr main.rkt has to (dynamic-require user-selected.rkt) and
user-selected.rkt is written in a different #lang and requires a file from
this program. How do I glue these pieces together for raco exe / raco
distribute?

My program has two things which seem to be hanging me up. The first is that
a file is grabbed with (dynamic-require) based on a path obtained by the
user with (get-file ...). This file is written in a different #lang and
uses (require ...) for some syntax transformers.

The exe builds alright but chokes when used because it can't find the #lang
and can't find the (require ...).

Ideally the file which is given to (dynamic-require ...) could be in any
folder the user chooses, but then the (require ...) statement would be all
over the map and I don't understand what I'm supposed to do to resolve
this. If it helps, the file is already required by the program and isn't
used only by the user-selected file. ++copy-collects doesn't seem to grab
#lang folders correctly or I don't understand how to use it.

Can someone give me some guidance here?

Thanks,
Deren

-- 
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] Quick regexp question

2018-02-02 Thread nocheroot
Sorry if I've missed this in the documentation, but I don't see it, and it 
is starting to bother me.

In Powershell. Python, and Splunk I'm able to perform automatic field 
extraction on strings and access the values of fields by name.  Is there a 
way to do this in Racket?  Of course, pairing matches with field names by 
index is an option, but not as convenient in some situations.

Take string "2018-02-02T11:26:34 someuser some-computername01 233.194.20.110 
something 
broke" as a trivial example.

Powershell:
"2018-02-02T11:26:34 someuser some-computername01 233.194.20.110 something 
broke" -match 
"^(?[\d\-T:]+)\s(?\w+)\s(?[\w\-\d]+)\s(?[\d\.]+)\s(?.+)$"
 
| Out-Null

$matches.date
$matches.username
$matches.hostname
$matches.IP
$matches.message

Python:
m = re.match(
"^(?P[\d\-T:]+)\s(?P\w+)\s(?P[\w\-\d]+)\s(?P[\d\.]+)\s(?P.+)$"
, "2018-02-02T11:26:34 someuser some-computername01 233.194.20.110 something 
broke")

m['Date']
m['Username']
m['Hostname']
m['IP']
m['Message']

Both output:

2018-02-02T11:26:34
someuser
some-computername01
233.194.20.110
something broke

-- 
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] [CFP] ICOOOLPS 2018

2018-02-05 Thread Tim Felgentreff
Call for Papers: ICOOOLPS'18


13th Workshop on Implementation, Compilation, Optimization of Object- 
Oriented
Languages, Programs and Systems

Co-located with ECOOP 2018
held Mon 16 - Sun 22 July in Amsterdam, Netherlands

Twitter: @ICOOOLPS
URL: https://conf.researchr.org/track/ecoop-issta-2018/ICOOOLPS-2018-papers

The ICOOOLPS workshop series brings together researchers and practitioners
working in the field of language implementation and optimization. The goal 
of
the workshop is to discuss emerging problems and research directions as 
well as
new solutions to classic performance challenges.

The topics of interest for the workshop include techniques for the
implementation and optimization of a wide range of languages including but 
not
limited to object-oriented ones. Furthermore, meta-compilation techniques or
language-agnostic approaches are welcome, too.

### Topics of Interest

A non-exclusive list of topics of interest for this workshop is:

- Implementation and optimization of fundamental languages features (from
automatic memory management to zero-overhead metaprogramming)
- Runtime systems technology (libraries, virtual machines)
- Static, adaptive, and speculative optimizations and compiler techniques
- Meta-compilation techniques and language-agnostic approaches for the 
efficient
implementation of languages
- Compilers (intermediate representations, offline and online 
optimizations,…)
- Empirical studies on language usage, benchmark design, and benchmarking
methodology
- Resource-sensitive systems (real-time, low power, mobile, cloud)
- Studies on design choices and tradeoffs (dynamic vs. static compilation,
heuristics vs. programmer input,…)
- Tooling support, debuggability and observability of languages as well as 
their
implementations

### Workshop Format and Submissions

This workshop welcomes the presentation and discussion of new ideas and 
emerging
problems that give a chance for interaction and exchange. More mature work 
is
welcome as part of a mini-conference format, too. We aim to interleave
interactive brainstorming and demonstration sessions between the formal
presentations to foster an active exchange of ideas. The workshop papers 
will be
published in ACM DL or an open archive (to be confirmed). Papers are to be
submitted using the sigplanconf LaTeX template
(http://www.sigplan.org/Resources/LaTeXClassFile/).

Please submit contributions via EasyChair:
https://easychair.org/conferences/submission_show_all.cgi?a=17114062

### Important Dates

Submissions: 18 May 2018
Author Notification: 8 June 2018

### Program Committee

The program committee consists of the organizers and the following 
reviewers:

Nada Amin, University of Cambridge
Clément Béra, RMOD - INRIA Lille Nord Europe
Shigeru Chiba, University of Tokyo
Benoit Daloze, JKU Linz
Görel Hedin, Lund University
Eric Jul, University of Oslo
Stefan Marr, University of Kent
Eliot Miranda, Cadence Design Systems
Sarah Mount, King's College London
Tobias Pape, Hasso Plattner Institute
Jennifer Sartor, Vrije Universiteit Brussel + University Ghent

### Workshop Organizers

Tim Felgentreff, Oracle Labs Potsdam
Olivier Zendra, INRIA / LORIA

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: racket2nix

2018-02-14 Thread Anthony Carrico
I use Nix, but mostly for Haskell currently, rather than Racket. I did
prototype a nix project with Racket. I don't have the sources at my
fingertips. I'll report if I look back and see anything helpful for you.

It looks like you are trying to tie into the Racket package system. We
didn't try to do so, we were just trying to go from a git clone to a
common development environment in one step.

I do remember modifying the racket derivation in the nixpkgs repo. I
don't think that got pushed upstream. The Racket derivation needed to be
parameterized to find the opengl libs/drivers. I also remember that I
couldn't get this to work reliably on any OS except NixOS. Any opengl
program was going to have similar trouble since the libs are a function
of the drivers which can't really be provided by Nix on non NixOS
platforms. This situation was more of a reflection on the state of
OpenGL than Nix in my opinion, but we ended up developing in a NixOs vm
for this reason only. I don't remember what other changes I made, this
was the biggest pain point. I did integrate with other foreign functions.

-- 
Anthony Carrico

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: racket2nix

2018-02-14 Thread Matthew Flatt
At Wed, 14 Feb 2018 03:44:44 -0800 (PST), Claes Wallin wrote:
> 1. The package I'm currently building probably needs to be the installation 
> path for racket, so that I can use installation scope and have links.rktd 
> and other things end up in the expected places.

That sounds right.

> 2. As my dependencies and their dependencies have already been installed 
> once, and I want to use them from their already-prepared destination, it 
> should be possible to just merge together the links.rktd of my dependencies 
> and add my own package to the list, and that should be my new links.rktd.
>
> [...]
>
> I've finally found that the way to customize where racket finds things is 
> to mess about with `racket -G` and the config.rktd file. I was hoping that 
> I could just add the share/racket directories of my dependencies to 
> 'links-search-files, but it doesn't seem that simple.

I think this is also the right idea, but I think you need to set
'pkg-search-dirs in parallel to 'links-search-files within
"config.rktd".

The two separate entries reflect how the package system is built on top
of the collection-link layer, but it has to keep additional information
that is specific to the package layer.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: racket2nix

2018-02-14 Thread Claes Wallin
On Thursday, February 15, 2018 at 3:16:24 AM UTC+8, Matthew Flatt wrote:
>
> At Wed, 14 Feb 2018 03:44:44 -0800 (PST), Claes Wallin wrote: 
>
 

> > I've finally found that the way to customize where racket finds things 
> is 
> > to mess about with `racket -G` and the config.rktd file. I was hoping 
> that 
> > I could just add the share/racket directories of my dependencies to 
> > 'links-search-files, but it doesn't seem that simple. 
>
> I think this is also the right idea, but I think you need to set 
> 'pkg-search-dirs in parallel to 'links-search-files within 
> "config.rktd". 
>
> The two separate entries reflect how the package system is built on top 
> of the collection-link layer, but it has to keep additional information 
> that is specific to the package layer. 
>

Thanks! I'll try that.

I thought packages were always looked up through the collections, but maybe 
that's a difference between package dependencies when installing and the 
way you look them up when you refer to them in the code?

-- 
   /c

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: racket2nix

2018-02-14 Thread Claes Wallin
On Thursday, February 15, 2018 at 3:01:08 AM UTC+8, Anthony Carrico wrote:
>
> The Racket derivation needed to be 
> parameterized to find the opengl libs/drivers. I also remember that I 
> couldn't get this to work reliably on any OS except NixOS. Any opengl 
> program was going to have similar trouble since the libs are a function 
> of the drivers which can't really be provided by Nix on non NixOS 
> platforms.


Wow, ok.
 

> This situation was more of a reflection on the state of 
> OpenGL than Nix in my opinion, but we ended up developing in a NixOs vm 
> for this reason only.
>

Yeah, that sounds like an oddity.

One nice thing you can do once you have racket2nix is that you can have 
your racket package generated as a nix package, and then override the nix 
package to have native dependencies, which I hope will be very helpful to 
people in your situation in the future.

-- 
   /c 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: racket2nix

2018-02-14 Thread Claes Wallin
On Thursday, February 15, 2018 at 9:18:14 AM UTC+8, Claes Wallin wrote:
>
> On Thursday, February 15, 2018 at 3:16:24 AM UTC+8, Matthew Flatt wrote:
>>
>>  

> I think this is also the right idea, but I think you need to set 
>> 'pkg-search-dirs in parallel to 'links-search-files within 
>> "config.rktd". 
>>
>
> Thanks! I'll try that.

It worked! So now it even complains when I try to install base against a 
full racket, that base already exists. This is a good thing. :-)

But when I'm installing against minimal I get:

/nix/store/rm4jgl2jhdmv0b2jlr2jmziih8clximf-racket-minimal-6.12/bin/racket -G 
/nix/store/gfwrnnq5ql1b35i03cs3xyzrflcrapfi-base/etc/racket -U -X 
/nix/store/gfwrnnq5ql1b35i03cs3xyzrflcrapfi-base/share/racket/collects -S 
/nix/store/rm4jgl2jhdmv0b2jlr2jmziih8clximf-racket-minimal-6.12/share/racket/collects
(current-library-collection-links): (#f 
/nix/store/rm4jgl2jhdmv0b2jlr2jmziih8clximf-racket-minimal-6.12/share/racket)
(find-library-collection-links): (#f 
/nix/store/rm4jgl2jhdmv0b2jlr2jmziih8clximf-racket-minimal-6.12/share/racket)
(find-links-file): 
/nix/store/gfwrnnq5ql1b35i03cs3xyzrflcrapfi-base/share/racket/links.rktd
(current-library-collection-paths): 
(/nix/store/gfwrnnq5ql1b35i03cs3xyzrflcrapfi-base/share/racket/collects 
/nix/store/rm4jgl2jhdmv0b2jlr2jmziih8clximf-racket-minimal-6.12/share/racket/collects)
(find-library-collection-paths): 
(/nix/store/gfwrnnq5ql1b35i03cs3xyzrflcrapfi-base/share/racket/collects)
(find-pkgs-dir): 
/nix/store/gfwrnnq5ql1b35i03cs3xyzrflcrapfi-base/share/racket/pkgs
(get-pkgs-search-dirs): 
(/nix/store/rm4jgl2jhdmv0b2jlr2jmziih8clximf-racket-minimal-6.12/share/racket/pkgs)
collection-file-path: collection not found
  collection: "setup"
  in collection directories:
   /nix/store/gfwrnnq5ql1b35i03cs3xyzrflcrapfi-base/share/racket/collects

 
So (current-library-collection-paths) reports both base/.../collects and 
racket-minimal-6.12/.../collects. And my little dump script, which printed 
that value, successfully requires setup/dirs, so I wonder why raco (or 
something) can't.

-- 
   /c

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: racket2nix

2018-02-16 Thread stewart mackenzie
Re opengl: I recall running into a similar problem, I eventually scrapped
the opengl dependency but it might be possible to wrap the whole thing up
in a makeWrapper then pass in the opengl executable path for non-nixos
systems into it.

The reason, I believe, is that opengl is packaged as a static library and
not a dynamic lib.

On 14 Feb 2018 21:01, "Anthony Carrico"  wrote:

Any opengl program was going to have similar trouble since the libs are a
function of the drivers which can't really be provided by Nix on non NixOS
platforms. This situation was more of a reflection on the state of
OpenGL than Nix in my opinion, but we ended up developing in a NixOs vm
for this reason only. I don't remember what other changes I made, this
was the biggest pain point. I did integrate with other foreign functions.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: racket2nix

2018-02-19 Thread Christopher Lemmer Webber
Claes Wallin writes:

> On Sunday, February 11, 2018 at 9:43:34 PM UTC+8, stewart mackenzie wrote:
>>
>> Hello,
>>
>> We're partially through the development of a nix{os} utility which 
>> transforms an info.rkt into a nix expression.
>>
>> https://github.com/clacke/racket2nix
>>
>> It'll be helpful if other nixers/racketers could contribute or test the 
>> project!
>>
>
> Hi, Racketeers! I'm the one mainly working on this, and I could use some 
> help right now. :-)
>
> I have a concrete problem, and I've been banging my head against this for a 
> bit, so I hope someone has some insights to share.

This is great Claes, and as I said on IRC, I hope we can eventually
collaborate... as some others know I'm hoping to get more Racket
packages into Guix... which is like Nix, but written in Scheme!
But that work will probably build on experiences from this Nix work if I
get to it first at all (and it sounds like you might beat me to it
anyway) ;)

Thanks for working on 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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: racket2nix

2018-02-19 Thread johnbclements
Test posting, please ignore, sorry

On Monday, February 19, 2018 at 12:40:38 PM UTC-8, cwebber wrote:
>
> Claes Wallin writes: 
>
> > On Sunday, February 11, 2018 at 9:43:34 PM UTC+8, stewart mackenzie 
> wrote: 
> >> 
> >> Hello, 
> >> 
> >> We're partially through the development of a nix{os} utility which 
> >> transforms an info.rkt into a nix expression. 
> >> 
> >> https://github.com/clacke/racket2nix 
> >> 
> >> It'll be helpful if other nixers/racketers could contribute or test the 
> >> project! 
> >> 
> > 
> > Hi, Racketeers! I'm the one mainly working on this, and I could use some 
> > help right now. :-) 
> > 
> > I have a concrete problem, and I've been banging my head against this 
> for a 
> > bit, so I hope someone has some insights to share. 
>
> This is great Claes, and as I said on IRC, I hope we can eventually 
> collaborate... as some others know I'm hoping to get more Racket 
> packages into Guix... which is like Nix, but written in Scheme! 
> But that work will probably build on experiences from this Nix work if I 
> get to it first at all (and it sounds like you might beat me to it 
> anyway) ;) 
>
> Thanks for working on 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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] #lang rust

2018-02-20 Thread 'Paulo Matos&#x27; via Racket Users


On 20/02/18 07:21, Neil Van Dyke wrote:
> If someone is looking for a challenging and interesting `#lang` project...
> 
> Build a `#lang rust`.  https://www.rust-lang.org/
> 

+1

> You might first implement mapping the non-checking semantics to Racket
> code (so that you can run valid Rust programs), and then later try to
> implement all the checking (for detecting invalid Rust programs).
> 
> Your big test would be bootstrapping the real Rust compiler.  (You use
> your Racket-based Rust language implementation to run the real Rust
> compiler, to have the real compiler compile itself.)
> 

This would be awesome but certainly a multi-year project for a single
person I think.

Also, there might be some trouble on understanding the rust grammar. I
have in the past toyed with the idea of building a rust gcc frontend
(previous attempts failed) but due to the lack of a formal grammar I
gave up. Things might have changed since mid-2017 but I doubt it.

One alternative to proceed without a formal grammar would be maybe to
somehow use libparse from the rust project to parse the code and then
use FFI to bring the structures into Racket.

However, as a C/C++ replacement I love what Rust stands for so +1
(again!) for this project.

-- 
Paulo Matos

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: racket2nix

2018-02-20 Thread Claes Wallin
On Tuesday, February 20, 2018 at 4:40:38 AM UTC+8, cwebber wrote:
>
> This is great Claes, and as I said on IRC, I hope we can eventually 
> collaborate... as some others know I'm hoping to get more Racket 
> packages into Guix... which is like Nix, but written in Scheme! 
> But that work will probably build on experiences from this Nix work if I 
> get to it first at all (and it sounds like you might beat me to it 
> anyway) ;) 
>
> Thanks for working on this! 
>

It sounded on IRC that you're pretty busy, so yeah, I'll probably get there 
first. :-)

Status update: racket2nix is now in a limited useful state! I'm able to 
build the drracket package without any error conditions occurring along the 
way, but:
 - The resulting drracket package is empty. :-D
 - I'm not actually building the packages, just installing them (raco pkg 
install --no-setup).
 - There is a lot of cleaning up to do in the nix expressions, the 
low-hanging fruit being e.g. redundant dependency listings -- drracket has 
over 1500 dependencies, but a simple sort -u on them reveals that they are 
actually only 135.
 - It probably doesn't put any stuff in .../bin .

My next step is dogfooding racket2nix: Put the logic in a library, generate 
a thin wrapper that calls it, add rackunit tests, make a man page, etc. 
Hopefully this will teach me enough about packaging that I can go back and 
work toward a working drracket package.

-- 
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] #lang rust

2018-02-21 Thread Alexander Shopov
What about totally different approach to Rust and Racket interaction:
Racket is trying to move to Chez Scheme.
https://blog.racket-lang.org/2018/01/racket-on-chez-status.html
The C part of Chez Scheme is about 16k lines.
Translating (at least) some of that to Rust might be an interesing project.
No guarantee that anyone will join, much less that it is a good idea.
Kind regards:
al_shopov



На вт, 20.02.2018 г. в 12:32 ч. 'Paulo Matos' via Racket Users <
racket-users@googlegroups.com> написа:

>
>
> On 20/02/18 07:21, Neil Van Dyke wrote:
> > If someone is looking for a challenging and interesting `#lang`
> project...
> >
> > Build a `#lang rust`.  https://www.rust-lang.org/
> >
>
> +1
>
> > You might first implement mapping the non-checking semantics to Racket
> > code (so that you can run valid Rust programs), and then later try to
> > implement all the checking (for detecting invalid Rust programs).
> >
> > Your big test would be bootstrapping the real Rust compiler.  (You use
> > your Racket-based Rust language implementation to run the real Rust
> > compiler, to have the real compiler compile itself.)
> >
>
> This would be awesome but certainly a multi-year project for a single
> person I think.
>
> Also, there might be some trouble on understanding the rust grammar. I
> have in the past toyed with the idea of building a rust gcc frontend
> (previous attempts failed) but due to the lack of a formal grammar I
> gave up. Things might have changed since mid-2017 but I doubt it.
>
> One alternative to proceed without a formal grammar would be maybe to
> somehow use libparse from the rust project to parse the code and then
> use FFI to bring the structures into Racket.
>
> However, as a C/C++ replacement I love what Rust stands for so +1
> (again!) for this project.
>
> --
> Paulo Matos
>
> --
> 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] #lang rust

2018-02-21 Thread Hendrik Boom
On Wed, Feb 21, 2018 at 10:34:03AM +, Alexander Shopov wrote:
> What about totally different approach to Rust and Racket interaction:
> Racket is trying to move to Chez Scheme.
> https://blog.racket-lang.org/2018/01/racket-on-chez-status.html
> The C part of Chez Scheme is about 16k lines.
> Translating (at least) some of that to Rust might be an interesing project.
> No guarantee that anyone will join, much less that it is a good idea.
> Kind regards:
> al_shopov

The interesting parrt would the integrating of Rust's garbage 
collector (yes, it has a concept of garbage collection for data declared 
to need it) with Racket's.

-- hendrik

-- 
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] #lang rust

2018-02-21 Thread stewart mackenzie
On Wed, 21 Feb 2018, 14:44 Hendrik Boom,  wrote:

> The interesting parrt would the integrating of Rust's garbage
> collector (yes, it has a concept of garbage collection for data declared
> to need it) with Racket's.
>

I understand you'd need the Custom Allocator which is (currently) only
available on rust nightly which is a relatively fast moving target.

/sjm

>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: racket2nix

2018-02-21 Thread Anthony Carrico
On 02/16/2018 04:32 AM, stewart mackenzie wrote:
> Re opengl: I recall running into a similar problem, I eventually
> scrapped the opengl dependency but it might be possible to wrap the
> whole thing up in a makeWrapper then pass in the opengl executable path
> for non-nixos systems into it. 

Thanks. That might require some (dynamic) probing. IIRC the OpenGL
library/driver situation was different from distribution to distribution
(and just needlessly confusing in general). Maybe someone has worked up
a general solution to this particular problem, and if so Racket could
adopt that. Amazingly, Nix has already solved many such weird issues. If
this Racket/Nix effort goes forward, Racket users will probably need
some guidance (and discipline) regarding foreign libraries.

-- 
Anthony Carrico

-- 
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] #lang rust

2018-02-22 Thread Claes Wallin
On Wednesday, February 21, 2018 at 11:20:23 PM UTC+8, stewart mackenzie 
wrote:
>
> On Wed, 21 Feb 2018, 14:44 Hendrik Boom,  > wrote:
>
>> The interesting parrt would the integrating of Rust's garbage
>> collector (yes, it has a concept of garbage collection for data declared
>> to need it) with Racket's.
>>
>
> I understand you'd need the Custom Allocator which is (currently) only 
> available on rust nightly which is a relatively fast moving target. 
>
>>
Unless you use Racket with the conservative gc and let it figure things out?

-- 
   /c 

-- 
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] Are canvases stackable?

2018-02-23 Thread David Alkire
Is it possible to stack two (or more) canvases on top of one another. I'm 
working on a chess app and I don't want to draw individual squares under 
each piece. I would prefer to have a board canvas that doesn't change and a 
transparent canvas with pieces overlaying it. Is that possible? Is that the 
right approach or are there better alternatives?

Thanks,
David

-- 
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] Are canvases stackable?

2018-02-23 Thread Alex Harsanyi
You want to use a pasteboard% for the chess table and snip% objects for the 
pieces.  You can draw the board as the pasteboard background in the on-draw 
method. 

You will have to implement snip management in the pasteboard though because by 
default snips can just be dragged around and placed anywhere. 

There’s a racket game collection which might provide useful classes, but I have 
no experience with those. 

Best regards,
Alex

-- 
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: Understanding 'curry'

2018-02-27 Thread David Storrs
On Tue, Feb 27, 2018 at 11:35 AM, David Storrs 
wrote:
> Despite using it for a long time, I discovered today that I do not
> understand 'curry', at least insofar as it applies to keyword
> arguments.
>
>> (define (baz a b) b)
>> (baz 8 9)
> 9
>
>> (curry baz 8)
> #
>
>> ((curry baz 8) 9)
> 9
>
>> (define (foo a #:bar x) x)
>> (foo 8 #:bar 9)
> 9
>
>> (curry foo #:bar 9)
> #
>
> Up to this point I'm fine, but now my understanding derails and all is
> confusion.
>
>> ((curry foo #:bar 9) 8)
> #
>
> I expected it to yield 9 as it did in the original direct call.  The
> curry records the keyword argument and returns a function that takes
> one positional argument; when that argument is supplied the original
> foo function has all the arguments it needs so it should execute.
>
> Maybe if I apply the final curried proc as a thunk?
>
>> (((curry foo #:bar 8) 9))
> #
>
> Nope.
>
> What am I not understanding?

For the record:  I did check the docs
<https://docs.racket-lang.org/reference/procedures.html> and this line
informed my (incorrect) understanding:  "The curry function provides
limited support for keyworded functions: only the curry call itself can
receive keyworded arguments to be propagated eventually to proc."

-- 
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] Understanding 'curry'

2018-02-27 Thread Jos Koot
curry itself is curried (which sometimes is puzzling)

(define (foo a #:bar x) x)
((curry   foo #:bar 9) 8) ; -> #
((curry curry foo #:bar 9) 8) ; -> 9

I hope others can explain this in detail.
I can't.

Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of David Storrs
Sent: martes, 27 de febrero de 2018 17:36
To: Racket Users
Subject: [racket-users] Understanding 'curry'

Despite using it for a long time, I discovered today that I do not
understand 'curry', at least insofar as it applies to keyword
arguments.

> (define (baz a b) b)
> (baz 8 9)
9

> (curry baz 8)
#

> ((curry baz 8) 9)
9

> (define (foo a #:bar x) x)
> (foo 8 #:bar 9)
9

> (curry foo #:bar 9)
#

Up to this point I'm fine, but now my understanding derails and all is
confusion.

> ((curry foo #:bar 9) 8)
#

I expected it to yield 9 as it did in the original direct call.  The
curry records the keyword argument and returns a function that takes
one positional argument; when that argument is supplied the original
foo function has all the arguments it needs so it should execute.

Maybe if I apply the final curried proc as a thunk?

> (((curry foo #:bar 8) 9))
#

Nope.

What am I not understanding?

-- 
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] Understanding 'curry'

2018-02-27 Thread David Storrs
On Tue, Feb 27, 2018 at 12:12 PM, Jos Koot  wrote:

> curry itself is curried (which sometimes is puzzling)
>
> (define (foo a #:bar x) x)
> ((curry   foo #:bar 9) 8) ; -> #
> ((curry curry foo #:bar 9) 8) ; -> 9
>
> I hope others can explain this in detail.
> I can't.
>
> Jos
>

Madness!  Madness, I say!

Okay, it looks like I misunderstood what it meant by "The curry function
provides limited support for keyworded functions: only the curry call
itself can receive keyworded arguments to be propagated eventually to
proc."  It's currying the keyword argument *onto the curry function*, not
onto the foo function.  The result is a form of curry, not a form of foo.

(define (bar a b) b)
(curry bar 7)
...produces a version of bar that takes one argument and the other one is
already set.

(curry curry bar)
...produces a function  that, when evaluated, will return a function 
that is the result of currying no arguments onto the function bar.  (Which
is equivalent to bar)

Similarly:

(define (foo a #:bar x) x)
(curry curry foo #:bar 9)
...is creating a function  that, when evaluated, will generate a
function  that is the result of currying the keyword argument+value
'#:bar 9' onto foo.   expects N arguments where N is the number of
positional arguments expected by foo.  It is not possible to generate 
directly, it needs to be done by creating and evaluating .  Also, 
will not accept keyword arguments.

(define (foo a #:bar x #:baz y) x)
> (foo 7 #:bar 8 #:baz 9)
8

> (curry curry foo #:bar 8 #:baz 9)
#

> ((curry curry foo #:bar 8 #:baz 9) 7)
8

> ((curry curry foo #:bar 8) 7)
; application: required keyword argument not supplied
;   procedure: foo
;   required keyword: #:baz
; [,bt for context]

> ((curry curry foo #:bar 8) 7 #:baz 9)
; application: procedure does not accept keyword arguments
;   procedure: curried
; [,bt for context]

That makes my brain hurt, but I think I get it.

Thanks, Jos



>
> -Original Message-
> From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com]
> On Behalf Of David Storrs
> Sent: martes, 27 de febrero de 2018 17:36
> To: Racket Users
> Subject: [racket-users] Understanding 'curry'
>
> Despite using it for a long time, I discovered today that I do not
> understand 'curry', at least insofar as it applies to keyword
> arguments.
>
> > (define (baz a b) b)
> > (baz 8 9)
> 9
>
> > (curry baz 8)
> #
>
> > ((curry baz 8) 9)
> 9
>
> > (define (foo a #:bar x) x)
> > (foo 8 #:bar 9)
> 9
>
> > (curry foo #:bar 9)
> #
>
> Up to this point I'm fine, but now my understanding derails and all is
> confusion.
>
> > ((curry foo #:bar 9) 8)
> #
>
> I expected it to yield 9 as it did in the original direct call.  The
> curry records the keyword argument and returns a function that takes
> one positional argument; when that argument is supplied the original
> foo function has all the arguments it needs so it should execute.
>
> Maybe if I apply the final curried proc as a thunk?
>
> > (((curry foo #:bar 8) 9))
> #
>
> Nope.
>
> What am I not understanding?
>
> --
> 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] Understanding 'curry'

2018-02-27 Thread Jos Koot
It breaks my brain, certainly.
Glad to read you think you are getting to it.
When you got it, explain to me, please, for I don't understand nothing of it.
I just applied some trial and error to get to a point where I can use curry.
(In fact I prefer to use my own curry (that is not curried, but neither workd 
with keyword arguments)
My private curry gives ((curry list)) -> (), not a procedure.
For me it remains a queston why curry has been made such as to give a procedure 
that in behaviour differs from a procedure produced
by an application of a curried frunction.
Jos

  _  

From: David Storrs [mailto:david.sto...@gmail.com] 
Sent: martes, 27 de febrero de 2018 20:13
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] Understanding 'curry'




On Tue, Feb 27, 2018 at 12:12 PM, Jos Koot  wrote:


curry itself is curried (which sometimes is puzzling)

(define (foo a #:bar x) x)
((curry   foo #:bar 9) 8) ; -> #
((curry curry foo #:bar 9) 8) ; -> 9

I hope others can explain this in detail.
I can't.

Jos



Madness!  Madness, I say!


Okay, it looks like I misunderstood what it meant by "The curry function 
provides limited support for keyworded functions: only the
curry call itself can receive keyworded arguments to be propagated eventually 
to proc."  It's currying the keyword argument *onto
the curry function*, not onto the foo function.  The result is a form of curry, 
not a form of foo.


(define (bar a b) b)

(curry bar 7)

...produces a version of bar that takes one argument and the other one is 
already set.


(curry curry bar)

...produces a function  that, when evaluated, will return a function  
that is the result of currying no arguments onto the
function bar.  (Which is equivalent to bar)


Similarly:

(define (foo a #:bar x) x)

(curry curry foo #:bar 9)

...is creating a function  that, when evaluated, will generate a function 
 that is the result of currying the keyword
argument+value '#:bar 9' onto foo.   expects N arguments where N is the 
number of positional arguments expected by foo.  It is
not possible to generate  directly, it needs to be done by creating and 
evaluating .  Also,  will not accept keyword
arguments.

(define (foo a #:bar x #:baz y) x)
> (foo 7 #:bar 8 #:baz 9)
8

> (curry curry foo #:bar 8 #:baz 9)
#

> ((curry curry foo #:bar 8 #:baz 9) 7)
8

> ((curry curry foo #:bar 8) 7)
; application: required keyword argument not supplied
;   procedure: foo
;   required keyword: #:baz
; [,bt for context]

> ((curry curry foo #:bar 8) 7 #:baz 9)
; application: procedure does not accept keyword arguments
;   procedure: curried
; [,bt for context]


That makes my brain hurt, but I think I get it.


Thanks, Jos


 



-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@ 
<mailto:racket-users@googlegroups.com> googlegroups.com] On Behalf Of
David Storrs
Sent: martes, 27 de febrero de 2018 17:36
To: Racket Users
Subject: [racket-users] Understanding 'curry'

Despite using it for a long time, I discovered today that I do not
understand 'curry', at least insofar as it applies to keyword
arguments.

> (define (baz a b) b)
> (baz 8 9)
9

> (curry baz 8)
#

> ((curry baz 8) 9)
9

> (define (foo a #:bar x) x)
> (foo 8 #:bar 9)
9

> (curry foo #:bar 9)
#

Up to this point I'm fine, but now my understanding derails and all is
confusion.

> ((curry foo #:bar 9) 8)
#

I expected it to yield 9 as it did in the original direct call.  The
curry records the keyword argument and returns a function that takes
one positional argument; when that argument is supplied the original
foo function has all the arguments it needs so it should execute.

Maybe if I apply the final curried proc as a thunk?

> (((curry foo #:bar 8) 9))
#

Nope.

What am I not understanding?


--
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+unsubscribe@
<mailto:racket-users%2bunsubscr...@googlegroups.com> googlegroups.com.
For more options, visit https://groups.google.com/d/ 
<https://groups.google.com/d/optout> 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] Understanding 'curry'

2018-02-27 Thread David Storrs
On Tue, Feb 27, 2018 at 2:46 PM, Jos Koot  wrote:

> It breaks my brain, certainly.
> Glad to read you think you are getting to it.
> When you got it, explain to me, please, for I don't understand nothing of
> it.
> I just applied some trial and error to get to a point where I can use
> curry.
> (In fact I prefer to use my own curry (that is not curried, but
> neither workd with keyword arguments)
> My private curry gives ((curry list)) -> (), not a procedure.
> For me it remains a queston why curry has been made such as to give a
> procedure that in behaviour differs from a procedure produced by an
> application of a curried frunction.
> Jos
>

Oh, it's simple!  When you curry curry your curried curry can have curried
any sort of arguments but it can't curry keyword arguments, only
positionals, so you need to curry curry in order to curry a keyword that
you want to curry onto a non-curry function to produce a curried function.

Stated in a less smart-alecky way:  You cannot curry keyword arguments onto
a function, unless that function is the curry function itself.  I have no
idea why it does that.


Here's a series of items that clarified it for me.  I suspect you get it at
least as well as I do, but hopefully it will help someone else at some
point:


Welcome to Racket v6.11.

> (define (pos-only a b) b)
> (pos-only 7 8)
8

> (curry pos-only 7)
# ; actual value is roughly (lambda (b) (pos-only 7 b))

> ((curry pos-only 7) 8)
8
> ((lambda (b) (pos-only 7 b)) 8)
8

> (curry curry pos-only 7) ; you can curry the 'curry' function.
#  ; roughly equivalent to (lambda args (apply (curry
pos-only 7) args))


> (define (has-1-kw a #:foo b) b)
> (has-1-kw 7 #:foo 8)
8

> (curry has-1-kw 7)  ; you cannot curry a function with keyword
arguments...
; application: required keyword argument not supplied
;   procedure: has-1-kw
;   required keyword: #:foo
; [,bt for context]

> (curry curry has-1-kw)  ; ...but you can curry the function 'curry',
giving it a single argument that is a function.  The function in question
requires keyword arguments, but that's not relevant here.
#

> (curry curry #:foo 7)   ; the 'curry' function can accept arbitrary
keyword arguments
# ; conceptually equivalent to (lambda (func . args)
(apply curry func _ #:foo 7)) where _ will be replaced with more arguments
later.  That is NOT legal syntax, however.

Recall that the 'curry' function takes a function (call it ) and returns
a new function (call it ).  In general,  is not allowed to accept
keyword arguments.  The only exception to this is if  is the curry
function itself, in which case you're free to pass keywords. Why it's like
this, I don't get any more than Jos does.




> ----------
> *From:* David Storrs [mailto:david.sto...@gmail.com]
> *Sent:* martes, 27 de febrero de 2018 20:13
> *To:* Jos Koot
> *Cc:* Racket Users
> *Subject:* Re: [racket-users] Understanding 'curry'
>
>
>
> On Tue, Feb 27, 2018 at 12:12 PM, Jos Koot  wrote:
>
>> curry itself is curried (which sometimes is puzzling)
>>
>> (define (foo a #:bar x) x)
>> ((curry   foo #:bar 9) 8) ; -> #
>> ((curry curry foo #:bar 9) 8) ; -> 9
>>
>> I hope others can explain this in detail.
>> I can't.
>>
>> Jos
>>
>
> Madness!  Madness, I say!
>
> Okay, it looks like I misunderstood what it meant by "The curry function
> provides limited support for keyworded functions: only the curry call
> itself can receive keyworded arguments to be propagated eventually to
> proc."  It's currying the keyword argument *onto the curry function*, not
> onto the foo function.  The result is a form of curry, not a form of foo.
>
> (define (bar a b) b)
> (curry bar 7)
> ...produces a version of bar that takes one argument and the other one is
> already set.
>
> (curry curry bar)
> ...produces a function  that, when evaluated, will return a function
>  that is the result of currying no arguments onto the function bar.
> (Which is equivalent to bar)
>
> Similarly:
>
> (define (foo a #:bar x) x)
> (curry curry foo #:bar 9)
> ...is creating a function  that, when evaluated, will generate a
> function  that is the result of currying the keyword argument+value
> '#:bar 9' onto foo.   expects N arguments where N is the number of
> positional arguments expected by foo.  It is not possible to generate 
> directly, it needs to be done by creating and evaluating .  Also, 
> will not accept keyword arguments.
>
> (define (foo a #:bar x #:baz y) x)
> > (foo 7 #:bar 8 #:baz 9)
> 8
>
> > (curry curry foo #:bar 8 #:baz 9)
> #
>
> > ((curry curry foo #:bar 8 #:baz 9)

RE: [racket-users] Understanding 'curry'

2018-02-28 Thread Jos Koot
You are right, I think.
Thanks.

  _  

From: David Storrs [mailto:david.sto...@gmail.com] 
Sent: martes, 27 de febrero de 2018 22:29
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] Understanding 'curry'




On Tue, Feb 27, 2018 at 2:46 PM, Jos Koot  wrote:



It breaks my brain, certainly.
Glad to read you think you are getting to it.
When you got it, explain to me, please, for I don't understand nothing of it.
I just applied some trial and error to get to a point where I can use curry.
(In fact I prefer to use my own curry (that is not curried, but neither workd 
with keyword arguments)
My private curry gives ((curry list)) -> (), not a procedure.
For me it remains a queston why curry has been made such as to give a procedure 
that in behaviour differs from a procedure produced
by an application of a curried frunction.
Jos


Oh, it's simple!  When you curry curry your curried curry can have curried any 
sort of arguments but it can't curry keyword
arguments, only positionals, so you need to curry curry in order to curry a 
keyword that you want to curry onto a non-curry function
to produce a curried function.


Stated in a less smart-alecky way:  You cannot curry keyword arguments onto a 
function, unless that function is the curry function
itself.  I have no idea why it does that.


Here's a series of items that clarified it for me.  I suspect you get it at 
least as well as I do, but hopefully it will help
someone else at some point:


Welcome to Racket v6.11.


> (define (pos-only a b) b)

> (pos-only 7 8)
8

> (curry pos-only 7)
# ; actual value is roughly (lambda (b) (pos-only 7 b))

> ((curry pos-only 7) 8)
8
> ((lambda (b) (pos-only 7 b)) 8)
8


> (curry curry pos-only 7) ; you can curry the 'curry' function.
#  ; roughly equivalent to (lambda args (apply (curry 
pos-only 7) args))
 

> (define (has-1-kw a #:foo b) b)
> (has-1-kw 7 #:foo 8)
8
 

> (curry has-1-kw 7)  ; you cannot curry a function with keyword arguments...
; application: required keyword argument not supplied
;   procedure: has-1-kw
;   required keyword: #:foo
; [,bt for context]

> (curry curry has-1-kw)  ; ...but you can curry the function 'curry', giving 
> it a single argument that is a function.  The function
in question requires keyword arguments, but that's not relevant here.
#  

> (curry curry #:foo 7)   ; the 'curry' function can accept arbitrary keyword 
> arguments
# ; conceptually equivalent to (lambda (func . args) (apply 
curry func _ #:foo 7)) where _ will be replaced with
more arguments later.  That is NOT legal syntax, however.


Recall that the 'curry' function takes a function (call it ) and returns a 
new function (call it ).  In general,  is not
allowed to accept keyword arguments.  The only exception to this is if  is 
the curry function itself, in which case you're free
to pass keywords. Why it's like this, I don't get any more than Jos does.






  _  

From: David Storrs [mailto:david.sto...@gmail.com] 
Sent: martes, 27 de febrero de 2018 20:13
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] Understanding 'curry'




On Tue, Feb 27, 2018 at 12:12 PM, Jos Koot  wrote:


curry itself is curried (which sometimes is puzzling)

(define (foo a #:bar x) x)
((curry   foo #:bar 9) 8) ; -> #
((curry curry foo #:bar 9) 8) ; -> 9

I hope others can explain this in detail.
I can't.

Jos



Madness!  Madness, I say!


Okay, it looks like I misunderstood what it meant by "The curry function 
provides limited support for keyworded functions: only the
curry call itself can receive keyworded arguments to be propagated eventually 
to proc."  It's currying the keyword argument *onto
the curry function*, not onto the foo function.  The result is a form of curry, 
not a form of foo.


(define (bar a b) b)

(curry bar 7)

...produces a version of bar that takes one argument and the other one is 
already set.


(curry curry bar)

...produces a function  that, when evaluated, will return a function  
that is the result of currying no arguments onto the
function bar.  (Which is equivalent to bar)


Similarly:

(define (foo a #:bar x) x)

(curry curry foo #:bar 9)

...is creating a function  that, when evaluated, will generate a function 
 that is the result of currying the keyword
argument+value '#:bar 9' onto foo.   expects N arguments where N is the 
number of positional arguments expected by foo.  It is
not possible to generate  directly, it needs to be done by creating and 
evaluating .  Also,  will not accept keyword
arguments.

(define (foo a #:bar x #:baz y) x)
> (foo 7 #:bar 8 #:baz 9)
8

> (curry curry foo #:bar 8 #:baz 9)
#

> ((curry curry foo #:bar 8 #:baz 9) 7)
8

> ((curry curry foo #:bar 8) 7)
; application: required keyword argument not supplied
;   procedure: foo
;   required keyword: #:baz
; [,

[racket-users] Re: Understanding 'curry'

2018-02-28 Thread Jack Firth
Thanks everyone for the headache. I think I'll stick to the `fancy-app` 
package and reserve curry for adventurous dinner outings.

-- 
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] Debugging racket applications

2018-03-05 Thread 'Paulo Matos&#x27; via Racket Users
Hi,

I have been using Greg's racket mode and racket on the command line to
start my application. One of the most frustrating/infuriating things
about full time racket programming at the moment is debugging.

For example, here's a run of my program:
$ racket /var/tmp/lt15198411601519841160715/0/driver-0.rkt
<: contract violation
  expected: real?
  given: #f
  argument position: 2nd
  other arguments...:
   1
  context...:
   /home/pmatos/Projects/lt/lt/stochastic.rkt:179:26
   /var/tmp/lt15198411601519841160715/0/driver-0.rkt: [running body]

The context is quite unhelpful. Like 179 of stochastic.rkt is:
 (lambda (candidate)

There's no call to '<' anywhere nearby.
DrRacket is not that much more helpful. If it helps, I currently setup
my project as:
raco pkg install --auto --link
raco setup --tidy --check-pkg-deps --unused-pkg-deps --pkgs lt

Is there anything I can try to improve backtrace generation?

Kind regards,

-- 
Paulo Matos

-- 
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: #lang rust

2018-03-06 Thread Milo Turner
FWIW at one point I began trying to translate something similar to Rust in 
Redex, but I haven't made progress on it in a few months.
https://github.com/iitalics/rust-redex

On Tuesday, February 20, 2018 at 1:21:46 AM UTC-5, Neil Van Dyke wrote:
>
> If someone is looking for a challenging and interesting `#lang` project... 
>
> Build a `#lang rust`.  https://www.rust-lang.org/ 
>
> You might first implement mapping the non-checking semantics to Racket 
> code (so that you can run valid Rust programs), and then later try to 
> implement all the checking (for detecting invalid Rust programs). 
>
> Your big test would be bootstrapping the real Rust compiler.  (You use 
> your Racket-based Rust language implementation to run the real Rust 
> compiler, to have the real compiler compile itself.) 
>
>

-- 
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] racket2nix status report

2018-03-07 Thread Claes Wallin
Progress!

It's still full of workarounds and doesn't do everything I'd like it to, 
but it does package and run itself successfully!

Maybe I will call it 0.1 some time this month and put it into the racket 
package space, but for now you can try it out by simply cloning 
https://github.com/fractalide/racket2nix/ and running ./racket2nix 
 and see what kind of nix expression pops out on 
stdout.

I'm going to go ahead according to "better to ask for forgiveness than for 
permission" and put up in the README that people are welcome to ask 
questions about racket2nix here on racket-users. I don't expect huge 
traffic, but if anybody objects, I'll remove it promptly.

-- 
   /c

-- 
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] struct question

2018-03-07 Thread Jon Zeppieri
On Wed, Mar 7, 2018 at 9:27 PM, Kevin Forchione  wrote:

> Hi guys,
> Can we associate more than 1 generic with a struct? Something like:
>
> (struct foo (..) #:methods gen:bar [] gen:baz [] …)
>
>
>
Yes, except it's:

(struct foo (..) #:methods gen:bar [] #:methods gen:baz [] ...)

-- 
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] "Site not secure"

2018-03-09 Thread Tim Hanson
Hi, I tried to grab the latest racket version from download.racket-lang.org and 
chrome and edge tell me the certificate of the site at mirror.racket-lang.org 
is not yet valid or expired. It's no problem as I found a mirror with a valid 
certificate, but I guess you'll want to renew the certificate.

Cheers, tim

-- 
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] Struct initialization?

2018-03-09 Thread Jon Zeppieri
On Fri, Mar 9, 2018 at 9:35 PM, Kevin Forchione  wrote:

> Is it possible to initialize a struct field based on values from
> previously defined fields? Something equivalent to let* where
>
> >(struct foo (A B C))
> >(foo 1 2) would produce (foo 1 2 3) for example?
>
>
> As far as I know, the only way to do this is to write your own function
that calls the struct constructor. You can do this in a module, and only
export your constructor, instead of the default struct constructor.

If you want the constructor and the match expander to use the same
identifier, then you need to do a bit more work.  For example:

```
#lang racket/base

(require racket/match
 (for-syntax racket/base
 syntax/transformer))

(struct foo* (A B C))

(define (foo a b)
  (foo* a b (+ a b)))

(define-match-expander $foo
  (syntax-rules ()
[(foo a b c) (foo* a b c)])
  (make-variable-like-transformer #'foo))

(provide (rename-out [$foo foo]
 [foo*-A foo-A]
 [foo*-B foo-B]
 [foo*-C foo-C])))
```

Of course, even here, an instance will print as #. You can implement
gen:custom-write to fix that.

There might be a better way to do this, but this is what I've used in the
past.

- Jon

-- 
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] Struct initialization?

2018-03-09 Thread Milo Turner
You can also set! the extra constructor

#lang racket

(struct foo [a b c]
  #:extra-constructor-name -foo
  #:transparent)

(define ((foo* make-foo) a b)
  (make-foo a b (+ a b)))

(set! -foo (foo* -foo))

(foo 1 2) ; -> (foo 1 2 3)
(match (foo 1 2)
  [(foo _ _ c) c]) ; -> 3

However I usually just provide a custom make-X function as the only 
constructor. If you're hiding initialization details through the 
constructor it seems a bit 
odd to not hide these details in the match expander. So if you really want 
full encapsulation you should write the match expander as well. But in 
practice
that's usually overkill.

On Friday, March 9, 2018 at 10:24:00 PM UTC-5, Jon Zeppieri wrote:
>
>
>
> On Fri, Mar 9, 2018 at 9:35 PM, Kevin Forchione  > wrote:
>
>> Is it possible to initialize a struct field based on values from 
>> previously defined fields? Something equivalent to let* where
>>
>> >(struct foo (A B C))
>> >(foo 1 2) would produce (foo 1 2 3) for example?
>>
>>
>> As far as I know, the only way to do this is to write your own function 
> that calls the struct constructor. You can do this in a module, and only 
> export your constructor, instead of the default struct constructor.
>
> If you want the constructor and the match expander to use the same 
> identifier, then you need to do a bit more work.  For example:
>
> ```
> #lang racket/base
>
> (require racket/match
>  (for-syntax racket/base
>  syntax/transformer))
>
> (struct foo* (A B C))
>
> (define (foo a b)
>   (foo* a b (+ a b)))
>
> (define-match-expander $foo
>   (syntax-rules ()
> [(foo a b c) (foo* a b c)])
>   (make-variable-like-transformer #'foo))
>
> (provide (rename-out [$foo foo]
>  [foo*-A foo-A]
>  [foo*-B foo-B]
>  [foo*-C foo-C])))
> ```
>
> Of course, even here, an instance will print as #. You can implement 
> gen:custom-write to fix that.
>
> There might be a better way to do this, but this is what I've used in the 
> past.
>
> - Jon
>
>
>
>
>

-- 
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] Style guide linter

2018-03-11 Thread 'Paulo Matos&#x27; via Racket Users
Hi,

I found the style guide a really great idea and generally very useful (although 
it's a shame the lack of content on the section of classes).
I have started a small script to check source code style based on the style 
guide. Simple things like spaces at the end of lines, lack of newline at the 
end of file, lines longer than 102 chars etc. However, I would like to know if 
there's anything already out there before I try to get more complex features 
implemented.

Kind regards,

-- 
Paulo Matos

-- 
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] Output Port Shenanigans

2018-03-13 Thread Lehi Toskin
Hello, everyone!

I'm trying to get an output port to display text to both the error port and 
a text% object every time there's an error or an `eprintf` is called. Now, 
I have already accomplished this by using `make-output-port`, but I had 
decided to try and use `open-output-text-editor` instead just for gits and 
shiggles. In the procedure documentation it shows that it takes a lambda 
labeled "special filter", so I figured I'd hijack this lambda to then 
fprintf to the error port, but for whatever reason it seems that all 
printing that is done from inside that special filter's scope is sent 

I have tried the following, but without any success:
(define old-out (current-output-port))
; now inside special filter's scope
(lambda (s) (fprintf old-out "foo") s)

There must be something I'm missing, but there's not much in the docs that 
would help me.

-- 
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] Struct initialization?

2018-03-13 Thread Philip McGrath
I've written an experimental macro `structure` that tries to make it
convenient to write custom wrappers for the constructor and the match
expander that use the name of the struct:
http://docs.racket-lang.org/adjutor/Experimental.html#%28form._%28%28lib._adjutor%2Fmain..rkt%29._structure%29%29
If you're interested in doing something like that as a one-off, the
implementation is here
<https://github.com/LiberalArtist/adjutor/blob/master/structure.rkt>.
Basically the approach is to use #:name and #:constructor-name to avoid
binding the name of the struct (which is still used for printing and error
reporting), define the actual constructor wrapper function you want, then
to define-syntax the name of the struct to a compile-time data structure
implementing prop:procedure, prop:struct-info, and prop:match-expander
(unless you want the default match behavior). That sounds a little more
complicated than it is: here's an example that doesn't override the default
match behavior.

#lang racket

(require (for-syntax racket/struct-info
 syntax/transformer
 ))

(begin-for-syntax
  (struct info-record (info macro)
#:property prop:procedure (struct-field-index macro)
#:property prop:struct-info (λ (this) (info-record-info this

(struct foo (A B C)
  #:transparent
  #:name foo-transformer
  #:constructor-name raw-make-foo)

(define (make-foo A B)
  (raw-make-foo A B (+ A B)))

(define-syntax foo
  (info-record
   (extract-struct-info (syntax-local-value #'foo-transformer))
   (make-variable-like-transformer #'make-foo)))

All of that said, in practice, I haven't found myself reaching for my
`structure` macro as frequently as I expected to when I wrote it. Most of
the cases seem to fall into one of two categories. If I'm writing a trivial
script, I usually find it sufficient to follow the convention of writing a
constructor wrapper named `make-foo`. On the other hand, in a larger
project, it becomes reasonable to use the module system to manage renaming
and encapsulation, and typically I have a bunch of data-structures that I
want to handle in a consistent, project-specific way.


-Philip

On Sat, Mar 10, 2018 at 1:19 AM, Milo Turner  wrote:

> You can also set! the extra constructor
>
> #lang racket
>
> (struct foo [a b c]
>   #:extra-constructor-name -foo
>   #:transparent)
>
> (define ((foo* make-foo) a b)
>   (make-foo a b (+ a b)))
>
> (set! -foo (foo* -foo))
>
> (foo 1 2) ; -> (foo 1 2 3)
> (match (foo 1 2)
>   [(foo _ _ c) c]) ; -> 3
>
> However I usually just provide a custom make-X function as the only
> constructor. If you're hiding initialization details through the
> constructor it seems a bit
> odd to not hide these details in the match expander. So if you really want
> full encapsulation you should write the match expander as well. But in
> practice
> that's usually overkill.
>
> On Friday, March 9, 2018 at 10:24:00 PM UTC-5, Jon Zeppieri wrote:
>
>>
>>
>> On Fri, Mar 9, 2018 at 9:35 PM, Kevin Forchione  wrote:
>>
>>> Is it possible to initialize a struct field based on values from
>>> previously defined fields? Something equivalent to let* where
>>>
>>> >(struct foo (A B C))
>>> >(foo 1 2) would produce (foo 1 2 3) for example?
>>>
>>>
>>> As far as I know, the only way to do this is to write your own function
>> that calls the struct constructor. You can do this in a module, and only
>> export your constructor, instead of the default struct constructor.
>>
>> If you want the constructor and the match expander to use the same
>> identifier, then you need to do a bit more work.  For example:
>>
>> ```
>> #lang racket/base
>>
>> (require racket/match
>>  (for-syntax racket/base
>>  syntax/transformer))
>>
>> (struct foo* (A B C))
>>
>> (define (foo a b)
>>   (foo* a b (+ a b)))
>>
>> (define-match-expander $foo
>>   (syntax-rules ()
>> [(foo a b c) (foo* a b c)])
>>   (make-variable-like-transformer #'foo))
>>
>> (provide (rename-out [$foo foo]
>>  [foo*-A foo-A]
>>  [foo*-B foo-B]
>>  [foo*-C foo-C])))
>> ```
>>
>> Of course, even here, an instance will print as #. You can
>> implement gen:custom-write to fix that.
>>
>> There might be a better way to do this, but this is what I've used in the
>> past.
>>
>> - Jon
>>
>>
>>
>>
>> --
> 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] Incorrect error reporting

2018-03-14 Thread 'Paulo Matos&#x27; via Racket Users
Hello,

I was trying to understand the imap module so I created the following
script called main.rkt inside a src/ folder.

The file looks like this:
#lang racket/base

(require racket/function
 net/imap)

(define (start-server user pass host port)
  (define-values (conn total new)
(parameterize ([imap-port-number port])
  (imap-connect host user pass "INBOX" #:try-tls? #true)))

  (dynamic-wind
(void)
(thunk
 (let loop ()
   (imap-noop conn)
   (define unseen (imap-unseen conn))
   (printf "unseen: ~a~n" unseen)
   (loop)))
(thunk
 (imap-disconnect conn

(module+ main

  (require racket/cmdline)

  (define hostname (make-parameter "localhost"))
  (define port (make-parameter "465"))
  (define password (make-parameter #f))

  (define username
(command-line
 #:program "s10-tryout server"
 #:once-each
 [("-h" "--hostname") h
  "Hostname (optional)"
  (hostname h)]
 [("-p" "--port") p
  "Port (optional)"
  (port p)]
 [("--password") pass
 "Password (optional)"
 (password pass)]
 #:args (user)
 user))

  (unless (password)
(password (read)))

  (start-server (username) (password) (hostname) (port)))


The most interesting thing about this is how it fails (surely due to
some error of mine), but without actually helping much even when called
with errortrace:

$ racket -l errortrace -t src/main.rkt
parse-command-line: expected argument of type ; given:
'((once-each (("-h" "--hostname")
# (("Hostname (optional)") "h"))
(("-p" "--port") # (("Port
(optional)") "p")) (("--password")
# (("Passw...
  errortrace...:
   /home/pmatos/installs/racket-6.12/collects/racket/cmdline.rkt:199:13:
(define username (command-line #:program "s10-tryout server" #:once-each
(("-h" ) h ) (() ) () ))
  context...:
   /home/pmatos/installs/racket-6.12/collects/racket/cmdline.rkt:266:10:
for-loop
   /home/pmatos/installs/racket-6.12/collects/racket/cmdline.rkt:257:4:
for-loop
   /home/pmatos/installs/racket-6.12/collects/racket/cmdline.rkt:251:2:
for-loop
   /home/pmatos/installs/racket-6.12/collects/racket/cmdline.rkt:229:0:
parse-command-line10
   (submod /home/pmatos/Projects/s10-tryout/src/main.rkt main): [running
body]


This is Racket 6.12. The error message complains about a
parse-command-line which I never called. Then the type in the message:
 is not very useful either if you do not understand the inner
working of parse-command-line.

The most surprising thing is that errortrace complains about:
/home/pmatos/installs/racket-6.12/collects/racket/cmdline.rkt:199:13:
(define username (command-line #:program "s10-tryout server" #:once-each
(("-h" ) h ....) ((....) ) () ))

But the expression (define username...) is on line 30 of main.rkt, not
on line 199 of cmdline.rkt.

Should this be reported as a bug?

-- 
Paulo Matos

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

2018-03-14 Thread google via Racket Users
Hi,

Papers often define parameterized metafunctions, reduction relations and 
judgment forms, and when I model them in PLT Redex, I reach for Racket 
parameters; but the resulting definitions are impure, and they invalidate 
Redex’s cache. I first present three workarounds, none of which are 
satisfactory, and then I propose two new Redex features that address this 
issue.


PROBLEM

To ground our conversation, let us consider an example: in Abstracting 
Abstract Machines (AAM),¹ page 726, we find the metafunction ‘tick’, which 
takes the ‘k’ first elements of the list ‘(e : t)’.² The ‘k’ in question is 
not an explicit argument of ‘tick’, but an analysis-wide parameter that is 
in scope and remains the same for definitions across several pages. To 
capture this intent, the following is a Redex model in which ‘k’ is a 
Racket parameter:

   #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))])

There is a problem with this definition, though, because ‘tick’ is 
impure—it relies on the mutable external state of ‘k’—and Redex caches 
metafunction applications:

(term (tick a _ _ _ []))

   '()

(parameterize ([k 1])

   (term (tick b _ _ _ [])))
   '(b)

(parameterize ([k 1])

   (term (tick a _ _ _ [])))
   '()

The first two interactions illustrate the desired behavior: on the first, 
the ‘a’ is discarded because it overflows the default maximum list size ‘k 
= 0’; on the second, we bump ‘k = 1’ and ‘tick’ returns the list containing 
‘b’. But things go wrong in the third interaction, when we try again to add 
‘a’ to the empty list, this time with ‘k = 1’: Redex has cached the 
previous answer, so ‘tick’ wrongly discards ‘a’.


WORKAROUNDS

Workaround 1: Disable the Cache

We set ‘caching-enabled? = #f’ whenever we parameterize ‘k’. This 
deteriorates performance.


Workaround 2: Thread the Parameter

Don’t have ‘k’ as a Racket parameter, and modify every definition to 
propagate ‘k’ as an argument. This clutters the model and sets it apart 
from the version on the paper.


Workaround 3: Use a macro

   #lang racket/base

   (require (for-syntax racket/base racket/syntax) syntax/parse/define
redex/reduction-semantics racket/list syntax/parse/define)

   (define-syntax-parser analysis
 [(_ k:integer)
  (with-syntax ([L (format-id #'k "L~a" (syntax-e #'k))]
[tick (format-id #'k "tick~a" (syntax-e #'k))])
#'(begin
(define-language L
  [e ::= any]
  [t ::= [e (... ...)]])

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

We can instantiate different analyses for our choice of ‘k’:

(analysis 0)
(analysis 1)
(term (tick0 a _ _ _ []))

   '()

(term (tick1 b _ _ _ []))

   '(b)

(term (tick1 a _ _ _ []))

   '(a)

This has many issues: it is harder to read and write; it requires escaping 
ellipses (see ‘(... ...)’ above); it binds the name ‘k’ in all contexts, 
including undesirable ones, for example, ‘(term k)’; it may break 
typesetting; it insists that ‘k’ is a literal number, not an expression 
that evaluates to a number; and it may be bad for compilation performance. 
Some of these issues are solved by writing even more incantations, but not 
all.


SOLUTIONS

Currently, I’m using Workaround 1, disabling the cache, but I wish for a 
lighter hammer. The simplest thing that comes to mind is a way for me to 
flush Redex’s cache when I parameterize ‘k’. This would be a good 
compromise: I’d still write a simple and correct model, and I’d leverage at 
least some of the performance benefits of caching. Unfortunately, cache 
invalidation continues to be one of the *hard problems* in computer 
science. I tried to disable and reenable the cache. I tried to 
‘set-cache-size!’ to a low number and then back again. Nothing worked.

Going further, we could introduce a ‘define-metaparameter’ form to Redex. A 
metaparameter is parameterizeable like a Racket parameter, but we can use 
it like a regular term in Redex definitions and the cache is aware of it.


* * *

Thoughts are appreciated. Is there a better way to accomplish my goal? Is 
it a valid thing to want in the first place?

Parametrically confused,
Leandro.


* * *

¹ Van horn, David, and Matthew Might. 2012. “Systematic Abstraction of 
Abstract Machines.” J. Funct. Program. 22 (4–5): 705–746. 
https://doi.org/10.1017/S0956796812000238.

² Similar to ‘take’ from ‘racket/list’.

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

[racket-users] struct-copy question

2018-03-16 Thread Kevin Forchione
Hi guys, 
I’ve noticed that struct-copy doesn’t appear to work when fields are defined 
with #:auto. So this leads to my question, which may not be answerable since it 
would presumably be used to fix struct-copy, but is there a way to retrieve a 
list of struct fields for a struct? I have a feeling there is some macro work 
going on and that the struct isn’t really “aware” of its field names. If that’s 
the case, wouldn’t it be interesting if the macro included building a function 
that would return these names as a symbols list? :) 

Thanks, 
Kevin

-- 
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] Prefab and mutable

2018-03-20 Thread 'Paulo Matos&#x27; via Racket Users
Hi,

I was quite surprised by a 'feature' of prefab mutable structures:
#lang racket

(struct f (a b)
  #:prefab
  #:mutable)

(place-message-allowed? (f 1 2))
(place-message-allowed? #s(f 1 2))

I was expecting both to return true but to my amazement it was not the
case. The one created with #s(...) returned true while the other
returned false. This is surprising because I thought I had read
everything about prefabs and never seen this distinction being discussed.

Any reasons for this to happen?

-- 
Paulo Matos

-- 
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] Prefab and contracts

2018-03-20 Thread 'Paulo Matos&#x27; via Racket Users
Hello,

In a similar comment to my previous thread, I am yet again surprised at
this:

a.rkt:

#lang racket

(provide (struct-out foo))

(struct foo (a b)
  #:prefab)

b.rkt:

#lang racket

(require "a.rkt")

(place-message-allowed? (foo 1 2))

This works! However, try to provide in a.rkt foo like this:
(provide (contract-out (struct foo ((a integer?)
(b integer?)

Suddenly you get:
#f

Here's the even more confusing part:
(define-values (pch1 pch2) (place-channel))
(place-channel-put pch1 (foo 1 2))

This will result in:
place-channel-put: value not allowed in a message
  value: '#s(foo 1 2)
  message: '#s(foo 1 2)


This will drive you mad because if you copy the message textual
representation:
(place-channel-put pch1 '#s(foo 1 2))

then it works.

What's the reason for this discrepancy? There's no mentioning of
#:prefab in contract-out documentation.

Regards,

-- 
Paulo Matos

-- 
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] Windows Foreign Libraries

2018-03-23 Thread silverfire675
Really silly question but I was using the rsvg package with racket/gui on 
Linux and everything was working fine.   I moved the code over to windows 
to try it out (after installing the rsvg package there) and it's 
complaining that librsvg-2.2.dll is missing.   I've now tried two separate 
.dll files in my code directory (one that was from the official gnome ftp) 
and racket throws an error that ($1 is not a valid Win32 application) when 
trying to call (ffi-lib) on it.

Now I'm going to try building the .dll myself,  but I'm wondering if it's 
possible after I've got a .dll that works if you can somehow connect it 
with the rsvg package so when I compile for distribution in DrRacket it 
automatically includes the .dll I have.  It pretty much already does this 
for all the other gnome libraries racket/gui uses, and it'd be much easier 
than having to manually add it to the libs after it's done compiling.


-- 
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] a matrix question

2018-03-25 Thread Tim Hanson
hi, 

I'm trying out matrices (without typed racket, though I read the performance 
caveat -- I'm not worried about performance at the moment) and am trying to 
find the best idioms for a small function I'd like to build.

Q1: is there an elegant away to assemble a matrix column-wise? (my first draft 
solution is to read one col-matrix and write cell by cell into a destination 
(mutable) matrix); my preference would be to use immutable items, but that's 
secondary to elegance at this point.

cheers,

Tim

-- 
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] Struct general question

2018-03-26 Thread Kevin Forchione
In another thread on structs it was confirmed that structs are in essence a 
vector with some fancy bindings associated. But there must be more going on, 
for instance, the definition (struct foo (A B)) creates a function foo that 
when applied does not print like a vector. Is there any documentation instructs 
that does into the details of what they are and are doing under the hood?

Kevin

-- 
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] Profiling places

2018-03-27 Thread 'Paulo Matos&#x27; via Racket Users


On 27/03/18 14:55, 'Paulo Matos' via Racket Users wrote:
> 
> 1. setup a profile command line argument that's passed to places-profile.rkt
> 2. send a flag indicating if we need profiling in any-double?
> 3. then use profile-thunk on the function if profiling is required, or
> nothing if profiling is not required.
> 

I have attempted this:
;; places-profile.rkt

#lang racket

(define (main)
  (define p
(dynamic-place "any-double.rkt" 'place-entry))

  ;; enable profiling
  (place-channel-put p #t)

  (for ([i (in-range 1000)])
(define l (build-list (random 1) (lambda (_) (random 100
(place-channel-put p l)
(place-channel-get p))

  (place-kill p))

(main)

;; any-double.rkt

#lang racket

(require profile)
(require profile/render-text)

(provide place-entry)

(define (any-double? l)
  (for/or ([i (in-list l)])
(for/or ([i2 (in-list l)])
  (= i2 (* 2 i)

(define (place-entry ch)
  (define profile? (place-channel-get ch))

  (profile-thunk
   (thunk
(let loop ()
  (define l (place-channel-get ch))
  (define l-double? (any-double? l))
  (place-channel-put ch l-double?)
  (loop)))
   #:periodic-renderer (list 4 render)
   #:use-errortrace? #t
   #:threads #t))



Unfortunately, every 4 secs I see:
Profiling results
-
  Total cpu time observed: 185393ms (out of 188238ms)
  Number of samples taken: 3727 (once every 50ms)


Caller
Idx  TotalSelfName+srcLocal%
 ms(pct)  ms(pct)   Callee



Absolutely no results. Why?

Also, if I reduce the number of iterations in places-profile.rkt to
1000, and remove the periodic-render, there's absolutely no output from
the profiler. Is this related with the killing of the place via
place-kill? Is there a nice way to kill a place and still preserve
profiling information?

-- 
Paulo Matos

-- 
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] Profiling places

2018-03-27 Thread Vincent St-Amour
On Tue, 27 Mar 2018 07:55:08 -0500,
'Paulo Matos' via Racket Users wrote:
> 
> I was trying to confirm my suspicion that profile needs to be manually
> setup in each place for profiling.

Right. Each place has its own separate runtime, and the profile only
spans a single runtime.

> Is this a possibility or is there something out there to make this
> easier? Also, profile-thunk says that:
> "To track all threads, specify a non-#f value for the threads?
> argument―this will execute the computation in a fresh custodian, and
> keep track of all threads under this custodian."
> 
> But what happens if the place itself creates its own custodian to launch
> threads?

In this case, thread refers to Racket's concurrency mechanism; this is
unrelated to places.

On Tue, 27 Mar 2018 08:15:19 -0500,
'Paulo Matos' via Racket Users wrote:
> 
> 
> 
> On 27/03/18 14:55, 'Paulo Matos' via Racket Users wrote:
> > 
> > 1. setup a profile command line argument that's passed to places-profile.rkt
> > 2. send a flag indicating if we need profiling in any-double?
> > 3. then use profile-thunk on the function if profiling is required, or
> > nothing if profiling is not required.
> > 
> 
> I have attempted this:
> [...]

I get profiling information (including periodic reports) when I disable
errortrace mode in `profile-thunk`.

The errortrace mode requires the use of the errortrace compile-handler,
without which there's nothing for the profiler to observe.

`raco profile --use-errortrace` sets it, as does `racket -l errortrace
-t places-profile.rkt`. However, neither of those work on your example.

Could places be interfering with the compile-handler?

Vincent

-- 
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] Profiling places

2018-03-28 Thread 'Paulo Matos&#x27; via Racket Users


On 27/03/18 17:18, Vincent St-Amour wrote:
> On Tue, 27 Mar 2018 07:55:08 -0500,
> 'Paulo Matos' via Racket Users wrote:
>>
>> I was trying to confirm my suspicion that profile needs to be manually
>> setup in each place for profiling.
> 
> Right. Each place has its own separate runtime, and the profile only
> spans a single runtime.
> 
>> Is this a possibility or is there something out there to make this
>> easier? Also, profile-thunk says that:
>> "To track all threads, specify a non-#f value for the threads?
>> argument―this will execute the computation in a fresh custodian, and
>> keep track of all threads under this custodian."
>>
>> But what happens if the place itself creates its own custodian to launch
>> threads?
> 
> In this case, thread refers to Racket's concurrency mechanism; this is
> unrelated to places.
> 

I understand that, what I meant was that I was wondering what would
happen (haven't tried it yet) if the place spawned by `dynamic-place`
creates a new custodian and uses that to create new threads. Would
profiling through the place, with #:threads #t, still profile the
threads? -- maybe I need to create an example.

> On Tue, 27 Mar 2018 08:15:19 -0500,
> 'Paulo Matos' via Racket Users wrote:
>>
>>
>>
>> On 27/03/18 14:55, 'Paulo Matos' via Racket Users wrote:
>>>
>>> 1. setup a profile command line argument that's passed to places-profile.rkt
>>> 2. send a flag indicating if we need profiling in any-double?
>>> 3. then use profile-thunk on the function if profiling is required, or
>>> nothing if profiling is not required.
>>>
>>
>> I have attempted this:
>> [...]
> 
> I get profiling information (including periodic reports) when I disable
> errortrace mode in `profile-thunk`.
> 
> The errortrace mode requires the use of the errortrace compile-handler,
> without which there's nothing for the profiler to observe.
> 
> `raco profile --use-errortrace` sets it, as does `racket -l errortrace
> -t places-profile.rkt`. However, neither of those work on your example.
> 
> Could places be interfering with the compile-handler?
> 

True, I can confirm that. I will open an issue on this. I have no idea
how the internals of these things work so not sure what could be
happening here. Maybe Matthew knows?

-- 
Paulo Matos

-- 
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] Profiling places

2018-03-28 Thread 'Paulo Matos&#x27; via Racket Users


On 28/03/18 10:23, 'Paulo Matos' via Racket Users wrote:
> True, I can confirm that. I will open an issue on this. 

Done #2019.
https://github.com/racket/racket/issues/2019

-- 
Paulo Matos

-- 
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] Profiling places

2018-03-28 Thread Vincent St-Amour
Thanks! I've commented there.

Vincent


On Wed, 28 Mar 2018 03:27:11 -0500,
'Paulo Matos' via Racket Users wrote:
> 
> 
> 
> On 28/03/18 10:23, 'Paulo Matos' via Racket Users wrote:
> > True, I can confirm that. I will open an issue on this. 
> 
> Done #2019.
> https://github.com/racket/racket/issues/2019
> 
> -- 
> Paulo Matos
> 
> -- 
> 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: Understanding 'curry'

2018-03-31 Thread 若草春男
It's very very easy. The "curry" is from functional languages(Haskell, 
OCaml, F#, ...).

The concept of curry is powerful when the following function form:
(function-name option-argument input-argument)

For example, we think about 2htdp/image.

#lang racket
(require 2htdp/image)

(overlay/align/offset
  "left" "top"
  (circle 30 "solid" "green yellow")
  0 0
  (overlay/align/offset
"left" "bottom"
(circle 30 "solid" "khaki")
10 0
(overlay/align/offset
  "right" "top"
  (circle 30 "solid" "orchid")
  0 10
  (overlay/align/offset
"right" "bottom"
(circle 30 "solid" "cornflowerblue")
-10 -10
(star-polygon 20 20 3 "solid" "navy")

In Lisp Programming, it prefer to indent radically. Therefore, we introduce 
the "thread macro".

; thread macro (function)
(define (~> init . procs)
  (foldl (lambda (proc arg) (proc arg))
 init
 procs))

(~> (star-polygon 20 20 3 "solid" "navy")
(lambda (image)
  (overlay/align/offset "right" "bottom"
(circle 30 "solid" "cornflowerblue")
-10 -10
image))
(lambda (image)
  (overlay/align/offset "right" "top"
(circle 30 "solid" "orchid")
0 10
image))
(lambda (image)
  (overlay/align/offset "left" "bottom"
(circle 30 "solid" "khaki")
10 0
image))
(lambda (image)
  (overlay/align/offset "left" "top"
(circle 30 "solid" "green yellow")
0 0
image)))

For more simple discription, we use curry instead of lambda.

(~> (star-polygon 20 20 3 "solid" "navy")
(curry overlay/align/offset "right" "bottom"
(circle 30 "solid" "cornflowerblue")
-10 -10)
(curry overlay/align/offset "right" "top"
        (circle 30 "solid" "orchid")
0 10)
    (curry overlay/align/offset "left" "bottom"
(circle 30 "solid" "khaki")
10 0)
(curry overlay/align/offset "left" "top"
(circle 30 "solid" "green yellow")
0 0))

Thanks,
Haruo

-- 
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: Understanding 'curry'

2018-03-31 Thread 若草春男
I'm sorry for my mistake.

[Wrong] Thread Macro
[Right] Threading Macro

Threading macros are provided by Racket Package System
and its documentation is included in Racket Document.

-- 
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: Understanding 'curry'

2018-03-31 Thread 若草春男
Curry is from functional languages(Haskell, OCaml, F#, ...).
Curry is the one of abbreviation of labmda.

But, curry is NOT usable for racket's threading macros.

#lang racket
(require threading)
(require 2htdp/image)

(~> (star-polygon 20 20 3 "solid" "navy")
(overlay/align/offset "right" "bottom"
  (circle 30 "solid" "cornflowerblue")
  -10 -10 _)
(overlay/align/offset "right" "top"
  (circle 30 "solid" "orchid")
  0 10 _)
(overlay/align/offset "left" "bottom"
  (circle 30 "solid" "khaki")
  10 0 _)
(overlay/align/offset "left" "top"
      (circle 30 "solid" "green yellow")
  0 0 _))

-- 
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] Simple loop control

2018-04-01 Thread 若草春男
Hi, everyone.

I want to write loops simpler.

> (do ([i 1 (add1 i)]) ([= i 10]) (display i))
123456789
> (for-each (lambda (i) (display i)) (range 1 10))
123456789

In Common Lisp, I like the extended loop like "for" of C-language.

[3]> (loop for i from 1 below 10 do (print i))

1
2
3
4
5
6
7
8
9
NIL

Please tell me the best solution.

Haruo

-- 
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] typed/racket surprises

2018-04-02 Thread Philip McGrath
While experimenting with porting an typed program to Typed Racket, I
encountered a few surprises. Some of these seem like they might be bugs,
others missing features, and several probably are misunderstandings on my
part.

*1. struct subtyping doesn't work with #:type-name*

The following program fails to typecheck with the error "Type Checker:
parent type not a valid structure name: animal":
#lang typed/racket

(struct animal ()
  #:type-name Animal
  #:transparent)

(struct dog animal ()
  #:transparent)

Trying to use `Animal` as the parent of `dog` doesn't work either,
producing the expected error from `struct` that `Animal` is not bound to
struct type information.

*2. Problems with define-struct/exec*

There seem to be some subtleties to using applicable structs created with
define-struct/exec that I do not understand. For example, the following
program fails to typecheck:
#lang typed/racket

(define-struct/exec adder ([name : Symbol])
  [(λ (this n) (add1 n)) : (-> adder Number Number)])

(define v
  (adder 'v))

(apply v '(41))

with the error "Type Checker: Type of argument to apply is not a function
type:
adder".

I thought that I might need to add a type annotation, but I also am
confused about how to write the type of `v` in the above program. If I
change the above program to one that does typecheck:
#lang typed/racket

(define-struct/exec adder ([name : Symbol])
  [(λ (this n) (add1 n)) : (-> adder Number Number)])

(define v
  (adder 'v))

(v 41)

the REPL prints the type of v as simply `adder`, but, hovering over the use
of `v` in the last line, the tooltip in DrRacket shows the type as `(U (->
adder Number Number) adder)`.

This seems to be wrong. That function type is the type of the value for
`adder`'s prop:procedure, not the type of an `adder` when used as a
function. Annotating `v` with `(: v (U (-> adder Number Number) adder))`
causes the program to fail to typecheck.

But it isn't clear what type should be used to annotate `v`. Writing `(: v
(U (-> Number Number) adder))` also causes typechecking to fail, as does
experimenting with an intersection type or simply writing `(: v (-> Number
Number))`.

*3. parse-command-line doesn't support usage-help, help-labels, help-proc,
or unknown-proc*

The type for `parse-command-line` doesn't support the `'usage-help`
specification (or `#:usage-help` in an equivalent `command-line` form), so
the following program, which works fine in #lang racket, fails to typecheck:
#lang typed/racket

(parse-command-line
 "example"
 #("-h")
 '([usage-help "here is some usage help"])
 void
 null)

Worse, the type for the `'help-labels`/`#:help-labels` specification is
wrong, so the following program typechecks successfully but raises a
run-time error:
#lang typed/racket

(parse-command-line
 "example"
 #("-h")
 '([help-labels ("this is a help label")])
 void
 null)

I have tried to write a better contract for `parse-command-line` using
`require/typed`, but the following program, for example, fails to typecheck
with the error "cannot generate contract for variable arity polymorphic
type":
#lang typed/racket/base

(require/typed
 racket/cmdline
 [parse-command-line
  (All (b a ...)
  (-> Path-String
  (U (Listof String) (Vectorof String))
  (Listof
   (U (Pairof 'ps (Listof String))
  (Pairof
   (U 'final 'help-labels 'multi 'once-any 'once-each)
   (Listof (Listof Any)
  (-> Any a ... a b)
  (Listof String)
  b))])

Note that the type above is exactly the type reported by the #lang
typed/racket REPL for `parse-command-line` by default. Also, this type does
not support the optional "help-proc" or "unknown-proc" arguments.

Thanks to all who have worked on and promoted Typed Racket! Really, it is
remarkable how *few* surprises there are when adding types to an untyped
program.

-Philip

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] let-syntax example?

2018-04-03 Thread Kevin Forchione
Hi Guys,
Does anyone have an analogous example for let-syntax to something as simple as 
this?

(let ([a 3]) a)

Something like….

(let-syntax ([a 3]) ….) 

At which point I’m stumped as to what expression in the body would return 3. 
There are no examples in the Reference. 

Thanks!
Kevin

-- 
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] CFP: TFPIE 2018

2018-04-06 Thread Marco Morazan
Dear All,

Kindly consider submitting an article/presentation to TFPIE 2018. The call 
for papers is below.

Also, follow us in Facebook: https://www.facebook.com/TFPIE/

Cheers,

Marco



TFPIE 2018 Call for papers
http://www.ccs.neu.edu/home/heather/tfpie2018/

TFPIE 2018 welcomes submissions describing techniques used in the 
classroom, tools used in and/or developed for the classroom and any 
creative use of functional programming (FP) to aid education in or outside 
Computer Science. Topics of interest include, but are not limited to:

FP and beginning CS students
FP and Computational Thinking
FP and Artificial Intelligence
FP in Robotics
FP and Music
Advanced FP for undergraduates
FP in graduate education
Engaging students in research using FP
FP in Programming Languages
FP in the high school curriculum
FP as a stepping stone to other CS topics
FP and Philosophy
The pedagogy of teaching FP
FP and e-learning: MOOCs, automated assessment etc.
Best Lectures – more details below

In addition to papers, we are requesting best lecture presentations. What’s 
your best lecture topic in an FP related course? Do you have a fun way to 
present FP concepts to novices or perhaps an especially interesting 
presentation of a difficult topic? In either case, please consider sharing 
it. Best lecture topics will be selected for presentation based on a short 
abstract describing the lecture and its interest to TFPIE attendees.

Submissions
Potential presenters are invited to submit an extended abstract (4-6 pages) 
or a draft paper (up to 16 pages) in EPTCS style. The authors of accepted 
presentations will have their preprints and their slides made available on 
the workshop's website. Papers and abstracts can be submitted via easychair 
at the following link: https://easychair.org/conferences/?conf=tfpie2018 
After the workshop, presenters will be invited to submit (a revised version 
of) their article for review. The PC will select the best articles for 
publication in the journal Electronic Proceedings in Theoretical Computer 
Science (EPTCS). Articles rejected for presentation and extended abstracts 
will not be formally reviewed by the PC.

Dates
Submission deadline: May 15th, Anywhere on Earth.
Notification: May 21st
Workshop: June 14th
Submission for formal review: August 17th
Notification of full article: October 5th
Camera ready: November 2nd
 

Program Committee

Kenichi Asai, Ochanomizu University, Japan
Kathi Fisler, Brown University, USA
Benjamin Lerner, Northeastern University, USA
Mark Lewis, Trinity University, USA
Heather Miller, Northeastern University, USA & EPFL, Switzerland
Elena Machkasova, University of Minnesota, USA
David Sands, Chalmers University of Technology, Sweden
Emmanuel Schanzer, Bootstrap World, USA

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Racket "google" package

2018-04-11 Thread Philip McGrath
Does anyone actively use the "google" Racket package? (
https://pkgs.racket-lang.org/package/google)

There are some things I'm interested in doing, especially with the Google
Drive API, but I see that the latest commit to the GitHub repository is
from 2016, which seems like a long time ago in Google land. It would be
great to hear that someone is using it happily and it still works.

-- 
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] Using Greek Letters

2018-04-18 Thread disaacmuniz
I saw the oficial Racket list of all the LaTeX thing and made some 
research, but I don't get it. 

Can someone please explain me how to digite the greek letter Theta for 
example? And how to use it as the mathematical Theta function if that's 
possible?

Thank you a lot in advance!


-- 
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] RacketCon 2018 Website

2018-04-20 Thread Leif Andersen
When looked as a whole, the new racketcon website looks cool.  But when you
are zoomed in (like I and many other blind/low-vision users frequently
are), it looks something like this:



Which honestly looks like something is broken with the website.

Also, it completely kills screen readers. Here is a capture of what a
screen reader thinks that block of text is saying:



So, if we are going to keep this logo, could we at least make it an image,
or use HTML accessibility tags to say what that block of text should be
read as, or something else that doesn't completely kill the website for
blind users?

~Leif Andersen

-- 
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] Installing packages

2018-04-23 Thread Philip McGrath
Yes.

For some package , you can install it for your current user with
the command "raco pkg install " or for the entire installation
(which I often prefer) with "raco pkg install -i ".

So, to install DrRacket, "raco pkg install drracket".

Installing the document you linked to illustrates another point: while you
can mix documentation and implementation in the same package, many
"industrial strength" packages like Scribble split them up into separate
packages, so that in resource-constrained environments you can leave out
the documentation. The document you linked to is part of the "scribble-doc"
package ("raco pkg install scribble-doc"), and the implementation is in
"scribble-lib" ("raco pkg install scribble-lib"). Assuming you want both,
you can just install the main Scribble package ("raco pkg install
scribble"), which pulls both the documentation and the implementation as
dependencies.

I would also note that the minimal installation is very minimal indeed, and
the main distribution is < 600 MB on my machine. Unless you have a
particular reason to want the minimal version, I think the main
distribution is a more friendly place to start.

-Philip

On Mon, Apr 23, 2018 at 9:38 AM, Manuel G <
paracomunicacionesinforma...@gmail.com> wrote:

> Hi,
>
> I'm new to racket, and I'm very interested in DSL , I've installed the
> minimal distribution, and I'd like to
> "install" documentation such as
>
> https://docs.racket-lang.org/scribble/index.html
>
> , is that possible ?
>
> Can I install drracket using raco ?
>
> thanks
> ...
> manolo
>
> --
> 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] Heresy 0.3.0 released

2018-04-30 Thread Annaia Berry
Greetings,

Version 0.3.0 of the Heresy programming language has been released,
containing a re-implementation of Holes based on Racket boxes, while
maintaining the same basic API, plus additional support for a "hole-do" DSL
for monadic operations on holes.

Special thanks to Greg Hendershott, for both rackjure, which provided some
of the internals for the new holes implementation, and for his
travis-racket scripts which enabled me to set up CI for Heresy with Travis.

You can find Heresy on Github <https://github.com/jarcane/heresy>, or
install with raco pkg install heresy. Docs are available at
http://docs.racket-lang.org/heresy/index.html* or locally after install.

Thanks for your time!
Annaia


* Note: There seems to be an issue with the package server as it's not
rebuilding the hosted docs for me at the moment despite running the recheck
twice. I don't know if I'm doing something wrong, someone needs to kick the
server, or it's just going to take a moment.

-- 
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: game help

2018-05-03 Thread Alex Harsanyi
   )))
>
>
> (define createButtonRows (lambda (vContainer rowCount colCount)
>; create a rowCount rows of buttons
>(cond
>  ((equal? rowCount 0) )
>  (else  
>   (createButRow 
>(new horizontal-panel% [parent vContainer]
> [alignment '(center center)])  
> rowCount colCount)
>   (createButtonRows vContainer (- rowCount 1) 
> colCount) 
>   )
>  )
>)
>   )
> (define createBoard (lambda (container rowCount colCount) 
>   (createButtonRows 
>(new vertical-panel% [parent container]
> [alignment '(center center)])
>rowCount colCount)
>   )
>   )
>
> ; add a message box at the bottom: this will be updated by do show whose 
> turn it is
> (define addMessageArea (lambda (container)
>  (let  ((messageBox (new message% [label ""] 
> [parent container] [ auto-resize #t])))
>(addUpdator (lambda ()
>  (let ((w (winner)))
>(cond
>  ((equal? w 0) (send 
> messageBox set-label (format "Player ~a to play" currentPlayer)))
>  (#t (send messageBox 
> set-label (format "Winner is ~a" w)))
>  )
>))
>
>
>
> ;-
> ; update a button - change label and disable
>
> (define updateButton (lambda (but rowNum colNum)
>(let* ((val (vector-ref (vector-ref board  rowNum) 
> colNum))
>   (str (cond
>  ((= val 1) "X")
>  ((= val 2) "O")
>  (#t "")
>  )))
>  (send but set-label str)
>  (cond ((> val 0) (send but enable #f))) ; disable 
> if already played in that cell
>  )
>)
>   )
>
> ; list of functions to update display
> (define updators (list))
> ; run all update functions
> (define update (lambda ()
>  (for-each (lambda (func) (func))  updators)
>  ))
> (define addUpdator (lambda (fun)
>  (set! updators (cons fun updators
> ;-
> ; initialisation - create the view
> (define myFrame (new frame%
>  [label "O and X game"]
>  [width 200] [height 200]))
> (createBoard myFrame rows cols)
> (addMessageArea myFrame)
> (send myFrame show #t)
> (update)
>

-- 
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] Parametric composition?

2018-05-04 Thread Alexis King
Your composex macro is very similar to the various forms from the (as far as I 
can tell) fairly well-known threading package:

 http://docs.racket-lang.org/threading/index.html

Disclaimer: I am the author of the threading package.

In any case, there are some differences, but it has the same general feel, and 
it might suit your needs.

Alexis

> On May 4, 2018, at 14:57, dexterla...@gmail.com wrote:
> 
> Hi there,
> 
>  This is my first post, pardon my ignorance. I have been using a homemade 
> macro to compose functions together, but still allow semi-currying of 
> functions (with lambdas) to keep control of the parameters :
> 
> (define-syntax (composex stx)
>  ; macro to compose functions passing an 'x' parameter
>  (syntax-case stx ()
>((_ f1 ...)
> (with-syntax ([x-var (datum->syntax stx 'x)])
>   #'(compose1 (λ (x-var) f1) ...)
> ; unit test
> (check-equal? ((composex (string-replace x " " "-")
> (string-downcase x)
> (string-trim x)) "Hello World")
>  "hello-world")
> 
> 
> I often use this or (apply composex (reverse v)) to keep function 
> applications in order.
> 
> Can you comment on this? Do you think this could be part of the language?
> 
> Cheers,
> 
> Dexter
> 
> P.S. For use in the wild, see provide-generator. Makes generate-provide more 
> readable :
> https://github.com/DexterLagan/provide-generator

-- 
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] Parametric composition?

2018-05-04 Thread dexterlagan
  Awesome. Your library is far better. Thanks for replying!

Dexter

On Friday, May 4, 2018 at 4:09:53 PM UTC-4, Alexis King wrote:

> Your composex macro is very similar to the various forms from the (as far 
> as I can tell) fairly well-known threading package: 
>
>  http://docs.racket-lang.org/threading/index.html 
>
> Disclaimer: I am the author of the threading package. 
>
> In any case, there are some differences, but it has the same general feel, 
> and it might suit your needs. 
>
> Alexis 
>
> > On May 4, 2018, at 14:57, dexte...@gmail.com  wrote: 
> > 
> > Hi there, 
> > 
> >  This is my first post, pardon my ignorance. I have been using a 
> homemade macro to compose functions together, but still allow semi-currying 
> of functions (with lambdas) to keep control of the parameters : 
> > 
> > (define-syntax (composex stx) 
> >  ; macro to compose functions passing an 'x' parameter 
> >  (syntax-case stx () 
> >((_ f1 ...) 
> > (with-syntax ([x-var (datum->syntax stx 'x)]) 
> >   #'(compose1 (λ (x-var) f1) ...) 
> > ; unit test 
> > (check-equal? ((composex (string-replace x " " "-") 
> > (string-downcase x) 
> > (string-trim x)) "Hello World") 
> >  "hello-world") 
> > 
> > 
> > I often use this or (apply composex (reverse v)) to keep function 
> applications in order. 
> > 
> > Can you comment on this? Do you think this could be part of the 
> language? 
> > 
> > Cheers, 
> > 
> > Dexter 
> > 
> > P.S. For use in the wild, see provide-generator. Makes generate-provide 
> more readable : 
> > https://github.com/DexterLagan/provide-generator 
>
>

-- 
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] Provide form generator

2018-05-08 Thread Dexter Lagan
Hi folks,

  I developed a provide form generator to take the pain out of writing module 
headers: 

https://github.com/dexterlagan/provide-generator

 It works great, but I wonder if there wouldn’t be a simpler and more standard 
way to write this. My original idea was to parse the module syntax and simply 
delete the body of each define form, converting each function definition to 
string and use it as comment to each provide element. I couldn’t make it work 
that way, so I had to switch from syntax objects to strings half-way and handle 
it by hand. Any insight?

Thanks!

Dex

-- 
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] DrRacket Plugin development

2018-05-09 Thread James Yoo
Hi all!

I'm an undergraduate TA for a Canadian university which uses DrRacket as 
its primary IDE for its introductory programming course. As a fun side 
project
to keep me busy during the summer, I was hoping to develop a DrRacket 
plugin which basically acts as an in-editor help desk. My vision for this 
is to
have a window that pops up once a user hovers over a function name that 
contains information from the help desk. I've already looked at the 
existing 
documentation for creating plugins, but it seems pretty esoteric. 

I was wondering if anyone has had any experience developing tools like this.

Thanks!

-- 
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] Student code metrics

2018-05-13 Thread Stephen Foster
Hi!

I was about to start building a tool for statically analyzing student 
code.  But I first want to ask if there's related work out there.

I'm interested in relatively simple stuff -- e.g. How many functions did 
the student write?  How many expressions?  What's the average nesting depth 
of expressions?  Etc.  Basically, I want to start quantifying things about 
students' coding styles -- both to identify potential problems and also to 
help students set goals (e.g. "Today, you wrote 2 functions.  Tomorrow, I 
want you to try to write 3!").

Before I start writing this myself, is there anything that I should know 
about?  Has someone already done exactly this?  Or is there some library 
for static analysis or code metrics that I should be building upon?  I 
searched a bit and couldn't find a lot.  Maybe I'm using the wrong keywords.

--Stephen

-- 
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] Edmond's Blossom Algorithm

2018-05-14 Thread Jens Axel Søgaard
Context:

I have students A, B, C, ..., Z that needs to work in pairs for their exam.
Each student has made a wish list with 3 other students that they'd like to
work with.
I need to find the maximum possible pairing.

I think - maybe - that the algorithm I need is Edmond's blossom algorithm.

Am I so lucky that someone has this in Racket?

https://en.wikipedia.org/wiki/Blossom_algorithm
http://www.cs.dartmouth.edu/~ac/Teach/CS105-Winter05/Handouts/tarjan-blossom.pdf

/Jens Axel

-- 
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] handin-server submissions

2018-05-15 Thread James Yoo
Hi, everyone

I'm currently in charge of a handin-server instance for a course at my 
university. We're currently experiencing issues where students are unable 
to handin their work, receiving this error message:

login error: user (STUDENT_USERNAME) not in assignment/section lab-01

I think I've configured config.rktd correctly, with "lab-01" being in the 
correct active-dirs s-expression.

Does anyone have an idea of what's going on? I'd be happy to share my 
config.rktd file.

Thanks!
James 

-- 
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-15 Thread 'John Clements&#x27; via Racket Users
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? 

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.


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

2018-05-15 Thread N. Raghavendra
At 2018-05-15T17:36:44-04:00, 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:

Thanks for tracing that change.

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.


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


Re: [racket-users] Unicode identifiers

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

(filtered-in
<http://docs.racket-lang.org/reference/require.html?q=regexp-in#%28form._%28%28lib._racket%2Frequire..rkt%29._filtered-in%29%29>
 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
<http://docs.racket-lang.org/reference/require.html?q=regexp-in#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29>
 (filtered-in
<http://docs.racket-lang.org/reference/require.html?q=regexp-in#%28form._%28%28lib._racket%2Frequire..rkt%29._filtered-in%29%29>
  (lambda
<http://docs.racket-lang.org/reference/lambda.html?q=regexp-in#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29>
 (name)
(and
<http://docs.racket-lang.org/reference/if.html?q=regexp-in#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._and%29%29>
 (regexp-match?
<http://docs.racket-lang.org/reference/regexp.html?q=regexp-in#%28def._%28%28quote._~23~25kernel%29._regexp-match~3f%29%29>
 #rx"^[a-z-]+$" name)
 (regexp-replace
<http://docs.racket-lang.org/reference/regexp.html?q=regexp-in#%28def._%28%28quote._~23~25kernel%29._regexp-replace%29%29>
 #rx"-" (string-titlecase
<http://docs.racket-lang.org/reference/strings.html?q=regexp-in#%28def._%28%28quote._~23~25kernel%29._string-titlecase%29%29>
 name) "")))
  racket/base))

imports only bindings from racket/base
<http://docs.racket-lang.org/reference/index.html?q=regexp-in> 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] 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 
> <http://docs.racket-lang.org/reference/require.html?q=regexp-in#%28form._%28%28lib._racket%2Frequire..rkt%29._filtered-in%29%29>
>  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 
> <http://docs.racket-lang.org/reference/require.html?q=regexp-in#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29>
>  (filtered-in 
> <http://docs.racket-lang.org/reference/require.html?q=regexp-in#%28form._%28%28lib._racket%2Frequire..rkt%29._filtered-in%29%29>
>   (lambda 
> <http://docs.racket-lang.org/reference/lambda.html?q=regexp-in#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29>
>  (name)
> (and 
> <http://docs.racket-lang.org/reference/if.html?q=regexp-in#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._and%29%29>
>  (regexp-match? 
> <http://docs.racket-lang.org/reference/regexp.html?q=regexp-in#%28def._%28%28quote._~23~25kernel%29._regexp-match~3f%29%29>
>  #rx"^[a-z-]+$" name)
>  (regexp-replace 
> <http://docs.racket-lang.org/reference/regexp.html?q=regexp-in#%28def._%28%28quote._~23~25kernel%29._regexp-replace%29%29>
>  #rx"-" (string-titlecase 
> <http://docs.racket-lang.org/reference/strings.html?q=regexp-in#%28def._%28%28quote._~23~25kernel%29._string-titlecase%29%29>
>  name) "")))
>   racket/base))
> imports only bindings from racket/base 
> <http://docs.racket-lang.org/reference/index.html?q=regexp-in> 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 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 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 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 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 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] ssax:make-parser

2018-05-16 Thread 'John Clements&#x27; 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] 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] 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 'John Clements&#x27; 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] 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 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:

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

`ssax:read-pi-body-as-string' is another identifier from sxml/ssax/ssax,
which I am finding useful.  Here is a usage adapted from

https://github.com/bernied/ssax/blob/master/SSAX/examples/ssax-extraction.scm

(define (outline-pi port pi-tag seed)
  ;; Read the body of PI and ignore it.
  (let ((dummy (ssax:read-pi-body-as-string port)))
seed))

This procedure can then be specified as a handler for processing
instructions (PIs) in the document, which just ignores them.  Without
such a dummy handler, one gets a warning message from ssax:make-parser
that PIs are being left unprocessed.

However, I am not advocating a full export of ssax from sxml.  I am fine
with importing ssax separately in my files.  I just thought that it is
good to keep a record of its useful identifiers.

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-17 Thread Greg Hendershott
One of my favorite small things about Racket is that is permits almost
anything to be an identifier -- allowing you to use whatever natural
names you prefer.

In addition to Unicode, identifiers can start with a number:

(define 100-continue? "✓")

In the rare case where an identifier wouldn't be valid, you can use it
anyway inside pipe chars:

(define |identifier with spaces| "✓")

(But it would be idiomatic to use `identifier-without-spaces`.)


You can even use identifiers that are entirely some number of spaces:

(define | | "one space")
(define |  | "two spaces")
(equal? | | |  |)  ;#f

Which I suppose can be a nutritious part of a code obfuscation diet. :)


One gotcha, which I remember confusing myself with, early on:

(define 'foo "foo")
'1 ;"foo"
'2 ;"foo"

Huh? That's because 'foo is reader shorthand for (quote foo). So the
above is actually:

(define (quote foo)
  "foo")
(quote 1)
(quote 2)

In other words, it defines `quote` as a constant function that always
returns "foo". Definitions in a module shadow those provided by the
module's language -- in this case the `quote` provided by racket.
(Definitions provided by a `require`d module, however, can't be
shadowed -- that's a redefinition error.)

-- 
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-17 Thread N. Raghavendra
At 2018-05-17T11:11:26-04:00, Greg Hendershott wrote:

> One gotcha, which I remember confusing myself with, early on:
>
> (define 'foo "foo")
> '1 ;"foo"
> '2 ;"foo"
>
> Huh? That's because 'foo is reader shorthand for (quote foo). So the
> above is actually:
>
> (define (quote foo)
>   "foo")
> (quote 1)
> (quote 2)

Yes, that'd be certainly confusing if one types (define 'foo "foo")
instead of (define foo "foo") by mistake.

Thanks for all the interesting information.

Raghu.

PS: Just migrated to racket-mode from geiser, so will ask here if I have
any queries there.  Thanks for the mode too!

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


<    3   4   5   6   7   8   9   10   11   12   >