Tayacan's Profile User Rating: -----

Reputation: 145 Stalwart
Group:
Contributors
Active Posts:
275 (0.19 per day)
Joined:
18-January 11
Profile Views:
6,862
Last Active:
User is offline Feb 13 2013 07:28 AM
Currently:
Offline

Previous Fields

Country:
DK
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
50
Icon   Tayacan has not set their status

Posts I've Made

  1. In Topic: Linked list within a linked list

    Posted 8 Feb 2013

    Ah, fair enough. Heh, I'm still mostly using Python 2.

    Anyway, I'd actually suggest defining __lt__ for the linked list, rather than the node. For instance, you could compare the lengths:

    #A linked list class
    class SingleSortedLinkedList :
        #constructor
        def __init__ (self) :
            self._size = 0
            self._head = None
        
        # ...
    
        # Compare linked lists by size.
        def __lt__(self,other):
            return len(self) < len(other)
    
    
  2. In Topic: Linked list within a linked list

    Posted 8 Feb 2013

    Well... Simply make an empty linked list, and then insert linked lists in it.

    outer_list = SingleSortedLinkedList()
    
    inner_list1 = SingleSortedLinkedList()
    inner_list2 = SingleSortedLinkedList()
    
    outer_list.insert(inner_list1)
    outer_list.insert(inner_list2)
    
    


    Of course, when your linked list is sorted, you'll need to make it so that linked lists can be compared too (otherwise, how will you know where to insert?). This can be done by overriding the __cmp__ method. How you want to compare them is up to you, of course.
  3. In Topic: splitting up a string

    Posted 29 Jan 2013

    I believe the #\ is just Lisps way of saying "this is a char". Like, if it was just (h e l l o), how would you know if h was a char or an atom?

My Information

Member Title:
D.I.C Regular
Age:
21 years old
Birthday:
February 10, 1993
Gender:
Interests:
Programming, reading (fantasy books), writing, music.
Programming Languages:
Know pretty well:
Python
C#
PHP
SML
Java
Processing

Learning:
Haskell

Know a bit of:
Perl
C++
C
Lua
Common Lisp
Javascript

Contact Information

E-mail:
Private

Friends

Comments

Page 1 of 1
  1. Photo

    raghav.naganathan Icon

    20 Nov 2012 - 06:26
    Most welcome :)
  2. Photo

    Tayacan Icon

    20 Nov 2012 - 02:30
    That's deep, man... Thanks.
  3. Photo

    raghav.naganathan Icon

    20 Nov 2012 - 02:25
    Dude...before your rep changes, I would like to tell you that it(81) is a perfect square :)Cheers :)
Page 1 of 1