Arc Forumnew | comments | leaders | submit | thaddeus's commentslogin
1 point by thaddeus 5885 days ago | link | parent | on: Arc 3.1 (works on latest MzScheme)

~great; right when I get the ability to downvote, you strip it away for another 100 karma!

lol. no worries - I haven't used it anyway... T.

[EDIT] oh - and thanks for the upgrade - even though :)

-----

2 points by thaddeus 5887 days ago | link | parent | on: How can one modify vals in assoc lists ?

That'll work!. Thanks both of you. T.

-----


can someone explain to me how the variable adm is being passed into the function when it's not accounted for in the functions input args ?

Also - anyone notice there's now vote down buttons on the forum?

-----

4 points by absz 5889 days ago | link

The brackify function returns the closure [+ openb _ closeb]. The [... _ ...] notation means "construct an anonymous function of one argument, _"; it's the same as (fn (_) (... _ ...)). Thus, (brackify "(" ")") returns a function of one argument which, when called, surrounds its text with "()"; the text given is "adm".

The downvote buttons have been there for quite a while for me---you seem to have just broken 100 karma, so maybe it's because of that?

-----

1 point by thaddeus 5889 days ago | link

I see - thanks. T.

-----

2 points by thaddeus 5892 days ago | link | parent | on: Noisy-each bug ?

Agreed - thnx. I was hacking noisy-each to do an intersperse equivalent for a function I am writing -should have stuck to the macro at hand :) T.

-----

1 point by palsecam 5892 days ago | link

Hihi thanks I was going to ask you what you were doing when spotting this bug!

-----

4 points by thaddeus 5893 days ago | link | parent | on: Can you create a binary for arc apps ?

Not to worried about about mzscheme being embedded as it's only 24MB. This is good to know... I plan to experiment with it a little so thanks for guidance.

T.

-----

3 points by thaddeus 5898 days ago | link | parent | on: Newbie arc app just for fun...

FYI - I decided to redefine the rand function.

   (def random (n1 (o n2 0))
        (if (is n2 0)
            (swap n1 n2))
          (+ (rand (- (1up n2) n1)) n1))
this will make my code more readable + less 1ups for future code.

   (until (is (len winset) set-count)
          (insortnew < (random bottom top) winset)) 
T.

-----

3 points by thaddeus 5897 days ago | link

eh-hem. oops. right when I said I need to think like you more palsecam - I didn't!

   (def random (n1 (o n2 0))
        (if (is n2 0)
            (swap n1 n2))
          (+ (rand (- (1up n2) n1)) n1))
I had been trying to allow (random n) to return 0 as a valid value, but given the poor performance - if I want that I can always use rand...

   arc> (time (repeat 1000 (random 50))) 
   time: 12 msec.

   arc> (time (repeat 1000 (rand 50)))
   time: 2 msec.

   .... so .... re-take :)

   (def random (n1 (o n2 nil))
        (if (no n2)
            (1up:rand n1)
            (+ (rand (- (1up n2) n1)) n1)))

   arc> (time (repeat 1000 (random 50)))
   time: 3 msec.
Just goes to show: don't get too fancy. :) T.

-----

2 points by palsecam 5896 days ago | link

Thanks for sharing your investigation & ideas on the question :-)

-----

2 points by thaddeus 5899 days ago | link | parent | on: Newbie arc app just for fun...

That's awesome. I hadn't gone that far... and have yet to create any sort of habitual thinking around optimizations... Need to think like you more. Thanks. T.

-----

1 point by thaddeus 5900 days ago | link | parent | on: Newbie arc app just for fun...

I have yet to win the lottery using this app, but hey its 15 million this coming Friday and I'm sure it's going to happen someday :).

That being said - my girlfriend insists the numbers don't look random.

-----

5 points by CatDancer 5899 days ago | link

the numbers don't look random: http://www.random.org/faq/#Q2.7

-----

1 point by thaddeus 5905 days ago | link | parent | on: I agree.

That's way too funny. I saw this a while back and thought 'flag' was to bookmark the post as 'important'.... so naturally was 'flagging' some of pgs' posts. I'm glad it didn't end up marking his posts as spam!

-----

1 point by thaddeus 5911 days ago | link | parent | on: Bug in ++?

I don't think this is a bug, I think it's a sacrifice pg is making for the sake of using the '+' as a special operator.

Only he can say for sure.

I've just substituted all my '+' names to 'up' and, in my mind, it's just as meaningful.

ie upmod or modup .....

-----

0 points by rs 5908 days ago | link

correcto!

-----

More