mostyfriedman's Profile User Rating: *****

Reputation: 727 Enlightened
Group:
Expert w/DIC++
Active Posts:
4,473 (2.01 per day)
Joined:
24-October 08
Profile Views:
61,262
Last Active:
User is offline Nov 17 2014 08:54 PM
Currently:
Offline

Previous Fields

Country:
EG
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Chevrolet
Dream Kudos:
625
Expert In:
Learning

Latest Visitors

Icon   mostyfriedman knows nothing about anything

Posts I've Made

  1. In Topic: random numbers

    Posted 18 Apr 2014

    try this
    Math.random()*3-1;
    
    


    Math.random() generates psuedorandoms in the range [0, 1), so by multiplying by 3, I'll generate numbers in the range [0, 3), then subtracting 1 will make the range into [-1, 2). Hope this helps.

    EDIT:

    I just noticed that you used the same formula. This should work, if you're having trouble, then I'll need to see more the code to figure out where the problem is.
  2. In Topic: Function scoring alignment of two strings (Scheme)

    Posted 16 Apr 2014

    Add an extra parameter to the procedure, that will be the output. In the base case, return the value of that argument, otherwise update its value when you make a recursive call.

    Also, don't scatter the parenthesis, don't format scheme code the same way you'd format Java or C.
  3. In Topic: 10 Programming Languages You Should Learn

    Posted 19 Mar 2014

    View PostSkydiver, on 19 March 2014 - 06:12 AM, said:

    As I stare at that code (and trying to envision how my defragger will work), I've come to the realization that is not quicksort. Quicksort is supposed to sort in place and a pivot is supposed to be picked out. What I'm seeing there is that new memory is being allocated and I can't for the life of me see where the pivot is being chosen (other than just grabbing the first number to be the pivot). For my defragger, that would mean that I would need more memory than I have diskspace...


    That was just a very simple implementation of sorting a list in Haskell, it's easy for newcomers to understand and write. If you want "true" quicksort, it'll look pretty similar to its imperative counterpart.

    xclite's description of what the code does is correct.
  4. In Topic: 10 Programming Languages You Should Learn

    Posted 17 Mar 2014

    Quote

    You mean Edsgar Dijkstra? I didn't know he ever advocated FP.

    Yes, see here.

    Quote

    I've noticed that the term "elegant", in both math and programming, generally indicates something which has been rigorously golfed down to its minimal-length expression, with no concern for readability. When I see the term "elegant" I usually expect to read something which makes perfect sense to someone who already understands it perfectly, but which communicates nothing to a reader coming to it fresh. That is, it's usually a piece of writing that shouldn't have happened, since it's perfectly useless.


    That's totally fine, it depends on how you define elegance.


    Quote

    Computers are wonderfully, frustratingly, linear. Imperative languages are how a computer thinks. You can take a simple C program and go one to one to assembly and then machine instructions. For computer science, you must understand this.

    Functional programming is a level of abstraction intended to allow the human to think of the problem in a different way. Unfortunately, the computer will still keep on chewing one instruction at a time, regardless of the language those instructions started in.

    And, when you have to debug, guess which paradigm is the most transparent.


    That is very true, but because of that we need to build abstractions that make our lives easier. I believe FP is one such abstraction. I have written and debugged both functional and imperative programs, and definitely debugging a higher level program is much easier.
  5. In Topic: 10 Programming Languages You Should Learn

    Posted 17 Mar 2014

    I totally agree, but in my experience FP can teach one a lot of great things that will make you a better programmer, even if you don't actually use FP in your job. If you want to know what I am talking about, read Structure and Interpretation of Computer Programs. It uses Scheme, and it's available to read online for free. The video lectures are also available on the book's website.

My Information

Member Title:
The Algorithmi
Age:
25 years old
Birthday:
April 15, 1989
Gender:
Location:
Cairo, Egypt
Interests:
Analysis and design of Algorithms
Theory Of Computation
Recursion
recreational mathematics
functional programming
Artificial Intelligence
Full Name:
Mostafa Hany El Sayed
Years Programming:
4
Programming Languages:
Java, Python, Ruby, Prolog, Haskell (learning), common lisp, C/C++, MySql, MSSQL, verilog hdl

Contact Information

E-mail:
Click here to e-mail me
MSN:
MSN  mostyfriedman@gmail.com
Website URL:
Website URL  http://
Facebook:
https://www.facebook.com/MostyFriedman
Twitter:
Cryptogrammer

Comments

  • (2 Pages)
  • +
  • 1
  • 2
  1. Photo

    rossypz Icon

    15 Aug 2014 - 01:34
    Hi,I Am Mrs Rose.I am writing to know you more for i have an important issue to discuss with you. for more details write me on This Email: rosse4u2006@hotmail.com wrte to my email..
    God bless.
    Roseline
  2. Photo

    modi123_1 Icon

    17 Mar 2014 - 12:24
    What eve what eva.. I do what I want.
  3. Photo

    tarmizi_adam2005 Icon

    21 Feb 2014 - 07:03
    Ah ok, Hopefully, everything is fine there InsyaAllah.
  4. Photo

    tarmizi_adam2005 Icon

    19 Feb 2014 - 19:24
    Salamu'alaikum,
    How is it in Misr ? How is the new government there ? Heard a lot about Misr, but I guess I should ask someone who is really from Misr to really find out.
  5. Photo

    tarmizi_adam2005 Icon

    12 Jan 2014 - 03:53
    Salamu'alaikum
  6. Photo

    BenignDesign Icon

    27 Sep 2013 - 06:59
    Hey.
  7. Photo

    no2pencil Icon

    21 Nov 2011 - 21:04
    Wow, have not seen you in a while?! Things good?
  8. Photo

    Martyr2 Icon

    01 Feb 2011 - 23:06
    Sounds like Hosni Mubarak may step down now. I hope he keeps his word. But you can never trust a dictator! :)
  9. Photo

    red_4900 Icon

    01 Feb 2011 - 01:45
    Seriously dude, don't go back to Egypt right now. It's a mess.
  10. Photo

    absynthe Icon

    28 Jan 2011 - 22:18
    I hope you are safe my friend! I'm thinking of you and hoping all is well! Don't pick up any rocks please..
  11. Photo

    Dogstopper Icon

    03 Jan 2011 - 00:15
    Hope you had a good New Year's day Mosty!
  12. Photo

    skyhawk133 Icon

    31 Dec 2010 - 13:59
    You too man! Hope 2011 is a good year for you! Glad to have you here at DIC.
  13. Photo

    Alex6788 Icon

    15 Nov 2010 - 23:07
    Hey mostyfriedman
  14. Photo

    Bent al-Yemen Icon

    19 Aug 2010 - 02:07
    looool, i don't know , i just got used to do so.
  15. Photo

    megglz Icon

    11 Aug 2010 - 05:21
    probably!
  • (2 Pages)
  • +
  • 1
  • 2