Search found 133 matches

by sylwester
Sun Mar 24, 2019 3:42 pm
Forum: Common Lisp
Topic: Using &rest parameters in Common Lisp
Replies: 3
Views: 2633

Re: Using &rest parameters in Common Lisp

Code: Select all

(apply 'func-two (cons value-a (cons value-b params))
Isn't really needed since apply can be used like this:

Code: Select all

(apply #'func-two value-a value-b params)
by sylwester
Sun Nov 11, 2018 7:20 am
Forum: Homework
Topic: Add 1 to the middle element of a list
Replies: 2
Views: 1694

Re: Add 1 to the middle element of a list

The clearest would be to (defun mid-add1 (list) "Adds 1 to the middle element of a three-element list." (assert (and (listp list) (= (length list) 3)) (list) "~a must be a 3 element list" list) (destructuring-bind (first-element mid-num third-element) list (assert (numberp mid-num) (list mid-num) "T...
by sylwester
Fri Aug 31, 2018 12:43 pm
Forum: The Lounge
Topic: What Lisp Dialect for "real world" programming
Replies: 1
Views: 1940

Re: What Lisp Dialect for "real world" programming

Clisp is just like Allegro, a Common Lisp implementation. The language is called Common Lisp or CL for short. I imagine SBCL, which is free, probably is the fastest general CL implementation since it compiles to machine code and does stuff with the proclaim and declare expressions. Racket is descend...
by sylwester
Thu Feb 01, 2018 9:31 am
Forum: The Lounge
Topic: Not Too Active Huh?
Replies: 8
Views: 13477

Re: Not Too Active Huh?

Many of the forums I'm a member have similar issues. It's not that Lisp has become obsolete :-) Facebook probably would like to control all your messaging needs, but their app has its pros and cons. I learned that the hard way when they suggested I use facebook instead of mail. The interface was hor...
by sylwester
Wed Jan 17, 2018 4:11 pm
Forum: The Lounge
Topic: Not Too Active Huh?
Replies: 8
Views: 13477

Re: Not Too Active Huh?

That's because Lisp isn't very wide spread used as lets say Python. Also "Lisp" is fragmented in several dialects too. ... Like the Algol community isn't fragmented.. Pascal, Java, C#, C, C++, Python, Ruby, Perl, PHP, JavaScript.. I haven't seem them unite but focus on their own dialect. Kind of li...
by sylwester
Wed Jan 03, 2018 2:44 pm
Forum: Common Lisp
Topic: function call: expected a function after the open parenthesi
Replies: 2
Views: 4161

Re: function call: expected a function after the open parent

Ive just made a SO Q&A that answers this question. The part of the text that is most suitable for your case: Trying to group expressions or create a block (if (< a b) ((proc1) (proc2)) #f) When the predicate/test is true Scheme assumes will try to evaluate both (proc1) and (proc2) then it will call ...
by sylwester
Thu Nov 16, 2017 2:32 pm
Forum: Scheme
Topic: How to fix an unbound variable error in scheme?
Replies: 3
Views: 8560

Re: How to fix an unbound variable error in scheme?

I guess you no longer get the unbound variabel error if you evaluated the definition of cat?
by sylwester
Thu Nov 16, 2017 2:28 pm
Forum: Scheme
Topic: How to make a scheme program accept inputs
Replies: 1
Views: 2684

Re: How to make a scheme program accept inputs

So imagine you have code as an expression that takes data: (some-processexpression some-otherargument data1 data2) You can always make a true refactoring by wrapping it in a fucntion and call it instead: (define (my-abstraction-name arg1 arg2) (some-processexpression some-otherargument arg1 arg2)) ;...
by sylwester
Sun Oct 29, 2017 12:54 pm
Forum: Common Lisp
Topic: delete does not work
Replies: 12
Views: 16460

Re: delete does not work

Not using mutating functions is the way to go when developing since you don't want to spend time micro optimizing code that does not need optimization. delete *is* compatible with remove in every implementation of Common Lisp so I don't understand how you can state remove is more compatible. As long...
by sylwester
Thu Oct 26, 2017 3:07 pm
Forum: Common Lisp
Topic: delete does not work
Replies: 12
Views: 16460

Re: delete does not work

Using a loop over POP is O(n) in both. pop does a setq. It won't alter the argument. In my description I'm doing consecutive delete of random elements until I'm at one last using double loop will end up being O(n^2) time and O(1) space. By making the delete O(1), as in hash, you can get it O(n) tim...