Search found 22 matches

by Tom
Sun Feb 12, 2012 12:32 pm
Forum: Common Lisp
Topic: Lisp Job on Elance
Replies: 3
Views: 6236

Lisp Job on Elance

Surely there's a lisper out there that can win this.

https://www.elance.com/j/lisp-website-a ... n/28604330

Tom
by Tom
Sun Sep 19, 2010 10:07 am
Forum: Common Lisp
Topic: Lesson of the Day
Replies: 12
Views: 9915

Re: Lesson of the Day

You know your problem domain better than I do; if you say that you've got objects that are best described with optional slots, I'll believe it. In anycase, this thread seemed an appropriate place for some function timing information I gleaned from SBCL. If you disagree, I'll move it elsewhere. I th...
by Tom
Fri Sep 10, 2010 8:20 pm
Forum: Common Lisp
Topic: Lesson of the Day
Replies: 12
Views: 9915

Re: Lesson of the Day

I think you two are fighting over nothing. It is obvious that every case has its proper tool and vice versa. Sometimes a constructor makes things clearer and easier, and that's why structs provide constructors which can be customized to use optional or required parameters. Sometimes they are almost...
by Tom
Fri Sep 10, 2010 7:59 pm
Forum: Common Lisp
Topic: Lesson of the Day
Replies: 12
Views: 9915

Re: Lesson of the Day

Why does your object have optional slots? Don't you end up with dozens of test to determine if an optional slots is bound before you use it? Could you instead provide appropriate dummy values to the optional slots and use algorithms that requires less decisions? This would make every slot have equa...
by Tom
Thu Sep 09, 2010 8:05 pm
Forum: Common Lisp
Topic: Lesson of the Day
Replies: 12
Views: 9915

Re: Lesson of the Day

The primary goal of that constructor interface I outlined is to clearly delineate the necessary and optional arguments. The secondary goal of the constructor interface is to work with your IDE to provide feedback when you are using the interface. The 2 IDE's that I am familiar with are SLIME and Lis...
by Tom
Thu Sep 09, 2010 10:09 am
Forum: Common Lisp
Topic: Lesson of the Day
Replies: 12
Views: 9915

Lesson of the Day

It seems that I learn something new about Common Lisp just about every day. As I learn more about Common Lisp, I often cringe at some hack that I've employed in my code as a result of my ignorance. I'd like this topic to be a place for people to post their lesson of the day. Today's lesson relates t...
by Tom
Sun Sep 05, 2010 10:35 am
Forum: Common Lisp
Topic: Will LISP be more useful than Java for this problem??
Replies: 7
Views: 6088

Re: Will LISP be more useful than Java for this problem??

Java will be more useful for your problem given 2 conditions: 1. You already know how to program in Java. 2. There is an existing Java library that performs pattern matching appropriate for your problem. Then you will only need to learn how to use the library and at most may have to modify or extend...
by Tom
Fri Sep 03, 2010 5:43 am
Forum: Common Lisp
Topic: Taking exponent of a number
Replies: 2
Views: 3161

Re: Taking exponent of a number

Just to be clear, you are writing your own exponent function for practice, right? Otherwise, you should use EXPT.

Good luck,

~ Tom
by Tom
Wed Sep 01, 2010 7:39 am
Forum: Common Lisp
Topic: File I/O woes
Replies: 9
Views: 7498

Re: File I/O woes

Surprisingly, Alexandria's READ-FILE-INTO-STRING was only slightly faster than my wonky read-line/append function, and left unwanted newlines in the output. I think if I filter out the whitespace, the two will be pretty much equivalent. This is not that surprising, since such operation would would ...
by Tom
Tue Aug 31, 2010 9:56 pm
Forum: Common Lisp
Topic: mapcar or notmapcar
Replies: 11
Views: 9645

Re: mapcar or notmapcar

Using MAPCAR and REDUCE is fine. As an alternative approach, you could LOOP. (defun notmapcar (list1 list2) "(list1 x list2) / Sum(list2)" (if (= (length list1) (length list2)) (loop for val1 in list1 and val2 in list2 sum (* val1 val2) into num sum val2 into den finally (return (/ num den...