Search found 271 matches

by Goheeca
Sun Oct 18, 2015 9:34 am
Forum: The Lounge
Topic: Woo hoo!
Replies: 2
Views: 4650

Re: Woo hoo!

Not necessarily: (defun firstzero (x y z) (cond ((= 0 x) 'first) ((= 0 y) 'second) ((= 0 z) 'third) (t 'none))) a minimal form of the code above: (defun firstzero(x y z)(cond((= 0 x)'first)((= 0 y)'second)((= 0 z)'third)(t'none))) It has 84 characters. But yeah, your code after minimalization is sho...
by Goheeca
Tue Oct 13, 2015 3:30 am
Forum: Homework
Topic: PROBLEM SCHEME
Replies: 10
Views: 15855

Re: PROBLEM SCHEME

I would decompose it to two problems. filling in to the rectangle transposing Rectangularization: (define (repeat n elem) (if (= n 0) '() (cons elem (repeat (- n 1) elem)))) (define (fill-list lst len elem) (if (>= (length lst) len) lst (append lst (repeat (- len (length lst)) elem)))) (define (make...
by Goheeca
Sun Oct 11, 2015 10:33 am
Forum: Homework
Topic: PROBLEM SCHEME
Replies: 10
Views: 15855

Re: PROBLEM SCHEME

(my-map '((d g) (6 9) (w r))) I should get '((d 6 w) (g 9 r)) as output as per single map logic. my-map don't solve your problem, it's an implementation of standard map function. It's a part of solution, which still is: (define (transpose data) (apply my-map my-list data)) I think '(a b) is a membe...
by Goheeca
Thu Oct 08, 2015 4:28 pm
Forum: Common Lisp
Topic: NUMBERP predicate
Replies: 4
Views: 6118

Re: NUMBERP predicate

It doesn't involve calculations, it's checking value's type whether it falls under the number type. The values of primitive types are usually unboxed, although they are tagged.

Ahh nuntius was faster.
by Goheeca
Thu Oct 08, 2015 11:12 am
Forum: Homework
Topic: PROBLEM SCHEME
Replies: 10
Views: 15855

Re: PROBLEM SCHEME

As OP requested, I'm providing here a detailed explanation of my solution. First of all I'm versed in Common Lisp not so much in Scheme. But let's go: I'd been looking for &rest counterpart from CL and find this neat construction, where in place of the argument list you put just one symbol/variable,...
by Goheeca
Wed Oct 07, 2015 3:10 am
Forum: Common Lisp
Topic: Common Lisp interpreter for DOS?
Replies: 3
Views: 4800

Re: Common Lisp interpreter for DOS?

I once tried SSCL in DOSBox, there are also non-free versions e.g. GCLISP . When I was porting ccmake (part of the cmake ) to DOS, for a moment I had an intention to port a mature CL implementation (such as SBCL) to DOS, but I resigned from it because of its complexity. Note aside: I had found and u...
by Goheeca
Tue Oct 06, 2015 8:47 am
Forum: Homework
Topic: PROBLEM SCHEME
Replies: 10
Views: 15855

Re: PROBLEM SCHEME

I do not want to use any ! function Do you mean not using functions with side effects? The short solution : (define (transpose data) (apply map list data)) since I want to understand recursion. Let's define own map , list : (define my-list (lambda elems elems)) (define (single-map fn lst) (if (null...
by Goheeca
Tue Oct 06, 2015 6:23 am
Forum: Common Lisp
Topic: Function that found matchs in nested Lisp
Replies: 4
Views: 5481

Re: Function that found matchs in nested Lisp

What input? *x* is just a variable, if you mean the standard input you have to read it and just call atleast-filter.
by Goheeca
Mon Oct 05, 2015 9:27 pm
Forum: Common Lisp
Topic: Function that found matchs in nested Lisp
Replies: 4
Views: 5481

Re: Function that found matchs in nested Lisp

That's quite simple:

Code: Select all

(defvar *x* '((a 2 3) (3 b 1) (1 2 3) (4 5 c)))

(defun atleast-filter (searched data)
  (remove-if-not #'(lambda (elem) (intersection searched elem)) data))

(atleast-filter '(a b c) *x*) ; => ((A 2 3) (3 B 1) (4 5 C))
by Goheeca
Fri Aug 21, 2015 2:40 pm
Forum: Common Lisp
Topic: Variable reference in structures
Replies: 18
Views: 27912

Re: Variable reference in structures

I'd say Java made a big step with Java 8 and loosened the paradigm.