Re: [racket-users] Blockly-Like Interface in DrRacket

2018-01-02 Thread Leif Andersen
Hello Stephens (this is going to be fun...I just know it.)

As Stephen D pointed out, there was a push to add traditional gui elements 
to DrScheme (now DrRacket), which currently lives in the `embedded-gui`[1] 
collection. Although honestly, that library is old and hasn't been 
maintained for years.

Another alternative is my editor collection which is still in VERY early 
stages of development[2], but it also lets you build editors in DrRacket. 
I'm still making a cleaner interface for it, and ultimately I would like to 
be able to make a nice graphical video editor with it. (Powered by #lang 
video[3]). But for now, you can see an example of doing a similar thing 
(making a video editor that is embedded directly in code) on github[4].

Good luck Stephen F. and feel free to ping me if you have any questions.

[1]: https://docs.racket-lang.org/embedded-gui/index.html
[2]: https://github.com/videolang/idmt
[3]: https://lang.video
[4]: https://github.com/videolang/video/blob/master/video/private/editor.rkt

~Leif Andersen

On Monday, January 1, 2018 at 12:39:10 PM UTC-5, Stephen Foster wrote:
>
> Yes, exactly -- Like Snap! except I don't need the runtime, just the code 
> editing paradigm.
>
> I googled for insert-gui and the closest thing I found was this:
>
> https://github.com/mflatt/guibuilder 
> 
>
> This seems really promising.
>
> Also, I didn't know about the plot library and its interactive snips.  So 
> I'll look more deeply at that too.
>
> Thanks!
>
> --Stephen
>
> On Saturday, December 30, 2017 at 5:31:28 PM UTC-8, spdegabrielle wrote:
>>
>> Hi Stephen, 
>>
>> I'm assuming you meant something like Snap (http://snap.berkeley.edu) in 
>> Dr Racket? 
>>  
>> Snips are powerful; they can inserted in text and pasteboard editors; 
>> they can be dynamic(e.g. plot), and they can contain other editors(text or 
>> pasteboard).
>>
>> The only possibly related prior work I’m aware of was an insert-gui 
>> functionality in DrRacket (maybe even DrScheme?) which allowed you to 
>> insert GUI elements into program text.
>>
>> There was a query about 'Extending DrRacket with non-text tabs' that 
>> might be helpful (see 
>> https://groups.google.com/d/msg/racket-users/Iu2XtxNX_Kk/SiavnnkYDEoJ)
>>
>> The DrRacket plugins documentation has a example of extending DrRacket 
>> https://docs.racket-lang.org/tools/implementing-tools.html
>>
>> Kind regards, 
>> Stephen D
>>
>> some documentation links:
>>  * DrRacket Plugins: http://docs.racket-lang.org/tools/index.html
>>
>>  * Graphical Interface Toolkit: http://docs.racket-lang.org/gui/ 
>> * Pasteboard(editor): 
>> http://docs.racket-lang.org/gui/pasteboard_.html
>>
>>
>> On Thu, 28 Dec 2017 at 04:30, Stephen Foster  
>> wrote:
>>
>>> If I wanted to build a drag-and-drop, visual programming interface for 
>>> programming in DrRacket, is there any prior work I can build on?  Ideally, 
>>> I'd like to implement this as a DrRacket "snip", so that my students can 
>>> make programs that are partially text-based and partially visual.  Any 
>>> suggestions?  Has anyone done something in the ballpark?  
>>>
>>> -- 
>>> 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.
>>>
>>

-- 
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] How to create a url-based image reference through Scribble

2018-01-02 Thread Matthew Flatt
You'll have to drop down to HTML, more or less, by using `alt-tag` and
`attributes`:

 @(require scribble/core
   scribble/html-properties)
 @elem[#:style (style #f
  (list (alt-tag "img")
(attributes (list (cons 'src "http://foo.gif;)
  (cons 'alt "bar")]

At Tue, 2 Jan 2018 14:19:22 -0800 (PST), Kathi Fisler wrote:
> I'm using Scribble and trying to end up with
> 
> http://foo.gif; alt="bar">
> 
> If I call (image "http://foo.gif; "bar"), I get an error as Scribble tries 
> to treat the url as a path.
> 
> How can I use a URL for the src attribute?
> 
> thanks,
> Kathi

-- 
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] How to create a url-based image reference through Scribble

2018-01-02 Thread Kathi Fisler
I'm using Scribble and trying to end up with

http://foo.gif; alt="bar">

If I call (image "http://foo.gif; "bar"), I get an error as Scribble tries 
to treat the url as a path.

How can I use a URL for the src attribute?

thanks,
Kathi

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

2018-01-02 Thread Sanjeeb Sinkhada
thank you are all your help I've got it now

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


Re: [racket-users] racket

2018-01-02 Thread Neil Van Dyke
One thing that sometimes helps is to get the code on your screen, and 
read through it, word-by-word and punctuation-by-punctuation, pointing 
with your finger or mouse pointer, and "explaining" to yourself what 
each is actually saying, and check what it's saying against what you 
think it's supposed to say.


A slight variation on that is to step through the code like above, but 
explain what it's *supposed* to do, and then check against what the code 
actually says.


This is useful whether you are familiar or unfamiliar with the 
particular language/library you're using.


If it helps you be methodical, force yourself to explain it as if you 
are explaining to another person, rather than to yourself: 
https://en.wikipedia.org/wiki/Rubber_duck_debugging


Also, as you're reading through the code, when you're not very familiar 
with some of language or some library you're using, it sometimes helps 
to look up what the documentation says.  For example, if you're stuck on 
this bit of code, you might go look up in the documentation a `define` 
form means, what a lambda form means, a `cond` form, a `list? procedure 
application, etc.


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


Re: [racket-users] racket

2018-01-02 Thread George Neuner


On 1/2/2018 1:24 PM, Sanjeeb Sinkhada wrote:


(define reduce-pair(λ(x)(cond

      ((list? x)(append (first(first x))

                       (last(second x)))

thank you so much for the reply I got this but still not working


You're getting there.  You have the 1st value and almost have the 2nd value.

The last element of the list is (last x), and the 2nd value of the pair 
is (second x).  In which order do you want to perform those operations?


Then you need to think about creating the result.  Append works with 2 
(or more) lists ... but you have *values* which may not be lists. So you 
can't use append, but you can use "list" to make a list, or "cons" to 
make a pair.


And finally, you need to think about what to do if the argument list is 
empty or isn't composed of pairs.


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

2018-01-02 Thread Sanjeeb Sinkhada
Thanks you 

On Tuesday, January 2, 2018 at 6:09:23 PM UTC, gneuner2 wrote:
>
> On 1/2/2018 12:43 PM, Sanjeeb Sinkhada wrote: 
> > hi could anyone help me with this question? 
> > Write a function that will take a list of pairs and return just the 
> > pair comprising the first element of the first pair and the second 
> > element of the last pair. 
> >  Eg. 
> >  > (reduce-pairs ’()) 
> > NIL 
> >  > (reduce-pairs ’((1 2) (3 4))) 
> > (1 4) 
> >  > (reduce-pairs ’((1 2) (3 4) (5 6))) 
> > (1 6) 
> > 
> > I have got this so far 
> > (define reduce-pair(λ(x y)(cond 
> >   ((pair? x)x) 
> >   (cons( car x) 
> >(cons ( list-tail (second y))) 
> > but its completely wrong 
> > thanks in advance 
>
> Yup, it definitely is wrong. This smells like homework and the 
> homework policy in this forum is to help but not answer directly. 
>
>
> First, your examples have a single list argument, but your function is 
> defined to have 2 arguments.  Why? 
> Second, what should happen if the list contains only 1 pair or contains 
> elements that are not pairs? 
> Third, are you supposed to solve the problem by walking the list, or can 
> you use any pre-defined list functions? 
>
> Think about how you would get the first and last elements of the list.  
> Then think about how you get the first and second values of those 
> pairs.  Then think about how to make a new pair from those values.   If 
> you can use any predefined function, then you're at least half way there 
> already ... you just need to put it together. 
>
> 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] racket

2018-01-02 Thread Sanjeeb Sinkhada

>
> (define reduce-pair(λ(x)(cond
>
>   ((list? x)(append (first(first x))
>
>(last(second x)))
>
> thank you so much for the reply I got this but still not working
 

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


Re: [racket-users] racket

2018-01-02 Thread George Neuner

On 1/2/2018 12:43 PM, Sanjeeb Sinkhada wrote:

hi could anyone help me with this question?
Write a function that will take a list of pairs and return just the 
pair comprising the first element of the first pair and the second 
element of the last pair.

 Eg.
 > (reduce-pairs ’())
NIL
 > (reduce-pairs ’((1 2) (3 4)))
(1 4)
 > (reduce-pairs ’((1 2) (3 4) (5 6)))
(1 6)

I have got this so far
(define reduce-pair(λ(x y)(cond
                          ((pair? x)x)
                          (cons( car x)
                               (cons ( list-tail (second y)))
but its completely wrong
thanks in advance


Yup, it definitely is wrong.     This smells like homework and the 
homework policy in this forum is to help but not answer directly.



First, your examples have a single list argument, but your function is 
defined to have 2 arguments.  Why?
Second, what should happen if the list contains only 1 pair or contains 
elements that are not pairs?
Third, are you supposed to solve the problem by walking the list, or can 
you use any pre-defined list functions?


Think about how you would get the first and last elements of the list.  
Then think about how you get the first and second values of those 
pairs.  Then think about how to make a new pair from those values.   If 
you can use any predefined function, then you're at least half way there 
already ... you just need to put it together.


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

2018-01-02 Thread Sanjeeb Sinkhada
hi could anyone help me with this question?
Write a function that will take a list of pairs and return just the pair 
comprising the first element of the first pair and the second element of 
the last pair.
 Eg.
 > (reduce-pairs ’()) 
NIL
 > (reduce-pairs ’((1 2) (3 4))) 
(1 4)
 > (reduce-pairs ’((1 2) (3 4) (5 6))) 
(1 6) 

I have got this so far
(define reduce-pair(λ(x y)(cond
  ((pair? x)x)
  (cons( car x)
   (cons ( list-tail (second y)))
but its completely wrong
thanks 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.