[racket-users] pie: dancing around 'U does not have a type'

2018-12-30 Thread 'John Clements' via Racket Users
I’m having a great deal of fun working through The Little Typer. I’ve run into 
a problem that I’m sure has a simple solution, but I don’t know what it is. To 
understand my question, let me first give a simple example.

Here’s a dependent type that’s uninhabited when n is zero:

#lang pie

(claim no-zero-please (-> Nat U))
(define no-zero-please
  (λ (n)
(rec-Nat n
  Absurd
  (λ (n-1 prev) Trivial

(the (no-zero-please 2) sole)
(the (no-zero-please 1) sole)
;;; (no-zero-please 0) is uninhabited

Note the use of rec-Nat, which doesn’t require a motive. What if we use 
ind-Nat, instead? Uh oh:

#lang pie

(claim no-zero-please (-> Nat U))
(define no-zero-please
  (λ (n)
(ind-Nat n
  ;; this doesn't work:
  (λ (n) U)
  Absurd
  (λ (n-1 prev) Trivial

(the (no-zero-please 2) sole)
(the (no-zero-please 1) sole)
;;; (no-zero-please 0) is uninhabited

The problem is that the motive has to have the type (-> Nat U), and U doesn’t 
have type U. The rec-Nat works because no motive is necessary.

This raises the question of whether ind-Nat is strictly more expressive than 
rec-Nat, but in the case of Either, the problem is more severe.

I wanted to try to formulate a type that was uninhabited for n=0 and n=1, and I 
thought I was getting there when I formulated a ternary type and
paired it with a type in a rec-Nat:

#lang pie

(claim discrete-3 U)
(define discrete-3 (Either (Either Trivial Trivial) Trivial))

(claim zogo (-> Nat (Pair discrete-3 U)))
(define zogo
  (λ (n)
(rec-Nat n
  (the (Pair discrete-3 U) (cons (left (left sole)) Absurd))
  (λ (n-1 prev)
(ind-Either (car prev)
  ;; oh no! can't type check motive:
  (λ (dc) (Pair discrete-3 U))
  (λ (inner) (ind-Either inner
   (λ (dc) (Pair discrete-3 U))
   (λ (dc) (cons (left (right sole)) Absurd))
   (λ (dc) (cons (right sole) Trivial
  (λ (dc) (cons (right sole) Trivial)))


The problem is that in this case, AFAICT, there’s no “non-motive” version of 
ind-Either.

Am I missing something obvious?

Thanks in advance!

John





-- 
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] Help debugging a custom language read/expansion error

2018-12-30 Thread Matthew Butterick


> On Dec 30, 2018, at 8:41 PM, Jonathan Simpson  wrote:
> 
> I'm doing #1, so I think #2 is the explanation. 'type' is a function 
> available in expander.rkt so the literal will only match that binding. The 
> same is true for 'offset'. Both need to be provided. 'test' is not bound to 
> anything because the macro uses 'compare' as the equivalent function, so 
> 'compare' doesn't need to be provided.
> 
> So I think it all makes sense. Thank you.


PS. This behavior with literals in syntax patterns is specific to 
`syntax-rules` and `syntax-case`. If you switch to `syntax-parse`, you can use 
its `#:datum-literals` option or its `~datum` pattern form to match raw datums 
without bindings.

-- 
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] Help debugging a custom language read/expansion error

2018-12-30 Thread Jonathan Simpson


On Sunday, December 30, 2018 at 8:51:25 PM UTC-5, Matthew Butterick wrote:
>
> Without seeing "reader.rkt" or "expander.rkt" — I'd guess that:
>
> 1) `read-syntax` isn't stripping all bindings from its parse tree before 
> returning it. Though this isn't mandatory, it's a wise practice to avoid 
> mysterious binding problems like this one. (Use `strip-context` in 
> `syntax/strip-context`.)
>
> and 
>
> 2) your list of literals in the `line` macro is stricter than you intend. 
> Macro literals match by datum AND binding, not merely by datum. So if you 
> say `(offset type test message)`, and you have `type` defined outside the 
> macro, then the literal will only match uses of that particular binding of 
> `type`. This is why `(provide type)` seems to fix the problem — you're 
> injecting the binding the macro pattern wants into the source environment. 
> Again, though Racket won't forbid you from managing bindings this way, it 
> can become a tangled web.
>


I'm doing #1, so I think #2 is the explanation. 'type' is a function 
available in expander.rkt so the literal will only match that binding. The 
same is true for 'offset'. Both need to be provided. 'test' is not bound to 
anything because the macro uses 'compare' as the equivalent function, so 
'compare' doesn't need to be provided.

So I think it all makes sense. Thank you.

-- Jonathan

-- 
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: hackernews

2018-12-30 Thread George Neuner
On Thu, 27 Dec 2018 17:15:39 -0500, Hendrik Boom
 wrote:

>On Thu, Dec 27, 2018 at 02:06:22PM -0800, Andrew Gwozdziewycz wrote:
>> On Thu, Dec 27, 2018 at 8:24 AM Brett Gilio  wrote:
>>
>> Python was meant to be a better version
>> of that. The History of Python wiki page suggests it was meant as a
>> "better verson of ABC with exceptions and better integration with the
>> Amoeba Operating System."[1] The exceptions originally were inspired
>> by Modula-3, apparently.
>
>Yeah.  That was the other language I couldn't think of.  One 
>of my favorites for a long time, and implementations still 
>available online.  

It's too bad Python didn't keep some of the other nice things in
Modula 3.


>An elegant language, except for its Pascal syntax.  

It could have stood a few tweaks, but Modula 3's syntax was good for
its intended use: modular projects involving teams of differently
skilled programmers.  Modula 3 was developed largely as a less
threatening alternative to Ada for system/application programming.
Like Ada, Modula 3 could also be used on bare-metal, but it did not
emphasize that use.


YMMV,
George

-- 
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: hackernews

2018-12-30 Thread George Neuner
On Thu, 27 Dec 2018 21:27:02 -0500, Neil Van Dyke
 wrote:

>Stephen De Gabrielle wrote on 12/27/18 4:47 PM:
>> I always wanted to ask if the prototype object model is a good 
>> idea or bad idea?
>
>I think it's not a bad idea, but I think you probably wouldn't use it 
>for general-purpose OOA, OOD, or OOP right now.  For a long time, OO 
>overwhelmingly embraced mostly the same class-instance-inheritance 
>model.  Recently, we're seeing some newly popular languages back off 
>from that very familiar model, including dusting off some ideas like 
>traits/interfaces and mixins/composition.

Given that Javascript is prototype based, it could be said that
prototype is the most widely used object model.

Not to mention:

  - Lua
  - Common Lisp with MOP

and some partial implementations:

  - Objective-C's "categories"   extends classes only
  - Swift's protocol genericsextends classes only

Then there are languages that can (more or less easily) fake
prototyping on top of their normal class-based objects by using
reflection and/or runtime compilation:

  - Python with prototype.py   
  - Perl with Class::Prototyped
  - Java
  - Racket  ;-)
  - Scheme
  - Common Lisp sans MOP
  etc.

Java, Perl, and Python [and probably also Objective-C] certainly count
as widely used even if their prototype abilities are not well known.

 

Prototype objects are well suited to small(ish) projects having a
single developer or even a small, well integrated team.  Where they
fall down is in big projects where you want more strict control over
the prototypes' use.  The notion of being able to "lock" an object
against modifications, or restrict it to use in certain modules, is
rarely included in prototype based systems.

The biggest (IMO) problem with prototype OO is that the lack of a
static hierarchy makes the code very difficult (or impossible) to
optimize.


>Maybe (just speculating, off the cuff) it turns out there's also a place 
>for prototype object models in symbolic machine learning, in acquiring 
>some variation on frame-based representations of knowledge.

There are many good use cases for prototype objects, but if you are
not careful, it is all too easy to screw up.  Most prototype systems
do little or nothing to protect you from yourself - they are
predicated on trusting the programmer not to make dumb mistakes or do
stupid things.

Languages having fine grained dynamic linking and runtime available
compilers - i.e. the ones that can fake it - have eliminated many of
the advantages of prototype based objects.
[OTOH, there is Java which offers both true reflection and runtime
compilation, but actively discourages using either by making both as
inconvenient to use as possible.]


>> The same question applies to Morphic User Interface Construction
>> Environment - good idea or bad idea?

Can't Squeak ;-)  for Morphic - I've never used it.


YMMV,
George

-- 
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] Help debugging a custom language read/expansion error

2018-12-30 Thread Matthew Butterick
> On Dec 30, 2018, at 3:13 PM, Jonathan Simpson  wrote:
> 
> Adding a '(provide type)' in expander.rkt (where 'line' is defined) gets me 
> past this error. Strangely, providing 'compare' or 'offset' doesn't seem to 
> be necessary. I'm interested in any theories as to why this might be the case.

Without seeing "reader.rkt" or "expander.rkt" — I'd guess that:

1) `read-syntax` isn't stripping all bindings from its parse tree before 
returning it. Though this isn't mandatory, it's a wise practice to avoid 
mysterious binding problems like this one. (Use `strip-context` in 
`syntax/strip-context`.)

and 

2) your list of literals in the `line` macro is stricter than you intend. Macro 
literals match by datum AND binding, not merely by datum. So if you say 
`(offset type test message)`, and you have `type` defined outside the macro, 
then the literal will only match uses of that particular binding of `type`. 
This is why `(provide type)` seems to fix the problem — you're injecting the 
binding the macro pattern wants into the source environment. Again, though 
Racket won't forbid you from managing bindings this way, it can become a 
tangled web.

-- 
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] Communicating the purpose of Racket (was: hackernews)

2018-12-30 Thread BD1 a


On Saturday, December 29, 2018 at 11:16:05 PM UTC-5, Alexis King wrote:
>
> > On Dec 29, 2018, at 21:32, Philip McGrath  > wrote: 
> > 
> >> Respectfully, I would also concentrate on Rackets web presence.  If I 
> was to google any of the popular languages, I would find the answer to 
> these questions in spades, with real life applications, and examples.  You 
> can also compare Pythons website to Rackets.   Pythons website seems to be 
> design more for advertising Python.  If I go to the Pythons web page there 
> is a section “use Python for” in it, it has various topics such as web 
> development, GUI development, scientific and numeric, with all the 
> applicable packages needed.   If you knew nothing about Python, but where 
> interested in using it for web development, it easy to see where to go, 
> etc.   
> > 
> > I would be interested to hear more about your experience with Racket's 
> web site, because it tries to include these things, but evidently it did 
> not succeed in communicating them to you. When I go to 
> https://racket-lang.org/ and scroll down about one screen's worth, I see 
> short, runable examples of a few flashy features including web development 
> and GUI applications specifically, with links to tutorials and 
> documentation. 
>
> The previous version of the Racket website (before its redesign two years 
> ago) included such things more explicitly, in a format non-Racketters 
> (which is who the homepage is for, after all!) are more likely to 
> comprehend. It included, among other things, a clear purpose statement for 
> the language at the very top of the page, a set of small, to the point code 
> examples that showed off various kinds of general-purpose programming (with 
> explanations), and a set of links to further resources clearly geared 
> towards programmers of different skill levels. To give you a sense for how 
> this website used to be targeted, here’s the aforementioned purpose 
> statement, in its entirety: 
>
> > Racket is a full-spectrum programming language. It goes beyond Lisp and 
> Scheme with dialects that support objects, types, laziness, and more. 
> Racket enables programmers to link components written in different 
> dialects, and it empowers programmers to create new, project-specific 
> dialects. Racket's libraries support applications from web servers and 
> databases to GUIs and charts. 
>
> >The concepts enumerated in the above statement are linked to the relevant 
> sections in the Guide for those interested in learning more. 
>
 

 I think the above statement is more explicit,  but it still does not 
answer the why, why should I create  project-specific dialects?  I also 
like how the old website has sections for grow you program, grow your 
language and grow your skill.  Here we get more information as to the 
benefits of using racket, with a description that is more descriptive about 
racket capabilities.  



> The following code snippets showed Racket doing mundane but useful tasks 
> an “ordinary” programmer would likely understand. They included things like 
> simple scripting using the filesystem, a small web server, basic terminal 
> I/O, creating a GUI window, a toy web scraper, and even sending e-mail. 
> Towards the end of this carousel of snippets, some of Racket’s 
> language-oriented programming features start to sneak in — there’s a small 
> Typed Racket program, a document written in Scribble, and even a tiny 
> datalog database — but these are clearly secondary to the main point: 
> Racket is a full-spectrum, general-purpose programming language, and if you 
> already know how to program, it is grounded in things familiar to you. 
>
> If you are interested in seeing the old homepage, in all its late aughts 
> design glory, it is preserved with full functionality here: 
>
> 
> https://web.archive.org/web/20161129144201/http://www.racket-lang.org:80/ 
>
> The redesign of the Racket website shifted the emphasis from Racket as a 
> general-purpose programming language to Racket as a language workbench. 
> There is no doubt that this shift has its advantages — Racket’s support for 
> language-oriented programming is one of its features that sets it apart 
> most significantly from other ecosystems. Unfortunately, I don’t think 
> we’ve gotten far enough to really push #lang as a killer feature to the 
> working programmer yet, so I don’t think the current design does much to 
> convey why the average person should care (especially since it focuses a 
> lot on building languages while the old homepage focused more on using 
> languages). I expressed some of these concerns, among others, when the 
> redesign was first proposed; if you are interested, you can read the 
> discussion here: 
>
 

This is one of the points I am trying to make.  Why is #lang a killer 
feature?  What benefits does it bring?  What problem does it solve?  These 
are some of the things that should be on the website.  Here is an example, 
again I am a 

Re: [racket-users] hackernews

2018-12-30 Thread Tomasz Rola
Thanks for your extensive reply. I realized that I have based my
opinions on Racket 6.7 and we are living in 7.1-era, which makes some
(but not all) of my words a bit irrelevant (I was subscribed here for
all this time, but it just... skipped my attention somehow). I will
address few points below.

On Sun, Dec 30, 2018 at 12:24:59AM -0500, Philip McGrath wrote:
> On Sat, Dec 29, 2018 at 1:48 PM Tomasz Rola  wrote:
> 

[...]
> closest relatives: there is ongoing work to implement Racket in Chez
> Scheme, and you will find some of the creators of Racket listed on the
> cover page of R6RS.

Ok, I guess this will suffice for me as sign of connection to the rest
of Lisp-land.

[...]
> stuff) that it expects to be installed via the OS package manager,
> but "Minimal Racket does not require additional native libraries to
> run" , and
> you can configure things so that these are bundled with Racket
> instead. Also, if you prefer, Racket can compile your scripts into
> stand-alone executables, so you could just deploy the binaries if
> that simplifies things.

I think I will play with this "minimal Racket" idea. As of standalone
execs, I will rather stay with scripts.

[...]
> The Racket Guide  points
> you to how to run pure R5RS and R6RS code in Racket: did you not see this,
> or was it not sufficiently clear?

The part of message stating about R5RS and R6RS was quite clear to me
and for long time. What was not clear was if I should expect vanishing
support for those dialects. But from what you have written, it seems
like I do not have to worry too much about it. So now I have lots of
potential worries shot at once, which is good.

> (Of course, writing practical programs in pure portable RnRS Scheme
> is hard,

Acknowledged. I was there and it was 4 on 0-10 point PITA scale.

> > Another niche for which I would like to consider R* is mobile apps
> > (i.e. for smartphone). But, is it possible to do such thing, actually?
> >
> 
> Jay McCarthy has ported Racket to Android:
> https://github.com/jeapostrophe/racket-android It should be possible to do
> likewise for iOS, but I don't know of anyone who's done it yet.

Wonderful. Really.

[...]
> > Python has an excellent "batteries included" motto.  …
> > Something which can talk to and make use of existing Python,
> > Perl, Ruby code? Open up a spreadsheet, read data, feed it to Python
> > library, write back results. … utilities/system
> > programming and/or stuff like reading and manipulating data in files,
> > databases and spreadsheets … And showing some controls for mouse.
> >
> 
> Not only can Racket do all of these things, I personally do essentially all
> of them. "Batteries included" is written right at the top of Racket's
> website . The main distribution comes with a

Since I have visited that site in 6.7 days I can see it underwent a
nice change. Despite the fact that others in this thread would like to
improve it even more.

> package for working with many databases
> , and other packages add
> support for others , as well
> CSV spreadsheets
> . I have been
> using Racket to run Python programs under its control and talk to
> them via standard IO in formats like JSON. I even use Racket's `raco
> setup` tool to manage the Python dependencies, and I'm working on
> integrating the Python docstrings into Racket's Scribble
> documentation.
> In Racket itself, I maintain a cross-platform (Windows, Mac, and
> GNU/Linux) GUI app, a server-side web application (including proxies
> and virtual hosts managed from within Racket), and various utilities
> for managing a large corpus of XML documents.

Very interesting. The thought of puppeting one interpreter from
another one is kind of hypnotizing me. And this (whole paragraph) is
the kind of stuff that would have kept me interested in Racket during
last two years, should I know about it (of course I am not blaming
you, or anybody else, but this is how things mishappen, mostly my own
lack of initiative plus circumstances).

> The Racket language has compelling features (e.g.  continuations,
> contracts, green threads, DSLs) that make it more effective and
> productive for my purposes than any other language I've encountered.

Yep, I realize that. Since we are coming out, I have for years written
small and low-medium utils in various scripting languages. But writing
one or two of them in Elisp (it - or Emacs - can be utilised in such
role) was quite an eye opening experience. There were some limitations
to such "scripting" - no exec funcall (at least not in E24, AFAIK),
and no easy way to process files in pieces (and the hard way was
uninteresting). Still, it convinced me that I should invest some time
into doing more scripts in such way.

I rarely use 

Re: [racket-users] Re: hackernews

2018-12-30 Thread BD1 a


On Saturday, December 29, 2018 at 10:32:28 PM UTC-5, Philip McGrath wrote:
>
> On Sat, Dec 29, 2018 at 10:31 AM BD1 a > 
> wrote:
>
>>
>> Are you looking for more or different material, or was it not clear to 
> you from the presentation on the website that these examples were what you 
> are looking for? I guess I can see some potential issues for 
> discoverability: you have to click to show any prose, even a heading 
> (rather than just code), and introducing the examples with "Make your dream 
> language, or use one of the dozens already available, including these —" 
> may not make it obvious what kind of examples these are, especially to 
> non-Racketeers, and especially since it's possible to write GUI and web 
> programs in Racket without using a special #lang.
>

This is one of the points I am trying, maybe unsucesfully, to make.  If you 
place yourself in the shoes of someone who knows nothing about Racket, and 
decided to visit it page for more information, what would you find?   Would 
Rackets website answer the questions you seek?  Would you choose Racket 
over a more popular language?  

-- 
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: Racket good for GUI apps! :)

2018-12-30 Thread Alex Harsanyi
You cannot do that: The control already uses text% snips internally for each
item, but it redefines their `on-default-char` method to discard all 
keyboard
input, which means they are not editable in-line.

If you want to have a look, the implementation for the hierarchical-list%, 
is
in your Racket installation under the "share/pkgs/gui-lib/mrlib/hierlist/"
folder.

Your option is to copy out the hierarchical-list% implementation and modify 
it
yourself. Simply removing the `on-default-char` override might create 
further
problems with how the snip% objects interact with each other and the
pasteboard% object which manages them.

I believe modifying the hierarchical-list% will work, but it involves a lot 
of
work and might not be a good task for someone who just starts out with 
Racket
GUI programming.

Alex.


On Monday, December 31, 2018 at 12:19:16 AM UTC+8, Andre Garzia wrote:
>
> Following the topic of Racket gui apps I decided to ask a question here 
> before I plunge into a rabbit hole from which I may take hours to climb 
> back. I am trying to implement a type of GUI app which is usually called an 
> outliner. Basically it should be a Hierarchical List like the one provided 
> by:
>
>   http://docs.racket-lang.org/mrlib/Hierarchical_List_Control.html 
>
> but with each item being editable. I thought, maybe wrongly, that I could 
> somehow build on top of that control and instead of using a "text%" use 
> some kind of editor or input field for each item by altering the mixin that 
> is used when you add a new item, but so far I don't see how to do it. I am 
> new to Racket Gui stuff and this task is not obvious to me. Can someone 
> here share a clue or two? 
>
> Thanks a lot in advance.
>
> Em domingo, 30 de dezembro de 2018 11:34:23 UTC, spdegabrielle escreveu:
>>
>> There oate other examples but I just saw this:
>>
>>
>> https://twitter.com/id_aa_carmack/status/1079200506139103233?s=21
>>
>> If you like to know more about creating GUI apps in Racket? Just start 
>> here: http://docs.racket-lang.org/gui/index.html
>>
>> S.
>>
>>
>> -- 
>> 
>>
>

-- 
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: hackernews

2018-12-30 Thread BD1 a


Here is the short version.


  Rackets website does not sell Racket, it does not answer the WHY, someone 
should choose racket to solve problems.  It’s not clear as to the benefits 
of using racket, it’s not clear what advantage I get for choosing Racket 
over something like Python for web development, etc.  It seems as if 
Rackets website is more suited towards someone who already measure the pro 
and cons of using a lisp like language, an individual who has already 
consciously made the decision to go with Racket, instead of showcasing the 
strengths of Racket to the uninitiated.   For example, let’s say you had 
some problem that you needed to solve and you had no idea about Racket or 
Python, and the only information you can get is from their respective web 
pages.  Which language would you choose and why?

>From my understanding, many of you use Racket to get real work done.  What 
is the reason behind your choice?  What benefits does using racket have 
above using a more popular language?  Why are these reasons not highlighted 
on Rackets website?  As I said in an above post, I am a just a beginner,  I 
have little to no idea what it means to refractor your code, design 
patterns, or any of the other jargon used in the software industry.  Don’t 
concentrate on the specifics of my critique, try to look at the overall 
point I am trying to make…..The Racket website does not sell Racket.   Here 
is another example, many of you work in the software industry.  If you 
where to ask your coworkers what macros are, what would they say?  Would 
they even understand the benefits the macros system in Racket brings?  If 
you ask them about language-oriented programming, what would they say?  
Would they truly understand what it is, and the benefits it brings?  Do 
your coworkers even understand how special Racket is?  Even If the answer 
is yes to these questions, in addition to what is already there, are some 
of the things that should also be highlighted on Rackets website.  

 

Longer version

 Let me refine my critique of Racket web presence.  We are talking about 
making Racket more popular, not the functionalities of the Racket 
language.   There is a lot less noise around Racket than other more popular 
languages.  This is an advantage that the Racket community can exploit.  
 Because of the lack of popularity, IMHO the Racket community needs utilize 
Racket webpage to SELL the use of racket as a possible solution to various 
problems.   For example, let’s look at Python.  I choose Python here not to 
compare Python capabilities to Racket but because it is one of the most 
popular languages in use today.Imagine if you knew nothing about 
programing but had problem you needed to solve and you landed on the Python 
website.  Out side of the tabs, you see that “Python is a programming 
language that lets you work quickly and integrate systems more effectively” 
Notice, it does not say that python is a scripting language or use some 
sort of computing jargon to describe Python.  It use words that a 
non-programmer can understand.  It simple, and to the point.If you 
would conduct the same exercise with Racket you see “Racket solves 
problems-make languages”.   To me it reads that Racket solves problems by 
making languages.  This sounds more complex than it needs to be.  WHY do I 
want to complicate my problem by making a language?  What I want to do is 
to solve my problem as efficiently as possible.  Making a language seems 
like an unneeded extra step.  Now my view of Racket is tainted by that 
statement.  As I continue to explore the site, I learn that Racket is 
cross-platform, etc.  I also learn that Racket has various packages for web 
applications,  math and statistics, etc.  Mind you my view of racket has 
already been formed, when I click on web applications I am greeted with an 
tutorial on web applications in Racket.  But there is still no answer as to 
WHY solving problems by making languages would be beneficial in my use 
case.   Compare that to Python website, when you click on Django, by the 
Web Development tab.   You are greeted by “Django makes it easier to build 
better web apps more quickly and with less code” Which is totally in line 
with the mission statement above.  We also learn that Django is 
“ridiculously fast, Reassuringly secure, Exceedingly scalable” again Python 
is answering the WHY, and its Answer is totally aligned with its mission 
statement.   When you go to the racket website and explore it, you are 
greeted with “Racket is a general -purpose programming language as well as 
the world’s first ecosystem for language -oriented programming.  Make your 
dream language, or use one of the dozen already available”   What does that 
mean?  What is language -oriented programming?  How do these things help me 
solve my problems?   The section powerful macros and languages seems to be 
able to answer some of these questions.   When you roll over it, it claims 
that’s 

Re: [racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Jonathan Simpson
Adding a '(provide type)' in expander.rkt (where 'line' is defined) gets me 
past this error. Strangely, providing 'compare' or 'offset' doesn't seem to 
be necessary. I'm interested in any theories as to why this might be the 
case.

Thanks for your help.

-- Jonathan

On Sunday, December 30, 2018 at 5:14:38 PM UTC-5, Jens Axel Søgaard wrote:
>
> Den søn. 30. dec. 2018 kl. 22.33 skrev Jonathan Simpson  >:
>
>> On Sunday, December 30, 2018 at 3:58:50 PM UTC-5, Jens Axel Søgaard wrote:
>>
>>> The error
>>>
>>> line: bad syntax
>>> (line (offset 0) (type (string8 "string")) (test (strtest "MZ")))
>>>
>>> means that the macro `line` doesn't have a clause that matches the input.
>>>
>>> How is line defined?
>>>
>>> /Jens Axel
>>>
>>
>> (define-syntax line
>>   (syntax-rules (offset type test message)
>> [(line (offset off) (type type-expr) (test test-expr)) 
>>  (magic-test (offset off) (type (quote type-expr) (quote test-expr)) 
>> (compare (quote test-expr)))]
>> [(line (offset off) (type type-expr) (test test-expr) (message msg)) 
>>  (magic-test (offset off) (type (quote type-expr) (quote test-expr)) 
>> (compare (quote test-expr)) msg)]))
>>
>> This is defined in my expander, and it seems to work from the REPL with 
>> expander.rkt loaded.
>>
>
> Try adding a clause:
>  
> (define-syntax line
>   (syntax-rules (offset type test message)
> [(line (offset off) (type type-expr) (test test-expr)) 
>  (magic-test (offset off) (type (quote type-expr) (quote test-expr)) 
> (compare (quote test-expr)))]
> [(line (offset off) (type type-expr) (test test-expr) (message msg)) 
>  (magic-test (offset off) (type (quote type-expr) (quote test-expr)) 
> (compare (quote test-expr)) msg)]
> [_ "no clause found in line"]))
>
> If you get the string instead of the "bad syntax" we know that something 
> unexpected happened.
>
> I am guessing it has "something" to do with either offset, type, test or 
> message which
> will only match in syntax-rules, if the context is correct.
>
> /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.


Re: [racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Jens Axel Søgaard
Den søn. 30. dec. 2018 kl. 22.33 skrev Jonathan Simpson :

> On Sunday, December 30, 2018 at 3:58:50 PM UTC-5, Jens Axel Søgaard wrote:
>
>> The error
>>
>> line: bad syntax
>> (line (offset 0) (type (string8 "string")) (test (strtest "MZ")))
>>
>> means that the macro `line` doesn't have a clause that matches the input.
>>
>> How is line defined?
>>
>> /Jens Axel
>>
>
> (define-syntax line
>   (syntax-rules (offset type test message)
> [(line (offset off) (type type-expr) (test test-expr))
>  (magic-test (offset off) (type (quote type-expr) (quote test-expr))
> (compare (quote test-expr)))]
> [(line (offset off) (type type-expr) (test test-expr) (message msg))
>  (magic-test (offset off) (type (quote type-expr) (quote test-expr))
> (compare (quote test-expr)) msg)]))
>
> This is defined in my expander, and it seems to work from the REPL with
> expander.rkt loaded.
>

Try adding a clause:

(define-syntax line
  (syntax-rules (offset type test message)
[(line (offset off) (type type-expr) (test test-expr))
 (magic-test (offset off) (type (quote type-expr) (quote test-expr))
(compare (quote test-expr)))]
[(line (offset off) (type type-expr) (test test-expr) (message msg))
 (magic-test (offset off) (type (quote type-expr) (quote test-expr))
(compare (quote test-expr)) msg)]
[_ "no clause found in line"]))

If you get the string instead of the "bad syntax" we know that something
unexpected happened.

I am guessing it has "something" to do with either offset, type, test or
message which
will only match in syntax-rules, if the context is correct.

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


Re: [racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Jonathan Simpson
On Sunday, December 30, 2018 at 3:58:50 PM UTC-5, Jens Axel Søgaard wrote:

> The error
>
> line: bad syntax
> (line (offset 0) (type (string8 "string")) (test (strtest "MZ")))
>
> means that the macro `line` doesn't have a clause that matches the input.
>
> How is line defined?
>
> /Jens Axel
>

(define-syntax line
  (syntax-rules (offset type test message)
[(line (offset off) (type type-expr) (test test-expr)) 
 (magic-test (offset off) (type (quote type-expr) (quote test-expr)) 
(compare (quote test-expr)))]
[(line (offset off) (type type-expr) (test test-expr) (message msg)) 
 (magic-test (offset off) (type (quote type-expr) (quote test-expr)) 
(compare (quote test-expr)) msg)]))

This is defined in my expander, and it seems to work from the REPL with 
expander.rkt loaded.

-- Jonathan
 

>  
>
> Den søn. 30. dec. 2018 kl. 21.27 skrev Jonathan Simpson  >:
>
>> I'm bumbling through my first attempts at creating a language in Racket 
>> and am currently stuck debugging an error in expansion. I have a macro in 
>> my expander that works fine until I try to run the language.
>>
>> Here's what the macro stepper in DrRacket gives me:
>>  
>> [Error]
>>
>>
>> line: bad syntax
>> (line (offset 0) (type (string8 "string")) (test (strtest "MZ")))
>>
>>
>> while executing macro transformer in:
>> (module magic-mod "expander.rkt"
>>   (#%module-begin
>>(module configure-runtime '#%kernel
>>  (#%module-begin (#%require racket/runtime-config) (#%app configure '
>> #f)))
>>(#%app call-with-values (lambda () (quote #f)) print-values)
>>(#%app call-with-values (lambda () (quote #f)) print-values)
>>(#%app
>> call-with-values
>> (lambda ()
>>   (#%app
>>(line (offset 0) (type (string8 "string")) (test (strtest "MZ")))
>>(level
>> (line
>>  (offset 24)
>>  (type (numeric "leshort"))
>>  (test (numtest "<" 64))
>>  (message "MZ executable (MS-DOS)"))
>> (line (offset 24) (type (numeric "leshort")) (test (numtest ">" 
>> 63)))
>> (level
>>  (line
>>   (offset (indoff 60 (size (lelong ".l"
>>   (type (string8 "string"))
>>   (test (strtest "PE\\0\\0"))
>>   (message "PE executable (MS-Windows)"))
>>  (line
>>   (offset (indoff 60 (size (lelong ".l"
>>   (type (string8 "string"))
>>   (test (strtest "LX\\0\\0"))
>>   (message "LX executable (OS/2)"))
>> print-values)))
>>
>>
>>
>> The macro line should expand to:
>>
>> (magic-test (offset 0) (type '(string8 "string") '(strtest "MZ")) (compare 
>> '(strtest "MZ")))
>>
>> And this works fine when run it from my expander.rkt.
>>
>> Here's the file I'm actually executing when I get the error:
>> #lang reader "reader.rkt"
>>
>>
>> # MS Windows executables are also valid MS-DOS executables
>> 0   string  MZ
>> >0x18   leshort <0x40   MZ executable (MS-DOS)
>> #>>(4.s*512) leshort 0x014c  COFF executable (MS-DOS, DJGPP)
>> #>>(4.s*512) leshort !0x014c MZ executable (MS-DOS)
>> # skip the whole block below if it is not an extended executable
>> >0x18   leshort >0x3f
>> >>(0x3c.l)  string  PE\0\0  PE executable (MS-Windows)
>> >>(0x3c.l)  string  LX\0\0  LX executable (OS/2)
>>
>> I know that the procedure application will eventually fail because 
>> magic-test doesn't return a function. This code is a work in progress. I 
>> just want to know if the reading/expansion is working properly. I feel like 
>> I'm probably just missing something basic.
>>
>> Thanks for any help,
>> -- Jonathan
>>
>> -- 
>> 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...@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] Help debugging a custom language read/expansion error

2018-12-30 Thread Jens Axel Søgaard
The error

line: bad syntax
(line (offset 0) (type (string8 "string")) (test (strtest "MZ")))

means that the macro `line` doesn't have a clause that matches the input.

How is line defined?

/Jens Axel


Den søn. 30. dec. 2018 kl. 21.27 skrev Jonathan Simpson :

> I'm bumbling through my first attempts at creating a language in Racket
> and am currently stuck debugging an error in expansion. I have a macro in
> my expander that works fine until I try to run the language.
>
> Here's what the macro stepper in DrRacket gives me:
>
> [Error]
>
>
> line: bad syntax
> (line (offset 0) (type (string8 "string")) (test (strtest "MZ")))
>
>
> while executing macro transformer in:
> (module magic-mod "expander.rkt"
>   (#%module-begin
>(module configure-runtime '#%kernel
>  (#%module-begin (#%require racket/runtime-config) (#%app configure '
> #f)))
>(#%app call-with-values (lambda () (quote #f)) print-values)
>(#%app call-with-values (lambda () (quote #f)) print-values)
>(#%app
> call-with-values
> (lambda ()
>   (#%app
>(line (offset 0) (type (string8 "string")) (test (strtest "MZ")))
>(level
> (line
>  (offset 24)
>  (type (numeric "leshort"))
>  (test (numtest "<" 64))
>  (message "MZ executable (MS-DOS)"))
> (line (offset 24) (type (numeric "leshort")) (test (numtest ">" 63
> )))
> (level
>  (line
>   (offset (indoff 60 (size (lelong ".l"
>   (type (string8 "string"))
>   (test (strtest "PE\\0\\0"))
>   (message "PE executable (MS-Windows)"))
>  (line
>   (offset (indoff 60 (size (lelong ".l"
>   (type (string8 "string"))
>   (test (strtest "LX\\0\\0"))
>   (message "LX executable (OS/2)"))
> print-values)))
>
>
>
> The macro line should expand to:
>
> (magic-test (offset 0) (type '(string8 "string") '(strtest "MZ")) (compare
> '(strtest "MZ")))
>
> And this works fine when run it from my expander.rkt.
>
> Here's the file I'm actually executing when I get the error:
> #lang reader "reader.rkt"
>
>
> # MS Windows executables are also valid MS-DOS executables
> 0   string  MZ
> >0x18   leshort <0x40   MZ executable (MS-DOS)
> #>>(4.s*512) leshort 0x014c  COFF executable (MS-DOS, DJGPP)
> #>>(4.s*512) leshort !0x014c MZ executable (MS-DOS)
> # skip the whole block below if it is not an extended executable
> >0x18   leshort >0x3f
> >>(0x3c.l)  string  PE\0\0  PE executable (MS-Windows)
> >>(0x3c.l)  string  LX\0\0  LX executable (OS/2)
>
> I know that the procedure application will eventually fail because
> magic-test doesn't return a function. This code is a work in progress. I
> just want to know if the reading/expansion is working properly. I feel like
> I'm probably just missing something basic.
>
> Thanks for any help,
> -- Jonathan
>
> --
> 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.


[racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Jonathan Simpson
I'm bumbling through my first attempts at creating a language in Racket and 
am currently stuck debugging an error in expansion. I have a macro in my 
expander that works fine until I try to run the language.

Here's what the macro stepper in DrRacket gives me:
 
[Error]


line: bad syntax
(line (offset 0) (type (string8 "string")) (test (strtest "MZ")))


while executing macro transformer in:
(module magic-mod "expander.rkt"
  (#%module-begin
   (module configure-runtime '#%kernel
 (#%module-begin (#%require racket/runtime-config) (#%app configure '
#f)))
   (#%app call-with-values (lambda () (quote #f)) print-values)
   (#%app call-with-values (lambda () (quote #f)) print-values)
   (#%app
call-with-values
(lambda ()
  (#%app
   (line (offset 0) (type (string8 "string")) (test (strtest "MZ")))
   (level
(line
 (offset 24)
 (type (numeric "leshort"))
 (test (numtest "<" 64))
 (message "MZ executable (MS-DOS)"))
(line (offset 24) (type (numeric "leshort")) (test (numtest ">" 63
)))
(level
 (line
  (offset (indoff 60 (size (lelong ".l"
  (type (string8 "string"))
  (test (strtest "PE\\0\\0"))
  (message "PE executable (MS-Windows)"))
 (line
  (offset (indoff 60 (size (lelong ".l"
  (type (string8 "string"))
  (test (strtest "LX\\0\\0"))
  (message "LX executable (OS/2)"))
print-values)))



The macro line should expand to:

(magic-test (offset 0) (type '(string8 "string") '(strtest "MZ")) (compare 
'(strtest 
"MZ")))

And this works fine when run it from my expander.rkt.

Here's the file I'm actually executing when I get the error:
#lang reader "reader.rkt"


# MS Windows executables are also valid MS-DOS executables
0   string  MZ
>0x18   leshort <0x40   MZ executable (MS-DOS)
#>>(4.s*512) leshort 0x014c  COFF executable (MS-DOS, DJGPP)
#>>(4.s*512) leshort !0x014c MZ executable (MS-DOS)
# skip the whole block below if it is not an extended executable
>0x18   leshort >0x3f
>>(0x3c.l)  string  PE\0\0  PE executable (MS-Windows)
>>(0x3c.l)  string  LX\0\0  LX executable (OS/2)

I know that the procedure application will eventually fail because 
magic-test doesn't return a function. This code is a work in progress. I 
just want to know if the reading/expansion is working properly. I feel like 
I'm probably just missing something basic.

Thanks for any help,
-- Jonathan

-- 
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] hackernews

2018-12-30 Thread Neil Van Dyke
Tomas, thank you for your helpful comments.  I just wanted to comment on 
a couple side points right now.


Tomasz Rola wrote on 12/29/18 1:48 PM:
I understand Racket community no longer considers themselves as part 
of Scheme landscape, but I am unable to say where I get this 
impression from.


I've been one of the people propagating that, for two reasons:

1. That was the impression I got of the intention of the name change 
from PLT Scheme, and I guessed it was a time to be a team player. :)


2. Many of the most savvy developers will immediately want to use 
"standard Scheme", not "embrace proprietary variants". But 
standard Scheme was a really great baseline foundation -- just not 
sufficiently as a complete general-purpose production language. So 
people were shooting themselves in the foot by trying to get by with 
R5RS and SRFIs.


(I say this as one of those foot-sharpshooters.  When I picked Scheme as 
my next language platform for rapid R, I started writing missing 
essential libraries and tools for it, and I went to a great deal of 
trouble to keep them portable, and to test with maybe 10 different 
Scheme implementations, with some scripts to package for a few of them.  
Eventually, I decided I was handicapping myself too much, so I switched 
to developing in PLT Scheme only, but always knowing how to switch to 
Gambit, Kawa, Chicken, Guile, or some other Scheme implementation with 
different strengths that I might need.  I announced this, maybe a few 
other Scheme and other Lisp people followed me to PLT, and some others 
who focused on non-PLT Schemes took up repackaging some of my libraries 
for those. The choice of PLT turned out to be a good one.)


(That said, RnRS is done by great people, and I think it would be good 
if all the Scheme variants could find a common svelte baseline again, 
and to continue to explore a diversity of different approaches and goals 
atop that baseline.  Then, for a comprehensive "standard library" today, 
I'd favor a more decentralized model. Some of it perhaps much like 
SRFIs, but maybe a little closer to IETF RFC and STD, combined with de 
jure "standards" of the day based on current popularity of open source 
libraries, some of which might eventually might turn into something like 
RFC/STD.  For example, given a baseline language, many libraries from 
Racket, Scheme48, and elsewhere might simply be used, and that's enough, 
and some might go through an RFC or STD process beyond that.  In any 
case, standardization efforts people care about tend to be a massive 
amount of work, especially when there's community involvement, and I do 
not envy those who heroically take on that task.)



BTW, maybe jobs using Racket will also encourage a lot more quality contributions of 
packages, when there's the additional motivation of open source "auditioning" 
for jobs, in addition to the current community participation, platform promotion, and 
love of craft.

Forget it. I think this is standing a problem on its head.


That "BTW" was not suggesting how to create jobs, but speculating a 
major reason why Rust-like contributions growth might happen once jobs 
exist (and why Racket hasn't yet seen that degree of sustained 
contributions).


(I have a holistic development model in mind that should give you 
optional open source contributions almost for free (doing things you'd 
do anyway for your project's and organization's immediate needs).  But 
that kind of organizational altruism/alignment/PR contribution, together 
with individual purely altruistic or collaborative contributions, are 
not the only kind or motivation of contributions -- another motivation 
is marketing of individual developers.   Individual marketing via open 
source (and blog posts, etc.) has been a thing since at least the start 
of Web popularity, but seems to be more of a standard practice than it 
used to be.)


--
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] Escaping strings for the shell

2018-12-30 Thread David Storrs
On Sat, Dec 29, 2018 at 2:25 PM Neil Van Dyke  wrote:
>
>
> > /tmp/Sara's birthday, 9/12/01-18/181: No such file or directory
>
> The "/" in the filename is a separate problem, which actually has
> nothing to do with shell special character command line
> escaping/quoting.  If you're on a Unix derivative OS, it normally
> expects "/" to be a directory separator in a file pathname

Yes.  That's why I expected it to fail.  :>   In a normal command line
I would put single quotes around that and it would be fine, or
backwhack the /.  Unfortunately, Racket disliked both of those
solutions, hence the problem.

I'm trying to download a friend's files and was trying to use the
filenames she gave them on Flickr.  I already had a working version
that transformed the filenames to remove difficult characters, but I
was hoping there was a cleaner way.  Thank you for the help -- I
hadn't realized the bit about needing -O to be separate.

-- 
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: Racket good for GUI apps! :)

2018-12-30 Thread Andre Garzia
Following the topic of Racket gui apps I decided to ask a question here 
before I plunge into a rabbit hole from which I may take hours to climb 
back. I am trying to implement a type of GUI app which is usually called an 
outliner. Basically it should be a Hierarchical List like the one provided 
by:

  http://docs.racket-lang.org/mrlib/Hierarchical_List_Control.html 

but with each item being editable. I thought, maybe wrongly, that I could 
somehow build on top of that control and instead of using a "text%" use 
some kind of editor or input field for each item by altering the mixin that 
is used when you add a new item, but so far I don't see how to do it. I am 
new to Racket Gui stuff and this task is not obvious to me. Can someone 
here share a clue or two? 

Thanks a lot in advance.

Em domingo, 30 de dezembro de 2018 11:34:23 UTC, spdegabrielle escreveu:
>
> There oate other examples but I just saw this:
>
>
> https://twitter.com/id_aa_carmack/status/1079200506139103233?s=21
>
> If you like to know more about creating GUI apps in Racket? Just start 
> here: http://docs.racket-lang.org/gui/index.html
>
> S.
>
>
> -- 
> 
>

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