[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Lisp General: Lisp Is Super Powerful Edition

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 67
Thread images: 2

File: Space-cadet.jpg (1MB, 2001x773px) Image search: [Google]
Space-cadet.jpg
1MB, 2001x773px
This is the Lisp General, ask any and all lisp questions here. Here's a link to the general's pastebin that contains many links to various books, sites, and other interesting information:
http://pastebin.com/u/g-lisp-general

Here's the /g/ wiki's page on lisp:
http://wiki.installgentoo.com/index.php?title=Lisp

>To foster discussion:
Which dialect do you prefer?
Do you use Emacs or a different lisp-based editor?
What was your first experience with lisp?
What have you made in lisp?
What is your favorite Lisp program?
What do you like about Lisp?
How do you think Lisp is (one of) the superior programming language(s)?
How long have you been programming in Lisp?
What are your favorite Lisp resources? Please share, preferably links!
Is Lisp your main programming language or not? Regardless, what do you primarily use it for?
What would you like to see in the Lisp general?
>>
So has anyone here ever used EIEIO for Elisp?

It's supposedly like CLOS.
>>
This might be an interesting read for those interested in Lisp machines.
https://groups.google.com/forum/#!topic/qilang/Ch3dZ_220kA
>>
>>42960961
For some reason that links to the last message; not that it matters too much, but https://groups.google.com/d/msg/qilang/Ch3dZ_220kA/2igXmqeqpK8J would be better.
>>
Nice recursive acronym.
>>
>>42960977
nice.
I don't know shen, but with hardware that cheap it sounds worth getting an fpga to tinker with.
it sounds like the processor design isn't very lisp specific though.
if I'm not mistaken, shen is compiled to a bytecode VM interpreted on the stack based CPU.
I think if you're to design a lisp machine it would be better to have a cisc (with SIMD) arch as risc is general purpose.
I need to read more into this subject though.
>>
>>42963088
Microcoded CISC is the traditional style of CPU used for Lisp machines.
>>
Lithp
>>
>>42963154
What an epic and original pun!
>>
>>42963192
Copyright © 2014 All Rights Reserved
>>
>>42963192
Just ignore them.

So, what have you been reading lately /lisp/?

I never did get why generals call themselves names like that.
>>
>>42963133
I'm aware, and I guess that is what they're doing technically
>>
>>42963458
I believe the main breakthrough with lisp machines was that whatever instructions weren't done in hardware were trapped then ruin as microcode.
>>
>>42963088
Shen's pretty neat but I'd prefer a Scheme chip. It looks like Mark Tarver has specific ideas in mind for the Shen chip though.
>>
Just saw this posted on Racket's twitter. I have no idea what I'm looking at.
https://github.com/plt/racket/blob/0e93e63/pkgs/redex-pkgs/redex-lib/redex/private/pat-unify.rkt#L422
>>
((lambda (bump) (bump bump)) (lambda (bump) (bump bump)))
>>
>>42968500
I've always enjoyed how easy recursive structures are in Lisp.
>>
>>42963088
Seems like it will support Scheme, and both the RTL and the Scheme VM will be free, so this is interesting. I could strip away any code pertaining to Shen and use it as a Scheme machine.
>>
So here's a video game that uses racket/gui for its 2D graphics: https://github.com/thomcc/W/; it even runs very smooth on my oldish ThinkPad, surprisingly. Has anyone tried to use it with more sprites/higher res? It would be great if you didn't need anything else for doing juicy 2D in Racket.
>>
http://clochure.org/
>>
>>42973570
This is a joke, right?
>>
>>42973641
language design has gone to shit apparently
>>
>>42973641
Yes, but in terms of aesthetics I agree:
[ ] is prettier than { } is prettier than < > is prettier than ( ) <-- ugly
>>
Is my letrec valid?
(define syntax letrec
(syntax-rules ()
((letrec ((var init) ...) body ...)
(let ((var #f) ...)
(let ((t init)) (set! var t)) ...
(let () body ...)))))

R5RS letrec seems a little fucked to me.
>>
File: 1356126096398.png (18KB, 198x200px) Image search: [Google]
1356126096398.png
18KB, 198x200px
>>42973570
>So now with Clochure you get all the advantages of the JVM, the elegance of Clojure and tons of Objective-C developers that can jump straight away to work in your startup code.
>Objective-C

This sounds a lot like the reason for JavaScript to use curly braces.
>>
>>42971790
Guys?
>>
Does SICP get easier after a bit? Seems like it went from 0 to 60 immediately with exercises on understanding how interpreters work.
>>
>>42976567
No, but you get better.
>>
Which math subjects should I cover before reading SICP?
>>
>>42978693
proofs by induction perhaps
similar to recursive algorithms
you don't need to know too much math though
>>
>>42959092
I just realized that I don't completely understand value vs reference semantics in common lisp.

I have some sort of intuitive understanding of it because it rarely causes an issue, but I can't fully describe it.


If I pass some object/value to a function and modify it (via SETF/Q), when are those changes reflected outside of the function, and when are they only reflected inside the function?
>>
>>42973796
but that's completely wrong:
() > [] > {} > <>
proper languages follow this heirarchy almost exclusively, making good use of (), and no/almost no use of <>. Exceptions:
>C++
>Obj-C
and I think we can all agree those are shit languages
>>
>>42978872
Are you sure? I learn best when new material references old material. Someone said that calculus was necessary which seems reasonable considering LISP's relation to lambda calculus. If it's at least somewhat necessary then I'd like to cover that first.
>>
>>42980275
I'd say skip over the maths parts you don't get then read into the specific area you need to learn.
Lambda calculus has nothing to do with "normal calculus".
>>
>>42980275
There's a symbolic differentiation program in SICP so you might want to learn differentiation first. But you don't really need to because they tell you everything you need to know for the program.

You don't need lambda calculus for SICP.
>>
(bump (current-thread))
>>
>>42979111
Anybody have a short answer on this?
>>
>>42973796
> preferring blocky symbols to smooth, round, perfection
>>
>>42979111
>>42982494
I don't have enough experience with Common Lisp to give you a CL-specific answer, but I do know a lot of Scheme and how this works there. I'll talk about it as if you know Scheme; the only important thing for you to keep in mind is that instead of setq/setf/etc we just use set!.
The most important thing to realize is that when parameters are given to functions they are evaluated. So, for example
(foo a 5)

First we evaluate a, which returns whatever value a has, and then we evaluate 5, which just evaluates to itself.
So, if foo is defined as such:
(define (foo x y) (set! x y))

Nothing interesting will happen, because the concept of what "a" is in the call (foo a 5) doesn't matter, just what the value of a is.

What functions can do is modify "known" variables. Take, for example, this definition of foo:
(define (foo x) (set! a x))

a is assumed to be defined somewhere. In the function call
(foo 5)

a will be set! to 5, because a remains unevaluated within the function. That is to say, when we define foo to set! a to x, a doesn't get evaluated, and remains within the special form set!.

The upshot of this is that we need macros to modify ARBITRARY variables. For a single variable functions will do.
Something specific to CL, I think, is procedures like setf that take a quoted variable and modify it. This is different;
(setf 'a 5)

'a evaluates to a, which in conjunction with e.g. eval can modify the global variable a. This isn't done in Scheme so my experience with it isn't as great.
>>
>>42982723
>I think, is procedures like setf that take a quoted variable and modify it. This is different;
You don't quote variables you're setting.
>>
>>42982723
Ok, I guess the idea is that if you have to derefence a pointer to some compound value to modify it (i.e.
 (setf (aref x y) 12)
)
then your changes are visible outside.

Single, atomic values are bound to new variables inside of their local scope.
>>
>>42982984
If you're using set you do. Not that anyone uses that.
>>
I like the idea of, in *scatch*, C-x C-e printing out the result of the evaluation to the buffer instead of just using the minibuffer.
(defun eval/insert-in-scratch ()
(interactive "P")
(let ((current-prefix-arg
(if (string= (buffer-name) "*scratch*")
'(4)
current-prefix-arg)))
(call-interactively 'eval-last-sexp)))

(add-hook 'lisp-interaction-mode-hook
(lambda ()
(local-set-key (kbd "C-x C-e") #'eval/insert-in-scratch)))

Had to look up how to call a function interactively and also how to call it as if we had used C-u. It almost works;
(* 50 20)
1000 (#o1750, #x3e8)

Not sure what the second parts are.
>>
>>42984065
I think C-j does that by default with paredit disabled.
>>
>>42985072
Oh wow, you're right. No idea how I ever missed something like that. Thanks.
>>
>>42979111
It's simple to me.

Variables are resolved to their final values and that can be modified with things like quote.

Changing the value of a symbol is just getting to the value cell.
>>
>>42984065
The second parts are the number in octal read syntax and hexadecimal read syntax.
>>
Is there an equivalent to last in CL and elisp?
>>
>>42988073
I meant for arrays.
>>
Does using a lisp-like markup language go here?
(example
:key value
(params !"Comments anywhere" foo bar))
[/cod]
>>
>>42988196
Everything lisp goes here.

That makes me wonder about something.

What exactly makes lisp markup and a lisp program different?
>>
>>42988239
Nothing, actually.
>>
>>42988253
Exactly.
>>
>>42988239
There is a difference between markup and program code. Programming languages are defined as being Turing complete, while markup languages needn't be. More importantly, programming languages are general purpose, while markup languages are intended to create some sort of visual presentation, usually of text.
>>
>>42988293
I wasn't talking about the differences between markup languages and programming languages. I was talking about how when using lisp for either, there isn't really a difference.
>>
>>42988315
Sure there is. There's just better integration between the two than with most languages. If we're using a libraries for markup languages written for CL then it'd still implement a language distinct from Lisp, even though the syntax is similar.
>>
>>42988414
But a Lisp library is just code written in Lisp.

A DSL in Lisp is still Lisp.
>>
>>42988443
No matter how neatly it sits atop Lisp it isn't truly Lisp. Otherwise we'd just be calling Python "still C", or C "still assembly."
>>
>>42988473
Except C and Python are languages, while LISP is a family of languages.
>>
>>42988473
But Lisp is the programmable programming language.

Still, I see your point.
>>
Breakpoints could allow for some really flexible debugging.
(define enter-env
(let ((x 0))
(lambda ()
(bkpt "You're now in an environment with x: " x)
x)))

1 ]=> (enter-env)

You're now in an environment with x: 0
;To continue, call RESTART with an option number:
; (RESTART 2) => Return from BKPT.
; (RESTART 1) => Return to read-eval-print level 1.

2 bkpt> x

;Value: 0

2 bkpt> (set! x 5)

;Value: 0

2 bkpt> (restart 2)

;Value: 5 <-- the value of x now

1 ]=> x

;Unbound variable: x

(enter-env)

You're now in an environment with x: 5
;To continue, call RESTART with an option number:
; (RESTART 2) => Return from BKPT.
; (RESTART 1) => Return to read-eval-print level 1.


Too bad they aren't common in Scheme interpreters anymore.
>>
>>42988093
>>42988073
(aref (length array) array)
or something like that.
>>
>>42988961
They're probably 0-indexed so it should be like: (aref (- (length array) 1) array). Naturally if this isn't already a function we can just write
(defun array-last (array) (aref (- (length array) 1) array))
>>
>>42982641
Does this not look good?

to ok? :n
output (and [number? :n] [4 = count :n] [4 = count remdup :n] [not member? 0 :n])
end

to init
do.until [make "hidden random 10000] [ok? :hidden]
end

to guess :n
if not ok? :n [print [Bad guess! (4 unique digits, 1-9)] stop]
localmake "bulls 0
localmake "cows 0
foreach :n [cond [
[[? = item # :hidden] make "bulls 1 + :bulls]
[[member? ? :hidden] make "cows 1 + :cows ]
]]
(print :bulls "bulls, :cows "cows)
if :bulls = 4 [print [You guessed it!]]
end
>>
>>42991558
Looks horrible to be honest.
>>
Can you get better error messages in Clojure? I feel as though I am being tricked into learning Java.
>>
>>42993450
>Can you get better error messages in Clojure?
I can't imagine you can't, but if nobody has implemented such a debugger in 7 years it can't be considered very important to the Clojure community.

Perhaps a lot of Clojure users come from other languages with similarly deficient debuggers, so nobody thought there might be a better way.
Thread posts: 67
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.