Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 2019 22:59
    @dockimbel banned @SmackMacDougal
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
GiuseppeChillemi
@GiuseppeChillemi
It is beacuse all objects are created and you can reference them ?
*is it beacuse all objects have already been created and you can reference them all ?
Vladimir Vasilyev
@9214
As I said, you can't reference something that doesn't exist.
Palaing
@Palaing
I needed replace/all which is not in Red's version of replace, I tried Rebol's version (got from source replace), it works great, and it even allows to give a function as third argument. Any reason why this is not integrated in Red ?
Vladimir Vasilyev
@9214
@Palaing red/REP#18
Palaing
@Palaing
@9214 Oh yes thanks. Now I will know where to make such remarks :)
GiuseppeChillemi
@GiuseppeChillemi

@9214 A simple "" made me crazy....
I have a bunch of dynamically created buttons
Their face/data content refer to dynamically created areas objects

    foreach [tag name] buttons [
        keep compose [
            (to set-word! name) area 300x50 (copy "") wrap
      ]
    ]

The function executed when I hit one of the buttons pass the face/data, which is <areaname> ,and then I print <areaname>/text....

I always had the same printed result despite the button I hit....

Four hours to discover that tiny "" had to be changed to (copy "") !

nedzadarek
@nedzadarek

Does anyone knows the Logo? You can play with it here.
I want to mimic Logo's functionality. What I need is to keep a) current pen position and b) rotation. shape sub-dialect keeps pen position but it does not know about rotation. I have found out that I can rotate over some point (rotate <degree> <point>). However I am rotating using values computed by me. Here is an example. I want to draw square.
The Logo code:

; just so we can start as Red's shape
right 90 

forward 40
right 90
forward 40
right 90
forward 40
right 90
forward 40

and here is the Red's code:

view [base 300x300 red draw [

  shape [ move 100x100 ]
  shape [ 'line 40x0 ] 

  rotate 90 140x100
  shape ['line 40x0]

  rotate 90 180x100
  shape ['line 40x0 ]

  rotate 90 220x100
  shape ['line 40x0 ]
 ]
]

Is there some function or word that keeps current pen position? I want to use it like rotate 90 _pen-position_ instead of hard-coded rotate 90 220x100.

Vladimir Vasilyev
@9214
@nedzadarek can't you just keep turtle's position and heading, emitting Draw code from compiler?
ne1uno
@ne1uno
relative position? '
Vladimir Vasilyev
@9214
@nedzadarek instead of mashing Draw code by hand, you can write Logo compiler/interpreter which will track turtle's coordinates with rotation angle and produces a Draw block automatically, by reading Logo commands.
nedzadarek
@nedzadarek

@9214

can't you just keep turtle's position and heading

Right! I'm too tired to remember most obvious things: shapes command uses end-point (pen position). So, as you said, I can just keep that 2 values.
Thank you.

GiuseppeChillemi
@GiuseppeChillemi
Is there any good Reading example in vid faces positioning ? I wish to have a Windows with Two orizontal Lines of buttons on the top, then a big area just below them on the left and many small areas spread vertically on the right. Each area should have a tittle just on the top of It.
I am going Crazy on this
Vladimir Vasilyev
@9214
GiuseppeChillemi
@GiuseppeChillemi
Needs articles and examples
view [
    style small: area 30x30

    button button button return
    button button button return
    area below small small small
]
GiuseppeChillemi
@GiuseppeChillemi
Small should be on the right of 300x500
area
Vladimir Vasilyev
@9214
Okay, now go on and fix it :wink:
GiuseppeChillemi
@GiuseppeChillemi
@9214 I'll look at It in few minutes. Those were my last words before falling asleep , written in my bed.
I still have bit seen the result of your examples
*still not seen
ne1uno
@ne1uno
@GiuseppeChillemi you can use a group-box to make some layout simpler, I don't think you can turn off the border though
GiuseppeChillemi
@GiuseppeChillemi
@9214 I have tried and it works. Now I have started experimenting.
It seems when you draw a face the cursor is moved just after it. So, if you write BELOW and you have draw the last on as ACROSS, then you have CURSOR LEFT - DRAW - CURSOR DOWN DRAW
GiuseppeChillemi
@GiuseppeChillemi
Is there a way to TRIGGER the default event connected to a face ?
GiuseppeChillemi
@GiuseppeChillemi
@toomasv @9214
Thanks for your help. I have just published the first working version: https://github.com/GiuseppeChillemi/textsplithelper.red/blob/master/TextSplitHelper.red
Attribution inside
This my first ever code published on GITHUB.
I will use this software to catalog all my notes.
But has many other applications when splitting text lines to corresponding categories
(user defined inside the script, visually on newer releses)
Toomas Vooglaid
@toomasv
@GiuseppeChillemi :+1:
@nedzadarek My turtle here:
turtle
Or is it bug?
nedzadarek
@nedzadarek
@toomasv are you trying to draw a square and are you using my (edited) code? If yes then it should work for square because after each line we rotate by 90 degree so <center> parameter ( (optional) center of rotation (pair!)) doesn't matter. We should calculate <center> parameter other way.
Toomas Vooglaid
@toomasv
@nedzadarek Neither. It's my code and turtle is drived by arrow-keys where-ever needed.
nedzadarek
@nedzadarek
@toomasv so what's the bug? It seems to move correctly (we don't know the key-presses) and it just goes off-screen (that's normal).
Toomas Vooglaid
@toomasv
@nedzadarek Sorry, I meant that it looks rather like a bug. But on closer inspection it is clearly not a bug. :smile:
nedzadarek
@nedzadarek
@toomasv oh :D Well, to me it looks like a turtle. It walks (slowly) as a turtle... so it must be a turtle.
Gregg Irwin
@greggirwin

@toomasv :^)

@nedzadarek Maybe not useful but: https://github.com/greggirwin/R2-ReboLogo

nedzadarek
@nedzadarek
@greggirwin :+1: I have yet to understand syntax but it is not far from the Rebol/Logo.
You once mentioned the Logo. I thought I would try it as a programmer (I have seen it when I was young). It has very easy syntax but it is capable of doing amazing things, even by accidents. Non-programmers can learn how to program and programmers can use it for building fractals, space-filling-curves etc.
What do you think about extending draw/shape of the Logo's features (rotation/heading, loops, conditions, functions etc)?
GiuseppeChillemi
@GiuseppeChillemi
Hi, which are the corresponding events in VID for:
Right Mouse Button
Middle mouse Button
Wheel rotation ?
dsunanda
@dsunanda
All the event names are listed here: event names - just remember that the name in the code block is ON-xxx where xxx is the listed event name.
Gregg Irwin
@greggirwin
@nedzadarek we could implement a separate drawing dialect, that works like the Logo turtle, but should probably keep draw as it is, since the two paradigms are quite different. For example, DRAW is strictly declarative, while the turtle commands are not.
Logo is almost just Lisp without the parens. Brian Harvey wrote a 3 volume series about it: Computer Science Logo Style.
nedzadarek
@nedzadarek
@greggirwin It is interesting. So, we would call draw and that dialect like view base draw[draw code]logo[logo code]?
Gregg Irwin
@greggirwin
You could easily compose things in that way for static drawings, but the real use of the turtle in logo was as a more interactive tool for thinking and learning. Draw is static while watching the turtle move and draw is a big part of that experience, which means your Logo drawing commands are really tied to a timer of some kind. What we could do, then, is set a canvas face for the turtle commands, and as you run them, the draw block for that face would be updated, so the Logo part is in control there.
nedzadarek
@nedzadarek
@greggirwin Interesting - thank you for the response.
lepinekong
@lepinekong_twitter
@nedzadarek of course I had seen any-type and block in help. My point is I contest this design choice as a condition is semantically one thing so there's no reason to have 2 different sets for value.
lepinekong
@lepinekong_twitter
@nedzadarek @toomasv I'm looking too for teaching kids programming. Is there code somewhere ? It seems much more difficult to do in Red than in Scratch especially the tortoise moving her legs ;)