Recent Posts

Pages: [1] 2 3 ... 10
1
General Project Discussion / Re: another lang draft
« Last post by Zero on Today at 07:45:35 am »
Ok, am I understanding correctly?

var(

    //  contains a number
    float zerothOrder     
   
    //  contains a function that returns an integer
    func(int) firstOrder
   
    //  contains a function that returns a function that returns a string
    func(func(str)) secondOrder
)

zerothOrder: 5.0

firstOrder: func(float n)( ret int(* n n) )

secondOrder: func(func(int) f)(
    ret func(float n)(
        ret .. "result= " f(n)
    )
)

print secondOrder(firstOrder)(zerothOrder)


Honestly, I'm having trouble with an input types / output types confusion.
It's maybe a symptom of bad design?
I'm trying to be as consistent as I can, and I have a feeling that I'm somehow on a "good path". I hope I am!
2
General Project Discussion / Re: another lang draft
« Last post by ivan.moony on Today at 01:34:46 am »
I'd try to fuse vars and functions into a single expression. Variables should be zeroth order expressions. Plain functions should be first order expressions. Functions that take functions as parameters and return functions as a result are second order expressions, and so on.
3
General Project Discussion / Re: another lang draft
« Last post by Zero on June 22, 2018, 10:57:11 pm »


new<seme



// declaring variables

var(
    int x
    str txt
)

/*  the general schema is var( type type type other other other type type other other )
 *  one series of "other" identifier is typed by the preceding type or pipe-type
 *
 */



// assignment

x: 5
txt: "hello"

/*  programming languages all use = as assignment
 *  using : instead of = is simpler and natural
 *  there's no space between the left side element and colons, it's easier to parse
 *
 */



// declare + assign

var(int n): 7

/*  the var( ) form can be used where variables can be used
 *  in this case, it is followed directly by an assignment
 *
 */



// function declare + assign

var(func(int) fib): func(int n)(

    ret ife < n 3
        1
        +   fib(- n 1)
            fib(- n 2)
)

/*  the type of a function is func()
 *  the type of the return value goes inside parentheses
 *  for example func(int) is a function that returns an int
 *
 *  everybody knows that variables must have explicit names
 *  x is a bad name, because it doesn't mean anything
 *  who would name a variable "ret"? nobody
 *  so we can use "ret" as keyword instead of "return"
 *
 */



// function shortcut

func(int) fib(int n)(

    ret ife < n 3
        1
        +   fib(- n 1)
            fib(- n 2)
)

/*  it would be shorter to write "int fib(int n)"
 *  but it would be inaccurate: fib is a function, not an int
 *
 */



// variable shortcut

int x(7)
str txt("hello")

/*  writing the initial value between parenthese seems weird at first
 *  but it is consistent with the way we write initial value of functions
 *  the "value" of a function is its body
 *
 */



// type shortcut

type dog(

    int size(40)
    int hunger(0)
   
    ctrl bark(speech times)(
   
        ife >= times 5
            do(
            cls
            print "woof"
         )
            repeat
                fib( int(times) )
                print & "woof" speech
    )
   
    func() run(int distance)(
   
        hunger: + hunger distance
    )
)

/*  types are a bit like classes, but simpler
 *  all variables are private (size and hunger can't be accessed from outside)
 *  all methods are public
 *  if you need encapsulation, put functions inside functions
 *
 *  ctrl are half-procedures half-macros
 *  controls don't return values
 *  they don't receive the interpreted value from the caller
 *  instead, they receive the source code from the caller
 *  like arguments on the command-line
 *
 *  "times" is converted from string to int
 */



// type declare + assign

var(type cat): type(

   func() sleep(
      print "rrr rrr"
   )
)

/*  types themselves are values
 *
 */



// instance

dog maxy(
    size: 50
)

/*  you can override things at initialization
 *  after that, you can only call methods, remember?
 *
 */



// accessing methods

maxy.bark "hello ruf" 3
maxy.run(4)

/*  you don't call a control (like "bark") with parentheses
 *  instead, the ctrl arity is used to pick the right number of arguments
 *  "bark" needs 2 arguments, the syntax is light
 *
 */



// type composition

type pitbull(

    type(dog)
    ugliness: 80%
    strength: 99%
)

/*  importing a type inside another is as simple as this
 *  a pitbull is also a dog
 *  a type could be composed exclusively of type imports
 *
 */



// variable tagging

int maxy'bones(2)

/*  a tag is an additional value sticked to a variable
 *  the syntax is varname'tagname
 *  the tag behaves like a regular variable
 *
 */



// tag set and get

maxy'bones: + maxy'bones 1

txt: "bones"
print( maxy'(txt) )

/*  the varname-quote-tagname syntax is ok for constant tagname
 *  there's also a varname-quote-openparen-tagname-closeparen syntax
 *  the value of the expression in parentheses becomes the tagname
 *
 */


// pipe-type variables

int string weight(30 "Kg")

/*  a variable can have several types organized in "pipeline"
 *  pipe-type values must be adjacent and space separated
 *
 */



// common types

var(
   void                 // nothing
   enum(r g b) primCol  // enumeration
   int n                // integers
   str t                // strings
   stk s                // stacks
   bool b               // boolean
   asso a               // associative array
   pair p               // augmented cons cell
)

/*  short names to make it light
 *  this list of types is still in evolution
 *
 */

4
General Project Discussion / Re: first.go: a lil' esolang
« Last post by Zero on June 22, 2018, 10:55:28 pm »
Almost! :P
5
General Project Discussion / Re: first.go: a lil' esolang
« Last post by korrelan on June 22, 2018, 10:12:58 pm »
Null?

 :)
6
General Project Discussion / Re: first.go: a lil' esolang
« Last post by Zero on June 22, 2018, 10:05:58 pm »
I understand your logic, it seems natural, and that's how most languages behave.
My logic is:
- only zero is full false
- only one is full true
- everything else is somewhere between full false and full true
- if something isn't full true, it's not "true", hence it's false
Weird?  ::)
7
General Project Discussion / Re: all universal joint robot
« Last post by LOCKSUIT on June 22, 2018, 07:34:25 pm »
Oh, once u progress to 2 arms, one can hold tool while the other claw clenches/pushes the gun lever.
8
General Project Discussion / Re: all universal joint robot
« Last post by ranch vermin on June 22, 2018, 07:20:32 pm »
yep.   those are weedwhackers, hes a garden robot ready to go.
9
General Project Discussion / Re: all universal joint robot
« Last post by LOCKSUIT on June 22, 2018, 07:00:00 pm »
Unless of course we...hack all tools and get right into the turn-on button / controls.
10
General Project Discussion / Re: all universal joint robot
« Last post by LOCKSUIT on June 22, 2018, 06:57:29 pm »
Hmm....my claw idea may not be suitable to use all human tools....I think it needs fingers. I need a human hand.
Pages: [1] 2 3 ... 10

another lang draft
by Zero (General Project Discussion)
Today at 07:45:35 am
first.go: a lil' esolang
by Zero (General Project Discussion)
June 22, 2018, 10:55:28 pm
all universal joint robot
by LOCKSUIT (General Project Discussion)
June 22, 2018, 07:34:25 pm
Can you guess the lyrics of this song?
by LOCKSUIT (General Chat)
June 22, 2018, 06:55:53 pm
Need help
by Don Patrick (General Chat)
June 22, 2018, 05:48:11 pm
I have a question
by LOCKSUIT (General Project Discussion)
June 22, 2018, 05:33:32 pm
TAU
by Art (AI in Film and Literature.)
June 21, 2018, 09:50:34 pm
I want to ask a question
by Art (General Chat)
June 21, 2018, 12:03:28 pm

Users Online

36 Guests, 1 User

Most Online Today: 43. Most Online Ever: 208 (August 27, 2008, 09:36:30 am)

Articles