Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

idk

Name: Anonymous 2013-06-30 16:10

Sometimes I think OOP code can be easier to read than functional or procedural

[1..10].map(x => x * 2).forEach(print)

versus

forEach(map([1..10], x => x * 2)), print)


is it possible for a language to allow you to write in both ways? I think F# has something like it.

Name: Anonymous 2013-06-30 16:17

>>1
Yes. Symta allows both styles.

(1 to 10) map: X => X * 2
map 1 to 10: X => X * 2

Name: Anonymous 2013-06-30 16:19

>>2
would be nice if it had an implementation

Name: Anonymous 2013-06-30 16:48

>>3
here map Xs F => Xs map F

it implements map function on top of map method.

Name: Anonymous 2013-06-30 17:39

>>4
by it I meant Symta.

Name: Anonymous 2013-06-30 18:14

just use ruby

Name: Anonymous 2013-06-30 22:48

>>5
I do wrote some initializing code. But it is in constant redesign for the last few years.

// std1 stage defines macro utility `form` which allows hygienic macros
use lib.std0

find Xs F => if Xs end then No
             else if F Xs.head then Xs.head
             else find Xs.tail F

printable? X => if tag_of.X isnt fn then Yes
                else if Yes is X then Yes
                else if No is X then Yes
                else if Void is X then Yes
                else if #mutate is X then Yes
                else if #head is X then Yes
                else find exports_of X: E => E.0 is print

print X => if printable? X then X print
           else [`#[` address_of.X.print `]`] join_text

// intersperse Xs with M
// infix 'and' [cat dog fox] --> [cat and dog and fox]
infix M Xs => if Xs end then []
              else | T = Xs tail
                   | if T end then Xs
                     else ((infix M T) headed M) headed Xs.head

say @Xs => | Xs = infix ' ': Xs map: X => if tag_of.X is text then X else print X
           | text_out [@Xs '\n'].join_text

bad @What => | say bad @What | halt

variable_name? X => X of text and X.size > 0 and if X.0 upcase? then Yes else X is '?'
function_name? X => X of text and not X^variable_name?

quasiquote X Head =>
  if variable_name? X then X
  else if Head and function_name? X then list (list _ q X) wrapped (list '&' X)
  else if not: X of list then
    if X is '@' then X else list _ q X
  else if X.size is 0 then list _ q X
  else if X.0 is '$' then X.1
  else if X.0 is form then bad nested form X.print
  else if X.0 is _ and X.size > 1 then //special forms cant be redefined
    with @X: A B @Xs => list list A B @(Xs map: X => quasiquote X No)
  else list list (quasiquote X.0 Yes) @(X.tail map: X => quasiquote X No)

form Gs X =>
  if Gs.size > 0
  then list _ let (Gs map: G => if G of list and G.size > 0 and G.0 is `\\`
                                then list G.1 G
                                else list G (list (list _ q G) gensym))
                  (quasiquote X No)
  else quasiquote X No

DefaultLabel = '[DefaultLabel]'
normLabel L => if L of text then L
               else if L end then DefaultLabel // is this the Right Thing?
               else L 0

block Label Body => list _ block normLabel.Label Body
continue Label => list _ continue normLabel.Label
break Label @Value => list _ break normLabel.Label
                        (if Value end then Void else Value 0)

export @lib.std0 //re-export whole package
       'form'
       printable? print say bad infix
       function_name? variable_name?
       'block' 'continue' 'break'

Name: Anonymous 2013-07-01 4:41

Name: Anonymous 2013-07-01 5:27

You're a nimrod.

Name: Anonymous 2013-07-01 10:09

>>8
static typing
instant fail.

Name: Anonymous 2013-07-01 20:42

Name: Anonymous 2013-07-01 20:48

Name: Anonymous 2013-07-01 20:53

Name: Anonymous 2013-07-02 0:17

Name: Anonymous 2013-07-02 0:17

Name: Anonymous 2013-07-02 0:18

Name: Anonymous 2013-07-02 0:23

Name: Anonymous 2013-07-02 0:28

Name: Anonymous 2013-07-02 0:33

Name: Anonymous 2013-07-02 4:04

spambegone

Name: Anonymous 2013-07-02 4:04

spambegone

Name: Anonymous 2013-07-02 4:04

spambegone

Name: Anonymous 2013-07-02 4:04

spambegone

Name: Anonymous 2013-07-02 4:05

spambegone

Don't change these.
Name: Email:
Entire Thread Thread List